alc_session.h

Go to the documentation of this file.
00001 
00034 #ifndef _ALC_SESSION_H_
00035 #define _ALC_SESSION_H_
00036 
00037 #ifdef _MSC_VER
00038 #define _WINSOCKAPI_   /* Prevent inclusion of winsock.h in windows.h */
00039 #include <windows.h>
00040 #else
00041 #include <pthread.h>
00042 #endif
00043 
00044 #include "defines.h"
00045 #include "mad.h"
00046 
00047 #ifdef __cplusplus
00048 extern "C" {
00049 #endif
00050 
00056 enum alc_session_states {
00057         SError = -1,    
00058         SActive,                
00059         SExiting,               
00060         STxStopped,             
00061         SClosed,                
00062         SAFlagReceived, 
00063         SPaused                 
00064 };
00065 
00071 typedef struct wanted_obj {
00072         
00073   struct wanted_obj *prev;                              
00074   struct wanted_obj *next;                              
00076   unsigned long long toi;                               
00077   unsigned long long transfer_len;              
00079   unsigned short es_len;                                
00080   unsigned int max_sb_len;                              
00081   int fec_inst_id;                                              
00082   short fec_enc_id;                                             
00083   unsigned short max_nb_of_es;                  
00084   unsigned char content_enc_algo;               
00086   unsigned char finite_field;                   
00087   unsigned char nb_of_es_per_group;             
00088 } wanted_obj_t;
00089    
00095 typedef struct rx_fdt_instance {
00096         
00097     struct rx_fdt_instance *prev;               
00098     struct rx_fdt_instance *next;               
00099     unsigned int fdt_instance_id;               
00100 } rx_fdt_instance_t;
00101 
00107 typedef struct tx_queue_struct {
00108         unsigned char *data;                            
00109         unsigned int datalen;                           
00110         unsigned int nb_tx_ch;                          
00111         struct tx_queue_struct *next;           
00112 } tx_queue_t;
00113 
00119 typedef struct alc_session {
00120   int s_id;                                                             
00121   int mode;                                                             
00123   unsigned long long tsi;                               
00124   unsigned long long starttime;                 
00125   unsigned long long stoptime;                  
00126   double ftimestarttime;
00127   
00128   struct alc_channel *ch_list[MAX_CHANNELS_IN_SESSION]; 
00129   int nb_channel;                                               
00130   int max_channel;                                     
00132   int nb_sending_channel;                       
00133   int nb_ready_channel;                         
00135   enum alc_session_states state;        
00137   int addr_family;                                      
00138   int addr_type;                                        
00140   int fdt_instance_id;                          
00142   struct mad_rlc *rlc;                          
00144   int def_ttl;                                          
00145   int def_tx_rate;                                      
00146   unsigned short def_eslen;                     
00147   unsigned int def_mxnbes;                      
00149   unsigned int def_max_sblen;           
00150   BOOL simul_losses;                            
00151   double loss_ratio1;                           
00152   double loss_ratio2;                           
00153   int def_fec_ratio;                            
00155   unsigned char def_fec_enc_id;         
00156   unsigned short def_fec_inst_id;       
00157   int cc_id;                                            
00158   int use_fec_oti_ext_hdr;                      
00160   int rx_memory_mode;                           
00161   int verbosity;                                        
00163   unsigned long long sent_bytes;                
00164   unsigned long long obj_sent_bytes;    
00165   unsigned long long obj_start_time;    
00166   unsigned long long tx_toi;                    
00168   double last_print_tx_percent;         
00170   int a_flag;                                           
00172   tx_queue_t *tx_queue_begin;           
00173   tx_queue_t *tx_queue_end;                     
00174   unsigned int tx_queue_size;           
00176   BOOL first_unit_in_loop;                      
00177   int encode_content;                           
00178   BOOL half_word;                                       
00179   BOOL optimize_tx_rate;                        
00180   BOOL calculate_session_size;      
00182 #ifdef SSM
00183   BOOL ssm;                                                     
00184 #endif
00185 
00186   char base_dir[MAX_PATH_LENGTH];                       
00187   char src_addr[40];                                            
00189   unsigned int rx_objs;                                         
00190   struct trans_obj *obj_list;                           
00191   struct trans_obj *fdt_list;                           
00192   wanted_obj_t *wanted_obj_list;                        
00193   rx_fdt_instance_t *rx_fdt_instance_list;      
00195 #ifdef _MSC_VER
00196   HANDLE handle_rx_thread;                                      
00197   unsigned int rx_thread_id;                            
00198   HANDLE handle_tx_thread;                                      
00199   unsigned int tx_thread_id;                            
00200 #else
00201   pthread_t rx_thread_id;                                       
00202   pthread_t tx_thread_id;                                       
00203 #endif
00204 
00205   unsigned int lost_packets;                            
00206   int accept_expired_fdt_inst;                          
00208 #ifdef USE_RETRIEVE_UNIT
00209   struct trans_unit_container *unit_pool;  
00210   struct trans_unit_container *last_given; 
00211 #endif
00212 
00213   BOOL waiting_fdt_instance;                            
00215 } alc_session_t;
00216 
00226 int open_alc_session(alc_arguments_t *a);
00227 
00235 void close_alc_session(int s_id);
00236 
00246 alc_session_t* get_alc_session(int s_id);
00247 
00260 int add_alc_channel(int s_id, const char *port, const char *addr, const char *intface, const char *intface_name);
00261 
00269 void remove_alc_channels(int s_id);
00270 
00280 struct trans_obj* get_session_obj_list(int s_id);
00281 
00291 struct trans_obj* get_session_fdt_list(int s_id);
00292 
00302 wanted_obj_t* get_session_wanted_obj_list(int s_id);
00303 
00313 int get_session_state(int s_id);
00314 
00323 void set_session_state(int s_id, enum alc_session_states state);
00324 
00332 void set_all_sessions_state(enum alc_session_states state);
00333 
00343 int get_session_a_flag_usage(int s_id);
00344 
00352 void set_session_a_flag_usage(int s_id);
00353 
00363 unsigned int get_fdt_instance_id(int s_id);
00364 
00373 void set_fdt_instance_id(int s_id, unsigned int instance_id);
00374 
00382 void set_fdt_instance_parsed(int s_id);
00383 
00393 unsigned long long get_session_sent_bytes(int s_id);
00394 
00403 void set_session_sent_bytes(int s_id, unsigned long long sent_bytes);
00404 
00413 void add_session_sent_bytes(int s_id, unsigned int sent_bytes);
00414 
00424 unsigned long long get_object_sent_bytes(int s_id);
00425 
00434 void set_object_sent_bytes(int s_id, unsigned long long sent_bytes);
00435 
00444 void add_object_sent_bytes(int s_id, unsigned int sent_bytes);
00445 
00455 double get_object_last_print_tx_percent(int s_id);
00456 
00465 void set_object_last_print_tx_percent(int s_id, double last_print_tx_percent);
00466 
00476 unsigned long long get_session_tx_toi(int s_id);
00477 
00486 void set_session_tx_toi(int s_id, unsigned long long toi);
00487 
00496 void update_session_tx_rate(int s_id, int base_tx_rate);
00497 
00508 wanted_obj_t* get_wanted_object(alc_session_t *s, unsigned long long toi);
00509 
00531 int set_wanted_object(int s_id,
00532                       unsigned long long toi,
00533                       unsigned long long transfer_len,
00534                       unsigned short es_len, unsigned int max_sb_len, int fec_inst_id,
00535                       short fec_enc_id, unsigned short max_nb_of_enc_symb,
00536                       unsigned char content_enc_algo, unsigned char finite_field,
00537                           unsigned char nb_of_es_per_group
00538                       );
00539 
00548 void remove_wanted_object(int s_id, unsigned long long toi);
00549 
00560 BOOL is_received_instance(alc_session_t *s, unsigned int fdt_instance_id);
00561 
00572 int set_received_instance(alc_session_t *s, unsigned int fdt_instance_id);
00573 
00583 char* get_session_basedir(int s_id);
00584 
00590 void initialize_session_handler();
00591 
00597 void release_session_handler();
00598 
00599 #ifdef __cplusplus
00600 }; //extern "C"
00601 #endif
00602 
00603 #endif /* _ALC_SESSION_H_ */
00604 

Generated on Fri Mar 9 20:08:50 2007 for MAD-FCL by  doxygen 1.5.0