00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __AWHANDLER_EVENTTX__
00023 #define __AWHANDLER_EVENTTX__
00024
00025 #include <stdio.h>
00026
00027 #include "monitor.h"
00028
00029 #include "wire.h"
00030
00032
00033
00066
00067
00068
00069
00070
00071
00072
00076 typedef enum {
00077
00078 AW_EVENTTXHANDLER_PROTOCOL_UDP,
00079
00080 AW_EVENTTXHANDLER_PROTOCOL_TCP,
00081
00082 AW_EVENTTXHANDLER_PROTOCOL_MC,
00083
00084 } aw_eventtxhandler_protocol_t;
00085
00089 typedef enum {
00090
00091 AW_EVENTTXHANDLER_IDLE,
00092 AW_EVENTTXHANDLER_WAIT_CONNECT,
00093 AW_EVENTTXHANDLER_WAIT_WRITE
00094
00095 } aw_eventtxhandler_state_cd_t;
00096
00097
00101 typedef struct {
00102
00103 int32_t
00104 sfd;
00105
00106
00107 byte_t
00108 tx_message[0xffff];
00109
00110
00111 aw_eventtxhandler_state_cd_t
00112 state_cd;
00113
00114
00115 aw_timestamp_t
00116 starttime;
00117
00118
00119 u_int32_t
00120 nbytes;
00121
00122
00123 int32_t
00124 data_left;
00125
00126 } aw_eventtxhandler_state_t;
00127
00128
00132 typedef struct {
00133
00134 aw_handler_t
00135 handler_header;
00136
00137
00138 struct sockaddr_in
00139 service_addr;
00140
00141 aw_eventtxhandler_protocol_t
00142 protocol;
00143
00144 aw_eventtxhandler_state_t
00145 state;
00146
00147 } aw_eventtxhandler_t;
00148
00152 typedef struct {
00153
00154
00155 const byte_t *mcinterface;
00156
00157
00158 u_int32_t mcloopback;
00159
00160 } aw_eventtxhandler_options_t;
00161
00174 aw_eventtxhandler_t *aw_create_eventtxhandler(const byte_t *hostname,
00175 u_int32_t port,
00176 aw_eventtxhandler_protocol_t protocol,
00177 const aw_eventtxhandler_options_t *options,
00178 int32_t (*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00179 int32_t (*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00180 const aw_alarm_sched_t *sched,
00181 aw_logger_t *aware_logger);
00182
00183
00188 void aw_free_eventtxhandler(aw_eventtxhandler_t *h);
00189
00190
00194 aw_handler_t *aw_wire_eventtxhandler(aw_wire_mkhandler_args_t *args);
00195
00196
00197
00198 #endif
00199