UDP service. More...
#include <I_UDPNet.h>
Inherits Processor.
Inherited by FakeUDPNetProcessor, and UDPNetProcessorInternal.
Public Member Functions | |
virtual int | start (int n_upd_threads, size_t stacksize)=0 |
Starts execution of the processor. | |
bool | CreateUDPSocket (int *resfd, sockaddr const *remote_addr, sockaddr *local_addr, int *local_addr_len, Action **status, int send_bufsize=0, int recv_bufsize=0) |
inkcoreapi Action * | UDPBind (Continuation *c, sockaddr const *addr, int send_bufsize=0, int recv_bufsize=0) |
create UDPConnection | |
Action * | sendto_re (Continuation *c, void *token, int fd, sockaddr const *toaddr, int toaddrlen, IOBufferBlock *buf, int len) |
Action * | sendmsg_re (Continuation *c, void *token, int fd, struct msghdr *msg) |
Action * | recvfrom_re (Continuation *c, void *token, int fd, sockaddr *fromaddr, socklen_t *fromaddrlen, IOBufferBlock *buf, int len, bool useReadCont=true, int timeout=0) |
UDP service.
You can create UDPConnections for asynchronous send/receive or call directly (inefficiently) into network layer.
Definition at line 45 of file I_UDPNet.h.
bool UDPNetProcessor::CreateUDPSocket | ( | int * | resfd, | |
sockaddr const * | remote_addr, | |||
sockaddr * | local_addr, | |||
int * | local_addr_len, | |||
Action ** | status, | |||
int | send_bufsize = 0 , |
|||
int | recv_bufsize = 0 | |||
) |
Definition at line 510 of file UnixUDPNet.cc.
References ats_ip_are_compatible(), ats_ip_nptop(), ats_ip_port_host_order(), ats_ip_size(), SocketManager::close(), Debug, INET6_ADDRPORTSTRLEN, ink_assert, SocketManager::ink_bind(), safe_fcntl(), safe_getsockname(), SocketManager::set_rcvbuf_size(), SocketManager::set_sndbuf_size(), SocketManager::socket(), socketManager, and unlikely.
Action * UDPNetProcessor::recvfrom_re | ( | Continuation * | c, | |
void * | token, | |||
int | fd, | |||
sockaddr * | fromaddr, | |||
socklen_t * | fromaddrlen, | |||
IOBufferBlock * | buf, | |||
int | len, | |||
bool | useReadCont = true , |
|||
int | timeout = 0 | |||
) |
Definition at line 406 of file UnixUDPNet.cc.
References completionUtil::create(), completionUtil::destroy(), IOBufferBlock::end(), IOBufferBlock::fill(), Continuation::handleEvent(), UDPReadContinuation::init_read(), UDPReadContinuation::init_token(), ink_assert, NET_EVENT_DATAGRAM_READ_COMPLETE, NET_EVENT_DATAGRAM_READ_ERROR, SocketManager::recvfrom(), UDPReadContinuation::set_timer(), completionUtil::setContinuation(), completionUtil::setHandle(), completionUtil::setInfo(), completionUtil::setThread(), socketManager, this_ethread(), udpReadContAllocator, and IOBufferBlock::write_avail().
Referenced by MultiCastPeer::RecvFrom_re(), and ParentSiblingPeer::RecvFrom_re().
Action * UDPNetProcessor::sendmsg_re | ( | Continuation * | c, | |
void * | token, | |||
int | fd, | |||
struct msghdr * | msg | |||
) |
Definition at line 454 of file UnixUDPNet.cc.
References completionUtil::create(), completionUtil::destroy(), Continuation::handleEvent(), NET_EVENT_DATAGRAM_WRITE_COMPLETE, NET_EVENT_DATAGRAM_WRITE_ERROR, SocketManager::sendmsg(), completionUtil::setContinuation(), completionUtil::setHandle(), completionUtil::setInfo(), completionUtil::setThread(), socketManager, and this_ethread().
Action* UDPNetProcessor::sendto_re | ( | Continuation * | c, | |
void * | token, | |||
int | fd, | |||
sockaddr const * | toaddr, | |||
int | toaddrlen, | |||
IOBufferBlock * | buf, | |||
int | len | |||
) |
Referenced by PrefetchBlaster::blastObject(), and PrefetchUrlBlaster::udpUrlBlaster().
virtual int UDPNetProcessor::start | ( | int | number_of_threads, | |
size_t | stacksize | |||
) | [pure virtual] |
Starts execution of the processor.
Attempts to start the number of threads specified for the processor, initializes their states and sets them running. On failure it returns a negative value.
number_of_threads | Positive value indicating the number of threads to spawn for the processor. | |
stacksize | The thread stack size to use for this processor. |
Reimplemented from Processor.
Implemented in UDPNetProcessorInternal.
Referenced by main().
Action * UDPNetProcessor::UDPBind | ( | Continuation * | c, | |
sockaddr const * | addr, | |||
int | send_bufsize = 0 , |
|||
int | recv_bufsize = 0 | |||
) |
create UDPConnection
Why was this implemented as an asynchronous call? Just in case Windows requires it...
Callbacks:
cont->handleEvent( NET_EVENT_DATAGRAM_OPEN, UDPConnection *) is called for new socket.
c | Continuation that is called back with newly created socket. | |
addr | Address to bind (includes port) | |
send_bufsize | (optional) Socket buffer size for sending. Limits how much outstanding data to OS before it is able to send to the NIC. | |
recv_bufsize | (optional) Socket buffer size for sending. Limits how much can be queued by OS before we read it. |
Definition at line 569 of file UnixUDPNet.cc.
References ats_ip_size(), ats_is_ip_multicast(), UDPConnection::bindToThread(), SocketManager::close(), Debug, Continuation::handleEvent(), SocketManager::ink_bind(), NET_EVENT_DATAGRAM_ERROR, NET_EVENT_DATAGRAM_OPEN, NO_FD, IpEndpoint::sa, safe_getsockname(), safe_setsockopt(), SocketManager::set_rcvbuf_size(), SocketManager::set_sndbuf_size(), UDPConnection::setBinding(), SocketManager::socket(), socketManager, and unlikely.
Referenced by INKUDPBind().