00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __AWHANDLER_TCP__
00024 #define __AWHANDLER_TCP__
00025
00026 #include "sysnet.h"
00027 #include "monitor.h"
00028 #include "wire.h"
00029
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00112 typedef struct {
00113
00114 aw_event_sig_t
00115 connect,
00116 noconnect,
00117 triptime;
00118
00119 u_int32_t
00120 statefull;
00121
00122
00123
00124 } aw_tcphandler_events_t;
00125
00129 typedef enum {
00130
00131 AW_TCPHANDLER_IDLE,
00132 AW_TCPHANDLER_WAIT_CONNECT,
00133 AW_TCPHANDLER_DONE_CONNECT
00134
00135 } aw_tcphandler_state_cd_t;
00136
00137
00141 typedef struct {
00142
00143 aw_tcphandler_state_cd_t
00144 state_cd;
00145
00146 aw_event_t
00147 *current_event;
00148
00149
00150 int32_t
00151 sfd;
00152
00153
00154 aw_timestamp_t
00155 starttime;
00156
00157
00158 int32_t
00159 connect;
00160
00161 } aw_tcphandler_state_t;
00162
00163
00167 typedef struct {
00168
00169 aw_handler_t
00170 handler_header;
00171
00172 aw_tcphandler_state_t
00173 state;
00174
00175 aw_tcphandler_events_t
00176 events;
00177
00178 struct sockaddr_in
00179 service_addr;
00180
00181
00182 aw_address_t
00183 timeout_event_id;
00184
00185
00186 aw_alarm_sched_t
00187 timeout_sched;
00188
00189 byte_t
00190 *host_n_port;
00191
00192 } aw_tcphandler_t ;
00193
00206 aw_tcphandler_t *aw_create_tcphandler(const aw_tcphandler_events_t *events,
00207 const byte_t *hostname,
00208 u_int32_t port,
00209 aw_timestamp_t timeout,
00210 int32_t (*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00211 int32_t (*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00212 const aw_alarm_sched_t *sched,
00213 aw_logger_t *logger
00214 );
00215
00220 void aw_free_tcphandler(aw_tcphandler_t *p);
00221
00225 aw_handler_t *aw_wire_tcphandler(aw_wire_mkhandler_args_t *args);
00226
00227 #endif
00228
00229