Implementation of the UDP protocol. More...
#include <udp-l4-protocol.h>
Public Member Functions | |
UdpL4Protocol () | |
virtual | ~UdpL4Protocol () |
void | SetNode (Ptr< Node > node) |
virtual int | GetProtocolNumber (void) const |
Ptr< Socket > | CreateSocket (void) |
Ipv4EndPoint * | Allocate (void) |
Ipv4EndPoint * | Allocate (Ipv4Address address) |
Ipv4EndPoint * | Allocate (uint16_t port) |
Ipv4EndPoint * | Allocate (Ipv4Address address, uint16_t port) |
Ipv4EndPoint * | Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4Address peerAddress, uint16_t peerPort) |
void | DeAllocate (Ipv4EndPoint *endPoint) |
void | Send (Ptr< Packet > packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t sport, uint16_t dport) |
Send a packet via UDP. | |
virtual enum Ipv4L4Protocol::RxStatus | Receive (Ptr< Packet > p, Ipv4Address const &source, Ipv4Address const &destination, Ptr< Ipv4Interface > interface) |
Receive a packet up the protocol stack. | |
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]) |
Receive an ICMP packet. | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::UdpL4Protocol. | |
Static Public Attributes | |
static const uint8_t | PROT_NUMBER = 17 |
Protected Member Functions | |
virtual void | DoDispose (void) |
Private Attributes | |
Ptr< Node > | m_node |
Ipv4EndPointDemux * | m_endPoints |
bool | m_calcChecksum |
Implementation of the UDP protocol.
Definition at line 40 of file udp-l4-protocol.h.
ns3::UdpL4Protocol::UdpL4Protocol | ( | ) |
Definition at line 58 of file udp-l4-protocol.cc.
References NS_LOG_FUNCTION_NOARGS.
ns3::UdpL4Protocol::~UdpL4Protocol | ( | ) | [virtual] |
Definition at line 64 of file udp-l4-protocol.cc.
References NS_LOG_FUNCTION_NOARGS.
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate | ( | Ipv4Address | localAddress, | |
uint16_t | localPort, | |||
Ipv4Address | peerAddress, | |||
uint16_t | peerPort | |||
) |
Definition at line 133 of file udp-l4-protocol.cc.
References ns3::Ipv4EndPointDemux::Allocate(), m_endPoints, and NS_LOG_FUNCTION.
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate | ( | Ipv4Address | address, | |
uint16_t | port | |||
) |
Definition at line 127 of file udp-l4-protocol.cc.
References ns3::Ipv4EndPointDemux::Allocate(), m_endPoints, and NS_LOG_FUNCTION.
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate | ( | uint16_t | port | ) |
Definition at line 120 of file udp-l4-protocol.cc.
References ns3::Ipv4EndPointDemux::Allocate(), m_endPoints, and NS_LOG_FUNCTION.
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate | ( | Ipv4Address | address | ) |
Definition at line 113 of file udp-l4-protocol.cc.
References ns3::Ipv4EndPointDemux::Allocate(), m_endPoints, and NS_LOG_FUNCTION.
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate | ( | void | ) |
Definition at line 106 of file udp-l4-protocol.cc.
References ns3::Ipv4EndPointDemux::Allocate(), m_endPoints, and NS_LOG_FUNCTION_NOARGS.
Definition at line 96 of file udp-l4-protocol.cc.
References m_node, and NS_LOG_FUNCTION_NOARGS.
void ns3::UdpL4Protocol::DeAllocate | ( | Ipv4EndPoint * | endPoint | ) |
Definition at line 142 of file udp-l4-protocol.cc.
References ns3::Ipv4EndPointDemux::DeAllocate(), m_endPoints, and NS_LOG_FUNCTION.
void ns3::UdpL4Protocol::DoDispose | ( | void | ) | [protected, virtual] |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden 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.
Reimplemented from ns3::Object.
Definition at line 83 of file udp-l4-protocol.cc.
References m_endPoints, m_node, and NS_LOG_FUNCTION_NOARGS.
int ns3::UdpL4Protocol::GetProtocolNumber | ( | void | ) | const [virtual] |
Implements ns3::Ipv4L4Protocol.
Definition at line 76 of file udp-l4-protocol.cc.
References PROT_NUMBER.
TypeId ns3::UdpL4Protocol::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::UdpL4Protocol.
Attributes defined for this type:
Attributes defined in parent class ns3::Ipv4L4Protocol:
No TraceSources defined for this type.
Reimplemented from ns3::Ipv4L4Protocol.
Definition at line 44 of file udp-l4-protocol.cc.
References ns3::TypeId::AddAttribute(), m_calcChecksum, and ns3::TypeId::SetParent().
enum Ipv4L4Protocol::RxStatus ns3::UdpL4Protocol::Receive | ( | Ptr< Packet > | p, | |
Ipv4Address const & | source, | |||
Ipv4Address const & | destination, | |||
Ptr< Ipv4Interface > | interface | |||
) | [virtual] |
Receive a packet up the protocol stack.
p | The Packet to dump the contents into | |
source | The source's Ipv4Address | |
destination | The destinations Ipv4Address | |
interface | the interface from which the packet is coming. |
Implements ns3::Ipv4L4Protocol.
Definition at line 176 of file udp-l4-protocol.cc.
References ns3::UdpHeader::EnableChecksums(), ns3::UdpHeader::GetDestinationPort(), ns3::UdpHeader::GetSourcePort(), ns3::UdpHeader::InitializeChecksum(), ns3::UdpHeader::IsChecksumOk(), ns3::Ipv4EndPointDemux::Lookup(), m_calcChecksum, m_endPoints, NS_LOG_FUNCTION, NS_LOG_INFO, PROT_NUMBER, ns3::Ipv4L4Protocol::RX_CSUM_FAILED, ns3::Ipv4L4Protocol::RX_ENDPOINT_UNREACH, and ns3::Ipv4L4Protocol::RX_OK.
void ns3::UdpL4Protocol::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] |
Receive an ICMP packet.
icmpSource | The IP address of the source of the packet. | |
icmpTtl | The time to live from the IP header | |
icmpType | The type of the message from the ICMP header | |
icmpCode | The message code from the ICMP header | |
icmpInfo | 32-bit integer carrying informational value of varying semantics. | |
payloadSource | The IP source addresss from the IP header of the packet | |
payloadDestination | The IP destination address from the IP header of the packet | |
payload | Payload of the ICMP packet |
Reimplemented from ns3::Ipv4L4Protocol.
Definition at line 149 of file udp-l4-protocol.cc.
References ns3::Ipv4EndPoint::ForwardIcmp(), m_endPoints, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Ipv4EndPointDemux::SimpleLookup().
void ns3::UdpL4Protocol::Send | ( | Ptr< Packet > | packet, | |
Ipv4Address | saddr, | |||
Ipv4Address | daddr, | |||
uint16_t | sport, | |||
uint16_t | dport | |||
) |
Send a packet via UDP.
packet | The packet to send | |
saddr | The source Ipv4Address | |
daddr | The destination Ipv4Address | |
sport | The source port number | |
dport | The destination port number |
Definition at line 214 of file udp-l4-protocol.cc.
References ns3::UdpHeader::EnableChecksums(), ns3::UdpHeader::InitializeChecksum(), m_calcChecksum, m_node, NS_LOG_FUNCTION, NS_LOG_LOGIC, PROT_NUMBER, ns3::UdpHeader::SetDestinationPort(), and ns3::UdpHeader::SetSourcePort().
Definition at line 70 of file udp-l4-protocol.cc.
References m_node.
bool ns3::UdpL4Protocol::m_calcChecksum [private] |
Definition at line 112 of file udp-l4-protocol.h.
Referenced by GetTypeId(), Receive(), and Send().
Ipv4EndPointDemux* ns3::UdpL4Protocol::m_endPoints [private] |
Definition at line 111 of file udp-l4-protocol.h.
Referenced by Allocate(), DeAllocate(), DoDispose(), Receive(), and ReceiveIcmp().
Ptr<Node> ns3::UdpL4Protocol::m_node [private] |
Definition at line 110 of file udp-l4-protocol.h.
Referenced by CreateSocket(), DoDispose(), Send(), and SetNode().
const uint8_t ns3::UdpL4Protocol::PROT_NUMBER = 17 [static] |
Definition at line 43 of file udp-l4-protocol.h.
Referenced by GetProtocolNumber(), Receive(), and Send().