mirror of
https://github.com/brunoos/luasec.git
synced 2025-07-19 15:29:46 +02:00
LuaSec 20120616 (unofficial) + patches
This commit is contained in:
34
src/luasocket/io.c
Normal file
34
src/luasocket/io.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*=========================================================================*\
|
||||
* LuaSocket 2.0.2
|
||||
* Copyright (C) 2004-2007 Diego Nehab
|
||||
*
|
||||
* Input/Output abstraction
|
||||
*
|
||||
* RCS ID: $Id: io.c 2 2006-04-30 19:30:47Z brunoos $
|
||||
\*=========================================================================*/
|
||||
#include "io.h"
|
||||
|
||||
/*=========================================================================*\
|
||||
* Exported functions
|
||||
\*=========================================================================*/
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Initializes C structure
|
||||
\*-------------------------------------------------------------------------*/
|
||||
void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx) {
|
||||
io->send = send;
|
||||
io->recv = recv;
|
||||
io->error = error;
|
||||
io->ctx = ctx;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* I/O error strings
|
||||
\*-------------------------------------------------------------------------*/
|
||||
const char *io_strerror(int err) {
|
||||
switch (err) {
|
||||
case IO_DONE: return NULL;
|
||||
case IO_CLOSED: return "closed";
|
||||
case IO_TIMEOUT: return "timeout";
|
||||
default: return "unknown error";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user