Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

eventrxhandler.h

Go to the documentation of this file.
00001 
00002 /*
00003 ** Copyright (C) 2004 Russell Leighton
00004 **
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 **
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 **
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 
00021 
00022 
00023 #ifndef __AWHANDLER_EVENTRX__
00024 #define __AWHANDLER_EVENTRX__
00025 
00026 #include "monitor.h"
00027 
00028 #include "wire.h"
00029 
00031 /*\@{*/
00032 
00068 typedef enum {
00069 
00070   AW_EVENTRXHANDLER_PROTOCOL_UDP,  /* udp */
00071 
00072   AW_EVENTRXHANDLER_PROTOCOL_TCP,  /* tcp */
00073 
00074   AW_EVENTRXHANDLER_PROTOCOL_MC,   /* multicast */
00075 
00076 } aw_eventrxhandler_protocol_t;
00077 
00081 typedef struct {
00082 
00083   aw_event_sig_t
00084    rx;
00085 
00086 } aw_eventrxhandler_events_t;
00087 
00091 typedef struct {
00092 
00093   int32_t
00094    sfd;
00095 
00096   /* space to read packets, max size of a UDP packet */
00097   byte_t
00098    rx_message[0xffff]; 
00099 
00100 } aw_eventrxhandler_state_t;
00101 
00105 typedef struct {
00106 
00107   aw_handler_t 
00108    handler_header;
00109 
00110   aw_eventrxhandler_state_t
00111    state;
00112 
00113   aw_eventrxhandler_events_t
00114    events;
00115 
00116   u_int32_t 
00117    port;
00118 
00119   /* ip to bind to , default to INADDR_ANY */
00120   aw_ip_addr_t
00121    bind;
00122 
00123 } aw_eventrxhandler_t ;
00124 
00128 typedef struct {
00129 
00130   /* multicast inteface, defaults to NULL -> INADDR_ANY */
00131   const byte_t *mcinterface;
00132 
00133   /* if not 0, ip to bind to -OR- multicast group ip */
00134   aw_ip_addr_t bind;
00135 
00136 } aw_eventrxhandler_options_t;
00137 
00138 
00148 aw_eventrxhandler_t *aw_create_eventrxhandler(const aw_eventrxhandler_events_t *events,
00149                                               u_int32_t port,
00150                                               aw_eventrxhandler_protocol_t protocol,
00151                                               aw_eventrxhandler_options_t *options,
00152                                               aw_logger_t *logger
00153                                               );
00154 
00159 void aw_free_eventrxhandler(aw_eventrxhandler_t *p);
00160 
00161 
00165 aw_handler_t *aw_wire_eventrxhandler(aw_wire_mkhandler_args_t *args);
00166 
00167 /*\@}*/
00168 
00169 #endif
00170 
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)