38 /** Enable events as specified */ |
39 /** Enable events as specified */ |
39 err_t (*event_enable) (struct sock_stream *sock, short mask); |
40 err_t (*event_enable) (struct sock_stream *sock, short mask); |
40 |
41 |
41 /** Release all resources and free the sock_stream */ |
42 /** Release all resources and free the sock_stream */ |
42 void (*release) (struct sock_stream *sock); |
43 void (*release) (struct sock_stream *sock); |
|
44 |
|
45 /** The type's connect_cb handler, defaults to just invoke conn_cb_func */ |
|
46 void (*_conn_cb) (struct sock_stream *sock, struct error_info *err); |
43 }; |
47 }; |
44 |
48 |
45 /** |
49 /** |
46 * The base type struct, which defines the method table. |
50 * The base type struct, which defines the method table. |
47 */ |
51 */ |
91 * |
95 * |
92 * The sock_stream should be initialized to zero. It is a bug to call this twice. |
96 * The sock_stream should be initialized to zero. It is a bug to call this twice. |
93 * |
97 * |
94 * @param sock the new sock_stream |
98 * @param sock the new sock_stream |
95 * @param type the sock_stream_type defining the implementation used |
99 * @param type the sock_stream_type defining the implementation used |
|
100 * @param cb_func the optional connect_async callback function |
|
101 * @param cb_arg the optional context argument for cb_func |
96 */ |
102 */ |
97 void sock_stream_init (struct sock_stream *sock, struct sock_stream_type *type); |
103 void sock_stream_init (struct sock_stream *sock, struct sock_stream_type *type, sock_stream_connect_cb cb_func, void *cb_arg); |
98 |
104 |
99 /** |
105 /** |
100 * Invoke the appropriate callbacks for the given EV_* bitmask. |
106 * Invoke the appropriate callbacks for the given EV_* bitmask. |
101 * |
107 * |
102 * @param sock the sock_stream |
108 * @param sock the sock_stream |
103 * @param what combination of EV_* bits describing what callbacks to invoke |
109 * @param what combination of EV_* bits describing what callbacks to invoke |
104 */ |
110 */ |
105 void sock_stream_invoke_callbacks (struct sock_stream *sock, short what); |
111 void sock_stream_invoke_callbacks (struct sock_stream *sock, short what); |
106 |
112 |
|
113 /** |
|
114 * Invoke the sock_stream_conn_cb callback with the given error param. |
|
115 * |
|
116 * This invokes the sock_stream_methods::_conn_cb if present and \a direct is not given, otherwise the callback directly |
|
117 * |
|
118 * @param direct force the conn_cb to be called directly |
|
119 */ |
|
120 void sock_stream_invoke_conn_cb (struct sock_stream *sock, struct error_info *err, bool direct); |
|
121 |
107 #endif /* SOCK_INTERNAL_H */ |
122 #endif /* SOCK_INTERNAL_H */ |