ns3::UdpL4Protocol Class Reference
[Udp]

Implementation of the UDP protocol. More...

#include <udp-l4-protocol.h>

Inheritance diagram for ns3::UdpL4Protocol:
Inheritance graph
[legend]
Collaboration diagram for ns3::UdpL4Protocol:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UdpL4Protocol ()
virtual ~UdpL4Protocol ()
void SetNode (Ptr< Node > node)
virtual int GetProtocolNumber (void) const
Ptr< SocketCreateSocket (void)
Ipv4EndPointAllocate (void)
Ipv4EndPointAllocate (Ipv4Address address)
Ipv4EndPointAllocate (uint16_t port)
Ipv4EndPointAllocate (Ipv4Address address, uint16_t port)
Ipv4EndPointAllocate (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< Nodem_node
Ipv4EndPointDemuxm_endPoints
bool m_calcChecksum

Detailed Description

Implementation of the UDP protocol.

Definition at line 40 of file udp-l4-protocol.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

Ipv4EndPoint * ns3::UdpL4Protocol::Allocate ( Ipv4Address  localAddress,
uint16_t  localPort,
Ipv4Address  peerAddress,
uint16_t  peerPort 
)
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate ( Ipv4Address  address,
uint16_t  port 
)
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate ( uint16_t  port  ) 
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate ( Ipv4Address  address  ) 
Ipv4EndPoint * ns3::UdpL4Protocol::Allocate ( void   ) 
Ptr< Socket > ns3::UdpL4Protocol::CreateSocket ( void   ) 
Returns:
A smart Socket pointer to a UdpSocket, allocated by this instance of the UDP protocol

Definition at line 96 of file udp-l4-protocol.cc.

References m_node, and NS_LOG_FUNCTION_NOARGS.

void ns3::UdpL4Protocol::DeAllocate ( Ipv4EndPoint endPoint  ) 
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]
Returns:
the protocol number of this protocol.

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:

  • CalcChecksum: If true, we calculate the checksum of outgoing packets and verify the checksum of incoming packets.
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: construct write read

Attributes defined in parent class ns3::Ipv4L4Protocol:

  • ProtocolNumber: The Ipv4 protocol number.

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]
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.

Parameters:
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.

Parameters:
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().

void ns3::UdpL4Protocol::SetNode ( Ptr< Node node  ) 

Definition at line 70 of file udp-l4-protocol.cc.

References m_node.


Member Data Documentation

Definition at line 112 of file udp-l4-protocol.h.

Referenced by GetTypeId(), Receive(), and Send().

Definition at line 111 of file udp-l4-protocol.h.

Referenced by Allocate(), DeAllocate(), DoDispose(), Receive(), and ReceiveIcmp().

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().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:11:52 2009 for NS-3 by  doxygen 1.6.3