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) 2011 Universita' di Firenze, Italy | 3 * Copyright (c) 2013 Universita' di Firenze, Italy |
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it> | 18 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it> |
19 * Michele Muccio <michelemuccio@virgilio.it> | |
19 */ | 20 */ |
20 | 21 |
21 #ifndef SIXLOWPAN_NET_DEVICE_H | 22 #ifndef SIXLOWPAN_NET_DEVICE_H |
22 #define SIXLOWPAN_NET_DEVICE_H | 23 #define SIXLOWPAN_NET_DEVICE_H |
23 | 24 |
24 #include "ns3/net-device.h" | |
25 #include "ns3/packet.h" | |
26 #include "ns3/internet-module.h" | |
Tom Henderson
2013/07/25 16:24:55
we do not use the "module" variants in the src/ di
Tommaso Pecorella
2013/07/28 17:08:48
Fixed. In all the other files as well.
| |
27 #include "ns3/nstime.h" | |
28 #include "sixlowpan-header.h" | |
29 #include <stdint.h> | 25 #include <stdint.h> |
30 #include <string> | 26 #include <string> |
31 #include <map> | 27 #include <map> |
32 | 28 #include "ns3/traced-callback.h" |
29 #include "ns3/event-id.h" | |
30 #include "ns3/nstime.h" | |
31 #include "ns3/net-device.h" | |
32 #include "ns3/packet.h" | |
33 #include "sixlowpan-header.h" | |
34 #include "ns3/random-variable-stream.h" | |
33 | 35 |
34 namespace ns3 { | 36 namespace ns3 { |
35 | 37 |
36 class Node; | 38 class Node; |
37 | 39 |
38 namespace sixlowpan { | 40 /** |
39 | 41 * \defgroup sixlowpan 6LoWPAN |
42 * \brief Performs 6LoWPAN compression of IPv6 packets as specified by RFC 4944 and RFC 6262 | |
43 * | |
44 * This module acts as a shim between IPv6 and a generic NetDevice. | |
45 * | |
46 * The module implements RFCs 4944 and 6262, with the following exceptions: | |
47 * <ul> | |
48 * <li> MESH and LOWPAN_BC0 dispatch types are not supported </li> | |
49 * <li> HC2 encoding is not supported </li> | |
50 * <li> IPHC's SAC and DAC are not supported </li> | |
51 *</ul> | |
52 */ | |
53 | |
54 /** | |
55 * \ingroup sixlowpan | |
56 * | |
57 * \brief Shim performing 6LoWPAN compression, decompression and fragmentation. | |
58 * | |
59 * This class implements the shim between IPv6 and a generic NetDevice, | |
60 * performing packet compression, decompression and fragmentation in a transpare nt way. | |
61 * To this end, the class pretend to be a normal NetDevice, masquerading some fu nctions | |
62 * of the underlying NetDevice. | |
63 */ | |
40 class SixLowPanNetDevice : public NetDevice | 64 class SixLowPanNetDevice : public NetDevice |
41 { | 65 { |
42 public: | 66 public: |
43 // same as IPv4 Drop Reasons, some does not apply | 67 /** |
68 * Enumeration of the dropping reasons in SixLoWPAN. | |
69 */ | |
44 enum DropReason | 70 enum DropReason |
45 { | 71 { |
46 DROP_TTL_EXPIRED = 1, /**< Packet TTL has expired */ | 72 DROP_FRAGMENT_TIMEOUT = 1, /**< Fragment timeout exceeded */ |
Tom Henderson
2013/07/25 16:24:55
is the device the right place for checking TTL exp
Tommaso Pecorella
2013/07/28 17:08:48
No, just the latest two are relevant. Deleted the
| |
47 DROP_NO_ROUTE, /**< No route to host */ | 73 DROP_FRAGMENT_BUFFER_FULL, /**< Fragment buffer size exceeded */ |
48 DROP_BAD_CHECKSUM, /**< Bad checksum */ | 74 DROP_UNKNOWN_EXTENSION /**< Unsupported compression kind */ |
49 DROP_INTERFACE_DOWN, /**< Interface is down so can not send packet */ | |
50 DROP_ROUTE_ERROR, /**< Route error */ | |
51 DROP_FRAGMENT_TIMEOUT, /**< Fragment timeout exceeded */ | |
52 DROP_FRAGMENT_BUFFERFULL /**< Fragment buffer size exceeded */ | |
53 }; | 75 }; |
54 | 76 |
77 /** | |
78 * \brief Get the type ID. | |
79 * \return the object TypeId | |
80 */ | |
55 static TypeId GetTypeId (void); | 81 static TypeId GetTypeId (void); |
82 | |
83 /** | |
84 * Constructor for the SixLowPanNetDevice. | |
85 */ | |
56 SixLowPanNetDevice (); | 86 SixLowPanNetDevice (); |
57 virtual ~SixLowPanNetDevice (); | |
58 | 87 |
59 // inherited from NetDevice base class | 88 // inherited from NetDevice base class |
60 | |
61 virtual void SetIfIndex (const uint32_t index); | 89 virtual void SetIfIndex (const uint32_t index); |
62 virtual uint32_t GetIfIndex (void) const; | 90 virtual uint32_t GetIfIndex (void) const; |
63 virtual Ptr<Channel> GetChannel (void) const; | 91 virtual Ptr<Channel> GetChannel (void) const; |
64 virtual void SetAddress (Address address); | 92 virtual void SetAddress (Address address); |
65 virtual Address GetAddress (void) const; | 93 virtual Address GetAddress (void) const; |
66 virtual bool SetMtu (const uint16_t mtu); | 94 virtual bool SetMtu (const uint16_t mtu); |
95 | |
96 /** | |
97 * \brief Returns the link-layer MTU for this interface. | |
98 * If the link-layer MTU is smaller than IPv6's minimum MTU (RFC 4944), | |
99 * 1280 will be returned. | |
100 * | |
101 * \return the link-level MTU in bytes for this interface. | |
102 */ | |
67 virtual uint16_t GetMtu (void) const; | 103 virtual uint16_t GetMtu (void) const; |
68 virtual bool IsLinkUp (void) const; | 104 virtual bool IsLinkUp (void) const; |
69 virtual void AddLinkChangeCallback (Callback<void> callback); | 105 virtual void AddLinkChangeCallback (Callback<void> callback); |
70 virtual bool IsBroadcast (void) const; | 106 virtual bool IsBroadcast (void) const; |
71 virtual Address GetBroadcast (void) const; | 107 virtual Address GetBroadcast (void) const; |
72 virtual bool IsMulticast (void) const; | 108 virtual bool IsMulticast (void) const; |
73 virtual Address GetMulticast (Ipv4Address multicastGroup) const; | 109 virtual Address GetMulticast (Ipv4Address multicastGroup) const; |
74 virtual bool IsPointToPoint (void) const; | 110 virtual bool IsPointToPoint (void) const; |
75 virtual bool IsBridge (void) const; | 111 virtual bool IsBridge (void) const; |
76 virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolN umber); | 112 virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolN umber); |
77 virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Addres s& dest, uint16_t protocolNumber); | 113 virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Addres s& dest, uint16_t protocolNumber); |
78 virtual Ptr<Node> GetNode (void) const; | 114 virtual Ptr<Node> GetNode (void) const; |
79 virtual void SetNode (Ptr<Node> node); | 115 virtual void SetNode (Ptr<Node> node); |
80 virtual bool NeedsArp (void) const; | 116 virtual bool NeedsArp (void) const; |
81 virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); | 117 virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); |
82 virtual void SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb); | 118 virtual void SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb); |
83 virtual bool SupportsSendFrom () const; | 119 virtual bool SupportsSendFrom () const; |
84 virtual Address GetMulticast (Ipv6Address addr) const; | 120 virtual Address GetMulticast (Ipv6Address addr) const; |
85 | 121 |
86 Ptr<NetDevice> GetPort () const; | 122 /** |
87 void SetPort (Ptr<NetDevice> port); | 123 * \brief Returns a smart pointer to the underlying NetDevice. |
Tom Henderson
2013/07/25 16:24:55
doxygen missing
Tommaso Pecorella
2013/07/28 17:08:48
Changed names to clarify and documented.
| |
124 * | |
125 * \return a smart pointer to the underlying NetDevice. | |
126 */ | |
127 Ptr<NetDevice> GetNetDevice () const; | |
128 | |
129 /** | |
130 * \brief Setup SixLowPan to be a proxy for the specified NetDevice. | |
131 * All the packets incoming and outgoing from the NetDevice will be | |
132 * processed by SixLowPanNetDevice. | |
133 * | |
134 * \param device a smart pointer to the NetDevice to be proxied. | |
135 */ | |
136 void SetNetDevice (Ptr<NetDevice> device); | |
137 | |
138 /** | |
139 * Assign a fixed random variable stream number to the random variables | |
140 * used by this model. Return the number of streams (possibly zero) that | |
141 * have been assigned. | |
142 * | |
143 * \param stream first stream index to use | |
144 * \return the number of stream indices assigned by this model | |
145 */ | |
146 int64_t AssignStreams (int64_t stream); | |
88 | 147 |
89 protected: | 148 protected: |
90 virtual void DoDispose (void); | 149 virtual void DoDispose (void); |
91 | 150 |
151 private: | |
152 /** | |
153 * \brief receives all the packets from a NetDevice for further processing. | |
154 * \param device the NetDevice the packet ws received from | |
155 * \param packet the received packet | |
156 * \param protocol the protocol (if known) | |
157 * \param source the source address | |
158 * \param destination the destination address | |
159 * \param packetType the packet kind (e.g., HOST, BROADCAST, etc.) | |
160 * \return the IPv6 link-local address | |
161 */ | |
92 void ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint1 6_t protocol, | 162 void ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint1 6_t protocol, |
93 Address const &source, Address const &destination, Pac ketType packetType); | 163 Address const &source, Address const &destination, Pac ketType packetType); |
94 | 164 |
95 private: | 165 /** |
166 * The callback used to notify higher layers that a packet has been received. | |
167 */ | |
96 NetDevice::ReceiveCallback m_rxCallback; | 168 NetDevice::ReceiveCallback m_rxCallback; |
169 | |
170 /** | |
171 * The callback used to notify higher layers that a packet has been received i n promiscuous mode. | |
172 */ | |
97 NetDevice::PromiscReceiveCallback m_promiscRxCallback; | 173 NetDevice::PromiscReceiveCallback m_promiscRxCallback; |
98 | 174 |
99 // The following two traces pass a packet with a 6LoWPAN header | 175 /** |
100 TracedCallback<Ptr<const Packet>, Ptr<SixLowPanNetDevice>, uint32_t> m_txTrac e; | 176 * \brief Callback to trace TX (transmission) packets. |
177 * | |
178 * Data passed: | |
179 * \li Packet received (including 6LoWPAN header) | |
180 * \li Ptr to SixLowPanNetDevice | |
181 * \li interface index | |
182 */ | |
183 TracedCallback<Ptr<const Packet>, Ptr<SixLowPanNetDevice>, uint32_t> m_txTrace ; | |
184 | |
185 /** | |
186 * \brief Callback to trace RX (reception) packets. | |
187 * | |
188 * Data passed: | |
189 * \li Packet received (including 6LoWPAN header) | |
190 * \li Ptr to SixLowPanNetDevice | |
191 * \li interface index | |
192 */ | |
101 TracedCallback<Ptr<const Packet>, Ptr<SixLowPanNetDevice>, uint32_t> m_rxTrace ; | 193 TracedCallback<Ptr<const Packet>, Ptr<SixLowPanNetDevice>, uint32_t> m_rxTrace ; |
102 // <ip-header, payload, reason, ifindex> (ifindex not valid if reason is DROP_ NO_ROUTE) | 194 |
103 TracedCallback<DropReason, Ptr<SixLowPanNetDevice>, uint32_t> m_dropTrace; | 195 /** |
196 * \brief Callback to trace drop packets. | |
197 * | |
198 * Data passed: | |
199 * \li DropReason | |
200 * \li Packet dropped (including 6LoWPAN header) | |
201 * \li Ptr to SixLowPanNetDevice | |
202 * \li interface index | |
203 */ | |
204 TracedCallback<DropReason, Ptr<const Packet>, Ptr<SixLowPanNetDevice>, uint32_ t> m_dropTrace; | |
104 | 205 |
105 /** | 206 /** |
106 * \brief make a link-local address from a MAC address. | 207 * \brief make a link-local address from a MAC address. |
107 * \param addr the MAC address | 208 * \param addr the MAC address |
108 * \return the IPv6 link-local address | 209 * \return the IPv6 link-local address |
109 */ | 210 */ |
110 Ipv6Address MakeLinkLocalAddressFromMac (Address const &addr); | 211 Ipv6Address MakeLinkLocalAddressFromMac (Address const &addr); |
111 | 212 |
112 /** | 213 /** |
113 * \brief make a global address from a MAC address. | 214 * \brief make a global address from a MAC address. |
(...skipping 23 matching lines...) Expand all Loading... | |
137 /** | 238 /** |
138 * \brief Compress the headers according to IPHC compression. | 239 * \brief Compress the headers according to IPHC compression. |
139 * \param packet the packet to be compressed | 240 * \param packet the packet to be compressed |
140 * \param src the MAC source address | 241 * \param src the MAC source address |
141 * \param dst the MAC destination address | 242 * \param dst the MAC destination address |
142 * \return the size of the removed headers | 243 * \return the size of the removed headers |
143 */ | 244 */ |
144 uint32_t CompressLowPanIphc (Ptr<Packet> packet, Address const &src, Address c onst &dst); | 245 uint32_t CompressLowPanIphc (Ptr<Packet> packet, Address const &src, Address c onst &dst); |
145 | 246 |
146 /** | 247 /** |
248 * \brief Checks if the next header can be compressed using NHC. | |
249 * \param headerType the header kind to be compressed | |
250 * \return true if the header can be compressed | |
251 */ | |
252 bool CanCompressLowPanNhc (uint8_t headerType); | |
253 | |
254 /** | |
147 * \brief Decompress the headers according to IPHC compression. | 255 * \brief Decompress the headers according to IPHC compression. |
148 * \param packet the packet to be compressed | 256 * \param packet the packet to be compressed |
149 * \param src the MAC source address | 257 * \param src the MAC source address |
150 * \param dst the MAC destination address | 258 * \param dst the MAC destination address |
151 */ | 259 */ |
152 void DecompressLowPanIphc (Ptr<Packet> packet, Address const &src, Address con st &dst); | 260 void DecompressLowPanIphc (Ptr<Packet> packet, Address const &src, Address con st &dst); |
153 | 261 |
154 /** | 262 /** |
155 * \brief Compress the headers according to NHC compression. | 263 * \brief Compress the headers according to NHC compression. |
156 * \param packet the packet to be compressed | 264 * \param packet the packet to be compressed |
157 * \param nextHeader the value of NextHeader field of Ipv6Header | 265 * \param headerType the header type |
158 * \return true if the IPV6 Extension Header is compressed with NHC, false oth erwise | 266 * \param src the MAC source address |
159 */ | 267 * \param dst the MAC destination address |
160 uint32_t CompressLowPanNhc (Ptr<Packet> packet, uint8_t nextHeader); | 268 * \return the size of the removed headers |
269 */ | |
270 uint32_t CompressLowPanNhc (Ptr<Packet> packet, uint8_t headerType, Address co nst &src, Address const &dst); | |
161 | 271 |
162 /** | 272 /** |
163 * \brief Decompress the headers according to NHC compression. | 273 * \brief Decompress the headers according to NHC compression. |
164 * \param packet the packet to be compressed | 274 * \param packet the packet to be compressed |
165 * \param nextHeader the value of NextHeader field of Ipv6Header | 275 * \param src the MAC source address |
166 * \param ipHeader the Ipv6Header of the packet | 276 * \param dst the MAC destination address |
167 */ | 277 * \param srcAddress the IPv6 source address |
168 void DecompressLowPanNhc (Ptr<Packet> packet, uint8_t nextHeader, Ipv6Header & ipHeader); | 278 * \param dstAddress the IPv6 destination address |
279 * \return the decompressed header type | |
280 */ | |
281 uint8_t DecompressLowPanNhc (Ptr<Packet> packet, Address const &src, Address c onst &dst, Ipv6Address srcAddress, Ipv6Address dstAddress); | |
169 | 282 |
170 /** | 283 /** |
171 * \brief Compress the headers according to NHC compression. | 284 * \brief Compress the headers according to NHC compression. |
172 * \param packet the packet to be compressed | 285 * \param packet the packet to be compressed |
173 * \param elideChecksum elide UDP checksum (if true) | 286 * \param omitChecksum omit UDP checksum (if true) |
174 */ | 287 * \return the size of the removed headers |
175 uint32_t CompressLowPanUdpNhc (Ptr<Packet> packet, bool elideChecksum); | 288 */ |
289 uint32_t CompressLowPanUdpNhc (Ptr<Packet> packet, bool omitChecksum); | |
176 | 290 |
177 /** | 291 /** |
178 * \brief Decompress the headers according to NHC compression. | 292 * \brief Decompress the headers according to NHC compression. |
179 * \param packet the packet to be compressed | 293 * \param packet the packet to be compressed |
294 * \param saddr the IPv6 source address | |
295 * \param daddr the IPv6 destination address | |
180 */ | 296 */ |
181 void DecompressLowPanUdpNhc (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Addres s daddr); | 297 void DecompressLowPanUdpNhc (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Addres s daddr); |
182 | 298 |
299 /** | |
300 * Fragment identifier type: src/dst address src/dst port | |
301 */ | |
183 typedef std::pair< std::pair<Address, Address>, std::pair<uint16_t, uint16_t> > FragmentKey; | 302 typedef std::pair< std::pair<Address, Address>, std::pair<uint16_t, uint16_t> > FragmentKey; |
184 | 303 |
185 /** | 304 /** |
186 * \class Fragments | 305 * \class Fragments |
187 * \brief A Set of Fragment | 306 * \brief A Set of Fragment |
188 */ | 307 */ |
189 class Fragments : public SimpleRefCount<Fragments> | 308 class Fragments : public SimpleRefCount<Fragments> |
190 { | 309 { |
191 public: | 310 public: |
192 /** | 311 /** |
193 * \brief Constructor. | 312 * \brief Constructor. |
194 */ | 313 */ |
195 Fragments (); | 314 Fragments (); |
196 | 315 |
197 /** | 316 /** |
198 * \brief Destructor. | 317 * \brief Destructor. |
199 */ | 318 */ |
200 ~Fragments (); | 319 ~Fragments (); |
201 | 320 |
202 /** | 321 /** |
203 * \brief Add a fragment. | 322 * \brief Add a fragment to the pool. |
204 * \param fragment the fragment | 323 * \param fragment the fragment |
205 * \param fragmentOffset the offset of the fragment | 324 * \param fragmentOffset the offset of the fragment |
206 */ | 325 */ |
207 void AddFragment (Ptr<Packet> fragment, uint16_t fragmentOffset); | 326 void AddFragment (Ptr<Packet> fragment, uint16_t fragmentOffset); |
208 | 327 |
209 /** | 328 /** |
210 * \brief Add a fragment. | 329 * \brief Add the first packet fragment. The first fragment is needed to |
Tom Henderson
2013/07/25 16:24:55
what is difference between AddFragment and AddFirs
Tommaso Pecorella
2013/07/28 17:08:48
Clarified
| |
330 * allow the post-defragmentation decompression. | |
211 * \param fragment the fragment | 331 * \param fragment the fragment |
212 */ | 332 */ |
213 void AddFirstFragment (Ptr<Packet> fragment); | 333 void AddFirstFragment (Ptr<Packet> fragment); |
214 | 334 |
215 /** | 335 /** |
216 * \brief If all fragments have been added. | 336 * \brief If all fragments have been added. |
217 * \returns true if the packet is entire | 337 * \returns true if the packet is entire |
218 */ | 338 */ |
219 bool IsEntire () const; | 339 bool IsEntire () const; |
Tom Henderson
2013/07/25 16:24:55
can this be inverted to IsFragmented () to keep wi
Tommaso Pecorella
2013/07/28 17:08:48
It's the same terminology and use that we have in
| |
220 | 340 |
221 /** | 341 /** |
222 * \brief Get the entire packet. | 342 * \brief Get the entire packet. |
223 * \return the entire packet | 343 * \return the entire packet |
224 */ | 344 */ |
225 Ptr<Packet> GetPacket () const; | 345 Ptr<Packet> GetPacket () const; |
226 | 346 |
227 /** | 347 /** |
228 * \brief Set the reconstructed packet size. | 348 * \brief Set the packet-to-be-defragmented size. |
Tom Henderson
2013/07/25 16:24:55
more documentation needed (is this a reassembly bu
| |
349 * \param packetSize the packet size (bytes) | |
229 */ | 350 */ |
230 void SetPacketSize (uint32_t packetSize); | 351 void SetPacketSize (uint32_t packetSize); |
231 | 352 |
353 /** | |
354 * \brief Get a list of the current stored fragments. | |
355 */ | |
356 std::list< Ptr<Packet> > GetFraments () const; | |
357 | |
232 private: | 358 private: |
233 /** | 359 /** |
234 * \brief The size of the reconstructed packet. | 360 * \brief The size of the reconstructed packet (bytes). |
Tom Henderson
2013/07/25 16:24:55
in bytes?
Tom Henderson
2013/07/25 16:24:55
in bytes?
| |
235 */ | 361 */ |
236 uint32_t m_packetSize; | 362 uint32_t m_packetSize; |
237 | 363 |
238 /** | 364 /** |
239 * \brief The current fragments. | 365 * \brief The current fragments. |
240 */ | 366 */ |
241 std::list<std::pair<Ptr<Packet>, uint16_t> > m_fragments; | 367 std::list<std::pair<Ptr<Packet>, uint16_t> > m_fragments; |
242 | 368 |
243 /** | 369 /** |
244 * \brief The very first fragment | 370 * \brief The very first fragment |
245 */ | 371 */ |
246 Ptr<Packet> m_firstFragment; | 372 Ptr<Packet> m_firstFragment; |
247 | 373 |
248 Time lastAccess; | |
Tom Henderson
2013/07/25 16:24:55
m_lastAccess? doxygen?
Tommaso Pecorella
2013/07/28 17:08:48
Dinosaur. Removed.
| |
249 }; | 374 }; |
250 | 375 |
251 /** | 376 /** |
252 * \brief Return the instance type identifier. | 377 * \brief Return the instance type identifier. |
253 * \param packet the packet to be fragmented (with headers already compressed with 6LoWPAN) | 378 * \param packet the packet to be fragmented (with headers already compressed with 6LoWPAN) |
254 * \param origPacketSize the size of the IP packet before the 6LoWPAN header c ompression, including the IP/L4 headers | 379 * \param origPacketSize the size of the IP packet before the 6LoWPAN header c ompression, including the IP/L4 headers |
380 * \param origHdrSize the size of the IP header before the 6LoWPAN header comp ression | |
255 * \param listFragments a reference to the list of the resulting packets, all with the proper headers in place | 381 * \param listFragments a reference to the list of the resulting packets, all with the proper headers in place |
256 */ | 382 */ |
257 void DoFragmentation (Ptr<Packet> packet, uint32_t origPacketSize, uint32_t or igHdrSize, | 383 void DoFragmentation (Ptr<Packet> packet, uint32_t origPacketSize, uint32_t or igHdrSize, |
258 std::list<Ptr<Packet> >& listFragments); | 384 std::list<Ptr<Packet> >& listFragments); |
259 | 385 |
260 /** | 386 /** |
261 * \brief Process a packet fragment | 387 * \brief Process a packet fragment |
262 * \param packet the packet | 388 * \param packet the packet |
263 * \param fragmentSize the size of the fragment | 389 * \param src the source MAC address |
264 * \param iif Input Interface | 390 * \param dst the destination MAC address |
391 * \param isFirst true if it is the first fragment, false otherwise | |
265 * \return true is the fragment completed the packet | 392 * \return true is the fragment completed the packet |
Tom Henderson
2013/07/25 16:24:55
doxygen doesn't match
Tommaso Pecorella
2013/07/28 17:08:48
Fixed
| |
266 */ | 393 */ |
267 bool ProcessFragment (Ptr<Packet>& packet, Address const &src, Address const & dst, bool isFirst); | 394 bool ProcessFragment (Ptr<Packet>& packet, Address const &src, Address const & dst, bool isFirst); |
268 | 395 |
269 /** | 396 /** |
270 * \brief Process the timeout for packet fragments | 397 * \brief Process the timeout for packet fragments |
271 * \param key representing the packet fragments | 398 * \param key representing the packet fragments |
272 * \param iif Input Interface | 399 * \param iif Input Interface |
273 */ | 400 */ |
274 void HandleFragmentsTimeout ( FragmentKey key, uint32_t iif); | 401 void HandleFragmentsTimeout ( FragmentKey key, uint32_t iif); |
275 | 402 |
276 /** | 403 /** |
277 * \brief Drops the oldest fragment set | 404 * \brief Drops the oldest fragment set |
278 */ | 405 */ |
279 void DropOldestFragmentSet (); | 406 void DropOldestFragmentSet (); |
280 | 407 |
408 /** | |
409 * Container for fragment key -> fragments | |
410 */ | |
281 typedef std::map< FragmentKey, Ptr<Fragments> > MapFragments_t; | 411 typedef std::map< FragmentKey, Ptr<Fragments> > MapFragments_t; |
412 /** | |
413 * Container Iterator for fragment key -> fragments | |
414 */ | |
415 typedef std::map< FragmentKey, Ptr<Fragments> >::iterator MapFragmentsI_t; | |
416 /** | |
417 * Container for fragment key -> exiration event | |
418 */ | |
282 typedef std::map< FragmentKey, EventId > MapFragmentsTimers_t; | 419 typedef std::map< FragmentKey, EventId > MapFragmentsTimers_t; |
283 | 420 /** |
284 MapFragments_t m_fragments; | 421 * Container Iterator for fragment key -> exiration event |
285 MapFragmentsTimers_t m_fragmentsTimers; | 422 */ |
286 Time m_fragmentExpirationTimeout; | 423 typedef std::map< FragmentKey, EventId >::iterator MapFragmentsTimersI_t; |
424 | |
425 MapFragments_t m_fragments; /**< Fragments hold to be rebuilt */ | |
426 MapFragmentsTimers_t m_fragmentsTimers; /**< Timers related to fragment rebuil ding */ | |
427 Time m_fragmentExpirationTimeout; /**< Time limit for fragment rebuilding */ | |
428 | |
429 /** | |
430 * \brief How many packets can be rebuilt at the same time. | |
431 * Some real implementation do limit this. Zero means no limit. | |
432 */ | |
287 uint16_t m_fragmentReassemblyListSize; | 433 uint16_t m_fragmentReassemblyListSize; |
288 | 434 |
289 bool m_useIphc; | 435 bool m_useIphc; /**< Use IPHC or HC1 */ |
290 | 436 |
291 Ptr<Node> m_node; | 437 Ptr<Node> m_node; /**< Smart pointer to the Node */ |
292 Ptr<NetDevice> m_port; | 438 Ptr<NetDevice> m_netDevice; /**< Smart pointer to the underlying NetDevice */ |
293 uint32_t m_ifIndex; | 439 uint32_t m_ifIndex; /**< Interface index */ |
440 | |
441 /** | |
442 * \brief Force the EtherType number. | |
443 * Also implying that the underlying NetDevice is using 48-bit Addresses, e.g. , Ethernet, WiFi, etc. | |
444 */ | |
294 bool m_forceEtherType; | 445 bool m_forceEtherType; |
295 uint16_t m_etherType; | 446 |
296 bool m_elideUdpChecksum; | 447 uint16_t m_etherType; /**< EtherType number (used only if m_forceEtherType is true) */ |
448 bool m_omitUdpChecksum; /**< Omit UDP checksum in NC1 encoding */ | |
449 | |
450 Ptr<UniformRandomVariable> m_rng; //!< Rng for the fragments tag. | |
297 }; | 451 }; |
298 | 452 |
299 } // namespace ns3 | 453 } // namespace ns3 |
300 } | |
301 | 454 |
302 #endif /* SIXLOWPAN_NET_DEVICE_H */ | 455 #endif /* SIXLOWPAN_NET_DEVICE_H */ |
LEFT | RIGHT |