/* $Id: mcl_cb.h,v 1.6 2003/10/31 14:58:43 chneuman Exp $ */ /* * Copyright (c) 1999-2003 INRIA - Universite Paris 6 - All rights reserved * (main author: Vincent Roca - vincent.roca@inrialpes.fr) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #ifndef MCL_CB_H /* { */ #define MCL_CB_H #include "mcl_fec.h" /* cross-references */ /* * MULTICAST GROUP control block * Several tx levels can send data on a given mcast group, so * information related to each mcast group is maintained here. * * ses_sock is the official socket where receptions can take place. * It is bind() to the session address and port number. * * An additional private socket (priv_sock) is required to benefit * from a private local port number used for unicast tx. This * socket is always used for (uni/multicast) transmissions. */ typedef struct { int group; /* mcast group number */ #ifdef WIN32 SOCKET ses_sock; /* session socket: mcast rx */ SOCKET priv_sock; /* private sock: mcast/uni tx, uni rx */ #else /* UNIX */ int ses_sock; /* session socket: mcast rx */ int priv_sock; /* private sock: mcast/uni tx, uni rx */ #endif /* OSDEP */ /*struct sockaddr_in saddr;*/ /* mcast address on session socket */ class mcl_addr addr; /* mcast address on session socket */ /*int mode;*/ /* UNI_TX MCAST_TX UNI_RX MCAST_RX */ char can_tx; /* 1 if can send on this group, or 0 */ char can_rx; /* 1 if can recv on this group, or 0 */ } mcgroup_t; /* * TRANSMISSION level control block * One entry for each level used by the sender (don't forget FEC levels if any) */ typedef struct { int level; /* tx layer (starts at 0) */ int rate; /* (cumulative) tx rate in DUs/tick */ int du_per_tick; /* # of DU (ie packets) sent each time*/ /*int bytes_per_tick;*//* and corresponding number of bytes */ mcgroup_t *mcgroup; /* mcast group where data is sent */ adu_t *adu_head; /* head of ADU list (only for layer 0)*/ txtab_t *txtab_head; /* tx plannification table */ txtab_t *cached_txtab; /* next DU to tx belongs to this txtab*/ int tot_rem; /* nb of DUs remaining to be sent */ int tot_in_txtab; /* SDA only: nb of DUs in txtab */ #ifdef RLC char wait_sp; /* boolean: 1 = no tx on lay i before */ /* sending the first SP on layer i-1 */ char wait_after_sp_count;/* wait this # ticks after wait=0 */ #endif } txlvl_t; /* * RECEPTION control block * Only one entry at the receiver. */ typedef struct { mcgroup_t *mcgroup_head; /* head of mcast group tab */ fd_set fds; /* set of fd, used by select */ int nfds; /* highest-numbered fd + 1 */ int n_fd; /* total nb of fd (ie sockets) */ adu_t *adu_head; /* head of the ADU list */ du_t *du_head; /* head of the orphan DU list */ #ifdef FEC du_t *dufec_head; /* head of the DU_FEC list */ #endif adu_t *next_adu2give; /* ptr to next adu to give to appli */ u_int next_adu2give_seq;/*seq # of next adu to give to appli*/ } rxlvl_t; /* * List of desired TOI in MCL_OPT_FLUTE_DELIVERY */ typedef struct toi_list_struct { struct toi_list_struct *next; u_int32_t toi; } toi_list_t; /* * session control block for MCL * defines all the working modes, parameters, etc. of a session */ typedef struct mclcb_s { int id; /* MCL session identifier */ char initialized; /* 1 once initSender/InitReceiver called */ /* * mode selection variables */ char mode; /* tx/rx mode: UNI_TX MCAST_TX UNI_RX MCAST_RX*/ char sender; /* by default neither sender nor receiver */ char receiver; /* NB: if both tx and rx, use values 1 & 2 to */ /* denote the main tendancy */ char verbose; /* produce debug traces */ char statistics; /* produce statistics */ char debug; char delivery_mode; /* which delivery mode? on-demand/push/... */ char immediate_delivery;/* enable immediate (in arrival order) deliver*/ #ifdef FEC char postpone_fec_decoding; /* decode during reception of at the end? */ /* only valid with RSE, doesn't apply to LDPC */ #endif //char sda_tx; /* use the sequential disk access for tx? */ char single_layer_mode; /* optimize for single layer mode */ char no_congestion_control; /* no congestion control mode. */ /* Required for FLUTE interoperability tests */ /* * time related variables */ int last_periodic_proc_tc;/* time_count for last do_periodic_proc call*/ mcl_itime_t last_periodic_proc_it;/* idem with itime */ int tx_mem_cleanup_count; /* tx memory cleanup function call period */ int stats_time_count; /* for periodic stats print */ #ifdef WIN32 BOOL test_cancel; /* used as a pthread_testcancel() alternative */ #endif /* * common tx/rx variables */ int demux_label; /* LCT demux label, or tx session ID (TSI) */ #if 0 int fec_encoding_id; /* see RFC 3452 */ /* set per ADU! */ int fec_instance_id; /* see RFC 3452 */ #endif int cc_id; class mcl_addr mcast_if;/* mcast interface to be used */ class mcl_addr addr; /* unicast/mcast address and port on which */ /* to rx (client) or tx (source). This is the */ /* ALC session addr/port. With mcast, it uses */ /* the ranges: [addr; addr+max_level[ (addr) */ /* and [port; port+max_level[ (port) */ ushort ttl; /* default TTL used with mcast */ INT32 max_datagram_size;// max datagram size for tx and rx INT32 payload_size; // default payload size for tx and rx // the actual DU size used for a given ADU is // kept in the adu->symbol_len, and may change // for different ADUs (not yet supported!) /* * the number of levels, nb_level, can vary in [1, max_level]. * the maximum nb of levels, max_level, can vary in * [1, MAX_TX_LEVEL]. * all tab allocations are done with MAX_TX_LEVEL. */ int nb_level; /* nb of tx layers */ int max_level; /* nb of tx layers */ /* * tx specific variables */ int rate_l0; /* in packets/s on base layer */ int nb_tx; /* # of desired tx for each DU */ float remaining_tx_tick_nb;/* fractional tick_nb in do_periodic_proc */ sig_tab_t *sig_tab; /* used by mcl_sig.c */ int skip; /* used by mcl_sig.c */ sig_tab_t *psig_next; /* used by mcl_sig.c */ int mcl_sig_pending; /* is there any SIG msg pending ? counter */ char first_tx_for_mclcb;/* boolean: 1 before first packet tx, 0 after */ char more_to_tx; /* boolean: 1 if DUs remain to be send */ char reuse_appli_tx_buffer; /* boolean: 1 to take control of buffer */ char keep_data; /* boolean: 1 to prevent scheduling of ADUs */ int lastADUseq; /* last submitted ADU sequence number*/ #ifdef ANTICIPATED_TX_FOR_PUSH char anticipated_tx_for_push; /* optimization for tx in PUSH mode */ #endif #ifdef VIRTUAL_TX_MEM char vtm_used; /* boolean: 1 to use virtual tx memory service*/ char vtm_initialized; /* boolean: 1 if vtm_cb is valid */ vtm_cb_t vtm_cb; /* vtm control block for that session */ #endif #ifdef VIRTUAL_RX_MEM char vrm_used; /* boolean: 1 to use virtual tx memory service*/ char vrm_initialized; /* boolean: 1 if vrm_cb is valid */ vrm_cb_t vrm_cb; /* vrm control block for that session */ #endif adu_t *adu_start; /* first adu concerned by the keep_data mode */ adu_t *adu_end; /* last adu concerned by the keep_data mode */ int scheduler; /* shed to use for next UpdateTxPlanning call */ int adu_scheduling; /* SEQUENTIAL, MIXED, PARTIALLY_MIXED, RANDOM */ #ifdef LCT_SCHED3 /* disk-aware scheduling */ int desired_du_in_seq_in_txtab; /* desired # of DUs in seq*/ #endif char no_nonewadu; /* deliver NONEWADU or not? (0: yes, 1: no) */ /* FLUTE conformance expects no, otherwise yes*/ /* * rx specific variables */ class mcl_addr src_addr;/* unicast address of the source. Used by */ /* the TSI/saddr check of incoming pkts. */ /* Port is not specified */ bool check_src_addr; /* true if TSI/saddr is done and src_addr set */ int rx_sock_size; /* reception socket size */ int next_adu_seq; /* seq # of next ADU. starts at ISS */ int ready_data; /* # completed ADU not yet returned to appli */ char never_leave_base_layer; /* required by MCL_WAIT_EVENT_CLOSED */ toi_list_t *desiredtois;/* desired TOIs in MCL_OPT_FLUTE_DELIVERY */ char deliverallADU; /* deliver all TOIs in MCL_OPT_FLUTE_DELIVERY*/ int nextFDTinstanceID; /* next FDT instance ID to deliver */ /* * tx rate scale (how many DUs to send on each layer at each time tick). * by default, use the power of 2 scale of tx rate. */ u_int du_per_tick_scale[MAX_TX_LEVEL]; #ifdef FEC class mcl_fec fec; /* FEC encoding/decoding class for all FEC */ /* flavors and the associated parameters */ #endif /* * various additional state/context */ txlvl_t txlvl_tab[MAX_TX_LEVEL];/* array of ctrl blocks, sending side */ rxlvl_t rxlvl; /* control block for receiving side */ tx_states_t tx_state; /* state in the transmission FSM graph */ rx_states_t rx_state; /* state in the reception FSM graph */ #ifdef RLC rlccb_t rlccb; /* RLC control block for the session */ #endif #ifdef FLIDS flids_cb_t flids_cb; /* FLIDS control block for the session */ #endif #ifdef SIMUL_LOSSES int simul_losses_state; #endif int mcl_max_group; /* nb of mcast groups */ mcgroup_t mcgroup_tab[MAX_MC_GROUP]; /* array of mcast group contexts */ stats_t stats; /* sent/recvd statistics array */ /*mcl_thread_t tx_thread;*//* tx thread idf */ mcl_thread_t rx_thread; /* rx thread idf */ /* * various working variables */ adu_t *findadu_cache; /* adu cache used by FindADU function */ } mclcb_t; #endif /* } MCL_CB_H */