/[cvs]/eggdrop1.9/testcode/sockbuf.h
ViewVC logotype

Contents of /eggdrop1.9/testcode/sockbuf.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Thu Apr 25 04:19:54 2002 UTC (17 years, 11 months ago) by stdarg
Branch: MAIN
Changes since 1.3: +8 -0 lines
File MIME type: text/x-csrc
* sclient.c - test program to telnet using a proxy
* http.c/base64.c - http anonymous and authenticated proxies
* socks5.c - socks5 proxy with support for username/password authentication, ipv4, ipv6, and remote hostname resolution
* socks4.c socks4 proxy (no authentication)

1 #ifndef _SOCKBUF_H_
2 #define _SOCKBUF_H_
3
4 /* Flags for sockbuf_t structure. */
5 #define SOCKBUF_BLOCK 1
6 #define SOCKBUF_SERVER 2
7 #define SOCKBUF_CLIENT 4
8 #define SOCKBUF_DELETE 8
9 #define SOCKBUF_NOREAD 16
10 #define SOCKBUF_AVAIL 32
11 #define SOCKBUF_DELETED 64
12
13 /* The difference between SOCKBUF_AVAIL and SOCKBUF_DELETED is that DELETED
14 means it's invalid but not available for use yet. That happens when you
15 delete a sockbuf from within sockbuf_update_all(). Otherwise, when you
16 create a new sockbuf after you delete one, you could get the same idx,
17 and sockbuf_update_all() might trigger invalid events for it. */
18
19 /* Event types. */
20 enum {
21 SOCKBUF_READ, SOCKBUF_EMPTY, SOCKBUF_EOF, SOCKBUF_ERR, SOCKBUF_CONNECT,
22 SOCKBUF_WRITE,
23 SOCKBUF_NEVENTS /* Marker for how many events are defined. */
24 };
25
26 typedef struct sockbuf_iobuf_b {
27 unsigned char *data;
28 int len;
29 int max;
30 } sockbuf_iobuf_t;
31
32 typedef int (*Function)();
33 typedef Function sockbuf_event_t[];
34 typedef Function *sockbuf_event_b;
35
36 int sockbuf_filter(int idx, int event, int level, void *arg);
37 int sockbuf_write(int idx, unsigned char *data, int len);
38 int sockbuf_write_filter(int idx, int level, unsigned char *data, int len);
39 int sockbuf_new(int sock, int flags);
40 int sockbuf_delete(int idx);
41 int sockbuf_set_handler(int idx, sockbuf_event_t handler, void *client_data);
42 int sockbuf_set_sock(int idx, int sock, int flags);
43 int sockbuf_attach_listener(int fd);
44 int sockbuf_detach_listener(int fd);
45 int sockbuf_attach_filter(int idx, sockbuf_event_t filter, void *client_data);
46 int sockbuf_detach_filter(int idx, sockbuf_event_t filter, void *client_data);
47 int sockbuf_update_all(int timeout);
48
49 #endif /* _SOCKBUF_H_ */

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23