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) 2008,2009 IITP RAS | 3 * Copyright (c) 2008,2009 IITP RAS |
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 IePeerManagement::SerializeInformationField (Buffer::Iterator i) const | 109 IePeerManagement::SerializeInformationField (Buffer::Iterator i) const |
110 { | 110 { |
111 i.WriteU8 (m_subtype); | 111 i.WriteU8 (m_subtype); |
112 i.WriteHtolsbU16 (m_localLinkId); | 112 i.WriteHtolsbU16 (m_localLinkId); |
113 if (m_length > 3) | 113 if (m_length > 3) |
114 { | 114 { |
115 i.WriteHtolsbU16 (m_peerLinkId); | 115 i.WriteHtolsbU16 (m_peerLinkId); |
116 } | 116 } |
117 if (m_length > 5) | 117 if (m_length > 5) |
118 { | 118 { |
119 i.WriteHtolsbU16 ((uint16_t)m_reasonCode); | 119 i.WriteHtolsbU16 (static_cast<uint16_t> (m_reasonCode)); |
120 } | 120 } |
121 } | 121 } |
122 uint8_t | 122 uint8_t |
123 IePeerManagement::DeserializeInformationField (Buffer::Iterator start, uint8_t l
ength) | 123 IePeerManagement::DeserializeInformationField (Buffer::Iterator start, uint8_t l
ength) |
124 { | 124 { |
125 Buffer::Iterator i = start; | 125 Buffer::Iterator i = start; |
126 m_subtype = i.ReadU8 (); | 126 m_subtype = i.ReadU8 (); |
127 m_length = length; | 127 m_length = length; |
128 if (m_subtype == PEER_OPEN) | 128 if (m_subtype == PEER_OPEN) |
129 { | 129 { |
130 NS_ASSERT (length == 3); | 130 NS_ASSERT (length == 3); |
131 } | 131 } |
132 if (m_subtype == PEER_CONFIRM) | 132 if (m_subtype == PEER_CONFIRM) |
133 { | 133 { |
134 NS_ASSERT (length == 5); | 134 NS_ASSERT (length == 5); |
135 } | 135 } |
136 if (m_subtype == PEER_CLOSE) | 136 if (m_subtype == PEER_CLOSE) |
137 { | 137 { |
138 NS_ASSERT (length == 7); | 138 NS_ASSERT (length == 7); |
139 } | 139 } |
140 m_localLinkId = i.ReadLsbtohU16 (); | 140 m_localLinkId = i.ReadLsbtohU16 (); |
141 if (m_length > 3) | 141 if (m_length > 3) |
142 { | 142 { |
143 m_peerLinkId = i.ReadLsbtohU16 (); | 143 m_peerLinkId = i.ReadLsbtohU16 (); |
144 } | 144 } |
145 if (m_length > 5) | 145 if (m_length > 5) |
146 { | 146 { |
147 m_reasonCode = (PmpReasonCode) i.ReadLsbtohU16 (); | 147 m_reasonCode = (PmpReasonCode) i.ReadLsbtohU16 (); |
148 } | 148 } |
149 return (uint8_t)i.GetDistanceFrom (start); | 149 return static_cast<uint8_t> (i.GetDistanceFrom (start)); |
150 } | 150 } |
151 void | 151 void |
152 IePeerManagement::Print (std::ostream& os) const | 152 IePeerManagement::Print (std::ostream& os) const |
153 { | 153 { |
154 os << "PeerMgmt=(Subtype=" << (uint16_t) m_subtype | 154 os << "PeerMgmt=(Subtype=" << (uint16_t) m_subtype |
155 << ", Length=" << (uint16_t) m_length | 155 << ", Length=" << (uint16_t) m_length |
156 << ", LocalLinkId=" << m_localLinkId | 156 << ", LocalLinkId=" << m_localLinkId |
157 << ", PeerLinkId=" << m_peerLinkId | 157 << ", PeerLinkId=" << m_peerLinkId |
158 << ", ReasonCode=" << m_reasonCode | 158 << ", ReasonCode=" << m_reasonCode |
159 << ")"; | 159 << ")"; |
160 } | 160 } |
161 bool | 161 bool |
162 operator== (const IePeerManagement & a, const IePeerManagement & b) | 162 operator== (const IePeerManagement & a, const IePeerManagement & b) |
163 { | 163 { |
164 return ((a.m_length == b.m_length) && (a.m_subtype == b.m_subtype) && (a.m_loc
alLinkId == b.m_localLinkId) | 164 return ((a.m_length == b.m_length) && (a.m_subtype == b.m_subtype) && (a.m_loc
alLinkId == b.m_localLinkId) |
165 && (a.m_peerLinkId == b.m_peerLinkId) && (a.m_reasonCode == b.m_reason
Code)); | 165 && (a.m_peerLinkId == b.m_peerLinkId) && (a.m_reasonCode == b.m_reason
Code)); |
166 } | 166 } |
167 std::ostream & | 167 std::ostream & |
168 operator << (std::ostream &os, const IePeerManagement &a) | 168 operator << (std::ostream &os, const IePeerManagement &a) |
169 { | 169 { |
170 a.Print (os); | 170 a.Print (os); |
171 return os; | 171 return os; |
172 } | 172 } |
173 } // namespace dot11s | 173 } // namespace dot11s |
174 } // namespace ns3 | 174 } // namespace ns3 |
175 | 175 |
LEFT | RIGHT |