ns-2.28/mac/hdr-802_16.h

Go to the documentation of this file.
00001 /*******************************************************************
00002  * This file contains:
00003  *   -the 802_16 frame formats (i.e., headers)
00004  *   -the map structure
00005  *   -the upstream flow table structure
00006  *   -All global enum and #defines needed by the code
00007  *
00008  * Revisions:
00009  *   $A1   :10/2004 : Ack filtering
00010  *   $A0:  2/17/2005:  Added upstream rate control (Viraj )  
00011  *   $A1:  3/10/05:  Fixed support of max_concat_thresh
00012  *   $A2:  Add stat to track avg number IP packets per concat packet
00013  *   $A3:  Fixed jitter calculation
00014  *   $A4:  9/13/05: (J. Freitag) sgrant_limit and lgrant_limit are not being used in any function of any class!
00015  *   $A5:  3/15/06: (J. Freitag) included non-real-time service
00016  *   $A6:  3/31/06: (J. Freitag) included downlink QoS services  
00017  *   $A7:  8/29/06: (J. Freitag) QoS parameters (latency and minimum bandwidth) for scheduling services 
00018  *   $A8:  8/30/06: (J. Freitag) included a new uplink scheduling algorithm
00019  *   $A9:  9/15/06: (J. Freitag) included incremental bandwidth request
00020  *   $A10: 11/13/06: (J. Freitag) included aggregate bandwidth request
00021  *   $A11: 11/22/06: (J. Freitag) replaced u_char mac_param; by u_int16_t mac_param; in 802_16_frame_hdr 
00022  *                                in order to permit bw requests greater than 255 slots 
00023  *   $A12: 04/27/07: (J. Freitag) included extended-real-time service
00024  *   $A13: 08/13/07: (J. Freitag) included the T16 timeout defined in the 802.16 standard. 
00025  ******************************************************************/
00034 #ifndef ns_hdr_mac802_16_h
00035 #define ns_hdr_mac802_16_h    
00036 
00037 #define EPSILON 0.0000000000005
00038 
00039 /*===============INCLUDE HEADER FILES====================*/
00040 
00041 #include <arp.h>
00042 #include <connector.h>
00043 #include <delay.h>      
00044 #include <ll.h>
00045 #include <mac.h>
00046 #include "mac-802_16-timers.h"
00047 #include <marshall.h>   
00048 #include <packet.h>     
00049 #include <queue.h>
00050 #include <random.h>
00051 
00052 /*===============END INCLUDE HEADER FILES====================*/
00053 
00054 
00055 /*================ENUM & CONSTANT DEFINITIONS================*/
00056 
00057 enum SchedType 
00058   {
00059     UGS         = 0x0000,
00060     RT_POLL     = 0x0001,
00061     ERT_POLL    = 0x0002, //$A12
00062     NRT_POLL    = 0x0003, //$A5
00063     BEST_EFFORT = 0x0004
00064   };
00065 
00066 enum PhsType 
00067   {
00068     SUPRESS_ALL   = 0x0000,
00069     SUPRESS_TCPIP = 0x0001,
00070     SUPRESS_UDPIP = 0x0002,
00071     SUPRESS_MAC   = 0x0003,
00072     NO_SUPRESSION = 0x0004
00073   };
00074 
00075 enum EventType 
00076   {
00077     PKT_ARRIVAL      = 0x0000,
00078     MAP_ARRIVAL      = 0x0001,
00079     SEND_TIMER       = 0x0002,
00080     REQ_TIMER        = 0x0003,
00081     SEND_PKT         = 0x0004,
00082     SEND_UREQ        = 0x0006,
00083     CONTENTION_ON    = 0x0007,
00084     CONTENTION_SLOTS = 0x0008,
00085     CONTENTION_BKOFF = 0x0009,
00086     UNLOCK_QUEUE     = 0x00010,
00087 //$A0
00088     PIGGYBACK_REQ  =   0x00011
00089 
00090   };
00091 
00092 #define UPSTREAM           0    
00093 #define DOWNSTREAM         1
00094 #define OFF                0
00095 #define ON                 1
00096 #define BROADCAST_SID      1
00097 
00098 #define DATA_PKT           0 /* Packet passed from IFQ(Upper layers) */
00099 #define MGMT_PKT           1 /* Packet generated at 802_16 layer */
00100 
00101 /* Need to redefine it later */
00102 #define SUPRESS_ALL_SIZE          100
00103 #define SUPRESS_TCPIP_SIZE         40
00104 #define SUPRESS_UDPIP_SIZE         28
00105 #define SUPRESS_MAC_SIZE           28
00106 
00107 #define DATA_GRANT                  0
00108 #define UREQ_GRANT                  1
00109 #define CONTENTION_GRANT            2
00110 #define SM_GRANT                    3
00111 #define ETHER_HDR_LEN               ((ETHER_ADDR_LEN << 1) + ETHER_TYPE_LEN)
00112 #define MAC802_16_HDR_LEN           6
00113 #define MAX_NUM_IE                240 /* Max num of IEs in a MAP */
00114 #define MAX_GRANT                 255 /* Max num of mini-slots that 
00115                                          can be assigned per service-flow */
00116 
00117 #define MAX_RETRY                  10
00118 #define SIZE_MGMT_HDR              24
00119 #define SIZE_MAP_HDR                4
00120 #define MANAGEMENT_MSG_PAYLOAD_SIZE 5 /*Size of payload of mgmt msgs */
00121 #define NUM_EXTENDED_HDR_ELEMENTS   2 /* Max num of EH elements in EH */
00122 #define MAX_NUM_DOWNFLOWS_PERSS    10 /* Max num of downstream flows 
00123                                          a SS can create */
00124 
00125 #define MAX_NUM_UPFLOWS_PERSS            10 /* Max num of upstream flows 
00126                                                a SS can create */
00127 #define NUM_802_16_LANS                   5
00128 #define MAX_NUM_SS_NODES                500 /* Max num of SSs in a mac-domain*/
00129 #define MAX_NUM_RETRIES                  15
00130 #define FRAG_ENABLE_BIT                   8
00131 #define CONCAT_ENABLE_BIT                 7
00132 #define FRAG_ON_BIT                       6
00133 #define CONCAT_ON_BIT                     5
00134 #define PIGGY_ENABLE_BIT                  4
00135 #define NO_PIGGY_BIT                      3
00136 #define PIGGY_NOT_SEND                    2
00137 #define CONCAT_THRESHHOLD                 1
00138 #define QUEUE_THRESHOLD                  25
00139 #define UGSSTATES                         4
00140 #define RTPOLLSTATES                      6
00141 //$A12
00142 #define ERTPOLLSTATES                     5
00143 //$A5
00144 #define NRTPOLLSTATES                     7
00145 //$A0
00146 //#define BEFFORTSTATES                   7
00147 #define BEFFORTSTATES                     8
00148 //$A6
00149 #define DOWNSTATES                        4
00150 
00151 #define UGS_IDLE                          0
00152 #define UGS_DECISION                      1
00153 #define UGS_TOSEND                        2
00154 #define UGS_WAITFORMAP                    3
00155 #define RTPOLL_IDLE                       0
00156 #define RTPOLL_DECISION                   1
00157 #define RTPOLL_TOSEND                     2
00158 #define RTPOLL_WAITFORMAP                 3
00159 #define RTPOLL_TOSENDREQ                  4
00160 #define RTPOLL_REQSENT                    5
00161 //$A12
00162 #define ERTPOLL_IDLE                      0
00163 #define ERTPOLL_DECISION                  1
00164 #define ERTPOLL_TOSEND                    2
00165 #define ERTPOLL_WAITFORMAP                3
00166 #define ERTPOLL_TOSENDREQ                 4
00167 //$A5
00168 #define NRTPOLL_IDLE                      0
00169 #define NRTPOLL_DECISION                  1
00170 #define NRTPOLL_TOSEND                    2
00171 #define NRTPOLL_WAITFORMAP                3
00172 #define NRTPOLL_TOSENDREQ                 4
00173 #define NRTPOLL_REQSENT                   5
00174 #define NRTPOLL_CONTENTION                6
00175 
00176 #define BEFFORT_IDLE                      0
00177 #define BEFFORT_DECISION                  1
00178 #define BEFFORT_TOSEND                    2
00179 #define BEFFORT_WAITFORMAP                3
00180 #define BEFFORT_TOSENDREQ                 4
00181 #define BEFFORT_REQSENT                   5
00182 #define BEFFORT_CONTENTION                6
00183 //$A0
00184 #define BEFFORT_RATECHECK                 7
00185 
00186 //$A6
00187 #define DOWN_IDLE                         0
00188 #define DOWN_DECISION                     1
00189 #define DOWN_TOSEND                       2
00190 #define DOWN_WAITFORMAP                   3
00191 
00192 //$A13
00193 #define T16_TIMER                         1 //in seconds
00194 
00195 /*================END ENUM  & CONSTANT DEFINITIONS===================== */       
00196 
00197 
00198 /* ==================================================================          
00199    FRAME STRUCTURE DECLARATIONS. 
00200    ==================================================================*/
00201 
00202 /*************************************************************************
00203 802_16 header format
00204 *************************************************************************/
00206 struct mac802_16_frame_hdr 
00207 {
00208   u_char    fc_type    : 2;
00209   u_char    fc_parm    : 5;
00210   u_char    ehdr_on    : 1;
00211   //$A11
00212   //u_char    mac_param;
00213   u_int16_t mac_param;          
00214   u_int16_t len;
00215 };  
00216 
00217 /*************************************************************************
00218 802_16 Extended header element
00219 *************************************************************************/
00221 struct mac802_16_extended_header_element 
00222 {
00223   u_char     eh_type     : 4;
00224   u_char     eh_len      : 4;
00225   u_int16_t  eh_data[6];
00226 };
00227 
00228 /*=====================END FRAME STRUCTURE DECLARATIONS==================*/
00229 
00230 
00231 /*===============NEW PACKET HEADERS FOR NS============*/
00232 
00233 /*************************************************************************
00234  802_16 packet header
00235 *************************************************************************/
00237 struct hdr_mac802_16 
00238 {
00239   struct mac802_16_frame_hdr dshdr_;
00240   int dt_conv_overhead_; /* Overhead added to
00241                             802_16 pkt to account 
00242                             for data convergence layer*/
00243   
00244   static int offset_;
00245   
00246   inline static int& offset() 
00247   {
00248     return offset_;
00249   }
00250   
00251   inline static hdr_mac802_16* access(const Packet * p) 
00252   {
00253     return (hdr_mac802_16*) p->access(offset_);
00254   }    
00255   
00256   /* per-field member functions */  
00257   struct mac802_16_frame_hdr& dshdr() 
00258   { 
00259     return dshdr_;
00260   }
00261   
00262   int& dt_conv_overhead() 
00263   { 
00264     return dt_conv_overhead_;
00265   }
00266 };
00267 
00268 /*************************************************************************
00269 802_16 extended packet header
00270 *************************************************************************/
00272 struct hdr_mac802_16extd 
00273 {  
00274   struct mac802_16_extended_header_element exthdr_[NUM_EXTENDED_HDR_ELEMENTS];
00275   
00276   int num_hdr;         /* Num of extended headers on */
00277   static int offset_;
00278   
00279   inline static int& offset()   
00280   { 
00281     return offset_; 
00282   }
00283   
00284   inline static hdr_mac802_16extd*      access(const Packet * p) 
00285   {
00286     return (hdr_mac802_16extd*) p->access(offset_);
00287   } 
00288   
00289   /* per-field member functions */
00290   inline int& num_hdr_() 
00291   { 
00292     return num_hdr;
00293   }
00294   
00295   struct mac802_16_extended_header_element* exthdr() 
00296   { 
00297     return exthdr_;
00298   } 
00299 };
00300 
00301 /*************************************************************************
00302 802_16 management packet header
00303 *************************************************************************/
00305 struct hdr_mac802_16mgmt 
00306 {
00307   int dstaddr;
00308   int srcaddr;
00309   u_char msg_payload_[MANAGEMENT_MSG_PAYLOAD_SIZE];
00310   
00311   /* 
00312      The last field will be used to carry          
00313      either SYNC or RNG or REG msg 
00314   */
00315   u_char type; /* To distinguish between MAP & non-MAP messages */
00316 
00317   static int offset_;
00318   
00319   inline static int& offset()   
00320   { 
00321     return offset_; 
00322   }
00323   
00324   inline static hdr_mac802_16mgmt*      access(const Packet * p) 
00325   {
00326     return (hdr_mac802_16mgmt*) p->access(offset_);
00327   }
00328   
00329   /* per-field member functions */
00330   inline int& dstaddr_() 
00331   { 
00332     return dstaddr;
00333   }
00334         
00335   inline int& srcaddr_() 
00336   { 
00337     return srcaddr;
00338   }
00339         
00340   inline u_char& type_() 
00341   { 
00342     return type;
00343   }     
00344 };
00345 
00346 /*************************************************************************
00347 802_16 map packet header
00348 The information elements will be send in DATA portion of packet
00349 *************************************************************************/
00354 struct hdr_mac802_16map 
00355 {
00356   double allocstarttime;
00357   double allocendtime;
00358   double acktime;
00359   u_char numIE; 
00360   u_char bkoff_start;
00361   u_char bkoff_end;
00362   
00363   static int offset_;
00364  
00365   inline static int& offset()
00366   {
00367     return offset_;
00368   }
00369   
00370   inline static hdr_mac802_16map*       access(const Packet * p) 
00371   {
00372     return (hdr_mac802_16map*) p->access(offset_);
00373   }
00374   
00375   /* per-field member functions */
00376   
00377   inline double& allocstarttime_()
00378   {
00379     return allocstarttime;
00380   }
00381   
00382   inline double& allocendtime_()
00383   {
00384     return allocendtime;
00385   }
00386   
00387   inline double& acktime_()   
00388   {
00389     return acktime;
00390   } 
00391   
00392   inline u_char& numIE_()   
00393   {
00394     return numIE;
00395   }
00396   
00397   inline u_char& bkoff_start_()
00398   {
00399     return bkoff_start;
00400   }
00401   
00402   inline u_char& bkoff_end_()      
00403   {
00404     return bkoff_end;
00405   }
00406 };
00407 
00408 
00409 /*=======================END PACKET HEADER DECLARATIONS================*/
00410 
00411 
00412 /*========================DATA STRUCTURES DECLARATIONS=================*/
00413 
00414 /*=======================Common data structures=========================*/
00415 
00416 /************************************************************************/
00417 typedef struct pnode * plist;
00418 
00419 struct pnode 
00420 {
00421   Packet * pkt;
00422   double enq_time; /* Time at which this pkt was enqued */
00423   plist next;
00424 };
00425 
00426 /*************************************************************************
00427 
00428 /*************************************************************************
00429 This defines the classifier to be used for matching packets to 
00430 upstream/downstream flows 
00431 *************************************************************************/
00434 struct flow_classifier 
00435 {
00436   int32_t  src_ip;
00437   int32_t  dst_ip;
00438   packet_t pkt_type;
00439 };
00440 
00441 /*************************************************************************
00442 
00443 *************************************************************************/
00444 typedef struct allocation_time * aptr;
00445 
00446 struct allocation_time 
00447 {
00448   double start_time;
00449   double end_time;
00450   u_int32_t num_slots;
00451   aptr next;
00452   u_char type; /* 0- Data, 1 - Unicast Req, 2- Contention-req */
00453   u_char used; /* Indicates whether this slot has already been 
00454                   allocated/used to some one */   
00455 };
00456 
00457 /*************************************************************************
00458 
00459 /*************************************************************************
00460  This structure defines attributes of downstream service flow of a SS 
00461 *************************************************************************/
00463 struct downstream_flow_record 
00464 {
00465   struct flow_classifier classifier;
00466 
00467   //$A6
00468   SchedType sched_type; /* UGS, RT-VBR, NRT-POLL
00469                              BEST-EFFORT*/
00470   plist packet_list; /* The bs must have one queue for each QoS service. 
00471                        Will not be used in SS code */
00472 
00473   u_int16_t max_qsize;       /* variable indicates the maximum
00474                                 queue size */
00475 
00476   u_char state;     /* The current state for this service flow.
00477                        Will not be used in SS code*/
00478   Packet* pkt;
00479 
00480   u_char    pending;           /* Denotes whether any data grant 
00481                                   is pending for this flow */  
00482   struct allocation_time* alloc_list;
00483 
00484   double ugsjitter;         /* The jitter in the grant, 
00485                                   valid only for UGS flows */
00486   int    jitterSamples;
00487   double last_granttime;    /* Last grant observed at this time
00488                                (to make sure that we do not use the 
00489                                same data grant again in the calculation) */
00490   
00491   double nominal_alloctime;    /* Grant should have ben allocated at this time */
00492   double last_jittercaltime;   /* Last time avg jitter was calculated */
00493 
00494   double ginterval;       /* Grant interval for UGS flow */
00495   
00496   u_int16_t gsize;        /* Grant size(bytes) for UGS flow */
00497 
00498   //$A7
00499   double latency;         /*maximum latency requested by the connection*/
00500 
00501   u_int32_t min_bw;       /*minimum bandwidth requested by the connection*/
00502   
00503    
00504   //end $A6
00505 
00506   u_int16_t flow_id; /* Downstream service flow id */
00507   PhsType PHS_profile; /* PHS to be applied */
00508 
00509   //#ifdef RATE_CONTROL//-------------------------------------------------
00510   PacketQueue *tokenq_; /* Token bucket queue */
00511   /* Will not be used in SS code as of now */
00512 
00513   double tokens_;
00514   double rate_;
00515   int bucket_;
00516   int tokenqlen_;
00517   double lastupdatetime_;
00518   int init_;
00519   Event intr;
00520   char ratecontrol; /* To indicate whether rate-control is ON or not */
00521   //#endif //-------------------------------------------------------------
00522   
00523   /* Per SID stats */
00524   double util_total_bytes_DS;
00525   int util_total_pkts_DS;
00526   int total_pkts_dropped;
00527   int dropped_tokenq;
00528   
00529   double dsq_delay; /* Queuing delay in DS queue */
00530   int num_qsamples; /* Num of samples used to calculate dsq queuing delay */
00531   int dropped_dsq;  /* Number of packets dropped in DS queue for this SID */
00532 };
00533 
00534 /*************************************************************************
00535 This structure defines attributes of an upstream service flow of a SS node
00536 *************************************************************************/
00538 struct upstream_flow_record 
00539 {
00540   struct flow_classifier classifier;
00541   SchedType sched_type; /* UGS, RT-VBR, NRT-POLL
00542                              BEST-EFFORT*/
00543   PhsType PHS_profile;    /* PHS to be applied */
00544   
00545   double ginterval;       /* Grant interval for UGS flow */
00546   
00547   //$A7
00548   double latency;         /*maximum latency requested by the connection*/
00549 
00550   u_int32_t min_bw;       /*minimum bandwidth requested by the connection*/
00551 
00552   u_int16_t flow_id;      /* Upstream service flow id */
00553   u_int16_t gsize;        /* Grant size(bytes) for UGS flow */
00554   u_char flag;
00555 };
00556 
00557 /*************************************************************************
00558  This structure defines all the user-configurable 
00559 paramters for upstream channel
00560 *************************************************************************/
00563 struct upstream_channel 
00564 {
00565   double data_rate;       /* (bits/sec) */
00566   double prop_delay;
00567   u_int32_t max_burst_size;
00568   u_int32_t overhead_bytes;
00569   u_char physlots_p_minislot;
00570 };
00571 
00572 /*************************************************************************
00573 
00574 *************************************************************************/
00575 struct  downstream_channel 
00576 {
00577   double data_rate;       /* (bits/sec) */
00578   double prop_delay;
00579   u_int32_t overhead_bytes;
00580 };
00581 
00582 /*************************************************************************
00583 
00584 /*======================= End Common data structures====================*/
00585 
00586 
00587 /*=========================BS DATA STRUCTURES=========================*/
00588 
00589 /*************************************************************************
00590 This structure contains all the information excluding scheduling algorithm 
00591 information   about a SS  at the BS node
00592 *************************************************************************/
00595 struct up_flow_record 
00596 {
00597   struct flow_classifier classifier;
00598   Packet* frag_pkt;
00599   SchedType sched_type;    /* UGS, RT-VBR, BEST-EFFORT*/
00600   PhsType PHS_profile;     /* PHS to be applied */
00601   
00602   double ginterval;        /* Grant interval for UGS flow */
00603   
00604   u_int32_t frag_data;
00605   u_int16_t flow_id;       /* Upstream service flow id */
00606   u_int16_t gsize;         /* Grant size(bytes) for UGS flow */
00607   u_int16_t seq_num;       /* The next seq_num for fragmentation*/
00608   u_char flag;             /* last 4 bit positions are used as
00609                              flags for concatenation/fragmentation */    
00610   //$A7
00611   double latency;          /*maximum latency requested by the connection*/
00612   u_int32_t min_bw;        /*minimum bandwidth requested by the connection*/
00613   double last_granttime;   /*for UGS and rt-pool/nrt-pool periodic grants*/
00614   u_int16_t backlogged;    /*number of slots backlogged for this flow*/
00615   int16_t granted_bw;      /*number of slots granted for this flow during a time window T*/
00616 };
00617 
00618 /*************************************************************************
00619 
00620 *************************************************************************/
00621 struct ss_record 
00622 {
00623   struct downstream_flow_record d_rec[MAX_NUM_DOWNFLOWS_PERSS];
00624   struct up_flow_record         u_rec[MAX_NUM_UPFLOWS_PERSS];
00625   
00626   int ss_macaddr;
00627   u_int16_t priority; /* Priority for best-effort flow */ 
00628   
00629   u_char SizeDnFlTable;
00630   u_char SizeUpFlTable;
00631   u_char default_upstream_index_;
00632   u_char default_downstream_index_;
00633 };
00634 
00635 
00636 /*************************************************************************
00637  The frequency of generation of management messages 
00638 *************************************************************************/
00640 struct mgmt_conf_param 
00641 {
00642   double sync_msg_interval;
00643   double rng_msg_interval;
00644   double ucd_msg_interval;
00645 };
00646 
00647 /*************************************************************************
00648 
00649 *************************************************************************/
00650 struct map_conf_param 
00651 {
00652   double time_covered;            /* Time covered by MAP(in ms), 
00653                                      0 inidcates varying, >0 indicates 
00654                                      the actual time to be covered by MAP */
00655   
00656   double map_interval;            /* Interval between two maps(in s)*/
00657   
00658   u_int32_t num_contention_slots; /* Number of contention slots per map */  
00659   u_int32_t num_sm_slots;         /* Number of station maintainence 
00660                                      slots per map */  
00661   //$A4
00662   //u_int32_t sgrant_limit;         /* Max number of bytes that can be
00663                                      //sent in short grant IE */  
00664   //  u_int32_t lgrant_limit;         /* Max number of bytes that can be
00665                                         // sent in long grant IE */  
00666   u_char bkoff_start;             /* Initial back-off window for 
00667                                      contention data and request */
00668   u_char bkoff_end;               /* Final back-off window for 
00669                                      contention data and request */
00670 };
00671 
00672 /*************************************************************************
00673 This structure contains all the configurable parameters of the BS node
00674 *************************************************************************/
00676 struct bs_conf_param 
00677 {
00678   struct mgmt_conf_param mgtparam;
00679   struct map_conf_param mapparam;  
00680 };
00681 
00682 /*************************************************************************
00683 Simulation output statistics variable
00684 *************************************************************************/
00686 struct bs_statistics 
00687 {
00688   double avg_interdpr_map;       /* Avg interdeparture between MAPs*/  
00689   u_int32_t avg_datagrants;      /* per MAP*/  
00690   u_int32_t num_req;             /* Number of requests for bandwidth per sec*/ 
00691   u_int32_t avg_contentionslots; /* Per map*/  
00692   u_int32_t data_sent;           /* bytes sent per sec*/  
00693   u_int32_t fragmented_count;    /* Number of fragmented frames received*/  
00694   u_int32_t concatenation_count; /* Number of concatenated frames received*/  
00695   u_char num_IE;                 /* per MAP */  
00696   u_int32_t num_creq;            /* Num of contention request received */
00697   u_int32_t num_piggyreq;        /* Num of piggy request received */
00698   u_int32_t num_creqgrant;       /* Num of contention request granted*/
00699   u_int32_t num_creqdenied;      /* Num of contention request denied*/
00700   u_int32_t total_num_cslots;    /* Total number of contention slots that 
00701                                     were assigned over the simulation */
00702   u_int32_t total_num_mgmtslots; /* Total number of management slots that 
00703                                     were assigned over the simualtion */  
00704 };
00705 
00706 /*************************************************************************
00707 Scheduling algorithm data structures
00708 *************************************************************************/
00710 typedef struct job* jptr;
00711 
00712 struct job 
00713 {
00714   double release_time;       /* The time after which the job can be processed*/
00715   double period;             /* For periodic jobs*/
00716   double deadline;           /* Request should be satisfied by this time */
00717   u_int32_t mini_slots;      /* Number of minislots requested */
00718   jptr next;                 /* Next job in the queue */
00719   u_int16_t flow_id;         /* Flow id of requesting SS */
00720   SchedType sclass;          /* UGS or RT-VBR or BEST-EFFORT */
00721   u_char type;               /* Type of request, DATA or Unicast req slots */
00722   u_char flag;               /* To delete or not..*/
00723   u_char retry_count; 
00724   double ugsjitter;          /* The jitter in the grant, valid only 
00725                                 for UGS flows */
00726   //$A3
00727   int    jitterSamples;
00728   double last_jittercaltime; /* Last time avg jitter was calculated */
00729 };
00730 
00731 /*************************************************************************
00732 
00733 *************************************************************************/
00734 typedef struct map_list * mapptr;
00735 
00736 struct map_list 
00737 {
00738   double alloc_stime;   /* When can the allocation be started in MAP*/
00739   double alloc_etime;   /* When can the allocation be ended in MAP*/
00740   double release_time;  /* The time after which the job can be processed*/
00741   double deadline;      /* Request should be satisfied by this time */
00742   u_int32_t nslots;
00743   mapptr next;
00744   u_int16_t flow_id;
00745   u_int16_t  flag;      /* To indicate whether this is hole or not 
00746                            This is the IUC*/
00747 };
00748 
00749 /*************************************************************************
00750 List of token timer requests 
00751 *************************************************************************/
00752 //#ifdef RATE_CONTROL //-------------------------------------------------
00754 typedef struct token_timer_list* tkptr;
00755 
00756 struct token_timer_list 
00757 {
00758   double expiration_time; /*stime + rtime */
00759   tkptr next;
00760   int cindex;   /* ssindex of the DownFlowTable for which 
00761                    Token timer has been set */
00762   
00763   int findex;   /* flindex of the DownFlowTable for which 
00764                    Token timer has been set */
00765 };
00766 
00767 /*************************************************************************
00768 Packet queue structure 
00769 *************************************************************************/
00771 typedef struct bsqnode * qlist;
00772 
00773 struct bsqnode 
00774 {
00775   Packet *pkt;
00776   double enq_time; /* Time at which this pkt was enqued */
00777   int cindex;
00778   int findex;
00779   qlist next;
00780 };
00781 //#endif //--------------------------------------------------------------
00782 
00783 /*************************************************************************
00784  $A6
00785 *************************************************************************/
00786 typedef struct bs_snd_timer_list* bs_sptr;
00787 
00788 struct bs_snd_timer_list 
00789 {
00790   double expiration_time; /* stime + rtime */
00791   bs_sptr next;
00792   int cindex; /* index of the SSRecord for which 
00793                     SEND timer has been set */
00794   int findex; /*flow index of the SSRecord[tindex].d_rec*/
00795 };
00796 
00797 /*************************************************************************
00798  $A8 - auxiliar struct to compute the priority of the rtPS and nrtPS in
00799        the intermediate queue
00800 *************************************************************************/
00803 typedef struct active_flows* acflows_ptr;
00804 
00805 struct active_flows
00806 {
00807   acflows_ptr next;          /*Next flow */
00808   u_int16_t flow_id;         /*Flow id of requesting SS */
00809   u_int16_t backlogged_tmp;  /*number of slots backlogged for this flow*/
00810   int16_t granted_bw_tmp;  /*number of slots granted for this flow during a time window T*/
00811 };
00812 
00813 /*************************************************************************
00814  $A8 - auxiliar struct to compute the priority of the rtPS and nrtPS in
00815        the intermediate queue
00816 *************************************************************************/
00819 struct priority_array
00820 {
00821   int priority;
00822   jptr job_pointer;
00823 };
00824 
00825 typedef struct priority_array* priority_array_p;
00826 
00827 /*=======================END BS data structures=========================*/
00828 
00829 
00830 /*=======================SS data structures=========================*/
00831 
00832 /*************************************************************************
00833 
00834 *************************************************************************/
00835 typedef struct snd_timer_list* sptr;
00836 
00837 struct snd_timer_list 
00838 {
00839   double expiration_time; /* stime + rtime */
00840   sptr next;
00841   u_char tindex; /* index of the UpFlowTable for which 
00842                     SEND timer has been set */
00843 };
00844 
00845 /*************************************************************************
00846 
00847 *************************************************************************/
00848 typedef struct req_timer_list* rptr;
00849 
00850 struct req_timer_list 
00851 {
00852   double expiration_time; /* stime + rtime */
00853   rptr next;
00854   u_char rindex; /* index of the UpFlowTable for which 
00855                     REQ timer has been set */
00856 };
00857 
00858 /*************************************************************************
00859 
00860 *************************************************************************/
00861 struct upstream_sflow 
00862 {
00863   struct upstream_flow_record upstream_record;
00864   struct allocation_time* alloc_list;
00865   //PacketQueue  *q_;
00866   plist packet_list;
00867   u_int16_t max_qsize;       /* variable indicates the maximum
00868                                 queue size */
00869   Packet* pkt;
00870   Packet* frag_pkt;
00871   
00872   char debug;                /* To debug the flow */
00873   
00874   double map_acktime;
00875   double req_time;           /* Time when a request for 
00876                                 bandwidth has been sent */
00877   
00878   double avg_queuing_delay;  /* Avg queuing delay 
00879                                 per packet for this service flow*/
00880   u_int32_t queuing_samples; /* Num of samples used to compute the 
00881                                 avg queuing delay */
00882   
00883   double avg_req_stime;      /* Avg time for
00884                                 a request to be serviced*/
00885   
00886   double enque_time;         /* Time at which the packet being sent now 
00887                                 was enqued, used to compute access delay */
00888   
00889   u_int32_t  num_delay_samples; /* Num of delay samples, used to 
00890                                    compute the avg access delay */
00891   
00892   u_int32_t curr_gsize;      /* This denotes how much data(in bytes) could be 
00893                                 sent when the SEND timer expires */
00894   
00895   u_int32_t num_pkt_snt; /* Number of packets for
00896                             which request for banwidth
00897                             has to be sent */
00898   u_int32_t drop_count;
00899   
00900   u_int32_t seq_num;
00901   u_int32_t frag_data;
00902   double    last_mfrtime;
00903   u_int32_t avg_pkts;    /* Avg number of frames
00904                             sent per sec */
00905   u_int32_t avg_bytes;   /* Avg number of bytes/s */ 
00906   u_int32_t num_bytes; 
00907   u_int32_t num_pkts;  
00908   
00909   /* STATISTICS */
00910   u_int32_t SID_num_sent_bytes; 
00911   u_int32_t SID_num_sent_pkts;  
00912   
00913   u_int32_t avg_slotspermap;     /* Avg number of slots
00914                                         per map */
00915   //$A0 : to support ACK filtering....
00916   u_int32_t totalACKs;         /* Total num of TCP acks that arrived to be sent */
00917   u_int32_t totalACKsFiltered; /* Total num of TCP acks that were filtered/removed */
00918   
00919   u_int32_t total_piggyreq;      /* Total num of piggy req sent */
00920   u_int32_t total_creq;          /* Total num of contention req sent */
00921   
00922   u_int32_t total_fcoll;         /* Total num of first collisions */
00923   u_int32_t avg_fcont;           /* avg num of slots skipped during first 
00924                                     contention back-off */
00925   u_int32_t fcont_count;         /* Number of first contentions done */
00926   
00927   u_int32_t total_collision_drops; /* Total number of packets droppeddue to 
00928                                         transmission attempt exceeding 16 */
00929   u_int32_t total_queue_drops;     /* Total number of packets dropped due to 
00930                                         service-flow queue overflow */
00931 
00932   int bs_addr;
00933   u_int16_t max_concat_threshhold;
00934   
00935   u_char state;                /* The current state for this service flow */
00936   
00937   u_int32_t bk_offwin;         /* Current bk-off window */
00938   u_int32_t bk_offcounter; 
00939   u_int32_t bk_offend; 
00940   u_int32_t bk_offstart;
00941   u_char    num_retries;
00942   u_char    max_retries; 
00943   u_char    contention_on;     /* (For best-effort flows only), 
00944                                         Indicates whether a req 
00945                                         has been sent in contention-slots */ 
00946 
00947   u_char    pending;           /* Denotes whether any data grant 
00948                                   is pending for this flow */  
00949   Event intr;
00950   Event rintr;
00951 
00952   double ugsjitter;         /* The jitter in the grant, 
00953                                   valid only for UGS flows */
00954   //$A3
00955   int    jitterSamples;
00956   double last_granttime;    /* Last grant observed at this time
00957                                (to make sure that we do not use the 
00958                                same data grant again in the calculation) */
00959   
00960   double nominal_alloctime;    /* Grant shud have ben allocated at this time */
00961   double last_jittercaltime;   /* Last time avg jitter was calculated */
00962 //$A0
00963 //#ifdef US_RATE_CONTROL
00964   double   acceptance_rate;
00965   double   prev_acceptance_rate;
00966   float    wt_factor;
00967   u_int32_t  num_slots_req;
00968   double     tokens_;
00969   double     rate_;
00970   int        bucket_;
00971   double     lastupdatetime_;
00972   int        init_;
00973   char  ratecontrol; /* To indicate whether rate-control is ON or not */
00974 //#endif
00975   //$A8
00976   int totalPacketsInConcatFrames;
00977   int totalConcatFrames;
00978 
00979   //$A9
00980   int not_requested_pkts; /*To indicate for how many bytes BW was not requested yet*/
00981   
00982   //$A10
00983   u_int16_t aggreqinterval; /*aggregate bw request interval (in number of reqs)*/
00984   u_int16_t req_counter;    /*request counter used to define when to send aggregate requests*/
00985   
00986 
00987 };
00988 
00989 /*************************************************************************
00990 To store the Upstream flow information so that it could be sent to BS 
00991 during the Registration Phase
00992 *************************************************************************/
00995 struct downstream_sflow 
00996 {
00997   struct downstream_flow_record downstream_record;
00998 
00999 };
01000 
01001 /*=======================END SS data structures=========================*/
01002 
01003 /*======================END DATA STRUCTURES DECLARATIONS==================*/
01004 
01005 #endif /* end __hdr_mac802_16_h */

Generated on Fri Feb 8 16:42:33 2008 for WiMAX by  doxygen 1.5.1