]> mj.ucw.cz Git - libucw.git/blob - ucw/fb-socket.h
tableprinter: return value of table_set_col_opt changed to int
[libucw.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 #ifdef CONFIG_UCW_CLEAN_ABI
16 #define fbsock_create ucw_fbsock_create
17 #endif
18
19 struct fbsock_params {  /** Configuration of socket fastbuf. **/
20   int fd;
21   int fd_is_shared;
22   uint bufsize;
23   uint timeout_ms;
24   void (*err)(void *data, uint flags, char *msg);
25   void *data;                   // Passed to the err callback
26 };
27
28 enum fbsock_err_flags { /** Description of a socket error **/
29   FBSOCK_READ = 1,              // Happened during read
30   FBSOCK_WRITE = 2,             // Happened during write
31   FBSOCK_TIMEOUT = 4,           // The error is a timeout
32 };
33
34 /**
35  * Create a new socket fastbuf.
36  * All information is passed by @par.
37  **/
38 struct fastbuf *fbsock_create(struct fbsock_params *par);
39
40 #endif