|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
20 #ifndef UDP_SOCKET_IMPL_H
21 #define UDP_SOCKET_IMPL_H
25 #include "ns3/callback.h"
26 #include "ns3/traced-callback.h"
27 #include "ns3/socket.h"
29 #include "ns3/ipv4-address.h"
30 #include "ns3/udp-socket.h"
31 #include "ns3/ipv4-interface.h"
97 virtual int Bind (
void);
98 virtual int Bind6 (
void);
100 virtual int Close (
void);
104 virtual int Listen (
void);
222 void ForwardIcmp (
Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo);
233 void ForwardIcmp6 (
Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo);
a unique identifier for an interface.
UdpSocketImpl()
Create an unbound udp socket.
Ipv6EndPoint * m_endPoint6
the IPv6 endpoint
virtual void SetIpMulticastLoop(bool loop)
Set the IP multicast loop capability.
int32_t m_ipMulticastIf
Multicast Interface.
API to create UDP socket instances.
virtual void SetRcvBufSize(uint32_t size)
Set the receiving buffer size.
virtual int GetSockName(Address &address) const
Get socket address.
void ForwardIcmp6(Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
Called by the L3 protocol when it received an ICMPv6 packet to pass on to TCP.
TracedCallback< Ptr< const Packet > > m_dropTrace
Trace for dropped packets.
SocketErrno
Enumeration of the possible errors returned by a socket.
virtual uint32_t GetTxAvailable(void) const
Returns the number of bytes which can be sent in a single call to Send.
bool m_ipMulticastLoop
Allow multicast loop.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< void, Ipv4Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback
ICMP callback.
A representation of an IPv6 endpoint/connection.
uint32_t m_rcvBufSize
Receive buffer size.
Ptr< Packet > Recv(void)
Read a single packet from the socket.
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)
Read a single packet from the socket and retrieve the sender address.
bool m_shutdownRecv
Receive no longer allowed.
bool m_connected
Connection established.
virtual void SetMtuDiscover(bool discover)
Set the MTU discover capability.
virtual int GetPeerName(Address &address) const
Get the peer address of a connected socket.
virtual bool GetIpMulticastLoop(void) const
Get the IP multicast loop capability.
virtual int Close(void)
Close a socket.
bool m_shutdownSend
Send no longer allowed.
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
void ForwardUp(Ptr< Packet > packet, Ipv4Header header, uint16_t port, Ptr< Ipv4Interface > incomingInterface)
Called by the L3 protocol when it received a packet to pass on to TCP.
bool m_allowBroadcast
Allow send broadcast packets.
Ipv4EndPoint * m_endPoint
the IPv4 endpoint
virtual enum SocketType GetSocketType(void) const
Ptr< UdpL4Protocol > m_udp
the associated UDP L4 protocol
virtual int Bind(void)
Allocate a local IPv4 endpoint for this socket.
Ipv6MulticastFilterMode
Enumeration of the possible filter of a socket.
virtual int MulticastJoinGroup(uint32_t interfaceIndex, const Address &groupAddress)
Corresponds to socket option MCAST_JOIN_GROUP.
uint16_t m_defaultPort
Default port.
virtual int Listen(void)
Listen for incoming connections.
virtual bool GetAllowBroadcast() const
Query whether broadcast datagram transmissions are allowed.
Ptr< Node > m_node
the associated node
void SetNode(Ptr< Node > node)
Set the associated node.
Address m_defaultAddress
Default address.
(abstract) base class of all UdpSockets
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
a polymophic address class
virtual bool GetMtuDiscover(void) const
Get the MTU discover capability.
virtual void Ipv6JoinGroup(Ipv6Address address, Socket::Ipv6MulticastFilterMode filterMode, std::vector< Ipv6Address > sourceAddresses)
Joins a IPv6 multicast group.
void ForwardIcmp(Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo)
Called by the L3 protocol when it received an ICMP packet to pass on to TCP.
virtual int Bind6(void)
Allocate a local IPv6 endpoint for this socket.
void Destroy6(void)
Kill this socket by zeroing its attributes (IPv6)
SocketType
Enumeration of the possible socket types.
virtual enum SocketErrno GetErrno(void) const
Get last error number.
virtual int ShutdownRecv(void)
bool m_mtuDiscover
Allow MTU discovery.
virtual void SetIpMulticastTtl(uint8_t ipTtl)
Set the IP multicast TTL.
void SetUdp(Ptr< UdpL4Protocol > udp)
Set the associated UDP L4 protocol.
std::queue< std::pair< Ptr< Packet >, Address > > m_deliveryQueue
Queue for incoming packets.
void DeallocateEndPoint(void)
Deallocate m_endPoint and m_endPoint6.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &address)
Send data to a specified peer.
A sockets interface to UDP.
uint8_t m_ipMulticastTtl
Multicast TTL.
int DoSendTo(Ptr< Packet > p, Ipv4Address daddr, uint16_t dport, uint8_t tos)
Send a packet to a specific destination and port (IPv4)
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
virtual bool SetAllowBroadcast(bool allowBroadcast)
Configure whether broadcast datagram transmissions are allowed.
enum SocketErrno m_errno
Socket error code.
virtual int32_t GetIpMulticastIf(void) const
Get the IP multicast interface.
Callback< void, Ipv6Address, uint8_t, uint8_t, uint8_t, uint32_t > m_icmpCallback6
ICMPv6 callback.
virtual uint32_t GetRcvBufSize(void) const
Get the receiving buffer size.
Forward calls to a chain of Callback.
int DoSend(Ptr< Packet > p)
Send a packet.
static TypeId GetTypeId(void)
Get the type ID.
void ForwardUp6(Ptr< Packet > packet, Ipv6Header header, uint16_t port, Ptr< Ipv6Interface > incomingInterface)
Called by the L3 protocol when it received a packet to pass on to TCP.
virtual void SetIpMulticastIf(int32_t ipIf)
Set the IP multicast interface.
int FinishBind(void)
Finish the binding process.
void Destroy(void)
Kill this socket by zeroing its attributes (IPv4)
virtual int Send(Ptr< Packet > p, uint32_t flags)
Send data (or dummy data) to the remote host.
virtual int MulticastLeaveGroup(uint32_t interfaceIndex, const Address &groupAddress)
Corresponds to socket option MCAST_LEAVE_GROUP.
A representation of an internet endpoint/connection.
virtual uint32_t GetRxAvailable(void) const
Return number of bytes which can be returned from one or multiple calls to Recv.
virtual int ShutdownSend(void)
virtual Ptr< Node > GetNode(void) const
Return the node this socket is associated with.
uint32_t m_rxAvailable
Number of available bytes to be received.
virtual uint8_t GetIpMulticastTtl(void) const
Get the IP multicast TTL.