ns-3
|
Dsr Routing base. More...
#include <dsr-routing.h>
Public Member Functions | |
DsrRouting () | |
Constructor. | |
virtual | ~DsrRouting () |
Destructor. | |
Ptr< Node > | GetNode () const |
Get the node. | |
void | SetNode (Ptr< Node > node) |
Set the node. | |
void | SetRouteCache (Ptr< dsr::RouteCache > r) |
Set the route cache. | |
Ptr< dsr::RouteCache > | GetRouteCache () const |
Get the route cache. | |
void | SetRequestTable (Ptr< dsr::RreqTable > r) |
Set the node. | |
Ptr< dsr::RreqTable > | GetRequestTable () const |
Get the request table. | |
uint16_t | GetIDfromIP (Ipv4Address address) |
Get the node id from ip address. | |
Ipv4Address | GetIPfromID (uint16_t id) |
Get the ip address from id. | |
Ipv4Address | GetIPfromMAC (Mac48Address address) |
Get the Ip address from mac address. | |
void | PrintVector (std::vector< Ipv4Address > &vec) |
Print the route vector. | |
Ipv4Address | SearchNextHop (Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec) |
Get the next hop of the route. | |
int | GetProtocolNumber (void) const |
Get the dsr protocol number. | |
void | SendBuffTimerExpire () |
The send buffer timer expire. | |
void | CheckSendBuffer () |
Check the send buffer of packets with route when send buffer timer expire. | |
void | PacketNewRoute (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol) |
When route vector corrupted, originate a new packet, normally not happening. | |
Ptr< Ipv4Route > | SetRoute (Ipv4Address nextHop, Ipv4Address srcAddress) |
uint32_t | GetPriority (DsrMessageType messageType) |
void | SendUnreachError (Ipv4Address errorHop, Ipv4Address destination, Ipv4Address originalDst, uint8_t salvage, uint8_t protocol) |
void | ForwardErrPacket (DsrOptionRerrUnreachHeader &rerr, DsrOptionSRHeader &sourceRoute, Ipv4Address nextHop, uint8_t protocol, Ptr< Ipv4Route > route) |
void | Send (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t protocol, Ptr< Ipv4Route > route) |
uint16_t | AddAckReqHeader (Ptr< Packet > &packet, Ipv4Address nextHop) |
void | SendPacket (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, uint8_t protocol) |
void | Scheduler (uint32_t priority) |
void | PriorityScheduler (uint32_t priority, bool continueWithFirst) |
void | IncreaseRetransTimer () |
bool | SendRealDown (DsrNetworkQueueEntry &newEntry) |
void | SendPacketFromBuffer (DsrOptionSRHeader const &sourceRoute, Ipv4Address nextHop, uint8_t protocol) |
bool | FindSamePackets (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, uint8_t segsLeft) |
void | CallCancelPacketTimer (uint16_t ackId, Ipv4Header const &ipv4Header, Ipv4Address realSrc, Ipv4Address realDst) |
void | CancelNetworkPacketTimer (MaintainBuffEntry &mb) |
void | CancelPassivePacketTimer (MaintainBuffEntry &mb) |
void | CancelPacketTimerNextHop (Ipv4Address nextHop, uint8_t protocol) |
void | SalvagePacket (Ptr< const Packet > packet, Ipv4Address source, Ipv4Address dst, uint8_t protocol) |
void | SchedulePassivePacketRetry (MaintainBuffEntry &mb, bool onlyPassive, uint8_t protocol) |
void | ScheduleNetworkPacketRetry (MaintainBuffEntry &mb, bool isFirst, uint8_t protocol) |
void | NetworkScheduleTimerExpire (MaintainBuffEntry &mb, uint8_t protocol) |
void | PassiveScheduleTimerExpire (MaintainBuffEntry &mb, bool onlyPassive, uint8_t protocol) |
void | ForwardPacket (Ptr< const Packet > packet, DsrOptionSRHeader &sourceRoute, Ipv4Header const &ipv4Header, Ipv4Address source, Ipv4Address destination, Ipv4Address targetAddress, uint8_t protocol, Ptr< Ipv4Route > route) |
void | SendInitialRequest (Ipv4Address source, Ipv4Address destination, uint8_t protocol) |
void | SendErrorRequest (DsrOptionRerrUnreachHeader &rerr, uint8_t protocol) |
void | SendRequestAndIncrement (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination) |
void | SendRequest (Ptr< Packet > packet, Ipv4Address source) |
void | ScheduleInterRequest (Ptr< Packet > packet) |
void | SendGratuitousReply (Ipv4Address replyTo, Ipv4Address replyFrom, std::vector< Ipv4Address > &nodeList, uint8_t protocol) |
void | SendReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, Ptr< Ipv4Route > route) |
void | ScheduleInitialReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address nextHop, Ptr< Ipv4Route > route) |
void | ScheduleCachedReply (Ptr< Packet > packet, Ipv4Address source, Ipv4Address destination, Ptr< Ipv4Route > route, double hops) |
void | SendAck (uint16_t ackId, Ipv4Address destination, Ipv4Address realSrc, Ipv4Address realDst, uint8_t protocol, Ptr< Ipv4Route > route) |
Ptr< Node > | GetNodeWithAddress (Ipv4Address ipv4Address) |
virtual enum IpL4Protocol::RxStatus | Receive (Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface) |
virtual enum IpL4Protocol::RxStatus | Receive (Ptr< Packet > p, Ipv6Address &src, Ipv6Address &dst, Ptr< Ipv6Interface > incomingInterface) |
void | SetDownTarget (IpL4Protocol::DownTargetCallback callback) |
void | SetDownTarget6 (IpL4Protocol::DownTargetCallback6 callback) |
IpL4Protocol::DownTargetCallback | GetDownTarget (void) const |
IpL4Protocol::DownTargetCallback6 | GetDownTarget6 (void) const |
uint8_t | GetExtensionNumber () const |
Get the extension number. | |
uint8_t | Process (Ptr< Packet > &packet, Ipv4Header const &ipv4Header, Ipv4Address dst, uint8_t *nextHeader, uint8_t protocol, bool &isDropped) |
Process method Called from Ipv4L3Protocol::Receive. | |
void | Insert (Ptr< dsr::DsrOptions > option) |
Insert a new Dsr Option. | |
Ptr< dsr::DsrOptions > | GetOption (int optionNumber) |
Get the option corresponding to optionNumber. | |
void | CancelRreqTimer (Ipv4Address dst, bool isRemove) |
Cancel the route request timer. | |
void | ScheduleRreqRetry (Ptr< Packet > packet, std::vector< Ipv4Address > address, bool nonProp, uint32_t requestId, uint8_t protocol) |
Schedule the route request retry. | |
void | RouteRequestTimerExpire (Ptr< Packet > packet, std::vector< Ipv4Address > address, uint32_t requestId, uint8_t protocol) |
bool | IsLinkCache () |
used to direct to route cache | |
void | UseExtends (RouteCacheEntry::IP_VECTOR rt) |
bool | LookupRoute (Ipv4Address id, RouteCacheEntry &rt) |
bool | AddRoute_Link (RouteCacheEntry::IP_VECTOR nodelist, Ipv4Address source) |
bool | AddRoute (RouteCacheEntry &rt) |
void | DeleteAllRoutesIncludeLink (Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node) |
bool | UpdateRouteEntry (Ipv4Address dst) |
![]() | |
virtual void | ReceiveIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, Ipv4Address payloadSource, Ipv4Address payloadDestination, const uint8_t payload[8]) |
virtual void | ReceiveIcmp (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, Ipv6Address payloadSource, Ipv6Address payloadDestination, const uint8_t payload[8]) |
![]() | |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Dispose (void) |
void | AggregateObject (Ptr< Object > other) |
AggregateIterator | GetAggregateIterator (void) const |
![]() | |
SimpleRefCount (const SimpleRefCount &o) | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
uint32_t | GetReferenceCount (void) const |
![]() | |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type identificator. |
Static Public Attributes | |
static const uint8_t | PROT_NUMBER = 48 |
Define the dsr protocol number. |
Protected Member Functions | |
virtual void | NotifyNewAggregate () |
virtual void | DoDispose (void) |
Drop trace callback. |
Protected Attributes | |
TracedCallback< Ptr< const Packet > > | m_dropTrace |
TracedCallback< const DsrOptionSRHeader & > | m_txPacketTrace |
Additional Inherited Members | |
![]() | |
enum | RxStatus { RX_OK, RX_CSUM_FAILED, RX_ENDPOINT_CLOSED, RX_ENDPOINT_UNREACH } |
typedef Callback< void, Ptr < Packet >, Ipv4Address, Ipv4Address, uint8_t, Ptr < Ipv4Route > > | DownTargetCallback |
typedef Callback< void, Ptr < Packet >, Ipv6Address, Ipv6Address, uint8_t, Ptr < Ipv6Route > > | DownTargetCallback6 |
Dsr Routing base.
void ns3::dsr::DsrRouting::CancelRreqTimer | ( | Ipv4Address | dst, |
bool | isRemove | ||
) |
Cancel the route request timer.
dst | The dst address of the route request timer |
isRemove | whether to remove the route request entry or not |
References NS_LOG_DEBUG, and NS_LOG_FUNCTION.
|
virtual |
This method allows a caller to get the current down target callback set for this L4 protocol, for
Implements ns3::IpL4Protocol.
uint8_t ns3::dsr::DsrRouting::GetExtensionNumber | ( | ) | const |
Get the extension number.
uint16_t ns3::dsr::DsrRouting::GetIDfromIP | ( | Ipv4Address | address | ) |
Get the node id from ip address.
References ns3::Ipv4::GetAddress(), ns3::NodeList::GetNNodes(), GetNode(), and ns3::Object::GetObject().
Referenced by CheckSendBuffer(), PacketNewRoute(), and SendGratuitousReply().
Ipv4Address ns3::dsr::DsrRouting::GetIPfromID | ( | uint16_t | id | ) |
Get the ip address from id.
References ns3::Ipv4::GetAddress(), GetNode(), ns3::Object::GetObject(), and NS_LOG_DEBUG.
Referenced by Receive().
Ipv4Address ns3::dsr::DsrRouting::GetIPfromMAC | ( | Mac48Address | address | ) |
Get the Ip address from mac address.
References ns3::Ipv4::GetAddress(), ns3::Ipv4::GetNetDevice(), ns3::NodeList::GetNNodes(), GetNode(), ns3::Object::GetObject(), and NS_LOG_FUNCTION.
Get the node.
References NS_LOG_FUNCTION_NOARGS.
Referenced by GetIDfromIP(), GetIPfromID(), GetIPfromMAC(), and Receive().
Ptr< dsr::DsrOptions > ns3::dsr::DsrRouting::GetOption | ( | int | optionNumber | ) |
Get the option corresponding to optionNumber.
optionNumber | the option number of the option to retrieve |
Referenced by Receive().
|
virtual |
Get the dsr protocol number.
Implements ns3::IpL4Protocol.
References PROT_NUMBER.
Ptr< dsr::RreqTable > ns3::dsr::DsrRouting::GetRequestTable | ( | ) | const |
Ptr< dsr::RouteCache > ns3::dsr::DsrRouting::GetRouteCache | ( | ) | const |
|
static |
Get the type identificator.
This method returns the TypeId associated to ns3::dsr::DsrRouting.
Attributes defined for this type:
Attributes defined in parent class ns3::IpL4Protocol:
TraceSources defined for this type:
Reimplemented from ns3::IpL4Protocol.
References GetRequestTable(), GetRouteCache(), ns3::MakeTraceSourceAccessor(), ns3::MilliSeconds(), ns3::Seconds(), ns3::TypeId::SetParent(), SetRequestTable(), and SetRouteCache().
void ns3::dsr::DsrRouting::Insert | ( | Ptr< dsr::DsrOptions > | option | ) |
|
protectedvirtual |
This method is invoked whenever two sets of objects are aggregated together. It is invoked exactly once for each object in both sets. This method can be overriden by subclasses who wish to be notified of aggregation events. These subclasses must chain up to their base class NotifyNewAggregate method. It is safe to call GetObject and AggregateObject from within this method.
This function must be implemented in the stack that needs to notify other stacks connected to the node of their presence in the node.
Reimplemented from ns3::Object.
References ns3::Object::GetObject(), ns3::Ipv4L3Protocol::Insert(), ns3::MakeCallback(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), ns3::Ipv4L3Protocol::Send(), SetDownTarget(), and SetNode().
uint8_t ns3::dsr::DsrRouting::Process | ( | Ptr< Packet > & | packet, |
Ipv4Header const & | ipv4Header, | ||
Ipv4Address | dst, | ||
uint8_t * | nextHeader, | ||
uint8_t | protocol, | ||
bool & | isDropped | ||
) |
Process method Called from Ipv4L3Protocol::Receive.
packet | the packet |
offset | the offset of the extension to process |
dst | destination address of the packet received (i.e. us) |
nextHeader | the next header |
isDropped | if the packet must be dropped |
|
virtual |
p | packet to forward up |
header | IPv4 Header information |
incomingInterface | the Ipv4Interface on which the packet arrived |
Called from lower-level layers to send the packet up in the stack.
Implements ns3::IpL4Protocol.
References ns3::Packet::Copy(), ns3::Packet::CopyData(), ns3::dsr::RreqTable::FindUnidirectional(), ns3::Ipv4Header::GetDestination(), ns3::dsr::DsrOptionField::GetDsrOptionsOffset(), GetIPfromID(), ns3::dsr::DsrFsHeader::GetNextHeader(), GetNode(), ns3::Object::GetObject(), GetOption(), ns3::Ipv4L3Protocol::GetProtocol(), ns3::Packet::GetSize(), ns3::Ipv4Header::GetSource(), ns3::dsr::DsrFsHeader::GetSourceId(), ns3::Ipv4Address::IsBroadcast(), ns3::Ipv4Address::IsMulticast(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ns3::Packet::RemoveAtStart(), ns3::Packet::RemoveHeader(), ns3::dsr::DsrOptionRerrUnsupportHeader::SetErrorDst(), ns3::dsr::DsrOptionRerrUnsupportHeader::SetErrorSrc(), ns3::dsr::DsrOptionRerrHeader::SetErrorType(), ns3::dsr::DsrOptionRerrUnsupportHeader::SetSalvage(), and ns3::dsr::DsrOptionRerrUnsupportHeader::SetUnsupported().
|
virtual |
p | packet to forward up |
src | source IPv6 address |
dst | destination IPv6 address |
incomingInterface | the Ipv6Interface on which the packet arrived |
Called from lower-level layers to send the packet up in the stack. Not implemented (IPv6).
Implements ns3::IpL4Protocol.
References NS_LOG_FUNCTION.
void ns3::dsr::DsrRouting::ScheduleRreqRetry | ( | Ptr< Packet > | packet, |
std::vector< Ipv4Address > | address, | ||
bool | nonProp, | ||
uint32_t | requestId, | ||
uint8_t | protocol | ||
) |
Schedule the route request retry.
dst | The dst address of the route request |
References ns3::Timer::CANCEL_ON_DESTROY, ns3::Time::GetSeconds(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Ipv4Address ns3::dsr::DsrRouting::SearchNextHop | ( | Ipv4Address | ipv4Address, |
std::vector< Ipv4Address > & | vec | ||
) |
Get the next hop of the route.
References NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by CheckSendBuffer(), and PacketNewRoute().
void ns3::dsr::DsrRouting::SendGratuitousReply | ( | Ipv4Address | replyTo, |
Ipv4Address | replyFrom, | ||
std::vector< Ipv4Address > & | nodeList, | ||
uint8_t | protocol | ||
) |
Push back the node addresses other than those between srcAddress and our own ip address
References ns3::dsr::DsrOptionField::AddDsrOption(), ns3::Packet::AddHeader(), GetIDfromIP(), ns3::dsr::DsrOptionHeader::GetLength(), ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, ns3::dsr::DsrFsHeader::SetDestId(), ns3::dsr::DsrFsHeader::SetMessageType(), ns3::dsr::DsrFsHeader::SetNextHeader(), ns3::dsr::DsrOptionRrepHeader::SetNodesAddress(), ns3::dsr::DsrFsHeader::SetPayloadLength(), and ns3::dsr::DsrFsHeader::SetSourceId().
|
virtual |
This method allows a caller to set the current down target callback set for this L4 protocol
cb | current Callback for the L4 protocol |
Implements ns3::IpL4Protocol.
Referenced by ns3::DsrHelper::Create(), and NotifyNewAggregate().
void ns3::dsr::DsrRouting::SetRequestTable | ( | Ptr< dsr::RreqTable > | r | ) |
void ns3::dsr::DsrRouting::SetRouteCache | ( | Ptr< dsr::RouteCache > | r | ) |