Shim performing 6LoWPAN compression, decompression and fragmentation. More...
#include "sixlowpan-net-device.h"
Classes | |
struct | ContextEntry |
Structure holding the information for a context (used in compression and decompression) More... | |
class | Fragments |
A Set of Fragments. More... | |
Public Types | |
enum | DropReason { DROP_FRAGMENT_TIMEOUT = 1 , DROP_FRAGMENT_BUFFER_FULL , DROP_UNKNOWN_EXTENSION , DROP_DISALLOWED_COMPRESSION , DROP_SATETFUL_DECOMPRESSION_PROBLEM } |
Enumeration of the dropping reasons in SixLoWPAN. More... | |
typedef void(* | DropTracedCallback) (DropReason reason, Ptr< const Packet > packet, Ptr< SixLowPanNetDevice > sixNetDevice, uint32_t ifindex) |
TracedCallback signature for packet drop events. More... | |
typedef void(* | RxTxTracedCallback) (Ptr< const Packet > packet, Ptr< SixLowPanNetDevice > sixNetDevice, uint32_t ifindex) |
TracedCallback signature for packet send/receive events. More... | |
Public Types inherited from ns3::NetDevice | |
typedef void(* | LinkChangeTracedCallback) () |
TracedCallback signature for link changed event. More... | |
enum | PacketType { PACKET_HOST = 1 , NS3_PACKET_HOST = PACKET_HOST , PACKET_BROADCAST , NS3_PACKET_BROADCAST = PACKET_BROADCAST , PACKET_MULTICAST , NS3_PACKET_MULTICAST = PACKET_MULTICAST , PACKET_OTHERHOST , NS3_PACKET_OTHERHOST = PACKET_OTHERHOST } |
Packet types are used as they are in Linux. More... | |
typedef Callback< bool, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address &, const Address &, PacketType > | PromiscReceiveCallback |
typedef Callback< bool, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address & > | ReceiveCallback |
Public Member Functions | |
SixLowPanNetDevice () | |
Constructor for the SixLowPanNetDevice. More... | |
SixLowPanNetDevice (const SixLowPanNetDevice &)=delete | |
void | AddContext (uint8_t contextId, Ipv6Prefix contextPrefix, bool compressionAllowed, Time validLifetime) |
Add, remove, or update a context used in IPHC stateful compression. More... | |
void | AddLinkChangeCallback (Callback< void > callback) override |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. More... | |
Address | GetAddress () const override |
Address | GetBroadcast () const override |
Ptr< Channel > | GetChannel () const override |
bool | GetContext (uint8_t contextId, Ipv6Prefix &contextPrefix, bool &compressionAllowed, Time &validLifetime) |
Get a context used in IPHC stateful compression. More... | |
uint32_t | GetIfIndex () const override |
uint16_t | GetMtu () const override |
Returns the link-layer MTU for this interface. More... | |
Address | GetMulticast (Ipv4Address multicastGroup) const override |
Make and return a MAC multicast address using the provided multicast group. More... | |
Address | GetMulticast (Ipv6Address addr) const override |
Get the MAC multicast address corresponding to the IPv6 address provided. More... | |
Ptr< NetDevice > | GetNetDevice () const |
Returns a smart pointer to the underlying NetDevice. More... | |
Ptr< Node > | GetNode () const override |
void | InvalidateContext (uint8_t contextId) |
Invalidate a context used in IPHC stateful compression. More... | |
bool | IsBridge () const override |
Return true if the net device is acting as a bridge. More... | |
bool | IsBroadcast () const override |
bool | IsLinkUp () const override |
bool | IsMulticast () const override |
bool | IsPointToPoint () const override |
Return true if the net device is on a point-to-point link. More... | |
bool | NeedsArp () const override |
SixLowPanNetDevice & | operator= (const SixLowPanNetDevice &)=delete |
void | RemoveContext (uint8_t contextId) |
Remove a context used in IPHC stateful compression. More... | |
void | RenewContext (uint8_t contextId, Time validLifetime) |
Renew a context used in IPHC stateful compression. More... | |
bool | Send (Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override |
bool | SendFrom (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override |
void | SetAddress (Address address) override |
Set the address of this interface. More... | |
void | SetIfIndex (const uint32_t index) override |
bool | SetMtu (const uint16_t mtu) override |
void | SetNetDevice (Ptr< NetDevice > device) |
Setup SixLowPan to be a proxy for the specified NetDevice. More... | |
void | SetNode (Ptr< Node > node) override |
void | SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb) override |
void | SetReceiveCallback (NetDevice::ReceiveCallback cb) override |
bool | SupportsSendFrom () const override |
Public Member Functions inherited from ns3::NetDevice | |
~NetDevice () override | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::NetDevice | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Attributes | |
static constexpr uint16_t | PROT_NUMBER {0xA0ED} |
The protocol number for 6LoWPAN (0xA0ED) - see RFC 7973. More... | |
Protected Member Functions | |
void | DoDispose () override |
Destructor implementation. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoInitialize () |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Types | |
typedef std::pair< std::pair< Address, Address >, std::pair< uint16_t, uint16_t > > | FragmentKey_t |
Fragment identifier type: src/dst address src/dst port. More... | |
typedef std::list< std::tuple< Time, FragmentKey_t, uint32_t > > | FragmentsTimeoutsList_t |
Container for fragment timeouts. More... | |
typedef std::list< std::tuple< Time, FragmentKey_t, uint32_t > >::iterator | FragmentsTimeoutsListI_t |
Container Iterator for fragment timeouts. More... | |
typedef std::map< FragmentKey_t, Ptr< Fragments > > | MapFragments_t |
Container for fragment key -> fragments. More... | |
typedef std::map< FragmentKey_t, Ptr< Fragments > >::iterator | MapFragmentsI_t |
Container Iterator for fragment key -> fragments. More... | |
Private Member Functions | |
bool | CanCompressLowPanNhc (uint8_t headerType) |
Checks if the next header can be compressed using NHC. More... | |
Ipv6Address | CleanPrefix (Ipv6Address address, Ipv6Prefix prefix) |
Clean an address from its prefix. More... | |
uint32_t | CompressLowPanHc1 (Ptr< Packet > packet, const Address &src, const Address &dst) |
Compress the headers according to HC1 compression. More... | |
uint32_t | CompressLowPanIphc (Ptr< Packet > packet, const Address &src, const Address &dst) |
Compress the headers according to IPHC compression. More... | |
uint32_t | CompressLowPanNhc (Ptr< Packet > packet, uint8_t headerType, const Address &src, const Address &dst) |
Compress the headers according to NHC compression. More... | |
uint32_t | CompressLowPanUdpNhc (Ptr< Packet > packet, bool omitChecksum) |
Compress the headers according to NHC compression. More... | |
void | DecompressLowPanHc1 (Ptr< Packet > packet, const Address &src, const Address &dst) |
Decompress the headers according to HC1 compression. More... | |
bool | DecompressLowPanIphc (Ptr< Packet > packet, const Address &src, const Address &dst) |
Decompress the headers according to IPHC compression. More... | |
std::pair< uint8_t, bool > | DecompressLowPanNhc (Ptr< Packet > packet, const Address &src, const Address &dst, Ipv6Address srcAddress, Ipv6Address dstAddress) |
Decompress the headers according to NHC compression. More... | |
void | DecompressLowPanUdpNhc (Ptr< Packet > packet, Ipv6Address saddr, Ipv6Address daddr) |
Decompress the headers according to NHC compression. More... | |
void | DoFragmentation (Ptr< Packet > packet, uint32_t origPacketSize, uint32_t origHdrSize, uint32_t extraHdrSize, std::list< Ptr< Packet >> &listFragments) |
Performs a packet fragmentation. More... | |
bool | DoSend (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber, bool doSendFrom) |
void | DropOldestFragmentSet () |
Drops the oldest fragment set. More... | |
bool | FindMulticastCompressionContext (Ipv6Address address, uint8_t &contextId) |
Finds if the given multicast address matches a context for compression. More... | |
bool | FindUnicastCompressionContext (Ipv6Address address, uint8_t &contextId) |
Finds if the given unicast address matches a context for compression. More... | |
Address | Get16MacFrom48Mac (Address addr) |
Get a Mac16 from its Mac48 pseudo-MAC. More... | |
void | HandleFragmentsTimeout (FragmentKey_t key, uint32_t iif) |
Process the timeout for packet fragments. More... | |
void | HandleTimeout () |
Handles a fragmented packet timeout. More... | |
bool | ProcessFragment (Ptr< Packet > &packet, const Address &src, const Address &dst, bool isFirst) |
Process a packet fragment. More... | |
void | ReceiveFromDevice (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &source, const Address &destination, PacketType packetType) |
Receives all the packets from a NetDevice for further processing. More... | |
FragmentsTimeoutsListI_t | SetTimeout (FragmentKey_t key, uint32_t iif) |
Set a new timeout "event" for a fragmented packet. More... | |
Private Attributes | |
uint8_t | m_bc0Serial |
Serial number used in BC0 header. More... | |
uint32_t | m_compressionThreshold |
Minimum L2 payload size. More... | |
std::map< uint8_t, ContextEntry > | m_contextTable |
Table of the contexts used in compression/decompression. More... | |
TracedCallback< DropReason, Ptr< const Packet >, Ptr< SixLowPanNetDevice >, uint32_t > | m_dropTrace |
Callback to trace drop packets. More... | |
Time | m_fragmentExpirationTimeout |
Time limit for fragment rebuilding. More... | |
uint16_t | m_fragmentReassemblyListSize |
How many packets can be rebuilt at the same time. More... | |
MapFragments_t | m_fragments |
Fragments hold to be rebuilt. More... | |
uint32_t | m_ifIndex |
Interface index. More... | |
uint16_t | m_meshCacheLength |
length of the cache for each source. More... | |
bool | m_meshUnder |
Use a mesh-under routing. More... | |
uint8_t | m_meshUnderHopsLeft |
Start value for mesh-under hops left. More... | |
Ptr< RandomVariableStream > | m_meshUnderJitter |
Random variable for the mesh-under packet retransmission. More... | |
Ptr< NetDevice > | m_netDevice |
Smart pointer to the underlying NetDevice. More... | |
Ptr< Node > | m_node |
Smart pointer to the Node. More... | |
bool | m_omitUdpChecksum |
Omit UDP checksum in NC1 encoding. More... | |
NetDevice::PromiscReceiveCallback | m_promiscRxCallback |
The callback used to notify higher layers that a packet has been received in promiscuous mode. More... | |
Ptr< UniformRandomVariable > | m_rng |
Rng for the fragments tag. More... | |
NetDevice::ReceiveCallback | m_rxCallback |
The callback used to notify higher layers that a packet has been received. More... | |
TracedCallback< Ptr< const Packet >, Ptr< SixLowPanNetDevice >, uint32_t > | m_rxTrace |
Callback to trace RX (reception) packets. More... | |
std::map< Address, std::list< uint8_t > > | m_seenPkts |
Seen packets, memorized by OriginatorAddress, SequenceNumber. More... | |
EventId | m_timeoutEvent |
Event for the next scheduled timeout. More... | |
FragmentsTimeoutsList_t | m_timeoutEventList |
Timeout "events" container. More... | |
TracedCallback< Ptr< const Packet >, Ptr< SixLowPanNetDevice >, uint32_t > | m_txTrace |
Callback to trace TX (transmission) packets. More... | |
bool | m_useIphc |
Use IPHC or HC1. More... | |
Additional Inherited Members | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Shim performing 6LoWPAN compression, decompression and fragmentation.
This class implements the shim between IPv6 and a generic NetDevice, performing packet compression, decompression and fragmentation in a transparent way. To this end, the class pretend to be a normal NetDevice, masquerading some functions of the underlying NetDevice.
Definition at line 72 of file sixlowpan-net-device.h.
typedef void(* ns3::SixLowPanNetDevice::DropTracedCallback) (DropReason reason, Ptr< const Packet > packet, Ptr< SixLowPanNetDevice > sixNetDevice, uint32_t ifindex) |
TracedCallback signature for packet drop events.
[in] | reason | The reason for the drop. |
[in] | packet | The packet. |
[in] | sixNetDevice | The SixLowPanNetDevice. |
[in] | ifindex | The ifindex of the device. |
Ptr<SixLowPanNetDevice>
argument is deprecated and will be changed to Ptr<const SixLowPanNetDevice>
in a future release. Definition at line 196 of file sixlowpan-net-device.h.
|
private |
Fragment identifier type: src/dst address src/dst port.
Definition at line 442 of file sixlowpan-net-device.h.
|
private |
Container for fragment timeouts.
Definition at line 445 of file sixlowpan-net-device.h.
|
private |
Container Iterator for fragment timeouts.
Definition at line 447 of file sixlowpan-net-device.h.
|
private |
Container for fragment key -> fragments.
Definition at line 604 of file sixlowpan-net-device.h.
|
private |
Container Iterator for fragment key -> fragments.
Definition at line 608 of file sixlowpan-net-device.h.
typedef void(* ns3::SixLowPanNetDevice::RxTxTracedCallback) (Ptr< const Packet > packet, Ptr< SixLowPanNetDevice > sixNetDevice, uint32_t ifindex) |
TracedCallback signature for packet send/receive events.
[in] | packet | The packet. |
[in] | sixNetDevice | The SixLowPanNetDevice. |
[in] | ifindex | The ifindex of the device. |
Ptr<SixLowPanNetDevice>
argument is deprecated and will be changed to Ptr<const SixLowPanNetDevice>
in a future release. Definition at line 181 of file sixlowpan-net-device.h.
Enumeration of the dropping reasons in SixLoWPAN.
Definition at line 78 of file sixlowpan-net-device.h.
ns3::SixLowPanNetDevice::SixLowPanNetDevice | ( | ) |
Constructor for the SixLowPanNetDevice.
Definition at line 125 of file sixlowpan-net-device.cc.
References m_bc0Serial, m_netDevice, m_rng, and NS_LOG_FUNCTION.
|
delete |
void ns3::SixLowPanNetDevice::AddContext | ( | uint8_t | contextId, |
Ipv6Prefix | contextPrefix, | ||
bool | compressionAllowed, | ||
Time | validLifetime | ||
) |
Add, remove, or update a context used in IPHC stateful compression.
A context with a zero validLifetime will be immediately removed.
[in] | contextId | context id (most be between 0 and 15 included). |
[in] | contextPrefix | context prefix to be used in compression/decompression. |
[in] | compressionAllowed | compression and decompression allowed (true), decompression only (false). |
[in] | validLifetime | validity time (relative to the actual time). |
Definition at line 2732 of file sixlowpan-net-device.cc.
References ns3::Time::As(), ns3::Ipv6Address::GetOnes(), m_contextTable, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Time::S.
|
overridevirtual |
callback | the callback to invoke |
Add a callback invoked whenever the link status changes to UP. This callback is typically used by the IP/ARP layer to flush the ARP cache and by IPv6 stack to flush NDISC cache whenever the link goes up.
Implements ns3::NetDevice.
Definition at line 478 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
int64_t ns3::SixLowPanNetDevice::AssignStreams | ( | int64_t | stream | ) |
Assign a fixed random variable stream number to the random variables used by this model.
Return the number of streams (possibly zero) that have been assigned.
[in] | stream | First stream index to use. |
Definition at line 166 of file sixlowpan-net-device.cc.
References m_meshUnderJitter, m_rng, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
|
private |
Checks if the next header can be compressed using NHC.
[in] | headerType | The header kind to be compressed. |
Definition at line 1359 of file sixlowpan-net-device.cc.
References ns3::Ipv6Header::IPV6_EXT_FRAGMENTATION, ns3::Ipv6Header::IPV6_EXT_HOP_BY_HOP, ns3::Ipv6Header::IPV6_EXT_MOBILITY, ns3::Ipv6Header::IPV6_EXT_ROUTING, ns3::Ipv6Header::IPV6_IPV6, and ns3::Ipv6Header::IPV6_UDP.
Referenced by CompressLowPanIphc(), and CompressLowPanNhc().
|
private |
Clean an address from its prefix.
This function is used to find the relevant bits to be sent in stateful IPHC compression. Only the prefix length is used - the address prefix is assumed to be matching the prefix.
address | the address to be cleaned |
prefix | the prefix to remove |
Definition at line 2915 of file sixlowpan-net-device.cc.
References first::address, ns3::Ipv6Address::Deserialize(), and ns3::Ipv6Prefix::GetPrefixLength().
Referenced by CompressLowPanIphc().
|
private |
Compress the headers according to HC1 compression.
[in] | packet | The packet to be compressed. |
[in] | src | The MAC source address. |
[in] | dst | The MAC destination address. |
Definition at line 753 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), ns3::Ipv6Address::GetBytes(), ns3::Ipv6Header::GetDestination(), ns3::Ipv6Header::GetFlowLabel(), ns3::Ipv6Header::GetHopLimit(), ns3::Ipv6Header::GetNextHeader(), ns3::Ipv6Header::GetSerializedSize(), ns3::SixLowPanHc1::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Ipv6Header::GetSource(), ns3::Ipv6Header::GetTrafficClass(), ns3::SixLowPanHc1::HC1_PCIC, ns3::SixLowPanHc1::HC1_PCII, ns3::SixLowPanHc1::HC1_PIIC, ns3::SixLowPanHc1::HC1_PIII, ns3::Ipv6Address::IsLinkLocal(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Packet::PeekHeader(), ns3::Packet::RemoveHeader(), ns3::SixLowPanHc1::SetDstCompression(), ns3::SixLowPanHc1::SetDstInterface(), ns3::SixLowPanHc1::SetDstPrefix(), ns3::SixLowPanHc1::SetFlowLabel(), ns3::SixLowPanHc1::SetHc2HeaderPresent(), ns3::SixLowPanHc1::SetHopLimit(), ns3::SixLowPanHc1::SetNextHeader(), ns3::SixLowPanHc1::SetSrcCompression(), ns3::SixLowPanHc1::SetSrcInterface(), ns3::SixLowPanHc1::SetSrcPrefix(), ns3::SixLowPanHc1::SetTcflCompression(), and ns3::SixLowPanHc1::SetTrafficClass().
Referenced by DoSend().
|
private |
Compress the headers according to IPHC compression.
[in] | packet | The packet to be compressed. |
[in] | src | The MAC source address. |
[in] | dst | The MAC destination address. |
Definition at line 978 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), CanCompressLowPanNhc(), CleanPrefix(), CompressLowPanNhc(), CompressLowPanUdpNhc(), FindMulticastCompressionContext(), FindUnicastCompressionContext(), ns3::Ipv6Address::GetAny(), ns3::Ipv6Address::GetBytes(), ns3::Ipv6Header::GetDestination(), ns3::Ipv6Header::GetFlowLabel(), ns3::Ipv6Header::GetHopLimit(), ns3::SixLowPanIphc::GetM(), ns3::Ipv6Header::GetNextHeader(), ns3::Ipv6Header::GetSerializedSize(), ns3::SixLowPanIphc::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Ipv6Header::GetSource(), ns3::Ipv6Header::GetTrafficClass(), ns3::SixLowPanIphc::HC_COMPR_0, ns3::SixLowPanIphc::HC_COMPR_16, ns3::SixLowPanIphc::HC_COMPR_64, ns3::SixLowPanIphc::HC_INLINE, ns3::SixLowPanIphc::HLIM_COMPR_1, ns3::SixLowPanIphc::HLIM_COMPR_255, ns3::SixLowPanIphc::HLIM_COMPR_64, ns3::SixLowPanIphc::HLIM_INLINE, ns3::Ipv6Header::IPV6_IPV6, ns3::Ipv6Header::IPV6_UDP, ns3::Ipv6Address::IsLinkLocal(), ns3::Ipv6Address::IsMulticast(), m_contextTable, m_omitUdpChecksum, ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Packet::PeekHeader(), ns3::Packet::RemoveHeader(), ns3::Ipv6Address::Serialize(), ns3::SixLowPanIphc::SetCid(), ns3::SixLowPanIphc::SetDac(), ns3::SixLowPanIphc::SetDam(), ns3::SixLowPanIphc::SetDscp(), ns3::SixLowPanIphc::SetDstContextId(), ns3::SixLowPanIphc::SetDstInlinePart(), ns3::SixLowPanIphc::SetEcn(), ns3::SixLowPanIphc::SetFlowLabel(), ns3::SixLowPanIphc::SetHlim(), ns3::SixLowPanIphc::SetHopLimit(), ns3::SixLowPanIphc::SetM(), ns3::SixLowPanIphc::SetNextHeader(), ns3::SixLowPanIphc::SetNh(), ns3::SixLowPanIphc::SetSac(), ns3::SixLowPanIphc::SetSam(), ns3::SixLowPanIphc::SetSrcContextId(), ns3::SixLowPanIphc::SetSrcInlinePart(), ns3::SixLowPanIphc::SetTf(), ns3::SixLowPanIphc::TF_DSCP_ELIDED, ns3::SixLowPanIphc::TF_ELIDED, ns3::SixLowPanIphc::TF_FL_ELIDED, and ns3::SixLowPanIphc::TF_FULL.
Referenced by CompressLowPanNhc(), and DoSend().
|
private |
Compress the headers according to NHC compression.
[in] | packet | The packet to be compressed. |
[in] | headerType | The header type. |
[in] | src | The MAC source address. |
[in] | dst | The MAC destination address. |
Definition at line 1712 of file sixlowpan-net-device.cc.
References ns3::Buffer::AddAtStart(), ns3::Packet::AddHeader(), ns3::Buffer::Begin(), CanCompressLowPanNhc(), CompressLowPanIphc(), CompressLowPanUdpNhc(), ns3::SixLowPanNhcExtension::EID_DESTINATION_OPTIONS_H, ns3::SixLowPanNhcExtension::EID_FRAGMENTATION_H, ns3::SixLowPanNhcExtension::EID_HOPBYHOP_OPTIONS_H, ns3::SixLowPanNhcExtension::EID_ROUTING_H, ns3::Ipv6ExtensionHeader::GetLength(), ns3::Ipv6ExtensionHeader::GetNextHeader(), ns3::Ipv6ExtensionHopByHopHeader::GetSerializedSize(), ns3::Ipv6ExtensionDestinationHeader::GetSerializedSize(), ns3::Ipv6ExtensionFragmentHeader::GetSerializedSize(), ns3::Ipv6ExtensionRoutingHeader::GetSerializedSize(), ns3::SixLowPanNhcExtension::GetSerializedSize(), ns3::Buffer::GetSize(), ns3::Packet::GetSize(), ns3::Ipv6Header::IPV6_EXT_DESTINATION, ns3::Ipv6Header::IPV6_EXT_FRAGMENTATION, ns3::Ipv6Header::IPV6_EXT_HOP_BY_HOP, ns3::Ipv6Header::IPV6_EXT_MOBILITY, ns3::Ipv6Header::IPV6_EXT_ROUTING, ns3::Ipv6Header::IPV6_IPV6, ns3::Ipv6Header::IPV6_UDP, m_omitUdpChecksum, NS_ABORT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Buffer::PeekData(), ns3::Packet::PeekHeader(), ns3::Buffer::RemoveAtStart(), ns3::Packet::RemoveHeader(), ns3::Ipv6ExtensionHopByHopHeader::Serialize(), ns3::Ipv6ExtensionDestinationHeader::Serialize(), ns3::Ipv6ExtensionFragmentHeader::Serialize(), ns3::Ipv6ExtensionRoutingHeader::Serialize(), ns3::SixLowPanNhcExtension::SetBlob(), ns3::SixLowPanNhcExtension::SetEid(), ns3::SixLowPanNhcExtension::SetNextHeader(), and ns3::SixLowPanNhcExtension::SetNh().
Referenced by CompressLowPanIphc().
|
private |
Compress the headers according to NHC compression.
[in] | packet | The packet to be compressed. |
[in] | omitChecksum | Omit UDP checksum (if true). |
Definition at line 2198 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), ns3::UdpHeader::GetChecksum(), ns3::UdpHeader::GetDestinationPort(), ns3::SixLowPanUdpNhcExtension::GetSerializedSize(), ns3::Packet::GetSize(), ns3::UdpHeader::GetSourcePort(), ns3::UdpHeader::IsChecksumOk(), NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::PeekHeader(), ns3::SixLowPanUdpNhcExtension::PORTS_ALL_SRC_LAST_DST, ns3::SixLowPanUdpNhcExtension::PORTS_INLINE, ns3::SixLowPanUdpNhcExtension::PORTS_LAST_SRC_ALL_DST, ns3::SixLowPanUdpNhcExtension::PORTS_LAST_SRC_LAST_DST, ns3::Packet::RemoveHeader(), ns3::SixLowPanUdpNhcExtension::SetC(), ns3::SixLowPanUdpNhcExtension::SetChecksum(), ns3::SixLowPanUdpNhcExtension::SetDstPort(), ns3::SixLowPanUdpNhcExtension::SetPorts(), and ns3::SixLowPanUdpNhcExtension::SetSrcPort().
Referenced by CompressLowPanIphc(), and CompressLowPanNhc().
|
private |
Decompress the headers according to HC1 compression.
[in] | packet | the packet to be compressed. |
[in] | src | the MAC source address. |
[in] | dst | the MAC destination address. |
Definition at line 861 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), first::address, two-ray-to-three-gpp-ch-calibration::encoding, ns3::Packet::GetSize(), ns3::SixLowPanHc1::HC1_PCIC, ns3::SixLowPanHc1::HC1_PCII, ns3::SixLowPanHc1::HC1_PIIC, ns3::SixLowPanHc1::HC1_PIII, ns3::Ipv6Address::MakeAutoconfiguredAddress(), ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::RemoveHeader(), ns3::Ipv6Header::SetDestination(), ns3::Ipv6Header::SetFlowLabel(), ns3::Ipv6Header::SetHopLimit(), ns3::Ipv6Header::SetNextHeader(), ns3::Ipv6Header::SetPayloadLength(), ns3::Ipv6Header::SetSource(), and ns3::Ipv6Header::SetTrafficClass().
Referenced by ProcessFragment(), and ReceiveFromDevice().
|
private |
Decompress the headers according to IPHC compression.
[in] | packet | The packet to be compressed. |
[in] | src | The MAC source address. |
[in] | dst | The MAC destination address. |
Definition at line 1380 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), ns3::Packet::CopyData(), DecompressLowPanNhc(), DecompressLowPanUdpNhc(), ns3::Ipv6Address::Deserialize(), two-ray-to-three-gpp-ch-calibration::encoding, ns3::Ipv6Address::GetAny(), ns3::Ipv6Address::GetBytes(), ns3::Ipv6Header::GetDestination(), ns3::SixLowPanDispatch::GetNhcDispatchType(), ns3::Packet::GetSize(), ns3::Ipv6Header::GetSource(), ns3::SixLowPanIphc::HC_COMPR_0, ns3::SixLowPanIphc::HC_COMPR_16, ns3::SixLowPanIphc::HC_COMPR_64, ns3::SixLowPanIphc::HC_INLINE, ns3::Ipv6Header::IPV6_UDP, ns3::SixLowPanDispatch::LOWPAN_UDPNHC, m_contextTable, ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(), ns3::Simulator::Now(), NS_ABORT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Packet::RemoveHeader(), ns3::Ipv6Header::SetDestination(), ns3::Ipv6Header::SetFlowLabel(), ns3::Ipv6Header::SetHopLimit(), ns3::Ipv6Header::SetNextHeader(), ns3::Ipv6Header::SetPayloadLength(), ns3::Ipv6Header::SetSource(), ns3::Ipv6Header::SetTrafficClass(), ns3::SixLowPanIphc::TF_DSCP_ELIDED, ns3::SixLowPanIphc::TF_ELIDED, ns3::SixLowPanIphc::TF_FL_ELIDED, and ns3::SixLowPanIphc::TF_FULL.
Referenced by DecompressLowPanNhc(), ProcessFragment(), and ReceiveFromDevice().
|
private |
Decompress the headers according to NHC compression.
[in] | packet | The packet to be compressed. |
[in] | src | The MAC source address. |
[in] | dst | The MAC destination address. |
[in] | srcAddress | The IPv6 source address. |
[in] | dstAddress | The IPv6 destination address. |
Definition at line 1978 of file sixlowpan-net-device.cc.
References ns3::Buffer::AddAtStart(), ns3::Packet::AddHeader(), ns3::Buffer::Begin(), ns3::Packet::CopyData(), DecompressLowPanIphc(), DecompressLowPanUdpNhc(), ns3::Ipv6ExtensionHopByHopHeader::Deserialize(), ns3::Ipv6ExtensionDestinationHeader::Deserialize(), ns3::Ipv6ExtensionFragmentHeader::Deserialize(), ns3::Ipv6ExtensionRoutingHeader::Deserialize(), DROP_SATETFUL_DECOMPRESSION_PROBLEM, ns3::SixLowPanNhcExtension::EID_DESTINATION_OPTIONS_H, ns3::SixLowPanNhcExtension::EID_FRAGMENTATION_H, ns3::SixLowPanNhcExtension::EID_HOPBYHOP_OPTIONS_H, ns3::SixLowPanNhcExtension::EID_IPv6_H, ns3::SixLowPanNhcExtension::EID_MOBILITY_H, ns3::SixLowPanNhcExtension::EID_ROUTING_H, two-ray-to-three-gpp-ch-calibration::encoding, GetIfIndex(), ns3::SixLowPanDispatch::GetNhcDispatchType(), ns3::Packet::GetSize(), ns3::Ipv6Header::IPV6_EXT_DESTINATION, ns3::Ipv6Header::IPV6_EXT_FRAGMENTATION, ns3::Ipv6Header::IPV6_EXT_HOP_BY_HOP, ns3::Ipv6Header::IPV6_EXT_ROUTING, ns3::Ipv6Header::IPV6_IPV6, ns3::Ipv6Header::IPV6_UDP, ns3::SixLowPanDispatch::LOWPAN_UDPNHC, m_dropTrace, NS_ABORT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Packet::RemoveHeader(), and ns3::Buffer::Iterator::Write().
Referenced by DecompressLowPanIphc().
|
private |
Decompress the headers according to NHC compression.
[in] | packet | The packet to be compressed. |
[in] | saddr | The IPv6 source address. |
[in] | daddr | The IPv6 destination address. |
Definition at line 2256 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), ns3::Node::ChecksumEnabled(), ns3::UdpHeader::EnableChecksums(), two-ray-to-three-gpp-ch-calibration::encoding, ns3::UdpHeader::ForceChecksum(), ns3::Packet::GetSize(), ns3::UdpHeader::InitializeChecksum(), ns3::UdpHeader::IsChecksumOk(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::SixLowPanUdpNhcExtension::PORTS_ALL_SRC_LAST_DST, ns3::SixLowPanUdpNhcExtension::PORTS_INLINE, ns3::SixLowPanUdpNhcExtension::PORTS_LAST_SRC_ALL_DST, ns3::SixLowPanUdpNhcExtension::PORTS_LAST_SRC_LAST_DST, ns3::UdpL4Protocol::PROT_NUMBER, ns3::Packet::RemoveHeader(), ns3::UdpHeader::SetDestinationPort(), and ns3::UdpHeader::SetSourcePort().
Referenced by DecompressLowPanIphc(), and DecompressLowPanNhc().
|
overrideprotectedvirtual |
Destructor implementation.
This method is called by Dispose() or by the Object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.
It is safe to call GetObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 175 of file sixlowpan-net-device.cc.
References ns3::EventId::Cancel(), ns3::Object::DoDispose(), ns3::EventId::IsRunning(), m_fragments, m_netDevice, m_node, m_timeoutEvent, m_timeoutEventList, and NS_LOG_FUNCTION.
|
private |
Performs a packet fragmentation.
[in] | packet | the packet to be fragmented (with headers already compressed with 6LoWPAN). |
[in] | origPacketSize | the size of the IP packet before the 6LoWPAN header compression, including the IP/L4 headers. |
[in] | origHdrSize | the size of the IP header before the 6LoWPAN header compression. |
[in] | extraHdrSize | the sum of the sizes of BC0 header and MESH header if mesh routing is used or 0. |
[out] | listFragments | A reference to the list of the resulting packets, all with the proper headers in place. |
Definition at line 2319 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), ns3::Packet::Copy(), ns3::Packet::CreateFragment(), ns3::SixLowPanFrag1::GetSerializedSize(), ns3::SixLowPanFragN::GetSerializedSize(), ns3::Packet::GetSize(), ns3::UniformRandomVariable::GetValue(), m_netDevice, m_rng, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, packetSize, ns3::SixLowPanFragN::SetDatagramOffset(), ns3::SixLowPanFrag1::SetDatagramSize(), ns3::SixLowPanFragN::SetDatagramSize(), ns3::SixLowPanFrag1::SetDatagramTag(), and ns3::SixLowPanFragN::SetDatagramTag().
Referenced by DoSend().
|
private |
[in] | packet | Packet sent from above down to Network Device. |
[in] | source | Source mac address (only used if doSendFrom is true, i.e., "MAC spoofing"). |
[in] | dest | Mac address of the destination (already resolved). |
[in] | protocolNumber | Identifies the type of payload contained in this packet. Used to call the right L3Protocol when the packet is received. |
[in] | doSendFrom | Perform a SendFrom instead of a Send. |
Called from higher layer to send packet into Network Device with the specified source and destination Addresses.
Definition at line 574 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), CompressLowPanHc1(), CompressLowPanIphc(), ns3::Packet::Copy(), DoFragmentation(), Get16MacFrom48Mac(), ns3::Node::GetId(), GetIfIndex(), ns3::SixLowPanBc0::GetSerializedSize(), ns3::SixLowPanMesh::GetSerializedSize(), ns3::Packet::GetSize(), ns3::Mac48Address::IsMatchingType(), m_bc0Serial, m_compressionThreshold, m_meshUnder, m_meshUnderHopsLeft, m_netDevice, m_node, m_txTrace, m_useIphc, NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, pktSize, PROT_NUMBER, ns3::SixLowPanMesh::SetFinalDst(), ns3::SixLowPanMesh::SetHopsLeft(), ns3::SixLowPanMesh::SetOriginator(), and ns3::SixLowPanBc0::SetSequenceNumber().
Referenced by Send(), and SendFrom().
|
private |
Drops the oldest fragment set.
|
private |
Finds if the given multicast address matches a context for compression.
[in] | address | the address to check |
[out] | contextId | the context found |
Definition at line 2871 of file sixlowpan-net-device.cc.
References first::address, ns3::SixLowPanNetDevice::ContextEntry::compressionAllowed, ns3::SixLowPanNetDevice::ContextEntry::contextPrefix, ns3::Ipv6Prefix::GetBytes(), ns3::Ipv6Address::GetOnes(), ns3::Ipv6Prefix::GetPrefixLength(), m_contextTable, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::SixLowPanNetDevice::ContextEntry::validLifetime.
Referenced by CompressLowPanIphc().
|
private |
Finds if the given unicast address matches a context for compression.
[in] | address | the address to check |
[out] | contextId | the context found |
Definition at line 2845 of file sixlowpan-net-device.cc.
References first::address, ns3::SixLowPanNetDevice::ContextEntry::compressionAllowed, ns3::SixLowPanNetDevice::ContextEntry::contextPrefix, ns3::Ipv6Address::GetOnes(), m_contextTable, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::SixLowPanNetDevice::ContextEntry::validLifetime.
Referenced by CompressLowPanIphc().
Get a Mac16 from its Mac48 pseudo-MAC.
addr | the PseudoMac address |
Definition at line 2681 of file sixlowpan-net-device.cc.
References ns3::Mac16Address::CopyFrom(), ns3::Address::CopyTo(), ns3::Mac48Address::IsMatchingType(), and NS_ASSERT_MSG.
Referenced by DoSend(), and ReceiveFromDevice().
|
overridevirtual |
Implements ns3::NetDevice.
Definition at line 436 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
overridevirtual |
Calling this method is invalid if IsBroadcast returns not true.
Implements ns3::NetDevice.
Definition at line 496 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
Implements ns3::NetDevice.
Definition at line 418 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
bool ns3::SixLowPanNetDevice::GetContext | ( | uint8_t | contextId, |
Ipv6Prefix & | contextPrefix, | ||
bool & | compressionAllowed, | ||
Time & | validLifetime | ||
) |
Get a context used in IPHC stateful compression.
[in] | contextId | context id (most be between 0 and 15 included). |
[out] | contextPrefix | context prefix to be used in compression/decompression. |
[out] | compressionAllowed | compression and decompression allowed (true), decompression only (false). |
[out] | validLifetime | validity time (relative to the actual time). |
Definition at line 2759 of file sixlowpan-net-device.cc.
References m_contextTable, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
overridevirtual |
Implements ns3::NetDevice.
Definition at line 411 of file sixlowpan-net-device.cc.
References m_ifIndex, and NS_LOG_FUNCTION.
Referenced by DecompressLowPanNhc(), DoSend(), ProcessFragment(), and ReceiveFromDevice().
|
overridevirtual |
Returns the link-layer MTU for this interface.
If the link-layer MTU is smaller than IPv6's minimum MTU (RFC 4944), 1280 will be returned.
Implements ns3::NetDevice.
Definition at line 454 of file sixlowpan-net-device.cc.
References m_netDevice, and NS_LOG_FUNCTION.
|
overridevirtual |
Make and return a MAC multicast address using the provided multicast group.
RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet multicast address by placing the low-order 23-bits of the IP address into the low-order 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). Similar RFCs exist for Ipv6 and Eui64 mappings. This method performs the multicast address creation function appropriate to the underlying MAC address of the device. This MAC address is encapsulated in an abstract Address to avoid dependencies on the exact MAC address format.
In the case of net devices that do not support multicast, clients are expected to test NetDevice::IsMulticast and avoid attempting to map multicast packets. Subclasses of NetDevice that do support multicasting are expected to override this method and provide an implementation appropriate to the particular device.
multicastGroup | The IP address for the multicast group destination of the packet. |
Implements ns3::NetDevice.
Definition at line 514 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
overridevirtual |
Get the MAC multicast address corresponding to the IPv6 address provided.
addr | IPv6 address |
Implements ns3::NetDevice.
Definition at line 523 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
Returns a smart pointer to the underlying NetDevice.
Definition at line 137 of file sixlowpan-net-device.cc.
References m_netDevice, and NS_LOG_FUNCTION.
When a subclass needs to get access to the underlying node base class to print the nodeid for example, it can invoke this method.
Implements ns3::NetDevice.
Definition at line 709 of file sixlowpan-net-device.cc.
References m_node, and NS_LOG_FUNCTION.
|
static |
Get the type ID.
Definition at line 52 of file sixlowpan-net-device.cc.
References m_compressionThreshold, m_dropTrace, m_fragmentExpirationTimeout, m_fragmentReassemblyListSize, m_meshCacheLength, m_meshUnder, m_meshUnderHopsLeft, m_meshUnderJitter, m_omitUdpChecksum, m_rxTrace, m_txTrace, m_useIphc, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), ns3::MakePointerAccessor(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::MakeTraceSourceAccessor(), ns3::MakeUintegerAccessor(), ns3::Seconds(), and ns3::TypeId::SetParent().
|
private |
Process the timeout for packet fragments.
[in] | key | A key representing the packet fragments. |
[in] | iif | Input Interface. |
Definition at line 2664 of file sixlowpan-net-device.cc.
References DROP_FRAGMENT_TIMEOUT, m_dropTrace, m_fragments, and NS_LOG_FUNCTION.
Referenced by HandleTimeout().
|
private |
Handles a fragmented packet timeout.
Definition at line 2711 of file sixlowpan-net-device.cc.
References HandleFragmentsTimeout(), m_timeoutEvent, m_timeoutEventList, ns3::Simulator::Now(), and ns3::Simulator::Schedule().
Referenced by SetTimeout().
void ns3::SixLowPanNetDevice::InvalidateContext | ( | uint8_t | contextId | ) |
Invalidate a context used in IPHC stateful compression.
An invalid context will not be used for compression but it will be used for decompression.
[in] | contextId | context id (most be between 0 and 15 included). |
Definition at line 2806 of file sixlowpan-net-device.cc.
References m_contextTable, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
overridevirtual |
Return true if the net device is acting as a bridge.
Implements ns3::NetDevice.
Definition at line 541 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
overridevirtual |
Implements ns3::NetDevice.
Definition at line 487 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
overridevirtual |
Implements ns3::NetDevice.
Definition at line 469 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
overridevirtual |
Implements ns3::NetDevice.
Definition at line 505 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
overridevirtual |
Return true if the net device is on a point-to-point link.
Implements ns3::NetDevice.
Definition at line 532 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
overridevirtual |
Called by higher-layers to check if this NetDevice requires ARP to be used.
Implements ns3::NetDevice.
Definition at line 723 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
delete |
|
private |
Process a packet fragment.
[in] | packet | The packet. |
[in] | src | The source MAC address. |
[in] | dst | The destination MAC address. |
[in] | isFirst | True if it is the first fragment, false otherwise. |
Definition at line 2393 of file sixlowpan-net-device.cc.
References ns3::SixLowPanNetDevice::Fragments::AddFirstFragment(), ns3::SixLowPanNetDevice::Fragments::AddFragment(), ns3::Packet::Copy(), ns3::Packet::CopyData(), DecompressLowPanHc1(), DecompressLowPanIphc(), DROP_FRAGMENT_BUFFER_FULL, DROP_SATETFUL_DECOMPRESSION_PROBLEM, ns3::SixLowPanFragN::GetDatagramOffset(), ns3::SixLowPanFrag1::GetDatagramSize(), ns3::SixLowPanFragN::GetDatagramSize(), ns3::SixLowPanFrag1::GetDatagramTag(), ns3::SixLowPanFragN::GetDatagramTag(), ns3::SixLowPanDispatch::GetDispatchType(), GetIfIndex(), ns3::SixLowPanNetDevice::Fragments::GetPacket(), ns3::Packet::GetSize(), ns3::SixLowPanNetDevice::Fragments::GetTimeoutIter(), ns3::SixLowPanNetDevice::Fragments::IsEntire(), ns3::SixLowPanDispatch::LOWPAN_HC1, ns3::SixLowPanDispatch::LOWPAN_IPHC, ns3::SixLowPanDispatch::LOWPAN_IPv6, m_dropTrace, m_fragmentReassemblyListSize, m_fragments, m_timeoutEventList, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, packetSize, ns3::Packet::RemoveHeader(), ns3::SixLowPanNetDevice::Fragments::SetPacketSize(), SetTimeout(), and ns3::SixLowPanNetDevice::Fragments::SetTimeoutIter().
Referenced by ReceiveFromDevice().
|
private |
Receives all the packets from a NetDevice for further processing.
[in] | device | The NetDevice the packet ws received from. |
[in] | packet | The received packet. |
[in] | protocol | The protocol (if known). |
[in] | source | The source address. |
[in] | destination | The destination address. |
[in] | packetType | The packet kind (e.g., HOST, BROADCAST, etc.). |
Definition at line 198 of file sixlowpan-net-device.cc.
References ns3::Packet::AddHeader(), ns3::Mac16Address::ConvertFrom(), ns3::Packet::Copy(), ns3::Packet::CopyData(), DecompressLowPanHc1(), DecompressLowPanIphc(), DROP_DISALLOWED_COMPRESSION, DROP_SATETFUL_DECOMPRESSION_PROBLEM, DROP_UNKNOWN_EXTENSION, Get16MacFrom48Mac(), ns3::SixLowPanDispatch::GetDispatchType(), ns3::SixLowPanMesh::GetFinalDst(), ns3::SixLowPanMesh::GetHopsLeft(), GetIfIndex(), ns3::SixLowPanMesh::GetOriginator(), ns3::SixLowPanBc0::GetSequenceNumber(), ns3::Packet::GetSize(), ns3::RandomVariableStream::GetValue(), ns3::Mac16Address::IsBroadcast(), ns3::Mac16Address::IsMatchingType(), ns3::Mac48Address::IsMatchingType(), ns3::Mac16Address::IsMulticast(), ns3::Callback< R, UArgs >::IsNull(), ns3::SixLowPanDispatch::LOWPAN_BC0, ns3::SixLowPanDispatch::LOWPAN_FRAG1, ns3::SixLowPanDispatch::LOWPAN_FRAGN, ns3::SixLowPanDispatch::LOWPAN_HC1, ns3::SixLowPanDispatch::LOWPAN_IPHC, ns3::SixLowPanDispatch::LOWPAN_IPv6, ns3::SixLowPanDispatch::LOWPAN_MESH, m_dropTrace, m_meshCacheLength, m_meshUnderJitter, m_netDevice, m_promiscRxCallback, m_rxCallback, m_rxTrace, m_seenPkts, m_useIphc, ns3::MilliSeconds(), NS_ABORT_MSG_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ProcessFragment(), ns3::Ipv6L3Protocol::PROT_NUMBER, ns3::Packet::RemoveHeader(), ns3::Simulator::Schedule(), ns3::NetDevice::Send(), and ns3::SixLowPanMesh::SetHopsLeft().
Referenced by SetNetDevice().
void ns3::SixLowPanNetDevice::RemoveContext | ( | uint8_t | contextId | ) |
Remove a context used in IPHC stateful compression.
[in] | contextId | context id (most be between 0 and 15 included). |
Definition at line 2825 of file sixlowpan-net-device.cc.
References m_contextTable, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
void ns3::SixLowPanNetDevice::RenewContext | ( | uint8_t | contextId, |
Time | validLifetime | ||
) |
Renew a context used in IPHC stateful compression.
The context will have its lifetime extended and its validity for compression re-enabled.
[in] | contextId | context id (most be between 0 and 15 included). |
[in] | validLifetime | validity time (relative to the actual time). |
Definition at line 2786 of file sixlowpan-net-device.cc.
References ns3::Time::As(), m_contextTable, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Time::S.
|
overridevirtual |
packet | packet sent from above down to Network Device |
dest | mac address of the destination (already resolved) |
protocolNumber | identifies the type of payload contained in this packet. Used to call the right L3Protocol when the packet is received. |
Called from higher layer to send packet into Network Device to the specified destination Address
Implements ns3::NetDevice.
Definition at line 550 of file sixlowpan-net-device.cc.
References DoSend(), and NS_LOG_FUNCTION.
|
overridevirtual |
packet | packet sent from above down to Network Device |
source | source mac address (so called "MAC spoofing") |
dest | mac address of the destination (already resolved) |
protocolNumber | identifies the type of payload contained in this packet. Used to call the right L3Protocol when the packet is received. |
Called from higher layer to send packet into Network Device with the specified source and destination Addresses.
Implements ns3::NetDevice.
Definition at line 561 of file sixlowpan-net-device.cc.
References DoSend(), and NS_LOG_FUNCTION.
|
overridevirtual |
Set the address of this interface.
address | address to set |
Implements ns3::NetDevice.
Definition at line 427 of file sixlowpan-net-device.cc.
References first::address, m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
|
overridevirtual |
index | ifIndex of the device |
Implements ns3::NetDevice.
Definition at line 404 of file sixlowpan-net-device.cc.
References m_ifIndex, and NS_LOG_FUNCTION.
|
overridevirtual |
mtu | MTU value, in bytes, to set for the device |
Override for default MTU defined on a per-type basis.
Implements ns3::NetDevice.
Definition at line 445 of file sixlowpan-net-device.cc.
References m_netDevice, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
Setup SixLowPan to be a proxy for the specified NetDevice.
All the packets incoming and outgoing from the NetDevice will be processed by SixLowPanNetDevice.
[in] | device | A smart pointer to the NetDevice to be proxied. |
Definition at line 144 of file sixlowpan-net-device.cc.
References m_netDevice, m_node, ns3::MakeCallback(), NS_LOG_DEBUG, NS_LOG_FUNCTION, PROT_NUMBER, ReceiveFromDevice(), and ns3::Node::RegisterProtocolHandler().
node | the node associated to this netdevice. |
This method is called from ns3::Node::AddDevice.
Implements ns3::NetDevice.
Definition at line 716 of file sixlowpan-net-device.cc.
References m_node, and NS_LOG_FUNCTION.
|
overridevirtual |
cb | callback to invoke whenever a packet has been received in promiscuous mode and must be forwarded to the higher layers. |
Enables netdevice promiscuous mode and sets the callback that will handle promiscuous mode packets. Note, promiscuous mode packets means all packets, including those packets that can be sensed by the netdevice but which are intended to be received by other hosts.
Implements ns3::NetDevice.
Definition at line 739 of file sixlowpan-net-device.cc.
References m_promiscRxCallback, and NS_LOG_FUNCTION.
|
overridevirtual |
cb | callback to invoke whenever a packet has been received and must be forwarded to the higher layers. |
Set the callback to be used to notify higher layers when a packet has been received.
Implements ns3::NetDevice.
Definition at line 732 of file sixlowpan-net-device.cc.
References m_rxCallback, and NS_LOG_FUNCTION.
|
private |
Set a new timeout "event" for a fragmented packet.
key | the fragment identification |
iif | input interface of the packet |
Definition at line 2695 of file sixlowpan-net-device.cc.
References HandleTimeout(), m_fragmentExpirationTimeout, m_timeoutEvent, m_timeoutEventList, ns3::Simulator::Now(), and ns3::Simulator::Schedule().
Referenced by ProcessFragment().
|
overridevirtual |
Implements ns3::NetDevice.
Definition at line 746 of file sixlowpan-net-device.cc.
References NS_LOG_FUNCTION.
|
private |
Serial number used in BC0 header.
Definition at line 622 of file sixlowpan-net-device.h.
Referenced by SixLowPanNetDevice(), and DoSend().
|
private |
Minimum L2 payload size.
Definition at line 636 of file sixlowpan-net-device.h.
Referenced by DoSend(), and GetTypeId().
|
private |
Table of the contexts used in compression/decompression.
Definition at line 652 of file sixlowpan-net-device.h.
Referenced by AddContext(), CompressLowPanIphc(), DecompressLowPanIphc(), FindMulticastCompressionContext(), FindUnicastCompressionContext(), GetContext(), InvalidateContext(), RemoveContext(), and RenewContext().
|
private |
Callback to trace drop packets.
Data passed:
Ptr<SixLowPanNetDevice>
argument is deprecated and will be changed to Ptr<const SixLowPanNetDevice>
in a future release. Definition at line 350 of file sixlowpan-net-device.h.
Referenced by DecompressLowPanNhc(), GetTypeId(), HandleFragmentsTimeout(), ProcessFragment(), and ReceiveFromDevice().
|
private |
Time limit for fragment rebuilding.
Definition at line 611 of file sixlowpan-net-device.h.
Referenced by GetTypeId(), and SetTimeout().
|
private |
How many packets can be rebuilt at the same time.
Some real implementation do limit this. Zero means no limit.
Definition at line 617 of file sixlowpan-net-device.h.
Referenced by GetTypeId(), and ProcessFragment().
|
private |
Fragments hold to be rebuilt.
Definition at line 610 of file sixlowpan-net-device.h.
Referenced by ns3::SixLowPanNetDevice::Fragments::AddFragment(), DoDispose(), ns3::SixLowPanNetDevice::Fragments::GetFragments(), ns3::SixLowPanNetDevice::Fragments::GetPacket(), HandleFragmentsTimeout(), ns3::SixLowPanNetDevice::Fragments::IsEntire(), and ProcessFragment().
|
private |
Interface index.
Definition at line 632 of file sixlowpan-net-device.h.
Referenced by GetIfIndex(), and SetIfIndex().
|
private |
length of the cache for each source.
Definition at line 624 of file sixlowpan-net-device.h.
Referenced by GetTypeId(), and ReceiveFromDevice().
|
private |
Use a mesh-under routing.
Definition at line 621 of file sixlowpan-net-device.h.
Referenced by DoSend(), and GetTypeId().
|
private |
Start value for mesh-under hops left.
Definition at line 623 of file sixlowpan-net-device.h.
Referenced by DoSend(), and GetTypeId().
|
private |
Random variable for the mesh-under packet retransmission.
Definition at line 626 of file sixlowpan-net-device.h.
Referenced by AssignStreams(), GetTypeId(), and ReceiveFromDevice().
Smart pointer to the underlying NetDevice.
Definition at line 631 of file sixlowpan-net-device.h.
Referenced by SixLowPanNetDevice(), AddLinkChangeCallback(), DoDispose(), DoFragmentation(), DoSend(), GetAddress(), GetBroadcast(), GetChannel(), GetMtu(), GetMulticast(), GetNetDevice(), IsBridge(), IsBroadcast(), IsLinkUp(), IsMulticast(), IsPointToPoint(), NeedsArp(), ReceiveFromDevice(), SetAddress(), SetMtu(), and SetNetDevice().
Smart pointer to the Node.
Definition at line 630 of file sixlowpan-net-device.h.
Referenced by DoDispose(), DoSend(), GetNode(), SetNetDevice(), and SetNode().
|
private |
Omit UDP checksum in NC1 encoding.
Definition at line 634 of file sixlowpan-net-device.h.
Referenced by CompressLowPanIphc(), CompressLowPanNhc(), and GetTypeId().
|
private |
The callback used to notify higher layers that a packet has been received in promiscuous mode.
Definition at line 310 of file sixlowpan-net-device.h.
Referenced by ReceiveFromDevice(), and SetPromiscReceiveCallback().
|
private |
Rng for the fragments tag.
Definition at line 638 of file sixlowpan-net-device.h.
Referenced by SixLowPanNetDevice(), AssignStreams(), and DoFragmentation().
|
private |
The callback used to notify higher layers that a packet has been received.
Definition at line 304 of file sixlowpan-net-device.h.
Referenced by ReceiveFromDevice(), and SetReceiveCallback().
|
private |
Callback to trace RX (reception) packets.
Data passed:
Ptr<SixLowPanNetDevice>
argument is deprecated and will be changed to Ptr<const SixLowPanNetDevice>
in a future release. Definition at line 336 of file sixlowpan-net-device.h.
Referenced by GetTypeId(), and ReceiveFromDevice().
Seen packets, memorized by OriginatorAddress, SequenceNumber.
Definition at line 628 of file sixlowpan-net-device.h.
Referenced by ReceiveFromDevice().
|
private |
Event for the next scheduled timeout.
Definition at line 464 of file sixlowpan-net-device.h.
Referenced by DoDispose(), HandleTimeout(), and SetTimeout().
|
private |
Timeout "events" container.
Definition at line 462 of file sixlowpan-net-device.h.
Referenced by DoDispose(), HandleTimeout(), ProcessFragment(), and SetTimeout().
|
private |
Callback to trace TX (transmission) packets.
Data passed:
Ptr<SixLowPanNetDevice>
argument is deprecated and will be changed to Ptr<const SixLowPanNetDevice>
in a future release. Definition at line 323 of file sixlowpan-net-device.h.
Referenced by DoSend(), and GetTypeId().
|
private |
Use IPHC or HC1.
Definition at line 619 of file sixlowpan-net-device.h.
Referenced by DoSend(), GetTypeId(), and ReceiveFromDevice().
|
staticconstexpr |
The protocol number for 6LoWPAN (0xA0ED) - see RFC 7973.
Definition at line 91 of file sixlowpan-net-device.h.
Referenced by DoSend(), and SetNetDevice().