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

mcrxhandler.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 #ifndef __AWHANDLER_MCRX__
00022 #define __AWHANDLER_MCRX__
00023 
00024 #include "monitor.h"
00025 
00026 #include "wire.h"
00027 
00028 #include "bitvector.h"
00029 
00079 /*
00080 
00081 Changes:
00082 
00083 
00084 */
00085 
00086 #include "monitor.h"
00087 #include "wire.h"
00088 
00089 #include "mctxrx.h"
00090 
00094 typedef struct {
00095 
00096   aw_event_sig_t
00097    received,              /* sucessfully received file */
00098    error;                 /* error receiving file */
00099 
00100 } aw_mcrxhandler_events_t;
00101 
00105 typedef enum {
00106 
00107   AW_MCRXHANDLER_IDLE,               /* not doing anything */
00108   AW_MCRXHANDLER_READING,            /* reading file from mcaddress */
00109   AW_MCRXHANDLER_WAIT_RETX,          /* waiting for request for re transmits */
00110 
00111 } aw_mcrxhandler_state_cd_t;
00112 
00116 typedef struct {
00117 
00118   aw_mcrxhandler_state_cd_t
00119    state_cd;
00120 
00121   /* tx ip for current transaction id */
00122   in_addr_t
00123    xtnip;
00124 
00125   /* current transaction id */
00126   u_int32_t
00127    xtnid;
00128 
00129   /* used in timeout_poller */
00130   aw_address_t
00131    timeout_event_id;
00132 
00133   int32_t
00134    file_fd,
00135    mc_fd,
00136    retx_fd;
00137 
00138   /* write to this until success */
00139   byte_t
00140    tmp_filename[AW_MCTXRX_MAX_PATHLEN+3];
00141 
00142   /* space to read/write packets, max size of a UDP packet */
00143   byte_t
00144    message[0xffff]; 
00145   u_int32_t
00146    message_size;
00147 
00148   /* bitvector indicating which blocks have not been read (1), if read then 0 */
00149   aw_bitvector_t
00150    *unread_blocks;
00151 
00152   u_int32_t
00153    nblocks_read,
00154    nblocks_missed;
00155 
00156   int32_t
00157    last_blockid;
00158 
00159   aw_timestamp_t
00160    initial_blocktstamp,
00161    last_blocktstamp;
00162 
00163   /* current file info */
00164   aw_mctxrx_info_t
00165    info;
00166 
00167 } aw_mcrxhandler_state_t;
00168 
00169 
00173 typedef struct {
00174 
00175   aw_handler_t 
00176     handler_header;
00177 
00178   aw_mcrxhandler_state_t
00179    state;
00180 
00181   aw_mcrxhandler_events_t 
00182    events;
00183 
00184   /* address of interface to rx multicast packets */
00185   struct in_addr
00186    mcast_if_addr;
00187 
00188   /* multicast address to rx packets */
00189   struct sockaddr_in
00190    mcast_grp_addr;
00191 
00192   /* max time allowed to succeed per try */
00193   aw_timestamp_t
00194    timeout;
00195 
00196   /* the schedule to send sw interrupts to test for timeouts */
00197   aw_alarm_sched_t
00198    timeout_sched;
00199 
00200 } aw_mcrxhandler_t ;
00201 
00202 
00213 aw_mcrxhandler_t *aw_create_mcrxhandler(const byte_t *mcaddress,
00214                                         u_int32_t mcport,
00215                                         const byte_t *mcinterface,
00216                                         aw_timestamp_t timeout,
00217                                         const aw_mcrxhandler_events_t *events,
00218                                         aw_logger_t *logger
00219                                         );
00220 
00221 
00222 #endif
Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)