This is the heart of the Net system. More...
#include <I_NetProcessor.h>
Inherits Processor.
Inherited by UnixNetProcessor.
Data Structures | |
struct | AcceptOptions |
Options for accept . More... | |
Public Member Functions | |
virtual inkcoreapi Action * | accept (Continuation *cont, AcceptOptions const &opt=DEFAULT_ACCEPT_OPTIONS) |
Accept connections on a port. | |
virtual Action * | main_accept (Continuation *cont, SOCKET listen_socket_in, AcceptOptions const &opt=DEFAULT_ACCEPT_OPTIONS) |
Accepts incoming connections on port. | |
inkcoreapi Action * | connect_re (Continuation *cont, sockaddr const *addr, NetVCOptions *options=NULL) |
Open a NetVConnection for connection oriented I/O. | |
Action * | connect_s (Continuation *cont, sockaddr const *addr, int timeout=NET_CONNECT_TIMEOUT, NetVCOptions *opts=NULL) |
Open a NetVConnection for connection oriented I/O. | |
virtual int | start (int number_of_net_threads, size_t stacksize)=0 |
Starts the Netprocessor. | |
virtual inkcoreapi NetVConnection * | allocate_vc (EThread *)=0 |
NetProcessor () | |
Private constructor. | |
virtual | ~NetProcessor () |
Private destructor. | |
Static Public Attributes | |
static int | accept_mss = 0 |
This is MSS for connections we accept (client connections). | |
static socks_conf_struct * | socks_conf_stuff = NULL |
static AcceptOptions const | DEFAULT_ACCEPT_OPTIONS |
Default options instance. |
This is the heart of the Net system.
Provides common network APIs, like accept, connect etc. It performs network I/O on behalf of a state machine.
Definition at line 41 of file I_NetProcessor.h.
NetProcessor::NetProcessor | ( | ) | [inline] |
Private constructor.
Definition at line 227 of file I_NetProcessor.h.
virtual NetProcessor::~NetProcessor | ( | ) | [inline, virtual] |
Private destructor.
Definition at line 232 of file I_NetProcessor.h.
Action * NetProcessor::accept | ( | Continuation * | cont, | |
AcceptOptions const & | opt = DEFAULT_ACCEPT_OPTIONS | |||
) | [virtual] |
Accept connections on a port.
Callbacks:
Re-entrant callbacks (based on callback_on_open flag):
cont | Continuation to be called back with events this continuation is not locked on callbacks and so the handler must be re-entrant. | |
opt | Accept options. |
Definition at line 67 of file UnixNetProcessor.cc.
References Debug, NetProcessor::AcceptOptions::local_port, NO_FD, NetProcessor::AcceptOptions::recv_bufsize, NetProcessor::AcceptOptions::send_bufsize, and NetProcessor::AcceptOptions::sockopt_flags.
Referenced by LogCollationAccept::LogCollationAccept(), test(), test_main(), and TSNetAccept().
virtual inkcoreapi NetVConnection* NetProcessor::allocate_vc | ( | EThread * | ) | [pure virtual] |
Implemented in SSLNetProcessor, and UnixNetProcessor.
Referenced by NetAccept::acceptFastEvent(), NetAccept::do_blocking_accept(), net_accept(), and TSVConnFdCreate().
TS_INLINE Action * NetProcessor::connect_re | ( | Continuation * | cont, | |
sockaddr const * | addr, | |||
NetVCOptions * | options = NULL | |||
) |
Open a NetVConnection for connection oriented I/O.
Connects through sockserver if netprocessor is configured to use socks or is socks parameters to the call are set.
Re-entrant callbacks:
cont | Continuation to be called back with events. | |
addr | target address and port to connect to. | |
options |
Definition at line 80 of file P_UnixNetProcessor.h.
Referenced by UnixNetProcessor::connect(), CheckConnect::connect_s(), ClusterHandler::connectClusterEvent(), HttpSM::do_http_server_open(), PrefetchBlaster::httpClient(), KeepAliveConn::init(), SocksProxy::mainEvent(), ObjectReloadCont::ObjectReloadEvent(), SocksEntry::startEvent(), TSNetConnect(), and TSNetConnectTransparent().
Action * NetProcessor::connect_s | ( | Continuation * | cont, | |
sockaddr const * | addr, | |||
int | timeout = NET_CONNECT_TIMEOUT , |
|||
NetVCOptions * | opts = NULL | |||
) |
Open a NetVConnection for connection oriented I/O.
This call is simliar to connect method except that the cont is called back only after the connections has been established. In the case of connect the cont could be called back with NET_EVENT_OPEN event and OS could still be in the process of establishing the connection. Re-entrant Callbacks: same as connect. If unix asynchronous type connect is desired use connect_re().
cont | Continuation to be called back with events. | |
addr | Address to which to connect (includes port). | |
timeout | for connect, the cont will get NET_EVENT_OPEN_FAILED if connection could not be established for timeout msecs. The default is 30 secs. | |
options |
Definition at line 380 of file UnixNetProcessor.cc.
References CheckConnect::connect_s(), Debug, and Continuation::mutex.
Referenced by HttpSM::do_http_server_open().
Action * NetProcessor::main_accept | ( | Continuation * | cont, | |
SOCKET | listen_socket_in, | |||
AcceptOptions const & | opt = DEFAULT_ACCEPT_OPTIONS | |||
) | [virtual] |
Accepts incoming connections on port.
Accept connections on port. Accept is done on all net threads and throttle limit is imposed if frequent_accept flag is true. This is similar to the accept method described above. The only difference is that the list of parameter that is takes is limited.
Callbacks:
Re-entrant callbacks (based on callback_on_open flag):
cont | Continuation to be called back with events this continuation is not locked on callbacks and so the handler must be re-entrant. | |
listen_socket_in | if passed, used for listening. | |
opt | Accept options. |
Definition at line 76 of file UnixNetProcessor.cc.
References UnixNetProcessor::accept_internal(), Debug, NetProcessor::AcceptOptions::local_port, NetProcessor::AcceptOptions::recv_bufsize, NetProcessor::AcceptOptions::send_bufsize, and NetProcessor::AcceptOptions::sockopt_flags.
Referenced by ClusterAccept::ClusterAcceptEvent(), start_HttpProxyServer(), start_HttpProxyServerBackDoor(), start_SocksProxy(), TSPluginDescriptorAccept(), and TSPortDescriptorAccept().
virtual int NetProcessor::start | ( | int | number_of_net_threads, | |
size_t | stacksize | |||
) | [pure virtual] |
Starts the Netprocessor.
This has to be called before doing any other net call.
number_of_net_threads | is not used. The net processor uses the Event Processor threads for its activity. |
Reimplemented from Processor.
Implemented in SSLNetProcessor, and UnixNetProcessor.
Referenced by main().
int NetProcessor::accept_mss = 0 [static] |
This is MSS for connections we accept (client connections).
Definition at line 233 of file I_NetProcessor.h.
Referenced by main(), and Server::setup_fd_for_listen().
NetProcessor::AcceptOptions const NetProcessor::DEFAULT_ACCEPT_OPTIONS [static] |
Default options instance.
Definition at line 255 of file I_NetProcessor.h.
struct socks_conf_struct * NetProcessor::socks_conf_stuff = NULL [static] |
Definition at line 252 of file I_NetProcessor.h.
Referenced by UnixNetProcessor::connect_re_internal(), SocksEntry::findServer(), SocksEntry::init(), main(), SocksProxy::mainEvent(), SocksEntry::mainEvent(), socks5BasicAuthHandler(), socks5PasswdAuthHandler(), UnixNetProcessor::start(), and SocksEntry::startEvent().