00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00035 #ifndef _SNL_H_
00036 #define _SNL_H_
00037
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041
00048 #define SNL_LISTEN_CALLBACK(CB) void (CB)(unsigned short port, int error, int fd, void *data)
00049
00056 #define SNL_READ_CALLBACK(CB) void (CB)(int fd, int error, void *buf, int len, void *data)
00057
00058 #define SNL_ERR_OK 0
00059 #define SNL_ERR_OPEN -1
00060 #define SNL_ERR_LISTEN -2
00061 #define SNL_ERR_CONNECT -3
00062 #define SNL_ERR_BIND -4
00063 #define SNL_ERR_ACCEPT -5
00064 #define SNL_ERR_READ -6
00065 #define SNL_ERR_WRITE -7
00066 #define SNL_ERR_CLOSED -8
00067 #define SNL_ERR_BUFFER -9
00068 #define SNL_ERR_ADDRESS -10
00069
00070
00081 int snl_write(int fd, void *buf, unsigned long int len);
00082
00094 int snl_read(int fd, SNL_READ_CALLBACK(*cb), void *data);
00095
00108 int snl_listen(const char *name, unsigned short port, SNL_LISTEN_CALLBACK(*cb), void *data);
00109
00122 int snl_connect(const char *name, unsigned short port);
00123
00124 #ifndef NULL
00125 #define NULL ((void *)0)
00126 #endif
00127
00128 #ifndef FALSE
00129 #define FALSE (0)
00130 #endif
00131
00132 #ifndef TRUE
00133 #define TRUE (!FALSE)
00134 #endif
00135
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139
00140 #endif