5 * License: LGPL 2.1+ with static linking exception
11 #ifndef _ROCKSOCKSERVER_H_
12 #define _ROCKSOCKSERVER_H_
15 #include <sys/socket.h>
16 #include <sys/select.h>
18 #if (! defined(USER_MAX_FD)) || (USER_MAX_FD > FD_SETSIZE)
20 #define USER_MAX_FD FD_SETSIZE
33 void rocksockserver_set_sleeptime(rocksockserver
* srv
, long microsecs
);
34 int rocksockserver_disconnect_client(rocksockserver
* srv
, int client
);
35 int rocksockserver_init(rocksockserver
* srv
, char* listenip
, unsigned short port
, void* userdata
);
36 void rocksockserver_watch_fd(rocksockserver
* srv
, int newfd
);
37 void rocksockserver_set_signalfd(rocksockserver
* srv
, int signalfd
);
38 int rocksockserver_loop(rocksockserver
* srv
,
39 char* buf
, size_t bufsize
,
40 int (*on_clientconnect
) (void* userdata
, struct sockaddr_storage
* clientaddr
, int fd
),
41 int (*on_clientread
) (void* userdata
, int fd
, size_t nread
),
42 int (*on_clientwantsdata
) (void* userdata
, int fd
),
43 int (*on_clientdisconnect
) (void* userdata
, int fd
)
48 //RcB: DEP "rocksockserver*.c"