Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2013 Mohammed J.F. Alenazi | 3 * Copyright (c) 2013 Mohammed J.F. Alenazi |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 18 matching lines...) Expand all Loading... | |
29 | 29 |
30 #include "epidemic-packet.h" | 30 #include "epidemic-packet.h" |
31 #include "epidemic-tag.h" | 31 #include "epidemic-tag.h" |
32 #include "ns3/address-utils.h" | 32 #include "ns3/address-utils.h" |
33 #include "ns3/log.h" | 33 #include "ns3/log.h" |
34 #include "ns3/packet.h" | 34 #include "ns3/packet.h" |
35 | 35 |
36 namespace ns3 { | 36 namespace ns3 { |
37 namespace Epidemic { | 37 namespace Epidemic { |
38 | 38 |
39 NS_OBJECT_ENSURE_REGISTERED (EpidemicTag); | 39 NS_OBJECT_ENSURE_REGISTERED (ControlTag); |
40 | 40 |
41 /// Get TypeId | 41 /// Get TypeId |
42 TypeId EpidemicTag::GetTypeId () | 42 TypeId ControlTag::GetTypeId () |
43 { | 43 { |
44 static TypeId tid = TypeId ("ns3::epidemic::EpidemicTag").SetParent<Tag> () | 44 static TypeId tid = TypeId ("ns3::Epidemic::ControlTag").SetParent<Tag> () |
Peter Barnes
2015/02/03 01:25:48
"ns3::Epidemic::…"
mjf.alenazi
2015/04/26 22:56:09
Done.
|
Peter Barnes
2015/04/28 23:42:33
.SetParent<Tag> () is duplicated
mjf.alenazi
2017/05/13 23:57:16
Done.
|
45 .SetParent<Tag> () | 45 .SetParent<Tag> () |
46 .AddConstructor<EpidemicTag> () | 46 .AddConstructor<ControlTag> () |
47 ; | 47 ; |
48 return tid; | 48 return tid; |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 /// Get instanceTypeId | 52 /// Get instanceTypeId |
53 TypeId EpidemicTag::GetInstanceTypeId () const | 53 TypeId ControlTag::GetInstanceTypeId () const |
54 { | 54 { |
55 return GetTypeId (); | 55 return GetTypeId (); |
56 } | 56 } |
57 | 57 |
58 /// Get epidemic tag | 58 /// Get epidemic tag |
59 EpidemicTag::TagType EpidemicTag::GetTagType () const | 59 ControlTag::TagType ControlTag::GetTagType () const |
60 { | 60 { |
61 return m_tag; | 61 return m_tag; |
62 } | 62 } |
63 | 63 |
64 bool | 64 bool |
65 EpidemicTag::IsTagType (const TagType type) const | 65 ControlTag::IsTagType (const TagType type) const |
66 { | 66 { |
67 return m_tag == type; | 67 return m_tag == type; |
68 } | 68 } |
69 | 69 |
70 /// Set epidemic tag | 70 /// Set epidemic tag |
71 void | 71 void |
72 EpidemicTag::SetTagType (const TagType tag) | 72 ControlTag::SetTagType (const TagType tag) |
73 { | 73 { |
74 m_tag = tag; | 74 m_tag = tag; |
75 } | 75 } |
76 | 76 |
77 /// Get size | 77 /// Get size |
78 uint32_t EpidemicTag::GetSerializedSize () const | 78 uint32_t ControlTag::GetSerializedSize () const |
79 { | 79 { |
80 return sizeof(uint8_t); | 80 return sizeof(uint8_t); |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 /// Serialize | 84 /// Serialize |
85 void EpidemicTag::Serialize (TagBuffer i) const | 85 void ControlTag::Serialize (TagBuffer i) const |
86 { | 86 { |
87 i.WriteU8 ((uint8_t) m_tag); | 87 i.WriteU8 ((uint8_t) m_tag); |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 | 91 |
92 ///Deserialize | 92 ///Deserialize |
93 void EpidemicTag::Deserialize (TagBuffer i) | 93 void ControlTag::Deserialize (TagBuffer i) |
94 { | 94 { |
95 uint8_t type = i.ReadU8 (); | 95 uint8_t type = i.ReadU8 (); |
96 switch (type) | 96 switch (type) |
97 { | 97 { |
98 case CONTROL: | 98 case CONTROL: |
99 case NOT_SET: | 99 case NOT_SET: |
100 { | 100 { |
101 m_tag = (TagType) type; | 101 m_tag = (TagType) type; |
102 break; | 102 break; |
103 } | 103 } |
104 default: | 104 default: |
105 break; | 105 break; |
106 } | 106 } |
107 | 107 |
108 } | 108 } |
109 /// Print | 109 /// Print |
110 void EpidemicTag::Print (std::ostream &os) const | 110 void ControlTag::Print (std::ostream &os) const |
111 { | 111 { |
112 os << "EpidemicTag:" << m_tag; | 112 os << "ControlTag:" << m_tag; |
113 } | 113 } |
114 | 114 |
115 } //end namespace epidemic | 115 } //end namespace epidemic |
116 } //end namespace ns3 | 116 } //end namespace ns3 |
LEFT | RIGHT |