A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
service-flow.cc
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  * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
20  * <amine.ismail@UDcast.com>
21  */
22 
23 #include "service-flow.h"
24 #include "service-flow-record.h"
25 #include "ns3/simulator.h"
26 #include "wimax-tlv.h"
27 
28 namespace ns3 {
29 
30 ServiceFlow::ServiceFlow (Direction direction)
31 {
32  InitValues ();
33  m_direction = direction;
34  m_type = SF_TYPE_PROVISIONED;
35  m_record = new ServiceFlowRecord ();
36  m_sfid = 0;
37  m_connection = 0;
38  m_isEnabled = false;
39  m_isMulticast = false;
40  m_modulationType = WimaxPhy::MODULATION_TYPE_QPSK_12;
41 }
42 
43 ServiceFlow::ServiceFlow ()
44  : m_sfid (0),
45  m_direction (SF_DIRECTION_DOWN),
46  m_type (SF_TYPE_PROVISIONED),
47  m_connection (0),
48  m_isEnabled (false),
49  m_record (new ServiceFlowRecord ())
50 {
51  InitValues ();
52  m_isMulticast = false;
53  m_modulationType = WimaxPhy::MODULATION_TYPE_QPSK_12;
54 
55 }
56 
57 ServiceFlow::ServiceFlow (uint32_t sfid, Direction direction, Ptr<WimaxConnection> connection)
58 {
59  InitValues ();
60  m_record = new ServiceFlowRecord ();
61  m_isEnabled = false;
62  m_connection = connection;
63  m_connection->SetServiceFlow (this);
64  m_type = SF_TYPE_PROVISIONED;
65  m_direction = direction;
66  m_sfid = sfid;
67  m_isMulticast = false;
68  m_modulationType = WimaxPhy::MODULATION_TYPE_QPSK_12;
69 }
70 
71 ServiceFlow::ServiceFlow (Tlv tlv)
72 {
73  InitValues ();
74  m_connection = 0;
75  m_isEnabled = 0;
76  m_record = new ServiceFlowRecord ();
77  NS_ASSERT_MSG (tlv.GetType () == Tlv::UPLINK_SERVICE_FLOW || tlv.GetType () == Tlv::DOWNLINK_SERVICE_FLOW,
78  "Invalid TLV");
79 
80  SfVectorTlvValue * param;
81  param = (SfVectorTlvValue*)(tlv.PeekValue ());
82 
83  if (tlv.GetType () == Tlv::UPLINK_SERVICE_FLOW)
84  {
85  m_direction = SF_DIRECTION_UP;
86  }
87  else
88  {
89  m_direction = SF_DIRECTION_DOWN;
90  }
91 
92  for (std::vector<Tlv*>::const_iterator iter = param->Begin (); iter != param->End (); ++iter)
93  {
94  switch ((*iter)->GetType ())
95  {
96  case SfVectorTlvValue::SFID:
97  {
98  m_sfid = ((U32TlvValue*)((*iter)->PeekValue ()))->GetValue ();
99  break;
100  }
101  case SfVectorTlvValue::CID:
102  {
103  uint16_t cid = ((U16TlvValue*)((*iter)->PeekValue ()))->GetValue ();
104  m_connection = CreateObject<WimaxConnection> (cid, Cid::TRANSPORT);
105  break;
106  }
107  case SfVectorTlvValue::QoS_Parameter_Set_Type:
108  {
109  m_qosParamSetType = ((U8TlvValue*)((*iter)->PeekValue ()))->GetValue ();
110  break;
111  }
112  case SfVectorTlvValue::Traffic_Priority:
113  {
114  m_trafficPriority = ((U8TlvValue*)((*iter)->PeekValue ()))->GetValue ();
115  break;
116  }
117  case SfVectorTlvValue::Maximum_Sustained_Traffic_Rate:
118  {
119  m_maxSustainedTrafficRate = ((U32TlvValue*)((*iter)->PeekValue ()))->GetValue ();
120  break;
121  }
122  case SfVectorTlvValue::Maximum_Traffic_Burst:
123  {
124  m_maxTrafficBurst = ((U32TlvValue*)((*iter)->PeekValue ()))->GetValue ();
125  break;
126  }
127  case SfVectorTlvValue::Minimum_Reserved_Traffic_Rate:
128  {
129  m_minReservedTrafficRate = ((U32TlvValue*)((*iter)->PeekValue ()))->GetValue ();
130  break;
131  }
132  case SfVectorTlvValue::Minimum_Tolerable_Traffic_Rate:
133  {
134  m_minTolerableTrafficRate = ((U32TlvValue*)((*iter)->PeekValue ()))->GetValue ();
135  break;
136  }
137  case SfVectorTlvValue::Service_Flow_Scheduling_Type:
138  {
139  m_schedulingType = (ServiceFlow::SchedulingType)((U8TlvValue*)((*iter)->PeekValue ()))->GetValue ();
140  break;
141  }
142  case SfVectorTlvValue::Request_Transmission_Policy:
143  {
144  m_requestTransmissionPolicy = ((U32TlvValue*)((*iter)->PeekValue ()))->GetValue ();
145  break;
146  }
147  case SfVectorTlvValue::Tolerated_Jitter:
148  {
149  m_toleratedJitter = ((U32TlvValue*)((*iter)->PeekValue ()))->GetValue ();
150  break;
151  }
152  case SfVectorTlvValue::Maximum_Latency:
153  {
154  m_maximumLatency = ((U32TlvValue*)((*iter)->PeekValue ()))->GetValue ();
155  break;
156  }
157  case SfVectorTlvValue::Fixed_length_versus_Variable_length_SDU_Indicator:
158  {
159  m_fixedversusVariableSduIndicator = ((U16TlvValue*)((*iter)->PeekValue ()))->GetValue ();
160  break;
161  }
162  case SfVectorTlvValue::CS_Specification:
163  {
164  m_csSpecification = (enum CsSpecification)(((U8TlvValue*)((*iter)->PeekValue ()))->GetValue ());
165  break;
166  }
167 
168  case SfVectorTlvValue::IPV4_CS_Parameters:
169  {
170  m_convergenceSublayerParam = CsParameters (*(*iter));
171  break;
172  }
173 
174  }
175  }
176  m_isMulticast = false;
177  m_modulationType = WimaxPhy::MODULATION_TYPE_QPSK_12;
178 }
179 
180 ServiceFlow::~ServiceFlow (void)
181 {
182  if (m_record != 0)
183  {
184  delete m_record;
185  m_record = 0;
186  }
187  m_connection = 0;
188 }
189 
190 void
191 ServiceFlow::SetDirection (Direction direction)
192 {
193  m_direction = direction;
194 }
195 
196 ServiceFlow::Direction
197 ServiceFlow::GetDirection (void) const
198 {
199  return m_direction;
200 }
201 
202 void
203 ServiceFlow::SetType (Type type)
204 {
205  m_type = type;
206 }
207 
208 ServiceFlow::Type
209 ServiceFlow::GetType (void) const
210 {
211  return m_type;
212 }
213 
214 void
215 ServiceFlow::SetConnection (Ptr<WimaxConnection> connection)
216 {
217  m_connection = connection;
218  m_connection->SetServiceFlow (this);
219 }
220 
221 Ptr<WimaxConnection>
222 ServiceFlow::GetConnection (void) const
223 {
224  return m_connection;
225 }
226 
227 void
228 ServiceFlow::SetIsEnabled (bool isEnabled)
229 {
230  m_isEnabled = isEnabled;
231 }
232 
233 bool
234 ServiceFlow::GetIsEnabled (void) const
235 {
236  return m_isEnabled;
237 }
238 
239 void
240 ServiceFlow::SetRecord (ServiceFlowRecord *record)
241 {
242  m_record = record;
243 }
244 
245 ServiceFlowRecord*
246 ServiceFlow::GetRecord (void) const
247 {
248  return m_record;
249 }
250 
251 Ptr<WimaxMacQueue>
252 ServiceFlow::GetQueue (void) const
253 {
254  if (!m_connection)
255  {
256  return 0;
257  }
258  return m_connection->GetQueue ();
259 }
260 
261 enum ServiceFlow::SchedulingType
262 ServiceFlow::GetSchedulingType (void) const
263 {
264  return m_schedulingType;
265 }
266 
267 bool
268 ServiceFlow::HasPackets (void) const
269 {
270  if (!m_connection)
271  {
272  return false;
273  }
274  return m_connection->HasPackets ();
275 }
276 
277 bool
278 ServiceFlow::HasPackets (MacHeaderType::HeaderType packetType) const
279 {
280  if (!m_connection)
281  {
282  return false;
283  }
284  return m_connection->HasPackets (packetType);
285 }
286 
287 void
288 ServiceFlow::CleanUpQueue (void)
289 {
290  GenericMacHeader hdr;
291  Time timeStamp;
292  Ptr<Packet> packet;
293  Time currentTime = Simulator::Now ();
294  if (m_connection)
295  {
296  while (m_connection->HasPackets ())
297  {
298  packet = m_connection->GetQueue ()->Peek (hdr, timeStamp);
299 
300  if (currentTime - timeStamp > MilliSeconds (GetMaximumLatency ()))
301  {
302  m_connection->Dequeue ();
303  }
304  else
305  {
306  break;
307  }
308  }
309  }
310 }
311 
312 void
313 ServiceFlow::PrintQoSParameters (void) const
314 {
315 }
316 // ==============================================================================
317 
318 
319 uint32_t
320 ServiceFlow::GetSfid (void) const
321 {
322  return m_sfid;
323 }
324 uint16_t
325 ServiceFlow::GetCid (void) const
326 {
327  if (m_connection == 0)
328  {
329  return 0;
330  }
331  return m_connection->GetCid ().GetIdentifier ();
332 }
333 std::string
334 ServiceFlow::GetServiceClassName () const
335 {
336  return m_serviceClassName;
337 }
338 uint8_t
339 ServiceFlow::GetQosParamSetType (void) const
340 {
341  return m_qosParamSetType;
342 }
343 uint8_t
344 ServiceFlow::GetTrafficPriority (void) const
345 {
346  return m_trafficPriority;
347 }
348 uint32_t
349 ServiceFlow::GetMaxSustainedTrafficRate (void) const
350 {
351  return m_maxSustainedTrafficRate;
352 }
353 uint32_t
354 ServiceFlow::GetMaxTrafficBurst (void) const
355 {
356  return m_maxTrafficBurst;
357 }
358 uint32_t
359 ServiceFlow::GetMinReservedTrafficRate (void) const
360 {
361  return m_minReservedTrafficRate;
362 }
363 uint32_t
364 ServiceFlow::GetMinTolerableTrafficRate (void) const
365 {
366  return m_minTolerableTrafficRate;
367 }
368 enum
369 ServiceFlow::SchedulingType ServiceFlow::GetServiceSchedulingType (void) const
370 {
371  return m_schedulingType;
372 }
373 uint32_t
374 ServiceFlow::GetRequestTransmissionPolicy (void) const
375 {
376  return m_requestTransmissionPolicy;
377 }
378 uint32_t
379 ServiceFlow::GetToleratedJitter (void) const
380 {
381  return m_toleratedJitter;
382 }
383 uint32_t
384 ServiceFlow::GetMaximumLatency (void) const
385 {
386  return m_maximumLatency;
387 }
388 uint8_t
389 ServiceFlow::GetFixedversusVariableSduIndicator (void) const
390 {
391  return m_fixedversusVariableSduIndicator;
392 }
393 uint8_t
394 ServiceFlow::GetSduSize (void) const
395 {
396  return m_sduSize;
397 }
398 uint16_t
399 ServiceFlow::GetTargetSAID (void) const
400 {
401  return m_targetSAID;
402 }
403 uint8_t
404 ServiceFlow::GetArqEnable (void) const
405 {
406  return m_arqEnable;
407 }
408 uint16_t
409 ServiceFlow::GetArqWindowSize (void) const
410 {
411  return m_arqWindowSize;
412 }
413 uint16_t
414 ServiceFlow::GetArqRetryTimeoutTx (void) const
415 {
416  return m_arqRetryTimeoutTx;
417 }
418 uint16_t
419 ServiceFlow::GetArqRetryTimeoutRx (void) const
420 {
421  return m_arqRetryTimeoutRx;
422 }
423 
424 uint16_t
425 ServiceFlow::GetArqBlockLifeTime (void) const
426 {
427  return m_arqBlockLifeTime;
428 }
429 uint16_t
430 ServiceFlow::GetArqSyncLoss (void) const
431 {
432  return m_arqSyncLoss;
433 }
434 uint8_t
435 ServiceFlow::GetArqDeliverInOrder (void) const
436 {
437  return m_arqDeliverInOrder;
438 }
439 uint16_t
440 ServiceFlow::GetArqPurgeTimeout (void) const
441 {
442  return m_arqPurgeTimeout;
443 }
444 uint16_t
445 ServiceFlow::GetArqBlockSize (void) const
446 {
447  return m_arqBlockSize;
448 }
449 enum
450 ServiceFlow::CsSpecification ServiceFlow::GetCsSpecification (void) const
451 {
452  return m_csSpecification;
453 }
454 CsParameters
455 ServiceFlow::GetConvergenceSublayerParam (void) const
456 {
457  return m_convergenceSublayerParam;
458 }
459 uint16_t
460 ServiceFlow::GetUnsolicitedGrantInterval (void) const
461 {
462  return m_unsolicitedGrantInterval;
463 }
464 uint16_t
465 ServiceFlow::GetUnsolicitedPollingInterval (void) const
466 {
467  return m_unsolicitedPollingInterval;
468 }
469 
470 bool
471 ServiceFlow::GetIsMulticast (void) const
472 {
473  return m_isMulticast;
474 }
475 enum WimaxPhy::ModulationType
476 ServiceFlow::GetModulation (void) const
477 {
478  return m_modulationType;
479 }
480 
481 
482 // ==============================================================================
483 
484 void
485 ServiceFlow::SetSfid (uint32_t sfid)
486 {
487  m_sfid = sfid;
488 }
489 void
490 ServiceFlow::SetServiceClassName (std::string name)
491 {
492  m_serviceClassName = name;
493 }
494 void
495 ServiceFlow::SetQosParamSetType (uint8_t type)
496 {
497  m_qosParamSetType = type;
498 }
499 void
500 ServiceFlow::SetTrafficPriority (uint8_t priority)
501 {
502  m_trafficPriority = priority;
503 }
504 void
505 ServiceFlow::SetMaxSustainedTrafficRate (uint32_t maxSustainedRate)
506 {
507  m_maxSustainedTrafficRate = maxSustainedRate;
508 }
509 void
510 ServiceFlow::SetMaxTrafficBurst (uint32_t maxTrafficBurst)
511 {
512  m_maxTrafficBurst = maxTrafficBurst;
513 }
514 void
515 ServiceFlow::SetMinReservedTrafficRate (uint32_t minResvRate)
516 {
517  m_minReservedTrafficRate = minResvRate;
518 }
519 void
520 ServiceFlow::SetMinTolerableTrafficRate (uint32_t minJitter)
521 {
522  m_minTolerableTrafficRate = minJitter;
523 }
524 void
525 ServiceFlow::SetServiceSchedulingType (enum ServiceFlow::SchedulingType schedType)
526 {
527  m_schedulingType = schedType;
528 }
529 void
530 ServiceFlow::SetRequestTransmissionPolicy (uint32_t policy)
531 {
532  m_requestTransmissionPolicy = policy;
533 }
534 void
535 ServiceFlow::SetToleratedJitter (uint32_t jitter)
536 {
537  m_toleratedJitter = jitter;
538 }
539 void
540 ServiceFlow::SetMaximumLatency (uint32_t MaximumLatency)
541 {
542  m_maximumLatency = MaximumLatency;
543 }
544 void
545 ServiceFlow::SetFixedversusVariableSduIndicator (uint8_t sduIndicator)
546 {
547  m_fixedversusVariableSduIndicator = sduIndicator;
548 }
549 void
550 ServiceFlow::SetSduSize (uint8_t sduSize)
551 {
552  m_sduSize = sduSize;
553 }
554 void
555 ServiceFlow::SetTargetSAID (uint16_t targetSaid)
556 {
557  m_targetSAID = targetSaid;
558 }
559 void
560 ServiceFlow::SetArqEnable (uint8_t arqEnable)
561 {
562  m_arqEnable = arqEnable;
563 }
564 void
565 ServiceFlow::SetArqWindowSize (uint16_t arqWindowSize)
566 {
567  m_arqWindowSize = arqWindowSize;
568 }
569 void
570 ServiceFlow::SetArqRetryTimeoutTx (uint16_t timeout)
571 {
572  m_arqRetryTimeoutTx = timeout;
573 }
574 void
575 ServiceFlow::SetArqRetryTimeoutRx (uint16_t timeout)
576 {
577  m_arqRetryTimeoutRx = timeout;
578 }
579 void
580 ServiceFlow::SetArqBlockLifeTime (uint16_t lifeTime)
581 {
582  m_arqBlockLifeTime = lifeTime;
583 }
584 void
585 ServiceFlow::SetArqSyncLoss (uint16_t syncLoss)
586 {
587  m_arqSyncLoss = syncLoss;
588 }
589 void
590 ServiceFlow::SetArqDeliverInOrder (uint8_t inOrder)
591 {
592  m_arqDeliverInOrder = inOrder;
593 }
594 void
595 ServiceFlow::SetArqPurgeTimeout (uint16_t timeout)
596 {
597  m_arqPurgeTimeout = timeout;
598 }
599 void
600 ServiceFlow::SetArqBlockSize (uint16_t size)
601 {
602  m_arqBlockSize = size;
603 }
604 void
605 ServiceFlow::SetCsSpecification (enum ServiceFlow::CsSpecification spec)
606 {
607  m_csSpecification = spec;
608 }
609 void
610 ServiceFlow::SetConvergenceSublayerParam (CsParameters csparam)
611 {
612  m_convergenceSublayerParam = csparam;
613 }
614 void
615 ServiceFlow::SetUnsolicitedGrantInterval (uint16_t unsolicitedGrantInterval)
616 {
617  m_unsolicitedGrantInterval = unsolicitedGrantInterval;
618 }
619 void
620 ServiceFlow::SetUnsolicitedPollingInterval (uint16_t unsolicitedPollingInterval)
621 {
622  m_unsolicitedPollingInterval = unsolicitedPollingInterval;
623 }
624 void
625 ServiceFlow::SetIsMulticast (bool isMulticast)
626 {
627  m_isMulticast = isMulticast;
628 }
629 void
630 ServiceFlow::SetModulation (enum WimaxPhy::ModulationType modulationType)
631 {
632  m_modulationType = modulationType;
633 }
634 
635 void
636 ServiceFlow::InitValues (void)
637 {
638  m_sfid = 0;
639  m_serviceClassName = "";
640  m_qosParamSetType = 0;
641  m_trafficPriority = 0;
642  m_maxSustainedTrafficRate = 0;
643  m_maxTrafficBurst = 0;
644  m_minReservedTrafficRate = 0;
645  m_minTolerableTrafficRate = 0;
646  m_schedulingType = ServiceFlow::SF_TYPE_NONE;
647  m_requestTransmissionPolicy = 0;
648  m_toleratedJitter = 0;
649  m_maximumLatency = 0;
650  m_fixedversusVariableSduIndicator = 0;
651  m_sduSize = 0;
652  m_targetSAID = 0;
653  m_arqEnable = 0;
654  m_arqWindowSize = 0;
655  m_arqRetryTimeoutTx = 0;
656  m_arqRetryTimeoutRx = 0;
657  m_csSpecification = ServiceFlow::IPV4;
658  m_unsolicitedGrantInterval = 0;
659  m_unsolicitedPollingInterval = 0;
660  m_arqBlockLifeTime = 0;
661  m_arqSyncLoss = 0;
662  m_arqDeliverInOrder = 0;
663  m_arqPurgeTimeout = 0;
664  m_arqBlockSize = 0;
665  m_direction = ServiceFlow::SF_DIRECTION_DOWN;
666  m_type = ServiceFlow::SF_TYPE_ACTIVE;
667  m_isMulticast = false;
668  m_modulationType = WimaxPhy::MODULATION_TYPE_QPSK_12;
669 }
670 
671 void
672 ServiceFlow::CopyParametersFrom (ServiceFlow sf)
673 {
674  m_serviceClassName = sf.GetServiceClassName ();
675  m_qosParamSetType = sf.GetQosParamSetType ();
676  m_trafficPriority = sf.GetTrafficPriority ();
677  m_maxSustainedTrafficRate = sf.GetMaxSustainedTrafficRate ();
678  m_maxTrafficBurst = sf.GetMaxTrafficBurst ();
679  m_minReservedTrafficRate = sf.GetMinReservedTrafficRate ();
680  m_minTolerableTrafficRate = sf.GetMinTolerableTrafficRate ();
681  m_schedulingType = sf.GetServiceSchedulingType ();
682  m_requestTransmissionPolicy = sf.GetRequestTransmissionPolicy ();
683  m_toleratedJitter = sf.GetToleratedJitter ();
684  m_maximumLatency = sf.GetMaximumLatency ();
685  m_fixedversusVariableSduIndicator = sf.GetFixedversusVariableSduIndicator ();
686  m_sduSize = sf.GetSduSize ();
687  m_targetSAID = sf.GetTargetSAID ();
688  m_arqEnable = sf.GetArqEnable ();
689  m_arqWindowSize = sf.GetArqWindowSize ();
690  m_arqRetryTimeoutTx = sf.GetArqRetryTimeoutTx ();
691  m_arqRetryTimeoutRx = sf.GetArqRetryTimeoutRx ();
692  m_csSpecification = sf.GetCsSpecification ();
693  m_convergenceSublayerParam = sf.GetConvergenceSublayerParam ();
694  m_unsolicitedGrantInterval = sf.GetUnsolicitedGrantInterval ();
695  m_unsolicitedPollingInterval = sf.GetUnsolicitedPollingInterval ();
696  m_direction = sf.GetDirection ();
697  m_isMulticast = sf.GetIsMulticast ();
698  m_modulationType = sf.GetModulation ();
699 }
700 
701 ServiceFlow::ServiceFlow (const ServiceFlow & sf)
702 {
703  m_sfid = sf.GetSfid ();
704  m_serviceClassName = sf.GetServiceClassName ();
705  m_qosParamSetType = sf.GetQosParamSetType ();
706  m_trafficPriority = sf.GetTrafficPriority ();
707  m_maxSustainedTrafficRate = sf.GetMaxSustainedTrafficRate ();
708  m_maxTrafficBurst = sf.GetMaxTrafficBurst ();
709  m_minReservedTrafficRate = sf.GetMinReservedTrafficRate ();
710  m_minTolerableTrafficRate = sf.GetMinTolerableTrafficRate ();
711  m_schedulingType = sf.GetServiceSchedulingType ();
712  m_requestTransmissionPolicy = sf.GetRequestTransmissionPolicy ();
713  m_toleratedJitter = sf.GetToleratedJitter ();
714  m_maximumLatency = sf.GetMaximumLatency ();
715  m_fixedversusVariableSduIndicator = sf.GetFixedversusVariableSduIndicator ();
716  m_sduSize = sf.GetSduSize ();
717  m_targetSAID = sf.GetTargetSAID ();
718  m_arqEnable = sf.GetArqEnable ();
719  m_arqWindowSize = sf.GetArqWindowSize ();
720  m_arqRetryTimeoutTx = sf.GetArqRetryTimeoutTx ();
721  m_arqRetryTimeoutRx = sf.GetArqRetryTimeoutRx ();
722  m_csSpecification = sf.GetCsSpecification ();
723  m_convergenceSublayerParam = sf.GetConvergenceSublayerParam ();
724  m_unsolicitedGrantInterval = sf.GetUnsolicitedGrantInterval ();
725  m_unsolicitedPollingInterval = sf.GetUnsolicitedPollingInterval ();
726  m_direction = sf.GetDirection ();
727  m_type = sf.GetType ();
728  m_connection = sf.GetConnection ();
729  m_isEnabled = sf.GetIsEnabled ();
730  m_record = new ServiceFlowRecord ();
731  (*m_record) = (*sf.GetRecord ());
732  m_isMulticast = sf.GetIsMulticast ();
733  m_modulationType = sf.GetModulation ();
734 }
735 
736 ServiceFlow &
737 ServiceFlow::operator = (ServiceFlow const& o)
738 {
739 
740  m_sfid = o.GetSfid ();
741  m_serviceClassName = o.GetServiceClassName ();
742  m_qosParamSetType = o.GetQosParamSetType ();
743  m_trafficPriority = o.GetTrafficPriority ();
744  m_maxSustainedTrafficRate = o.GetMaxSustainedTrafficRate ();
745  m_maxTrafficBurst = o.GetMaxTrafficBurst ();
746  m_minReservedTrafficRate = o.GetMinReservedTrafficRate ();
747  m_minTolerableTrafficRate = o.GetMinTolerableTrafficRate ();
748  m_schedulingType = o.GetServiceSchedulingType ();
749  m_requestTransmissionPolicy = o.GetRequestTransmissionPolicy ();
750  m_toleratedJitter = o.GetToleratedJitter ();
751  m_maximumLatency = o.GetMaximumLatency ();
752  m_fixedversusVariableSduIndicator = o.GetFixedversusVariableSduIndicator ();
753  m_sduSize = o.GetSduSize ();
754  m_targetSAID = o.GetTargetSAID ();
755  m_arqEnable = o.GetArqEnable ();
756  m_arqWindowSize = o.GetArqWindowSize ();
757  m_arqRetryTimeoutTx = o.GetArqRetryTimeoutTx ();
758  m_arqRetryTimeoutRx = o.GetArqRetryTimeoutRx ();
759  m_csSpecification = o.GetCsSpecification ();
760  m_convergenceSublayerParam = o.GetConvergenceSublayerParam ();
761  m_unsolicitedGrantInterval = o.GetUnsolicitedGrantInterval ();
762  m_unsolicitedPollingInterval = o.GetUnsolicitedPollingInterval ();
763  m_direction = o.GetDirection ();
764  m_type = o.GetType ();
765  m_connection = o.GetConnection ();
766  m_isEnabled = o.GetIsEnabled ();
767  m_isMulticast = o.GetIsMulticast ();
768  m_modulationType = o.GetModulation ();
769  if (m_record != 0)
770  {
771  delete m_record;
772  }
773 
774  m_record = new ServiceFlowRecord ();
775 
776  (*m_record) = (*o.GetRecord ());
777  return *this;
778 }
779 
780 char*
781 ServiceFlow::GetSchedulingTypeStr (void) const
782 {
783  switch (m_schedulingType)
784  {
785  case SF_TYPE_UGS:
786  return (char*) "UGS";
787  break;
788  case SF_TYPE_RTPS:
789  return (char*) "rtPS";
790  break;
791  case SF_TYPE_NRTPS:
792  return (char*) "nrtPS";
793  break;
794  case SF_TYPE_BE:
795  return (char*) "BE";
796  break;
797  default:
798  NS_FATAL_ERROR ("Invalid scheduling type");
799  }
800  return 0;
801 }
802 
803 Tlv
804 ServiceFlow::ToTlv (void) const
805 {
806  SfVectorTlvValue tmpSfVector;
807  tmpSfVector.Add (Tlv (SfVectorTlvValue::SFID, 4, U32TlvValue (m_sfid)));
808  tmpSfVector.Add (Tlv (SfVectorTlvValue::CID, 2, U16TlvValue (GetCid ())));
809  tmpSfVector.Add (Tlv (SfVectorTlvValue::QoS_Parameter_Set_Type, 1, U8TlvValue (m_qosParamSetType)));
810  tmpSfVector.Add (Tlv (SfVectorTlvValue::Traffic_Priority, 1, U8TlvValue (m_trafficPriority)));
811  tmpSfVector.Add (Tlv (SfVectorTlvValue::Maximum_Sustained_Traffic_Rate, 4, U32TlvValue (m_maxSustainedTrafficRate)));
812  tmpSfVector.Add (Tlv (SfVectorTlvValue::Maximum_Traffic_Burst, 4, U32TlvValue (m_maxTrafficBurst)));
813  tmpSfVector.Add (Tlv (SfVectorTlvValue::Minimum_Reserved_Traffic_Rate, 4, U32TlvValue (m_minReservedTrafficRate)));
814  tmpSfVector.Add (Tlv (SfVectorTlvValue::Minimum_Tolerable_Traffic_Rate, 4, U32TlvValue (m_minTolerableTrafficRate)));
815  tmpSfVector.Add (Tlv (SfVectorTlvValue::Service_Flow_Scheduling_Type, 1, U8TlvValue (m_schedulingType)));
816  tmpSfVector.Add (Tlv (SfVectorTlvValue::Request_Transmission_Policy, 4, U32TlvValue (m_requestTransmissionPolicy)));
817  tmpSfVector.Add (Tlv (SfVectorTlvValue::Tolerated_Jitter, 4, U32TlvValue (m_toleratedJitter)));
818  tmpSfVector.Add (Tlv (SfVectorTlvValue::Maximum_Latency, 4, U32TlvValue (m_maximumLatency)));
819  tmpSfVector.Add (Tlv (SfVectorTlvValue::Fixed_length_versus_Variable_length_SDU_Indicator,
820  1,
821  U8TlvValue (m_fixedversusVariableSduIndicator)));
822  tmpSfVector.Add (Tlv (SfVectorTlvValue::SDU_Size, 1, U8TlvValue (m_sduSize)));
823  tmpSfVector.Add (Tlv (SfVectorTlvValue::Target_SAID, 2, U16TlvValue (m_targetSAID)));
824  tmpSfVector.Add (Tlv (SfVectorTlvValue::CS_Specification, 1, U8TlvValue (m_csSpecification)));
825  tmpSfVector.Add (m_convergenceSublayerParam.ToTlv ());
826  if (m_direction == SF_DIRECTION_UP)
827  {
828  return Tlv (Tlv::UPLINK_SERVICE_FLOW, tmpSfVector.GetSerializedSize (), tmpSfVector);
829  }
830  else
831  {
832  return Tlv (Tlv::DOWNLINK_SERVICE_FLOW, tmpSfVector.GetSerializedSize (), tmpSfVector);
833  }
834 }
835 
836 bool
838  Ipv4Address dstAddress,
839  uint16_t srcPort,
840  uint16_t dstPort,
841  uint8_t proto) const
842 {
843  return m_convergenceSublayerParam.GetPacketClassifierRule ().CheckMatch (srcAddress,
844  dstAddress,
845  srcPort,
846  dstPort,
847  proto);
848 }
849 } // namespace ns3
HeaderType
this class implements the mac header type field.
this class implements a structure to manage some parameters and statistics related to a service flow ...
bool CheckMatch(Ipv4Address srcAddress, Ipv4Address dstAddress, uint16_t srcPort, uint16_t dstPort, uint8_t proto) const
check if a packets can be used with this classifier
This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard f...
Definition: wimax-tlv.h:64
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72
Tlv ToTlv(void) const
creates a tlv from the classifier record
bool CheckClassifierMatch(Ipv4Address srcAddress, Ipv4Address dstAddress, uint16_t srcPort, uint16_t dstPort, uint8_t proto) const
static Time Now(void)
Definition: simulator.cc:179
#define NS_ASSERT_MSG(condition, message)
Definition: assert.h:86
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
Time MilliSeconds(uint64_t ms)
create ns3::Time instances in units of milliseconds.
Definition: nstime.h:601
Tlv ToTlv(void) const
creates a TLV from this service flow
IpcsClassifierRecord GetPacketClassifierRule(void) const