equal
deleted
inserted
replaced
1 #ifndef SOCK_INTERNAL_H |
1 #ifndef SOCK_INTERNAL_H |
2 #define SOCK_INTERNAL_H |
2 #define SOCK_INTERNAL_H |
3 |
3 |
4 #include "sock.h" |
4 #include "sock.h" |
|
5 |
|
6 /* |
|
7 * Global config related to all sock_streams |
|
8 */ |
|
9 extern struct sock_stream_ctx { |
|
10 /* Event core */ |
|
11 struct event_base *ev_base; |
|
12 |
|
13 } _sock_stream_ctx; |
5 |
14 |
6 /* |
15 /* |
7 * The base type struct, which defines the method table. |
16 * The base type struct, which defines the method table. |
8 */ |
17 */ |
9 struct sock_stream_type { |
18 struct sock_stream_type { |
28 /* The sock_stream_type for this socket */ |
37 /* The sock_stream_type for this socket */ |
29 struct sock_stream_type *type; |
38 struct sock_stream_type *type; |
30 |
39 |
31 /* Last error info */ |
40 /* Last error info */ |
32 struct error_info err; |
41 struct error_info err; |
|
42 |
|
43 /* Callbacks */ |
|
44 const struct sock_stream_callbacks *cb_info; |
|
45 |
|
46 /* Callback arg */ |
|
47 void *cb_arg; |
33 }; |
48 }; |
34 |
49 |
35 #define SOCK_FROM_BASE(sock, type) ((type*) sock) |
50 #define SOCK_FROM_BASE(sock, type) ((type*) sock) |
36 #define SOCK_ERR(sock) (&(sock)->err) |
51 #define SOCK_ERR(sock) (&(sock)->err) |
37 |
52 |