A Discrete-Event Network Simulator
API
segmentnum.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 
3 
4 /*
5 * Copyright (c) 2020 DLTLT
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation;
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * Corresponding author: Niki Hrovatin <niki.hrovatin@famnit.upr.si>
21 */
22 
23 
24 #include "ns3/segmentnum.h"
25 
26 namespace ns3 {
27 
28 NS_OBJECT_ENSURE_REGISTERED (SegmentNum);
29 
30 TypeId
32 {
33  static TypeId tid = TypeId ("ns3::SegmentNum")
34  .SetParent<Tag> ()
35  .SetGroupName("Network")
36  .AddConstructor<SegmentNum> ();
37  return tid;
38 }
39 
40 
41 TypeId
43 {
44  return GetTypeId ();
45 }
46 
47 
49 {
50  s_num = 0;
51 }
52 
53 SegmentNum::SegmentNum(uint32_t seg_num)
54 {
55  s_num = seg_num;
56 }
57 
59 
61 {
62  return s_num;
63 }
64 
65 void SegmentNum::SetSegNum(uint32_t seg_num)
66 {
67  s_num = seg_num;
68 }
69 
70 
71 uint32_t
73 {
74  return 4;
75 }
76 void
77 SegmentNum::Serialize (TagBuffer i) const
78 {
79  i.WriteU32 (s_num);
80 }
81 void
83 {
84  s_num = i.ReadU32 ();
85 }
86 void
87 SegmentNum::Print (std::ostream &os) const
88 {
89  os << "Segment num=" << (uint32_t) s_num;
90 }
91 
92 
93 } // namespace ns3
ns3::SegmentNum::GetSegNum
uint32_t GetSegNum()
Definition: segmentnum.cc:60
ns3
Definition: sensornode-helper.cc:26
ns3::SegmentNum::SetSegNum
void SetSegNum(uint32_t seg_num)
Definition: segmentnum.cc:65
ns3::SegmentNum::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: segmentnum.cc:72
ns3::SegmentNum
Class for adding a tag to packets used to track different segments of packets packets are fragmented ...
Definition: segmentnum.h:41
ns3::SegmentNum::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Definition: segmentnum.cc:42
ns3::SegmentNum::Serialize
virtual void Serialize(TagBuffer i) const
Definition: segmentnum.cc:77
ns3::SegmentNum::Deserialize
virtual void Deserialize(TagBuffer i)
Definition: segmentnum.cc:82
ns3::SegmentNum::SegmentNum
SegmentNum()
Definition: segmentnum.cc:48
ns3::SegmentNum::~SegmentNum
~SegmentNum()
Definition: segmentnum.cc:58
ns3::SegmentNum::GetTypeId
static TypeId GetTypeId(void)
Definition: segmentnum.cc:31
ns3::SegmentNum::Print
virtual void Print(std::ostream &os) const
Definition: segmentnum.cc:87
ns3::SegmentNum::s_num
uint32_t s_num
Definition: segmentnum.h:61