00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __AWHANDLER_MCTX__
00022 #define __AWHANDLER_MCTX__
00023
00024 #include "monitor.h"
00025
00026 #include "wire.h"
00027
00028 #include "mctxrx.h"
00029
00093
00094
00095
00096
00097
00098
00099
00100 #include "monitor.h"
00101 #include "wire.h"
00102
00106 typedef struct {
00107
00108 aw_event_sig_t
00109 sent,
00110 error;
00111
00112 } aw_mctxhandler_events_t;
00113
00117 typedef enum {
00118
00119 AW_MCTXHANDLER_IDLE,
00120 AW_MCTXHANDLER_WRITING,
00121 AW_MCTXHANDLER_WAIT_RETX,
00123 } aw_mctxhandler_state_cd_t;
00124
00128 typedef struct {
00129
00130 aw_mctxhandler_state_cd_t
00131 state_cd;
00132
00133 aw_event_t
00134 *current_event;
00135
00136 u_int32_t
00137 xtnid;
00138
00139 aw_address_t
00140 retx_event_id,
00141 timeout_event_id;
00142
00143 aw_timestamp_t
00144 sendfile_tstamp,
00145 start_retx_timeout;
00146
00147 int32_t
00148 file_fd,
00149 mc_fd,
00150 retx_fd;
00151
00152
00153 byte_t
00154 message[0xffff];
00155 int32_t
00156 message_size;
00157
00158
00159 u_int32_t
00160 nblocks_error;
00161
00162
00163 u_int32_t
00164 nblocks_retx;
00165
00166 u_int32_t
00167 nblocks_written;
00168
00169
00170 aw_mctxrx_info_t
00171 info;
00172
00173
00174 aw_bitvector_t
00175 *unread_blocks;
00176
00177 } aw_mctxhandler_state_t;
00178
00179
00183 typedef struct {
00184
00185 aw_handler_t
00186 handler_header;
00187
00188 aw_mctxhandler_state_t
00189 state;
00190
00191 aw_mctxhandler_events_t
00192 events;
00193
00194
00195 struct in_addr
00196 mcast_if_addr;
00197
00198
00199 u_int32_t
00200 mcast_loopback;
00201
00202
00203 struct sockaddr_in
00204 mcast_grp_addr;
00205
00206
00207 u_int64_t
00208 write_rate;
00209
00210
00211 struct timespec
00212 write_delay;
00213
00214
00215 aw_timestamp_t
00216 timeout;
00217
00218
00219 u_int32_t
00220 messagesize;
00221
00222 } aw_mctxhandler_t ;
00223
00224
00243 aw_mctxhandler_t *aw_create_mctxhandler(const byte_t *filename,
00244 u_int32_t rate,
00245 u_int32_t messagesize,
00246 const byte_t *mcaddress,
00247 u_int32_t mcport,
00248 const byte_t *mcinterface,
00249 u_int32_t mcloopback,
00250 u_int32_t retxport,
00251 aw_timestamp_t timeout,
00252 const aw_mctxhandler_events_t *events,
00253 int32_t (*regevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00254 int32_t (*regmaskevent)(aw_handler_t *h, aw_address_t *eventid, u_int32_t index),
00255 const aw_alarm_sched_t *sched,
00256 aw_logger_t *logger
00257 );
00258
00259 #endif