nl:: Inet:: UDPEndPoint
#include <src/inet/UDPEndPoint.h>
Objects of this class represent UDP transport endpoints.
Summary
Nest Inet Layer encapsulates methods for interacting with UDP transport endpoints (SOCK_DGRAM sockets on Linux and BSD-derived systems) or LwIP UDP protocol control blocks, as the system is configured accordingly.
Inheritance
Inherits from: nl::Inet::IPEndPointBasis
Public functions |
|
---|---|
Bind(IPAddressType addrType, IPAddress addr, uint16_t port, InterfaceId intfId)
|
Bind the endpoint to an interface IP address.
|
BindInterface(IPAddressType addrType, InterfaceId intf)
|
Bind the endpoint to a network interface.
|
Close(void)
|
void
Close the endpoint.
|
Free(void)
|
void
Close the endpoint and recycle its memory.
|
GetBoundInterface(void)
|
InterfaceId
Get the bound interface on this endpoint.
|
GetBoundPort(void)
|
uint16_t
|
Listen(void)
|
Prepare the endpoint to receive UDP messages.
|
SendMsg(const IPPacketInfo *pktInfo, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
|
Send a UDP message to a specified destination.
|
SendTo(IPAddress addr, uint16_t port, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
|
A synonym for
SendTo(addr, port, INET_NULL_INTERFACEID, msg, sendFlags) . |
SendTo(IPAddress addr, uint16_t port, InterfaceId intfId, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
|
Send a UDP message to the specified destination address.
|
Public functions
Bind
INET_ERROR Bind( IPAddressType addrType, IPAddress addr, uint16_t port, InterfaceId intfId )
Bind the endpoint to an interface IP address.
Binds the endpoint to the specified network interface IP address.
Details | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||||
Return Values |
|
On LwIP, this method must not be called with the LwIP stack lock already acquired.
BindInterface
INET_ERROR BindInterface( IPAddressType addrType, InterfaceId intf )
Bind the endpoint to a network interface.
Binds the endpoint to the specified network interface IP address.
Details | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||
Return Values |
|
On LwIP, this method must not be called with the LwIP stack lock already acquired.
Close
void Close( void )
Close the endpoint.
If mState != kState_Closed
, then closes the endpoint, removing it from the set of endpoints eligible for communication events.
On LwIP systems, this method must not be called with the LwIP stack lock already acquired.
Free
void Free( void )
Close the endpoint and recycle its memory.
Invokes the Close
method, then invokes the InetLayerBasis::Release
method to return the object to its memory pool.
On LwIP systems, this method must not be called with the LwIP stack lock already acquired.
GetBoundInterface
InterfaceId GetBoundInterface( void )
Get the bound interface on this endpoint.
Details | |
---|---|
Returns |
InterfaceId The bound interface id.
|
GetBoundPort
uint16_t GetBoundPort( void )
Listen
INET_ERROR Listen( void )
Prepare the endpoint to receive UDP messages.
If State
is already kState_Listening
, then no operation is performed, otherwise the mState
is set to kState_Listening
and the endpoint is prepared to received UDP messages, according to the semantics of the platform.
Details | |||||
---|---|---|---|---|---|
Return Values |
|
On LwIP, this method must not be called with the LwIP stack lock already acquired
SendMsg
INET_ERROR SendMsg( const IPPacketInfo *pktInfo, Weave::System::PacketBuffer *msg, uint16_t sendFlags )
Send a UDP message to a specified destination.
Send the UDP message in \c msg to the destination address and port given in \c pktInfo. If \c pktInfo contains an interface id, the message will be sent over the specified interface. If \c pktInfo contains a source address, the given address will be used as the source of the UDP message. Where (sendFlags & kSendFlag_RetainBuffer) != 0, calls Weave::System::PacketBuffer::Free on behalf of the caller, otherwise this method deep-copies \c msg into a fresh object, and queues that for transmission, leaving the original \c msg available after return.
Details | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||
Return Values |
|
SendTo
INET_ERROR SendTo( IPAddress addr, uint16_t port, Weave::System::PacketBuffer *msg, uint16_t sendFlags )
A synonym for SendTo(addr, port, INET_NULL_INTERFACEID, msg, sendFlags)
.
SendTo
INET_ERROR SendTo( IPAddress addr, uint16_t port, InterfaceId intfId, Weave::System::PacketBuffer *msg, uint16_t sendFlags )
Send a UDP message to the specified destination address.
If possible, then this method sends the UDP message \c msg to the destination \c addr (with \c intfId used as the scope identifier for IPv6 link-local destinations) and \c port with the transmit option flags encoded in \c sendFlags. Where (sendFlags & kSendFlag_RetainBuffer) != 0, calls Weave::System::PacketBuffer::Free on behalf of the caller, otherwise this method deep-copies \c msg into a fresh object, and queues that for transmission, leaving the original \c msg available after return.
Details | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||
Return Values |
|