A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
service-flow.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007,2008, 2009 INRIA, UDcast
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
20  */
21 
22 #ifndef SERVICE_FLOW_H
23 #define SERVICE_FLOW_H
24 
25 #include <stdint.h>
26 #include "wimax-phy.h"
27 #include "wimax-connection.h"
28 #include "cs-parameters.h"
29 
30 namespace ns3 {
31 
32 class ServiceFlowRecord;
33 class WimaxConnection;
34 
40 {
41 public:
42  enum Direction
43  {
44  SF_DIRECTION_DOWN, SF_DIRECTION_UP
45  };
46 
47  enum Type
48  {
49  SF_TYPE_PROVISIONED, SF_TYPE_ADMITTED, SF_TYPE_ACTIVE
50  };
51 
52  // section 11.13.11 Service flow scheduling type, page 701
53  enum SchedulingType
54  {
55  SF_TYPE_NONE = 0, SF_TYPE_UNDEF = 1, SF_TYPE_BE = 2, SF_TYPE_NRTPS = 3,
56  SF_TYPE_RTPS = 4, SF_TYPE_UGS = 6, SF_TYPE_ALL = 255
57  };
58  // section 11.13.19.2 CS parameter encoding rules, page 707
59  enum CsSpecification
60  {
61  ATM = 99, IPV4 = 100, IPV6 = 101, ETHERNET = 102, VLAN = 103,
62  IPV4_OVER_ETHERNET = 104, IPV6_OVER_ETHERNET = 105, IPV4_OVER_VLAN = 106,
63  IPV6_OVER_VLAN = 107
64  };
65  enum ModulationType // Table 356 and 362
66  {
67  MODULATION_TYPE_BPSK_12, MODULATION_TYPE_QPSK_12, MODULATION_TYPE_QPSK_34, MODULATION_TYPE_QAM16_12,
68  MODULATION_TYPE_QAM16_34, MODULATION_TYPE_QAM64_23, MODULATION_TYPE_QAM64_34
69  };
70 
76  Tlv ToTlv (void) const;
81  ServiceFlow (Tlv tlv);
90  bool CheckClassifierMatch (Ipv4Address srcAddress,
91  Ipv4Address dstAddress,
92  uint16_t srcPort,
93  uint16_t dstPort,
94  uint8_t proto) const;
95  ServiceFlow (enum Direction direction);
96  ServiceFlow ();
97  ServiceFlow (const ServiceFlow & sf);
98  ServiceFlow (uint32_t sfid,
99  enum Direction direction,
100  Ptr<WimaxConnection> connection);
101  ~ServiceFlow (void);
102  ServiceFlow & operator = (ServiceFlow const& o);
103 
104  void InitValues (void);
105  void SetDirection (enum Direction direction);
106  enum Direction GetDirection (void) const;
107  void CopyParametersFrom (ServiceFlow sf);
108 
109  void SetType (enum Type type);
110  enum Type GetType (void) const;
111  void SetConnection (Ptr<WimaxConnection> connection);
112  // Can return a null connection is this service flow has not
113  // been associated yet to a connection.
114  Ptr<WimaxConnection> GetConnection (void) const;
115 
116  void SetIsEnabled (bool isEnabled);
117  bool GetIsEnabled (void) const;
118 
119  void SetRecord (ServiceFlowRecord *record);
120  ServiceFlowRecord* GetRecord (void) const;
121 
122  // wrapper functions
123  Ptr<WimaxMacQueue> GetQueue (void) const;
124  enum ServiceFlow::SchedulingType GetSchedulingType (void) const;
125  bool HasPackets (void) const;
126  bool HasPackets (MacHeaderType::HeaderType packetType) const;
127 
128  // shall be called only by BS
129  void CleanUpQueue (void);
130 
131  void PrintQoSParameters (void) const;
132 
133  char* GetSchedulingTypeStr (void) const;
134 
135  uint32_t GetSfid (void) const;
136  uint16_t GetCid (void) const;
137  std::string GetServiceClassName () const;
138  uint8_t GetQosParamSetType (void) const;
139  uint8_t GetTrafficPriority (void) const;
140  uint32_t GetMaxSustainedTrafficRate (void) const;
141  uint32_t GetMaxTrafficBurst (void) const;
142  uint32_t GetMinReservedTrafficRate (void) const;
143  uint32_t GetMinTolerableTrafficRate (void) const;
144  enum ServiceFlow::SchedulingType GetServiceSchedulingType (void) const;
145  uint32_t GetRequestTransmissionPolicy (void) const;
146  uint32_t GetToleratedJitter (void) const;
147  uint32_t GetMaximumLatency (void) const;
148  uint8_t GetFixedversusVariableSduIndicator (void) const;
149  uint8_t GetSduSize (void) const;
150  uint16_t GetTargetSAID (void) const;
151  uint8_t GetArqEnable (void) const;
152  uint16_t GetArqWindowSize (void) const;
153  uint16_t GetArqRetryTimeoutTx (void) const;
154  uint16_t GetArqRetryTimeoutRx (void) const;
155  uint16_t GetArqBlockLifeTime (void) const;
156  uint16_t GetArqSyncLoss (void) const;
157  uint8_t GetArqDeliverInOrder (void) const;
158  uint16_t GetArqPurgeTimeout (void) const;
159  uint16_t GetArqBlockSize (void) const;
160  enum CsSpecification GetCsSpecification (void) const;
161  CsParameters GetConvergenceSublayerParam (void) const;
162  uint16_t GetUnsolicitedGrantInterval (void) const;
163  uint16_t GetUnsolicitedPollingInterval (void) const;
164  bool GetIsMulticast (void) const;
165  enum WimaxPhy::ModulationType GetModulation (void) const;
166 
167  void SetSfid (uint32_t);
168  void SetServiceClassName (std::string);
169  void SetQosParamSetType (uint8_t);
170  void SetTrafficPriority (uint8_t);
171  void SetMaxSustainedTrafficRate (uint32_t);
172  void SetMaxTrafficBurst (uint32_t);
173  void SetMinReservedTrafficRate (uint32_t);
174  void SetMinTolerableTrafficRate (uint32_t);
175  void SetServiceSchedulingType (enum ServiceFlow::SchedulingType);
176  void SetRequestTransmissionPolicy (uint32_t);
177  void SetToleratedJitter (uint32_t);
178  void SetMaximumLatency (uint32_t);
179  void SetFixedversusVariableSduIndicator (uint8_t);
180  void SetSduSize (uint8_t);
181  void SetTargetSAID (uint16_t);
182  void SetArqEnable (uint8_t);
183  void SetArqWindowSize (uint16_t);
184  void SetArqRetryTimeoutTx (uint16_t);
185  void SetArqRetryTimeoutRx (uint16_t);
186  void SetArqBlockLifeTime (uint16_t);
187  void SetArqSyncLoss (uint16_t);
188  void SetArqDeliverInOrder (uint8_t);
189  void SetArqPurgeTimeout (uint16_t);
190  void SetArqBlockSize (uint16_t);
191  void SetCsSpecification (enum CsSpecification);
192  void SetConvergenceSublayerParam (CsParameters);
193 
194  void SetUnsolicitedGrantInterval (uint16_t);
195  void SetUnsolicitedPollingInterval (uint16_t);
196  void SetIsMulticast (bool isMulticast);
197  void SetModulation (enum WimaxPhy::ModulationType modulationType);
198 
199 
200 
201 private:
202  uint32_t m_sfid;
203  std::string m_serviceClassName;
204  uint8_t m_qosParamSetType;
205  uint8_t m_trafficPriority;
206  uint32_t m_maxSustainedTrafficRate;
207  uint32_t m_maxTrafficBurst;
208  uint32_t m_minReservedTrafficRate;
209  uint32_t m_minTolerableTrafficRate;
210  enum ServiceFlow::SchedulingType m_schedulingType;
211  uint32_t m_requestTransmissionPolicy;
212  uint32_t m_toleratedJitter;
213  uint32_t m_maximumLatency;
214  uint8_t m_fixedversusVariableSduIndicator;
215  uint8_t m_sduSize;
216  uint16_t m_targetSAID;
217  uint8_t m_arqEnable;
218  uint16_t m_arqWindowSize;
219  uint16_t m_arqRetryTimeoutTx;
220  uint16_t m_arqRetryTimeoutRx;
221  uint16_t m_arqBlockLifeTime;
222  uint16_t m_arqSyncLoss;
223  uint8_t m_arqDeliverInOrder;
224  uint16_t m_arqPurgeTimeout;
225  uint16_t m_arqBlockSize;
226  enum CsSpecification m_csSpecification;
227  CsParameters m_convergenceSublayerParam;
228  uint16_t m_unsolicitedGrantInterval;
229  uint16_t m_unsolicitedPollingInterval;
230  Direction m_direction;
231  Type m_type;
232  Ptr<WimaxConnection> m_connection;
233  bool m_isEnabled;
234  bool m_isMulticast;
235  enum WimaxPhy::ModulationType m_modulationType;
236  // will be used by the BS
237  ServiceFlowRecord *m_record;
238 };
239 
240 } // namespace ns3
241 
242 #endif /* SERVICE_FLOW_H */
HeaderType
this class implements the mac header type field.
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
this class implements a structure to manage some parameters and statistics related to a service flow ...
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
Definition: wimax-tlv.h:64
bool CheckClassifierMatch(Ipv4Address srcAddress, Ipv4Address dstAddress, uint16_t srcPort, uint16_t dstPort, uint8_t proto) const
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
Tlv ToTlv(void) const
creates a TLV from this service flow