]> mj.ucw.cz Git - eval.git/blob - ucw/fb-socket.h
Doc: Note that Isolate has moved
[eval.git] / ucw / fb-socket.h
1 /*
2  *      UCW Library -- Fast Buffered I/O on Sockets with Timeouts
3  *
4  *      (c) 2008 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #ifndef _UCW_FB_SOCKET_H
11 #define _UCW_FB_SOCKET_H
12
13 #include "ucw/fastbuf.h"
14
15 struct fbsock_params {  /** Configuration of socket fastbuf. **/
16   int fd;
17   uns bufsize;
18   uns timeout_ms;
19   void (*err)(void *data, uns flags, char *msg);
20   void *data;                   // Passed to the err callback
21 };
22
23 enum fbsock_err_flags { /** Description of a socket error **/
24   FBSOCK_READ = 1,              // Happened during read
25   FBSOCK_WRITE = 2,             // Happened during write
26   FBSOCK_TIMEOUT = 4,           // The error is a timeout
27 };
28
29 /**
30  * Create a new socket fastbuf.
31  * All information is passed by @par.
32  **/
33 struct fastbuf *fbsock_create(struct fbsock_params *par);
34
35 #endif