UDP Connection endpoint. More...
#include <I_UDPConnection.h>
Inherits Continuation.
Inherited by UDPConnectionInternal.
Public Member Functions | |
virtual | ~UDPConnection () |
SOCKET | getFd () |
void | setBinding (struct sockaddr const *) |
inkcoreapi int | getBinding (struct sockaddr *) |
void | destroy () |
int | shouldDestroy () |
Action * | send (Continuation *c, UDPPacket *p) |
Action * | recv (Continuation *c) |
void | Release () |
void | AddRef () |
int | GetRefCount () |
int | getPortNum (void) |
int | GetSendGenerationNumber () |
void | SetLastSentPktTSSeqNum (int64_t sentSeqNum) |
int64_t | cancel () |
void | setContinuation (Continuation *c) |
void | bindToThread (Continuation *c) |
Put socket on net queue for read/write polling. | |
virtual void | UDPConnection_is_abstract ()=0 |
UDP Connection endpoint.
You can schedule packet to be sent immediately or for the future, and set up a persistent receive() operation.
Definition at line 45 of file I_UDPConnection.h.
virtual UDPConnection::~UDPConnection | ( | ) | [inline, virtual] |
Definition at line 48 of file I_UDPConnection.h.
TS_INLINE void UDPConnection::AddRef | ( | ) |
Definition at line 119 of file P_UDPConnection.h.
Referenced by bindToThread(), UDPPacket::setConnection(), UDPNetProcessorInternal::udp_callback(), and UDPNetProcessorInternal::udp_read_from_net().
void UDPConnection::bindToThread | ( | Continuation * | c | ) |
Put socket on net queue for read/write polling.
Not required for UDPConnections created with UDPNetProcessor::UDPBind
Required for and UDPNetProcessor::CreateUDPSocket. They don't do bindToThread() automatically so that the sockets can be passed to other Continuations.
Definition at line 104 of file UnixUDPConnection.cc.
References AddRef(), EventProcessor::assign_thread(), UDPConnectionInternal::continuation, ET_UDP, UnixUDPConnection::ethread, eventProcessor, get_UDPNetHandler(), ink_assert, ink_atomiclist_push(), and Continuation::mutex.
Referenced by UDPNetProcessor::UDPBind().
TS_INLINE int64_t UDPConnection::cancel | ( | void | ) |
Definition at line 143 of file P_UDPConnection.h.
References UDPConnectionInternal::lastPktStartTime, UDPConnectionInternal::lastSentPktStartTime, UDPConnectionInternal::lastSentPktTSSeqNum, and UDPConnectionInternal::sendGenerationNum.
TS_INLINE void UDPConnection::destroy | ( | ) |
Definition at line 107 of file P_UDPConnection.h.
Referenced by UnixUDPConnection::callbackHandler().
TS_INLINE int UDPConnection::getBinding | ( | struct sockaddr * | s | ) |
Definition at line 99 of file P_UDPConnection.h.
References ats_ip_copy(), UDPConnectionInternal::binding, and UDPConnectionInternal::binding_valid.
TS_INLINE SOCKET UDPConnection::getFd | ( | ) |
Definition at line 85 of file P_UDPConnection.h.
Referenced by INKUDPConnFdGet(), UDPQueue::SendUDPPacket(), and UDPNetProcessorInternal::udp_read_from_net().
TS_INLINE int UDPConnection::getPortNum | ( | void | ) |
Definition at line 137 of file P_UDPConnection.h.
References ats_ip_port_host_order().
Referenced by UnixUDPConnection::~UnixUDPConnection().
TS_INLINE int UDPConnection::GetRefCount | ( | ) |
Definition at line 125 of file P_UDPConnection.h.
TS_INLINE int UDPConnection::GetSendGenerationNumber | ( | ) |
Definition at line 131 of file P_UDPConnection.h.
Referenced by PacketQueue::IsCancelledPacket(), and UDPQueue::SendPackets().
TS_INLINE Action * UDPConnection::recv | ( | Continuation * | c | ) |
Callbacks:
cont->handleEvent(NET_EVENT_DATAGRAM_ERROR, UDPConnection *) on error
cont->handleEvent(NET_EVENT_DATAGRAM_READ_READY, Queue<UDPPacketInternal> *) on incoming packets.
c | continuation to be called back |
Definition at line 102 of file P_UnixUDPConnection.h.
References UDPConnectionInternal::continuation, ink_assert, Continuation::mutex, and UDPConnectionInternal::recvActive.
Referenced by INKUDPRecvFrom().
void UDPConnection::Release | ( | ) |
Definition at line 142 of file UnixUDPConnection.cc.
References UnixUDPConnection::ep, ink_assert, UDPConnectionInternal::refcount, and EventIO::stop().
Referenced by UnixUDPConnection::callbackHandler(), UDPPacketInternal::free(), UDPNetHandler::mainNetEvent(), and UDPPacket::setConnection().
Action * UDPConnection::send | ( | Continuation * | c, | |
UDPPacket * | p | |||
) |
Callbacks:
cont->handleEvent(NET_EVENT_DATAGRAM_WRITE_ERROR, UDPPacket *) on error
no callback on success.
c | continuation to be called back | |
p | packet to be sent. |
Definition at line 119 of file UnixUDPConnection.cc.
References UDPConnectionInternal::continuation, UnixUDPConnection::ethread, UDPPacketInternal::free(), get_UDPNetHandler(), ink_assert, Continuation::mutex, UDPPacketInternal::reqGenerationNum, UDPQueue::send(), UDPConnectionInternal::sendGenerationNum, UDPPacket::setConnection(), UDPPacket::setContinuation(), shouldDestroy(), and UDPNetHandler::udpOutQueue.
Referenced by INKUDPSendTo().
TS_INLINE void UDPConnection::setBinding | ( | struct sockaddr const * | s | ) |
Definition at line 91 of file P_UDPConnection.h.
References ats_ip_copy(), UDPConnectionInternal::binding, and UDPConnectionInternal::binding_valid.
Referenced by UDPNetProcessor::UDPBind().
TS_INLINE void UDPConnection::setContinuation | ( | Continuation * | c | ) |
Definition at line 159 of file P_UDPConnection.h.
References ink_assert, and Continuation::mutex.
TS_INLINE void UDPConnection::SetLastSentPktTSSeqNum | ( | int64_t | sentSeqNum | ) |
Definition at line 153 of file P_UDPConnection.h.
TS_INLINE int UDPConnection::shouldDestroy | ( | ) |
Definition at line 113 of file P_UDPConnection.h.
Referenced by UnixUDPConnection::callbackHandler(), PacketQueue::IsCancelledPacket(), UDPNetHandler::mainNetEvent(), send(), and UDPQueue::SendPackets().
virtual void UDPConnection::UDPConnection_is_abstract | ( | ) | [pure virtual] |