A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
epc-x2-header.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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: Manuel Requena <manuel.requena@cttc.es>
19  */
20 
21 #include "ns3/log.h"
22 #include "ns3/epc-x2-header.h"
23 
24 
25 NS_LOG_COMPONENT_DEFINE ("EpcX2Header");
26 
27 namespace ns3 {
28 
29 
30 NS_OBJECT_ENSURE_REGISTERED (EpcX2Header)
31  ;
32 
34  : m_messageType (0xfa),
35  m_procedureCode (0xfa),
36  m_lengthOfIes (0xfa),
37  m_numberOfIes (0xfa)
38 {
39 }
40 
42 {
43  m_messageType = 0xfb;
44  m_procedureCode = 0xfb;
45  m_lengthOfIes = 0xfb;
46  m_numberOfIes = 0xfb;
47 }
48 
49 TypeId
51 {
52  static TypeId tid = TypeId ("ns3::EpcX2Header")
53  .SetParent<Header> ()
54  .AddConstructor<EpcX2Header> ()
55  ;
56  return tid;
57 }
58 
59 TypeId
61 {
62  return GetTypeId ();
63 }
64 
65 uint32_t
67 {
68  return 7;
69 }
70 
71 void
73 {
75 
78 
79  i.WriteU8 (0x00); // criticality = REJECT
80  i.WriteU8 (m_lengthOfIes + 3);
81  i.WriteHtonU16 (0);
83 }
84 
85 uint32_t
87 {
89 
90  m_messageType = i.ReadU8 ();
91  m_procedureCode = i.ReadU8 ();
92 
93  i.ReadU8 ();
94  m_lengthOfIes = i.ReadU8 () - 3;
95  i.ReadNtohU16 ();
96  m_numberOfIes = i.ReadU8 ();
97 
98  return GetSerializedSize ();
99 }
100 
101 void
102 EpcX2Header::Print (std::ostream &os) const
103 {
104  os << "MessageType=" << (uint32_t) m_messageType;
105  os << " ProcedureCode=" << (uint32_t) m_procedureCode;
106  os << " LengthOfIEs=" << (uint32_t) m_lengthOfIes;
107  os << " NumberOfIEs=" << (uint32_t) m_numberOfIes;
108 }
109 
110 uint8_t
112 {
113  return m_messageType;
114 }
115 
116 void
117 EpcX2Header::SetMessageType (uint8_t messageType)
118 {
119  m_messageType = messageType;
120 }
121 
122 uint8_t
124 {
125  return m_procedureCode;
126 }
127 
128 void
129 EpcX2Header::SetProcedureCode (uint8_t procedureCode)
130 {
131  m_procedureCode = procedureCode;
132 }
133 
134 
135 void
136 EpcX2Header::SetLengthOfIes (uint32_t lengthOfIes)
137 {
138  m_lengthOfIes = lengthOfIes;
139 }
140 
141 void
142 EpcX2Header::SetNumberOfIes (uint32_t numberOfIes)
143 {
144  m_numberOfIes = numberOfIes;
145 }
146 
148 
150  ;
151 
153  : m_numberOfIes (1 + 1 + 1 + 1),
154  m_headerLength (6 + 5 + 12 + (3 + 4 + 8 + 8 + 4)),
155  m_oldEnbUeX2apId (0xfffa),
156  m_cause (0xfffa),
157  m_targetCellId (0xfffa),
158  m_mmeUeS1apId (0xfffffffa)
159 {
160  m_erabsToBeSetupList.clear ();
161 }
162 
164 {
165  m_numberOfIes = 0;
166  m_headerLength = 0;
167  m_oldEnbUeX2apId = 0xfffb;
168  m_cause = 0xfffb;
169  m_targetCellId = 0xfffb;
170  m_mmeUeS1apId = 0xfffffffb;
171  m_erabsToBeSetupList.clear ();
172 }
173 
174 TypeId
176 {
177  static TypeId tid = TypeId ("ns3::EpcX2HandoverRequestHeader")
178  .SetParent<Header> ()
179  .AddConstructor<EpcX2HandoverRequestHeader> ()
180  ;
181  return tid;
182 }
183 
184 TypeId
186 {
187  return GetTypeId ();
188 }
189 
190 uint32_t
192 {
193  return m_headerLength;
194 }
195 
196 void
198 {
200 
201  i.WriteHtonU16 (10); // id = OLD_ENB_UE_X2AP_ID
202  i.WriteU8 (0); // criticality = REJECT
203  i.WriteU8 (2); // length of OLD_ENB_UE_X2AP_ID
205 
206  i.WriteHtonU16 (5); // id = CAUSE
207  i.WriteU8 (1 << 6); // criticality = IGNORE
208  i.WriteU8 (1); // length of CAUSE
209  i.WriteU8 (m_cause);
210 
211  i.WriteHtonU16 (11); // id = TARGET_CELLID
212  i.WriteU8 (0); // criticality = REJECT
213  i.WriteU8 (8); // length of TARGET_CELLID
214  i.WriteHtonU32 (0x123456); // fake PLMN
215  i.WriteHtonU32 (m_targetCellId << 4);
216 
217  i.WriteHtonU16 (14); // id = UE_CONTEXT_INFORMATION
218  i.WriteU8 (0); // criticality = REJECT
219 
223 
224  std::vector <EpcX2Sap::ErabToBeSetupItem>::size_type sz = m_erabsToBeSetupList.size ();
225  i.WriteHtonU32 (sz); // number of bearers
226  for (int j = 0; j < (int) sz; j++)
227  {
228  i.WriteHtonU16 (m_erabsToBeSetupList [j].erabId);
229  i.WriteHtonU16 (m_erabsToBeSetupList [j].erabLevelQosParameters.qci);
230  i.WriteHtonU64 (m_erabsToBeSetupList [j].erabLevelQosParameters.gbrQosInfo.gbrDl);
231  i.WriteHtonU64 (m_erabsToBeSetupList [j].erabLevelQosParameters.gbrQosInfo.gbrUl);
232  i.WriteHtonU64 (m_erabsToBeSetupList [j].erabLevelQosParameters.gbrQosInfo.mbrDl);
233  i.WriteHtonU64 (m_erabsToBeSetupList [j].erabLevelQosParameters.gbrQosInfo.mbrUl);
234  i.WriteU8 (m_erabsToBeSetupList [j].erabLevelQosParameters.arp.priorityLevel);
235  i.WriteU8 (m_erabsToBeSetupList [j].erabLevelQosParameters.arp.preemptionCapability);
236  i.WriteU8 (m_erabsToBeSetupList [j].erabLevelQosParameters.arp.preemptionVulnerability);
237  i.WriteU8 (m_erabsToBeSetupList [j].dlForwarding);
238  i.WriteHtonU32 (m_erabsToBeSetupList [j].transportLayerAddress.Get ());
239  i.WriteHtonU32 (m_erabsToBeSetupList [j].gtpTeid);
240  }
241 
242 }
243 
244 uint32_t
246 {
248 
249  m_headerLength = 0;
250  m_numberOfIes = 0;
251 
252  i.ReadNtohU16 ();
253  i.ReadU8 ();
254  i.ReadU8 ();
256  m_headerLength += 6;
257  m_numberOfIes++;
258 
259  i.ReadNtohU16 ();
260  i.ReadU8 ();
261  i.ReadU8 ();
262  m_cause = i.ReadU8 ();
263  m_headerLength += 5;
264  m_numberOfIes++;
265 
266  i.ReadNtohU16 ();
267  i.ReadU8 ();
268  i.ReadU8 ();
269  i.ReadNtohU32 ();
270  m_targetCellId = i.ReadNtohU32 () >> 4;
271  m_headerLength += 12;
272  m_numberOfIes++;
273 
274  i.ReadNtohU16 ();
275  i.ReadU8 ();
276  m_mmeUeS1apId = i.ReadNtohU32 ();
279  int sz = i.ReadNtohU32 ();
280  m_headerLength += 27;
281  m_numberOfIes++;
282 
283  for (int j = 0; j < sz; j++)
284  {
286 
287  erabItem.erabId = i.ReadNtohU16 ();
288 
297 
298  erabItem.dlForwarding = i.ReadU8 ();
300  erabItem.gtpTeid = i.ReadNtohU32 ();
301 
302  m_erabsToBeSetupList.push_back (erabItem);
303  m_headerLength += 48;
304  }
305 
306  return GetSerializedSize ();
307 }
308 
309 void
310 EpcX2HandoverRequestHeader::Print (std::ostream &os) const
311 {
312  os << "OldEnbUeX2apId = " << m_oldEnbUeX2apId;
313  os << " Cause = " << m_cause;
314  os << " TargetCellId = " << m_targetCellId;
315  os << " MmeUeS1apId = " << m_mmeUeS1apId;
316  os << " UeAggrMaxBitRateDownlink = " << m_ueAggregateMaxBitRateDownlink;
317  os << " UeAggrMaxBitRateUplink = " << m_ueAggregateMaxBitRateUplink;
318  os << " NumOfBearers = " << m_erabsToBeSetupList.size ();
319 
320  std::vector <EpcX2Sap::ErabToBeSetupItem>::size_type sz = m_erabsToBeSetupList.size ();
321  if (sz > 0)
322  {
323  os << " [";
324  }
325  for (int j = 0; j < (int) sz; j++)
326  {
327  os << m_erabsToBeSetupList[j].erabId;
328  if (j < (int) sz - 1)
329  {
330  os << ", ";
331  }
332  else
333  {
334  os << "]";
335  }
336  }
337 }
338 
339 uint16_t
341 {
342  return m_oldEnbUeX2apId;
343 }
344 
345 void
347 {
348  m_oldEnbUeX2apId = x2apId;
349 }
350 
351 uint16_t
353 {
354  return m_cause;
355 }
356 
357 void
359 {
360  m_cause = cause;
361 }
362 
363 uint16_t
365 {
366  return m_targetCellId;
367 }
368 
369 void
371 {
372  m_targetCellId = targetCellId;
373 }
374 
375 uint32_t
377 {
378  return m_mmeUeS1apId;
379 }
380 
381 void
383 {
384  m_mmeUeS1apId = mmeUeS1apId;
385 }
386 
387 std::vector <EpcX2Sap::ErabToBeSetupItem>
389 {
390  return m_erabsToBeSetupList;
391 }
392 
393 void
394 EpcX2HandoverRequestHeader::SetBearers (std::vector <EpcX2Sap::ErabToBeSetupItem> bearers)
395 {
396  m_headerLength += 48 * bearers.size ();
397  m_erabsToBeSetupList = bearers;
398 }
399 
400 uint64_t
402 {
404 }
405 
406 void
408 {
410 }
411 
412 uint64_t
414 {
416 }
417 
418 void
420 {
422 }
423 
424 uint32_t
426 {
427  return m_headerLength;
428 }
429 
430 uint32_t
432 {
433  return m_numberOfIes;
434 }
435 
437 
439  ;
440 
442  : m_numberOfIes (1 + 1 + 1 + 1),
443  m_headerLength (2 + 2 + 4 + 4),
444  m_oldEnbUeX2apId (0xfffa),
445  m_newEnbUeX2apId (0xfffa)
446 {
447 }
448 
450 {
451  m_numberOfIes = 0;
452  m_headerLength = 0;
453  m_oldEnbUeX2apId = 0xfffb;
454  m_newEnbUeX2apId = 0xfffb;
455  m_erabsAdmittedList.clear ();
456  m_erabsNotAdmittedList.clear ();
457 }
458 
459 TypeId
461 {
462  static TypeId tid = TypeId ("ns3::EpcX2HandoverRequestAckHeader")
463  .SetParent<Header> ()
464  .AddConstructor<EpcX2HandoverRequestAckHeader> ()
465  ;
466  return tid;
467 }
468 
469 TypeId
471 {
472  return GetTypeId ();
473 }
474 
475 uint32_t
477 {
478  return m_headerLength;
479 }
480 
481 void
483 {
485 
488 
489  std::vector <EpcX2Sap::ErabAdmittedItem>::size_type sz = m_erabsAdmittedList.size ();
490  i.WriteHtonU32 (sz);
491  for (int j = 0; j < (int) sz; j++)
492  {
493  i.WriteHtonU16 (m_erabsAdmittedList [j].erabId);
494  i.WriteHtonU32 (m_erabsAdmittedList [j].ulGtpTeid);
495  i.WriteHtonU32 (m_erabsAdmittedList [j].dlGtpTeid);
496  }
497 
498  std::vector <EpcX2Sap::ErabNotAdmittedItem>::size_type sz2 = m_erabsNotAdmittedList.size ();
499  i.WriteHtonU32 (sz2);
500  for (int j = 0; j < (int) sz2; j++)
501  {
502  i.WriteHtonU16 (m_erabsNotAdmittedList [j].erabId);
503  i.WriteHtonU16 (m_erabsNotAdmittedList [j].cause);
504  }
505 }
506 
507 uint32_t
509 {
511 
512  m_headerLength = 0;
513  m_numberOfIes = 0;
514 
517  m_headerLength += 4;
518  m_numberOfIes += 2;
519 
520  int sz = i.ReadNtohU32 ();
521  m_headerLength += 4;
522  m_numberOfIes++;
523 
524  for (int j = 0; j < sz; j++)
525  {
527 
528  erabItem.erabId = i.ReadNtohU16 ();
529  erabItem.ulGtpTeid = i.ReadNtohU32 ();
530  erabItem.dlGtpTeid = i.ReadNtohU32 ();
531 
532  m_erabsAdmittedList.push_back (erabItem);
533  m_headerLength += 10;
534  }
535 
536  sz = i.ReadNtohU32 ();
537  m_headerLength += 4;
538  m_numberOfIes++;
539 
540  for (int j = 0; j < sz; j++)
541  {
543 
544  erabItem.erabId = i.ReadNtohU16 ();
545  erabItem.cause = i.ReadNtohU16 ();
546 
547  m_erabsNotAdmittedList.push_back (erabItem);
548  m_headerLength += 4;
549  }
550 
551  return GetSerializedSize ();
552 }
553 
554 void
555 EpcX2HandoverRequestAckHeader::Print (std::ostream &os) const
556 {
557  os << "OldEnbUeX2apId=" << m_oldEnbUeX2apId;
558  os << " NewEnbUeX2apId=" << m_newEnbUeX2apId;
559 
560  os << " AdmittedBearers=" << m_erabsAdmittedList.size ();
561  std::vector <EpcX2Sap::ErabAdmittedItem>::size_type sz = m_erabsAdmittedList.size ();
562  if (sz > 0)
563  {
564  os << " [";
565  }
566  for (int j = 0; j < (int) sz; j++)
567  {
568  os << m_erabsAdmittedList[j].erabId;
569  if (j < (int) sz - 1)
570  {
571  os << ", ";
572  }
573  else
574  {
575  os << "]";
576  }
577  }
578 
579  os << " NotAdmittedBearers=" << m_erabsNotAdmittedList.size ();
580  std::vector <EpcX2Sap::ErabNotAdmittedItem>::size_type sz2 = m_erabsNotAdmittedList.size ();
581  if (sz2 > 0)
582  {
583  os << " [";
584  }
585  for (int j = 0; j < (int) sz2; j++)
586  {
587  os << m_erabsNotAdmittedList[j].erabId;
588  if (j < (int) sz2 - 1)
589  {
590  os << ", ";
591  }
592  else
593  {
594  os << "]";
595  }
596  }
597 
598 }
599 
600 uint16_t
602 {
603  return m_oldEnbUeX2apId;
604 }
605 
606 void
608 {
609  m_oldEnbUeX2apId = x2apId;
610 }
611 
612 uint16_t
614 {
615  return m_newEnbUeX2apId;
616 }
617 
618 void
620 {
621  m_newEnbUeX2apId = x2apId;
622 }
623 
624 std::vector <EpcX2Sap::ErabAdmittedItem>
626 {
627  return m_erabsAdmittedList;
628 }
629 
630 void
631 EpcX2HandoverRequestAckHeader::SetAdmittedBearers (std::vector <EpcX2Sap::ErabAdmittedItem> bearers)
632 {
633  m_headerLength += 10 * bearers.size ();
634  m_erabsAdmittedList = bearers;
635 }
636 
637 std::vector <EpcX2Sap::ErabNotAdmittedItem>
639 {
640  return m_erabsNotAdmittedList;
641 }
642 
643 void
644 EpcX2HandoverRequestAckHeader::SetNotAdmittedBearers (std::vector <EpcX2Sap::ErabNotAdmittedItem> bearers)
645 {
646  m_headerLength += 4 * bearers.size ();
647  m_erabsNotAdmittedList = bearers;
648 }
649 
650 uint32_t
652 {
653  return m_headerLength;
654 }
655 
656 uint32_t
658 {
659  return m_numberOfIes;
660 }
661 
663 
665  ;
666 
668  : m_numberOfIes (1 + 1 + 1),
669  m_headerLength (2 + 2 + 2),
670  m_oldEnbUeX2apId (0xfffa),
671  m_cause (0xfffa),
672  m_criticalityDiagnostics (0xfffa)
673 {
674 }
675 
677 {
678  m_numberOfIes = 0;
679  m_headerLength = 0;
680  m_oldEnbUeX2apId = 0xfffb;
681  m_cause = 0xfffb;
682  m_criticalityDiagnostics = 0xfffb;
683 }
684 
685 TypeId
687 {
688  static TypeId tid = TypeId ("ns3::EpcX2HandoverPreparationFailureHeader")
689  .SetParent<Header> ()
690  .AddConstructor<EpcX2HandoverPreparationFailureHeader> ()
691  ;
692  return tid;
693 }
694 
695 TypeId
697 {
698  return GetTypeId ();
699 }
700 
701 uint32_t
703 {
704  return m_headerLength;
705 }
706 
707 void
709 {
711 
713  i.WriteHtonU16 (m_cause);
715 }
716 
717 uint32_t
719 {
721 
723  m_cause = i.ReadNtohU16 ();
725 
726  m_headerLength = 6;
727  m_numberOfIes = 3;
728 
729  return GetSerializedSize ();
730 }
731 
732 void
734 {
735  os << "OldEnbUeX2apId = " << m_oldEnbUeX2apId;
736  os << " Cause = " << m_cause;
737  os << " CriticalityDiagnostics = " << m_criticalityDiagnostics;
738 }
739 
740 uint16_t
742 {
743  return m_oldEnbUeX2apId;
744 }
745 
746 void
748 {
749  m_oldEnbUeX2apId = x2apId;
750 }
751 
752 uint16_t
754 {
755  return m_cause;
756 }
757 
758 void
760 {
761  m_cause = cause;
762 }
763 
764 uint16_t
766 {
768 }
769 
770 void
772 {
773  m_criticalityDiagnostics = criticalityDiagnostics;
774 }
775 
776 uint32_t
778 {
779  return m_headerLength;
780 }
781 
782 uint32_t
784 {
785  return m_numberOfIes;
786 }
787 
789 
791  ;
792 
794  : m_numberOfIes (3),
795  m_headerLength (6),
796  m_oldEnbUeX2apId (0xfffa),
797  m_newEnbUeX2apId (0xfffa)
798 {
800 }
801 
803 {
804  m_numberOfIes = 0;
805  m_headerLength = 0;
806  m_oldEnbUeX2apId = 0xfffb;
807  m_newEnbUeX2apId = 0xfffb;
809 }
810 
811 TypeId
813 {
814  static TypeId tid = TypeId ("ns3::EpcX2SnStatusTransferHeader")
815  .SetParent<Header> ()
816  .AddConstructor<EpcX2SnStatusTransferHeader> ()
817  ;
818  return tid;
819 }
820 
821 TypeId
823 {
824  return GetTypeId ();
825 }
826 
827 uint32_t
829 {
830  return m_headerLength;
831 }
832 
833 void
835 {
837 
840 
841  std::vector <EpcX2Sap::ErabsSubjectToStatusTransferItem>::size_type sz = m_erabsSubjectToStatusTransferList.size ();
842  i.WriteHtonU16 (sz); // number of ErabsSubjectToStatusTransferItems
843 
844  for (int j = 0; j < (int) sz; j++)
845  {
847 
848  i.WriteHtonU16 (item.erabId);
849 
850  uint16_t bitsetSize = EpcX2Sap::m_maxPdcpSn / 64;
851  for (int k = 0; k < bitsetSize; k++)
852  {
853  uint64_t statusValue = 0;
854  for (int m = 0; m < 64; m++)
855  {
856  statusValue |= item.receiveStatusOfUlPdcpSdus[64 * k + m] << m;
857  }
858  i.WriteHtonU64 (statusValue);
859  }
860 
861  i.WriteHtonU16 (item.ulPdcpSn);
862  i.WriteHtonU32 (item.ulHfn);
863  i.WriteHtonU16 (item.dlPdcpSn);
864  i.WriteHtonU32 (item.dlHfn);
865  }
866 }
867 
868 uint32_t
870 {
872 
875  int sz = i.ReadNtohU16 ();
876 
877  m_numberOfIes = 3;
878  m_headerLength = 6 + sz * (14 + (EpcX2Sap::m_maxPdcpSn / 64));
879 
880  for (int j = 0; j < sz; j++)
881  {
883  ErabItem.erabId = i.ReadNtohU16 ();
884 
885  uint16_t bitsetSize = EpcX2Sap::m_maxPdcpSn / 64;
886  for (int k = 0; k < bitsetSize; k++)
887  {
888  uint64_t statusValue = i.ReadNtohU64 ();
889  for (int m = 0; m < 64; m++)
890  {
891  ErabItem.receiveStatusOfUlPdcpSdus[64 * k + m] = (statusValue >> m) & 1;
892  }
893  }
894 
895  ErabItem.ulPdcpSn = i.ReadNtohU16 ();
896  ErabItem.ulHfn = i.ReadNtohU32 ();
897  ErabItem.dlPdcpSn = i.ReadNtohU16 ();
898  ErabItem.dlHfn = i.ReadNtohU32 ();
899 
900  m_erabsSubjectToStatusTransferList.push_back (ErabItem);
901  }
902 
903  return GetSerializedSize ();
904 }
905 
906 void
907 EpcX2SnStatusTransferHeader::Print (std::ostream &os) const
908 {
909  os << "OldEnbUeX2apId = " << m_oldEnbUeX2apId;
910  os << " NewEnbUeX2apId = " << m_newEnbUeX2apId;
911  os << " ErabsSubjectToStatusTransferList size = " << m_erabsSubjectToStatusTransferList.size ();
912 
913  std::vector <EpcX2Sap::ErabsSubjectToStatusTransferItem>::size_type sz = m_erabsSubjectToStatusTransferList.size ();
914  if (sz > 0)
915  {
916  os << " [";
917  }
918  for (int j = 0; j < (int) sz; j++)
919  {
920  os << m_erabsSubjectToStatusTransferList[j].erabId;
921  if (j < (int) sz - 1)
922  {
923  os << ", ";
924  }
925  else
926  {
927  os << "]";
928  }
929  }
930 }
931 
932 uint16_t
934 {
935  return m_oldEnbUeX2apId;
936 }
937 
938 void
940 {
941  m_oldEnbUeX2apId = x2apId;
942 }
943 
944 uint16_t
946 {
947  return m_newEnbUeX2apId;
948 }
949 
950 void
952 {
953  m_newEnbUeX2apId = x2apId;
954 }
955 
956 std::vector <EpcX2Sap::ErabsSubjectToStatusTransferItem>
958 {
960 }
961 
962 void
963 EpcX2SnStatusTransferHeader::SetErabsSubjectToStatusTransferList (std::vector <EpcX2Sap::ErabsSubjectToStatusTransferItem> erabs)
964 {
965  m_headerLength += erabs.size () * (14 + (EpcX2Sap::m_maxPdcpSn / 8));
967 }
968 
969 uint32_t
971 {
972  return m_headerLength;
973 }
974 
975 uint32_t
977 {
978  return m_numberOfIes;
979 }
980 
982 
984  ;
985 
987  : m_numberOfIes (1 + 1),
988  m_headerLength (2 + 2),
989  m_oldEnbUeX2apId (0xfffa),
990  m_newEnbUeX2apId (0xfffa)
991 {
992 }
993 
995 {
996  m_numberOfIes = 0;
997  m_headerLength = 0;
998  m_oldEnbUeX2apId = 0xfffb;
999  m_newEnbUeX2apId = 0xfffb;
1000 }
1001 
1002 TypeId
1004 {
1005  static TypeId tid = TypeId ("ns3::EpcX2UeContextReleaseHeader")
1006  .SetParent<Header> ()
1007  .AddConstructor<EpcX2UeContextReleaseHeader> ()
1008  ;
1009  return tid;
1010 }
1011 
1012 TypeId
1014 {
1015  return GetTypeId ();
1016 }
1017 
1018 uint32_t
1020 {
1021  return m_headerLength;
1022 }
1023 
1024 void
1026 {
1027  Buffer::Iterator i = start;
1028 
1031 }
1032 
1033 uint32_t
1035 {
1036  Buffer::Iterator i = start;
1037 
1040  m_numberOfIes = 2;
1041  m_headerLength = 4;
1042 
1043  return GetSerializedSize ();
1044 }
1045 
1046 void
1047 EpcX2UeContextReleaseHeader::Print (std::ostream &os) const
1048 {
1049  os << "OldEnbUeX2apId=" << m_oldEnbUeX2apId;
1050  os << " NewEnbUeX2apId=" << m_newEnbUeX2apId;
1051 }
1052 
1053 uint16_t
1055 {
1056  return m_oldEnbUeX2apId;
1057 }
1058 
1059 void
1061 {
1062  m_oldEnbUeX2apId = x2apId;
1063 }
1064 
1065 uint16_t
1067 {
1068  return m_newEnbUeX2apId;
1069 }
1070 
1071 void
1073 {
1074  m_newEnbUeX2apId = x2apId;
1075 }
1076 
1077 uint32_t
1079 {
1080  return m_headerLength;
1081 }
1082 
1083 uint32_t
1085 {
1086  return m_numberOfIes;
1087 }
1088 
1090 
1092  ;
1093 
1095  : m_numberOfIes (1),
1096  m_headerLength (6)
1097 {
1098  m_cellInformationList.clear ();
1099 }
1100 
1102 {
1103  m_numberOfIes = 0;
1104  m_headerLength = 0;
1105  m_cellInformationList.clear ();
1106 }
1107 
1108 TypeId
1110 {
1111  static TypeId tid = TypeId ("ns3::EpcX2LoadInformationHeader")
1112  .SetParent<Header> ()
1113  .AddConstructor<EpcX2LoadInformationHeader> ()
1114  ;
1115  return tid;
1116 }
1117 
1118 TypeId
1120 {
1121  return GetTypeId ();
1122 }
1123 
1124 uint32_t
1126 {
1127  return m_headerLength;
1128 }
1129 
1130 void
1132 {
1133  Buffer::Iterator i = start;
1134 
1135  i.WriteHtonU16 (6); // id = CELL_INFORMATION
1136  i.WriteU8 (1 << 6); // criticality = IGNORE
1137  i.WriteU8 (4); // length of CELL_INFORMATION_ID
1138 
1139  std::vector <EpcX2Sap::CellInformationItem>::size_type sz = m_cellInformationList.size ();
1140  i.WriteHtonU16 (sz); // number of cellInformationItems
1141 
1142  for (int j = 0; j < (int) sz; j++)
1143  {
1144  i.WriteHtonU16 (m_cellInformationList [j].sourceCellId);
1145 
1146  std::vector <EpcX2Sap::UlInterferenceOverloadIndicationItem>::size_type sz2;
1147  sz2 = m_cellInformationList [j].ulInterferenceOverloadIndicationList.size ();
1148  i.WriteHtonU16 (sz2); // number of UlInterferenceOverloadIndicationItem
1149 
1150  for (int k = 0; k < (int) sz2; k++)
1151  {
1152  i.WriteU8 (m_cellInformationList [j].ulInterferenceOverloadIndicationList [k]);
1153  }
1154 
1155  std::vector <EpcX2Sap::UlHighInterferenceInformationItem>::size_type sz3;
1156  sz3 = m_cellInformationList [j].ulHighInterferenceInformationList.size ();
1157  i.WriteHtonU16 (sz3); // number of UlHighInterferenceInformationItem
1158 
1159  for (int k = 0; k < (int) sz3; k++)
1160  {
1161  i.WriteHtonU16 (m_cellInformationList [j].ulHighInterferenceInformationList [k].targetCellId);
1162 
1163  std::vector <bool>::size_type sz4;
1164  sz4 = m_cellInformationList [j].ulHighInterferenceInformationList [k].ulHighInterferenceIndicationList.size ();
1165  i.WriteHtonU16 (sz4);
1166 
1167  for (int m = 0; m < (int) sz4; m++)
1168  {
1169  i.WriteU8 (m_cellInformationList [j].ulHighInterferenceInformationList [k].ulHighInterferenceIndicationList [m]);
1170  }
1171  }
1172 
1173  std::vector <bool>::size_type sz5;
1174  sz5 = m_cellInformationList [j].relativeNarrowbandTxBand.rntpPerPrbList.size ();
1175  i.WriteHtonU16 (sz5);
1176 
1177  for (int k = 0; k < (int) sz5; k++)
1178  {
1179  i.WriteU8 (m_cellInformationList [j].relativeNarrowbandTxBand.rntpPerPrbList [k]);
1180  }
1181 
1182  i.WriteHtonU16 (m_cellInformationList [j].relativeNarrowbandTxBand.rntpThreshold);
1183  i.WriteHtonU16 (m_cellInformationList [j].relativeNarrowbandTxBand.antennaPorts);
1184  i.WriteHtonU16 (m_cellInformationList [j].relativeNarrowbandTxBand.pB);
1185  i.WriteHtonU16 (m_cellInformationList [j].relativeNarrowbandTxBand.pdcchInterferenceImpact);
1186  }
1187 }
1188 
1189 uint32_t
1191 {
1192  Buffer::Iterator i = start;
1193 
1194  m_headerLength = 0;
1195  m_numberOfIes = 0;
1196 
1197  i.ReadNtohU16 ();
1198  i.ReadU8 ();
1199  i.ReadU8 ();
1200  int sz = i.ReadNtohU16 ();
1201  m_headerLength += 6;
1202  m_numberOfIes++;
1203 
1204  for (int j = 0; j < sz; j++)
1205  {
1206  EpcX2Sap::CellInformationItem cellInfoItem;
1207  cellInfoItem.sourceCellId = i.ReadNtohU16 ();
1208  m_headerLength += 2;
1209 
1210  int sz2 = i.ReadNtohU16 ();
1211  m_headerLength += 2;
1212  for (int k = 0; k < sz2; k++)
1213  {
1215  cellInfoItem.ulInterferenceOverloadIndicationList.push_back (item);
1216  }
1217  m_headerLength += sz2;
1218 
1219  int sz3 = i.ReadNtohU16 ();
1220  m_headerLength += 2;
1221  for (int k = 0; k < sz3; k++)
1222  {
1224  item.targetCellId = i.ReadNtohU16 ();
1225  m_headerLength += 2;
1226 
1227  int sz4 = i.ReadNtohU16 ();
1228  m_headerLength += 2;
1229  for (int m = 0; m < sz4; m++)
1230  {
1231  item.ulHighInterferenceIndicationList.push_back (i.ReadU8 ());
1232  }
1233  m_headerLength += sz4;
1234 
1235  cellInfoItem.ulHighInterferenceInformationList.push_back (item);
1236  }
1237 
1238  int sz5 = i.ReadNtohU16 ();
1239  m_headerLength += 2;
1240  for (int k = 0; k < sz5; k++)
1241  {
1242  cellInfoItem.relativeNarrowbandTxBand.rntpPerPrbList.push_back (i.ReadU8 ());
1243  }
1244  m_headerLength += sz5;
1245 
1248  cellInfoItem.relativeNarrowbandTxBand.pB = i.ReadNtohU16 ();
1250  m_headerLength += 8;
1251 
1252  m_cellInformationList.push_back (cellInfoItem);
1253  }
1254 
1255  return GetSerializedSize ();
1256 }
1257 
1258 void
1259 EpcX2LoadInformationHeader::Print (std::ostream &os) const
1260 {
1261  os << "NumOfCellInformationItems=" << m_cellInformationList.size ();
1262 }
1263 
1264 std::vector <EpcX2Sap::CellInformationItem>
1266 {
1267  return m_cellInformationList;
1268 }
1269 
1270 void
1271 EpcX2LoadInformationHeader::SetCellInformationList (std::vector <EpcX2Sap::CellInformationItem> cellInformationList)
1272 {
1273  m_cellInformationList = cellInformationList;
1274  m_headerLength += 2;
1275 
1276  std::vector <EpcX2Sap::CellInformationItem>::size_type sz = m_cellInformationList.size ();
1277  for (int j = 0; j < (int) sz; j++)
1278  {
1279  m_headerLength += 2;
1280 
1281  std::vector <EpcX2Sap::UlInterferenceOverloadIndicationItem>::size_type sz2;
1282  sz2 = m_cellInformationList [j].ulInterferenceOverloadIndicationList.size ();
1283  m_headerLength += 2 + sz2;
1284 
1285  std::vector <EpcX2Sap::UlHighInterferenceInformationItem>::size_type sz3;
1286  sz3 = m_cellInformationList [j].ulHighInterferenceInformationList.size ();
1287  m_headerLength += 2;
1288 
1289  for (int k = 0; k < (int) sz3; k++)
1290  {
1291  std::vector <bool>::size_type sz4;
1292  sz4 = m_cellInformationList [j].ulHighInterferenceInformationList [k].ulHighInterferenceIndicationList.size ();
1293  m_headerLength += 2 + 2 + sz4;
1294  }
1295 
1296  std::vector <bool>::size_type sz5;
1297  sz5 = m_cellInformationList [j].relativeNarrowbandTxBand.rntpPerPrbList.size ();
1298  m_headerLength += 2 + sz5 + 8;
1299  }
1300 }
1301 
1302 uint32_t
1304 {
1305  return m_headerLength;
1306 }
1307 
1308 uint32_t
1310 {
1311  return m_numberOfIes;
1312 }
1313 
1315 
1317  ;
1318 
1320  : m_numberOfIes (3),
1321  m_headerLength (6),
1322  m_enb1MeasurementId (0xfffa),
1323  m_enb2MeasurementId (0xfffa)
1324 {
1325  m_cellMeasurementResultList.clear ();
1326 }
1327 
1329 {
1330  m_numberOfIes = 0;
1331  m_headerLength = 0;
1332  m_enb1MeasurementId = 0xfffb;
1333  m_enb2MeasurementId = 0xfffb;
1334  m_cellMeasurementResultList.clear ();
1335 }
1336 
1337 TypeId
1339 {
1340  static TypeId tid = TypeId ("ns3::EpcX2ResourceStatusUpdateHeader")
1341  .SetParent<Header> ()
1342  .AddConstructor<EpcX2ResourceStatusUpdateHeader> ()
1343  ;
1344  return tid;
1345 }
1346 
1347 TypeId
1349 {
1350  return GetTypeId ();
1351 }
1352 
1353 uint32_t
1355 {
1356  return m_headerLength;
1357 }
1358 
1359 void
1361 {
1362  Buffer::Iterator i = start;
1363 
1366 
1367  std::vector <EpcX2Sap::CellMeasurementResultItem>::size_type sz = m_cellMeasurementResultList.size ();
1368  i.WriteHtonU16 (sz); // number of CellMeasurementResultItem
1369 
1370  for (int j = 0; j < (int) sz; j++)
1371  {
1373 
1374  i.WriteHtonU16 (item.sourceCellId);
1377  i.WriteU8 (item.dlS1TnlLoadIndicator);
1378  i.WriteU8 (item.ulS1TnlLoadIndicator);
1379 
1380  i.WriteHtonU16 (item.dlGbrPrbUsage);
1381  i.WriteHtonU16 (item.ulGbrPrbUsage);
1382  i.WriteHtonU16 (item.dlNonGbrPrbUsage);
1383  i.WriteHtonU16 (item.ulNonGbrPrbUsage);
1384  i.WriteHtonU16 (item.dlTotalPrbUsage);
1385  i.WriteHtonU16 (item.ulTotalPrbUsage);
1386 
1391  }
1392 }
1393 
1394 uint32_t
1396 {
1397  Buffer::Iterator i = start;
1398 
1401 
1402  int sz = i.ReadNtohU16 ();
1403  for (int j = 0; j < sz; j++)
1404  {
1406 
1407  item.sourceCellId = i.ReadNtohU16 ();
1412 
1413  item.dlGbrPrbUsage = i.ReadNtohU16 ();
1414  item.ulGbrPrbUsage = i.ReadNtohU16 ();
1415  item.dlNonGbrPrbUsage = i.ReadNtohU16 ();
1416  item.ulNonGbrPrbUsage = i.ReadNtohU16 ();
1417  item.dlTotalPrbUsage = i.ReadNtohU16 ();
1418  item.ulTotalPrbUsage = i.ReadNtohU16 ();
1419 
1424 
1425  m_cellMeasurementResultList.push_back (item);
1426  }
1427 
1428  m_headerLength = 6 + sz * 26;
1429  m_numberOfIes = 3;
1430 
1431  return GetSerializedSize ();
1432 }
1433 
1434 void
1436 {
1437  os << "Enb1MeasurementId = " << m_enb1MeasurementId
1438  << " Enb2MeasurementId = " << m_enb2MeasurementId
1439  << " NumOfCellMeasurementResultItems = " << m_cellMeasurementResultList.size ();
1440 }
1441 
1442 uint16_t
1444 {
1445  return m_enb1MeasurementId;
1446 }
1447 
1448 void
1450 {
1451  m_enb1MeasurementId = enb1MeasurementId;
1452 }
1453 
1454 uint16_t
1456 {
1457  return m_enb2MeasurementId;
1458 }
1459 
1460 void
1462 {
1463  m_enb2MeasurementId = enb2MeasurementId;
1464 }
1465 
1466 std::vector <EpcX2Sap::CellMeasurementResultItem>
1468 {
1470 }
1471 
1472 void
1473 EpcX2ResourceStatusUpdateHeader::SetCellMeasurementResultList (std::vector <EpcX2Sap::CellMeasurementResultItem> cellMeasurementResultList)
1474 {
1475  m_cellMeasurementResultList = cellMeasurementResultList;
1476 
1477  std::vector <EpcX2Sap::CellMeasurementResultItem>::size_type sz = m_cellMeasurementResultList.size ();
1478  m_headerLength += sz * 26;
1479 }
1480 
1481 uint32_t
1483 {
1484  return m_headerLength;
1485 }
1486 
1487 uint32_t
1489 {
1490  return m_numberOfIes;
1491 }
1492 
1493 } // namespace ns3
virtual uint32_t Deserialize(Buffer::Iterator start)
Protocol header serialization and deserialization.
Definition: header.h:42
void SetNumberOfIes(uint32_t numberOfIes)
RelativeNarrowbandTxBand relativeNarrowbandTxBand
Definition: epc-x2-sap.h:159
virtual void Print(std::ostream &os) const
Doxygen introspection did not find any typical Config paths.
void WriteHtonU64(uint64_t data)
Definition: buffer.cc:965
uint8_t GetMessageType() const
E-RABs admitted item as it is used in the HANDOVER REQUEST ACKNOWLEDGE message.
Definition: epc-x2-sap.h:75
virtual void Serialize(Buffer::Iterator start) const
uint16_t GetOldEnbUeX2apId() const
void SetNewEnbUeX2apId(uint16_t x2apId)
virtual uint32_t GetSerializedSize(void) const
void SetOldEnbUeX2apId(uint16_t x2apId)
std::vector< EpcX2Sap::ErabNotAdmittedItem > GetNotAdmittedBearers() const
uint8_t m_procedureCode
Definition: epc-x2-header.h:73
virtual ~EpcX2Header()
virtual TypeId GetInstanceTypeId(void) const
std::vector< EpcX2Sap::CellInformationItem > m_cellInformationList
void SetCause(uint16_t cause)
uint64_t ReadNtohU64(void)
Definition: buffer.cc:1068
std::vector< EpcX2Sap::CellMeasurementResultItem > GetCellMeasurementResultList() const
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
virtual void Serialize(Buffer::Iterator start) const
std::vector< UlInterferenceOverloadIndicationItem > ulInterferenceOverloadIndicationList
Definition: epc-x2-sap.h:157
virtual void Print(std::ostream &os) const
virtual uint32_t Deserialize(Buffer::Iterator start)
virtual void Serialize(Buffer::Iterator start) const
virtual void Serialize(Buffer::Iterator start) const
virtual void Serialize(Buffer::Iterator start) const
std::vector< EpcX2Sap::ErabsSubjectToStatusTransferItem > GetErabsSubjectToStatusTransferList() const
void SetLengthOfIes(uint32_t lengthOfIes)
virtual uint32_t GetSerializedSize(void) const
uint32_t m_numberOfIes
Definition: epc-x2-header.h:76
virtual void Serialize(Buffer::Iterator start) const
uint32_t ReadNtohU32(void)
Definition: buffer.h:791
CompositeAvailCapacity dlCompositeAvailableCapacity
Definition: epc-x2-sap.h:208
Doxygen introspection did not find any typical Config paths.
iterator in a Buffer instance
Definition: buffer.h:98
uint64_t GetUeAggregateMaxBitRateUplink() const
std::vector< EpcX2Sap::ErabToBeSetupItem > GetBearers() const
std::vector< EpcX2Sap::CellMeasurementResultItem > m_cellMeasurementResultList
uint64_t gbrUl
Guaranteed Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:41
virtual void Serialize(Buffer::Iterator start) const
Doxygen introspection did not find any typical Config paths.
Definition: epc-x2-header.h:80
virtual TypeId GetInstanceTypeId(void) const
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:71
virtual uint32_t GetSerializedSize(void) const
void SetTargetCellId(uint16_t targetCellId)
virtual uint32_t GetSerializedSize(void) const
UlInterferenceOverloadIndicationItem
UL Interference OverloadIndication as it is used in the LOAD INFORMATION message. ...
Definition: epc-x2-sap.h:114
virtual void Print(std::ostream &os) const
static TypeId GetTypeId(void)
void SetUeAggregateMaxBitRateUplink(uint64_t bitRate)
static const uint16_t m_maxPdcpSn
E-RABs subject to status transfer item as it is used in the SN STATUS TRANSFER message.
Definition: epc-x2-sap.h:98
void SetOldEnbUeX2apId(uint16_t x2apId)
GbrQosInformation gbrQosInfo
Definition: eps-bearer.h:90
virtual TypeId GetInstanceTypeId(void) const
void WriteHtonU16(uint16_t data)
Definition: buffer.h:726
void SetEnb1MeasurementId(uint16_t enb1MeasurementId)
Doxygen introspection did not find any typical Config paths.
Doxygen introspection did not find any typical Config paths.
uint64_t gbrDl
Guaranteed Bit Rate (bit/s) in downlink.
Definition: eps-bearer.h:40
virtual TypeId GetInstanceTypeId(void) const
void SetUeAggregateMaxBitRateDownlink(uint64_t bitRate)
std::vector< UlHighInterferenceInformationItem > ulHighInterferenceInformationList
Definition: epc-x2-sap.h:158
uint8_t GetProcedureCode() const
virtual TypeId GetInstanceTypeId(void) const
uint32_t m_lengthOfIes
Definition: epc-x2-header.h:75
virtual void Print(std::ostream &os) const
std::bitset< m_maxPdcpSn > receiveStatusOfUlPdcpSdus
Definition: epc-x2-sap.h:102
E-RABs to be setup item as it is used in the HANDOVER REQUEST message.
Definition: epc-x2-sap.h:59
virtual uint32_t Deserialize(Buffer::Iterator start)
void SetNotAdmittedBearers(std::vector< EpcX2Sap::ErabNotAdmittedItem > bearers)
uint64_t mbrUl
Maximum Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:43
E-RABs not admitted item as it is used in the HANDOVER REQUEST ACKNOWLEDGE message.
Definition: epc-x2-sap.h:87
void SetProcedureCode(uint8_t procedureCode)
uint8_t m_messageType
Definition: epc-x2-header.h:72
void SetNewEnbUeX2apId(uint16_t x2apId)
void WriteHtonU32(uint32_t data)
Definition: buffer.h:745
virtual TypeId GetInstanceTypeId(void) const
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
std::vector< EpcX2Sap::CellInformationItem > GetCellInformationList() const
virtual void Print(std::ostream &os) const
virtual void Serialize(Buffer::Iterator start) const
void WriteU8(uint8_t data)
Definition: buffer.h:690
void SetErabsSubjectToStatusTransferList(std::vector< EpcX2Sap::ErabsSubjectToStatusTransferItem > erabs)
virtual TypeId GetInstanceTypeId(void) const
virtual uint32_t GetSerializedSize(void) const
LoadIndicator
Load Indicator as it is used in the RESOURCE STATUS UPDATE message.
Definition: epc-x2-sap.h:167
std::vector< EpcX2Sap::ErabNotAdmittedItem > m_erabsNotAdmittedList
virtual uint32_t Deserialize(Buffer::Iterator start)
Cell Measurement Result Item as it is used in the RESOURCE STATUS UPDATE message. ...
Definition: epc-x2-sap.h:191
Doxygen introspection did not find any typical Config paths.
void SetNewEnbUeX2apId(uint16_t x2apId)
std::vector< EpcX2Sap::ErabAdmittedItem > m_erabsAdmittedList
virtual void Print(std::ostream &os) const
uint8_t ReadU8(void)
Definition: buffer.h:819
virtual TypeId GetInstanceTypeId(void) const
void SetEnb2MeasurementId(uint16_t enb2MeasurementId)
Cell Information Item as it is used in the LOAD INFORMATION message.
Definition: epc-x2-sap.h:154
void SetCellInformationList(std::vector< EpcX2Sap::CellInformationItem > cellInformationList)
void SetAdmittedBearers(std::vector< EpcX2Sap::ErabAdmittedItem > bearers)
NS_LOG_COMPONENT_DEFINE("EpcX2Header")
void SetBearers(std::vector< EpcX2Sap::ErabToBeSetupItem > bearers)
std::vector< EpcX2Sap::ErabAdmittedItem > GetAdmittedBearers() const
uint64_t GetUeAggregateMaxBitRateDownlink() const
void SetOldEnbUeX2apId(uint16_t x2apId)
virtual uint32_t Deserialize(Buffer::Iterator start)
Doxygen introspection did not find any typical Config paths.
uint64_t mbrDl
Maximum Bit Rate (bit/s) in downlink.
Definition: eps-bearer.h:42
void SetOldEnbUeX2apId(uint16_t x2apId)
uint16_t ReadNtohU16(void)
Definition: buffer.h:767
std::vector< EpcX2Sap::ErabToBeSetupItem > m_erabsToBeSetupList
virtual uint32_t GetSerializedSize(void) const
UL High Interference Information as it is used in the LOAD INFORMATION message.
Definition: epc-x2-sap.h:126
a unique identifier for an interface.
Definition: type-id.h:49
void SetCriticalityDiagnostics(uint16_t criticalityDiagnostics)
virtual uint32_t GetSerializedSize(void) const
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
virtual uint32_t Deserialize(Buffer::Iterator start)
Qci
QoS Class Indicator.
Definition: eps-bearer.h:77
std::vector< EpcX2Sap::ErabsSubjectToStatusTransferItem > m_erabsSubjectToStatusTransferList
void SetCellMeasurementResultList(std::vector< EpcX2Sap::CellMeasurementResultItem > cellMeasurementResultList)
AllocationRetentionPriority arp
Definition: eps-bearer.h:91
virtual uint32_t Deserialize(Buffer::Iterator start)
virtual uint32_t GetSerializedSize(void) const
virtual void Print(std::ostream &os) const
void SetMessageType(uint8_t messageType)
virtual uint32_t Deserialize(Buffer::Iterator start)
CompositeAvailCapacity ulCompositeAvailableCapacity
Definition: epc-x2-sap.h:209
virtual void Print(std::ostream &os) const
void SetMmeUeS1apId(uint32_t mmeUeS1apId)