Public Member Functions

UDPNetProcessor Class Reference

UDP service. More...

#include <I_UDPNet.h>

Inherits Processor.

Inherited by FakeUDPNetProcessor, and UDPNetProcessorInternal.

Collaboration diagram for UDPNetProcessor:
Collaboration graph
[legend]

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 ActionUDPBind (Continuation *c, sockaddr const *addr, int send_bufsize=0, int recv_bufsize=0)
 create UDPConnection
Actionsendto_re (Continuation *c, void *token, int fd, sockaddr const *toaddr, int toaddrlen, IOBufferBlock *buf, int len)
Actionsendmsg_re (Continuation *c, void *token, int fd, struct msghdr *msg)
Actionrecvfrom_re (Continuation *c, void *token, int fd, sockaddr *fromaddr, socklen_t *fromaddrlen, IOBufferBlock *buf, int len, bool useReadCont=true, int timeout=0)

Detailed Description

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.


Member Function Documentation

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 
)
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 
)
Action * UDPNetProcessor::sendmsg_re ( Continuation c,
void *  token,
int  fd,
struct msghdr *  msg 
)
Action* UDPNetProcessor::sendto_re ( Continuation c,
void *  token,
int  fd,
sockaddr const *  toaddr,
int  toaddrlen,
IOBufferBlock buf,
int  len 
)
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.

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

Parameters:
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.
Returns:
Action* Always returns ACTION_RESULT_DONE if socket was created successfuly, or ACTION_IO_ERROR if not.

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


The documentation for this class was generated from the following files: