Holds client options for NetVConnection. More...
#include <I_NetVConnection.h>
Public Types | |
enum | ip_protocol_t { USE_TCP, USE_UDP } |
Values for valid IP protocols. More... | |
enum | addr_bind_style { ANY_ADDR, INTF_ADDR, FOREIGN_ADDR } |
The set of ways in which the local address should be bound. More... | |
typedef NetVCOptions | self |
Self reference type. | |
Public Member Functions | |
void | reset () |
Reset all values to defaults. | |
void | set_sock_param (int _recv_bufsize, int _send_bufsize, unsigned long _opt_flags, unsigned long _packet_mark=0, unsigned long _packet_tos=0) |
NetVCOptions () | |
~NetVCOptions () | |
void | set_sni_servername (const char *name, size_t len) |
NetVCOptions & | operator= (const NetVCOptions &opt) |
Static Public Member Functions | |
Debugging | |
static char const * | toString (addr_bind_style s) |
Convert s to its string equivalent. | |
Data Fields | |
ip_protocol_t | ip_proto |
IP (TCP or UDP) protocol to use on socket. | |
uint16_t | ip_family |
IP address family. | |
IpAddr | local_ip |
Local address for the connection. | |
uint16_t | local_port |
Local port for connection. | |
addr_bind_style | addr_binding |
How to bind the local address. | |
bool | f_blocking |
Make the socket blocking on I/O (default: false ). | |
bool | f_blocking_connect |
Make socket block on connect (default: false ). | |
unsigned char | socks_support |
Control use of SOCKS. | |
unsigned char | socks_version |
Version of SOCKS to use. | |
int | socket_recv_bufsize |
int | socket_send_bufsize |
uint32_t | sockopt_flags |
Configuration options for sockets. | |
uint32_t | packet_mark |
uint32_t | packet_tos |
EventType | etype |
char * | sni_servername |
Static Public Attributes | |
static uint32_t const | SOCK_OPT_NO_DELAY = 1 |
Value for TCP no delay for sockopt_flags . | |
static uint32_t const | SOCK_OPT_KEEP_ALIVE = 2 |
Value for keep alive for sockopt_flags . |
Holds client options for NetVConnection.
This class holds various options a user can specify for NetVConnection. Various clients need many slightly different features. This is an attempt to prevent out of control growth of the connection method signatures. Only options of interest need to be explicitly set -- the rest get sensible default values.
ANY_ADDR
and bind to any address in that protocol. If it's not an IP protocol, IPv4 will be used. Definition at line 57 of file I_NetVConnection.h.
typedef NetVCOptions NetVCOptions::self |
Self reference type.
Definition at line 58 of file I_NetVConnection.h.
The set of ways in which the local address should be bound.
The protocol is set by the contents of local_addr regardless of this value. ANY_ADDR
will override only the address.
INTF_ADDR
and FOREIGN_ADDR
is whether transparency is enabled on the socket. It is the client's responsibility to set this correctly based on whether the address in local_addr is associated with an interface on the local system ( INTF_ADDR
) or is owned by a foreign system ( FOREIGN_ADDR
). A binding style of ANY_ADDR
causes the value in local_addr to be ignored.The IP address and port are separate because most clients treat these independently. For the same reason IpAddr
is used to be clear that it contains no port data.
ANY_ADDR |
Bind to any available local address (don't care, default). |
INTF_ADDR |
Bind to interface address in local_addr. |
FOREIGN_ADDR |
Bind to foreign address in local_addr. |
Definition at line 106 of file I_NetVConnection.h.
Values for valid IP protocols.
Definition at line 61 of file I_NetVConnection.h.
NetVCOptions::NetVCOptions | ( | ) | [inline] |
Definition at line 170 of file I_NetVConnection.h.
References reset().
NetVCOptions::~NetVCOptions | ( | ) | [inline] |
Definition at line 174 of file I_NetVConnection.h.
References ats_free(), and sni_servername.
NetVCOptions& NetVCOptions::operator= | ( | const NetVCOptions & | opt | ) | [inline] |
Definition at line 189 of file I_NetVConnection.h.
References ats_free(), ats_strdup, memcpy, and sni_servername.
TS_INLINE void NetVCOptions::reset | ( | ) |
Reset all values to defaults.
Definition at line 45 of file P_UnixNetVConnection.h.
References addr_binding, ats_free(), etype, f_blocking, f_blocking_connect, IpAddr::invalidate(), ip_family, ip_proto, local_ip, local_port, packet_mark, packet_tos, sni_servername, socket_recv_bufsize, socket_send_bufsize, sockopt_flags, socks_support, and socks_version.
Referenced by UnixNetVConnection::free(), SSLNetVConnection::free(), and NetVCOptions().
void NetVCOptions::set_sni_servername | ( | const char * | name, | |
size_t | len | |||
) | [inline] |
Definition at line 178 of file I_NetVConnection.h.
References ats_free(), ats_ip_pton(), ats_strndup, and sni_servername.
Referenced by HttpSM::do_http_server_open().
TS_INLINE void NetVCOptions::set_sock_param | ( | int | _recv_bufsize, | |
int | _send_bufsize, | |||
unsigned long | _opt_flags, | |||
unsigned long | _packet_mark = 0 , |
|||
unsigned long | _packet_tos = 0 | |||
) |
Definition at line 74 of file P_UnixNetVConnection.h.
References packet_mark, packet_tos, socket_recv_bufsize, socket_send_bufsize, and sockopt_flags.
Referenced by HttpSM::do_http_server_open().
char const * NetVCOptions::toString | ( | addr_bind_style | s | ) | [static] |
Convert s to its string equivalent.
Definition at line 62 of file Connection.cc.
References ANY_ADDR, and INTF_ADDR.
Referenced by UnixNetVConnection::connectUp().
How to bind the local address.
ANY_ADDR
. Definition at line 130 of file I_NetVConnection.h.
Referenced by ClusterHandler::connectClusterEvent(), UnixNetVConnection::connectUp(), HttpSM::do_http_server_open(), Connection::open(), reset(), and TSNetConnectTransparent().
Definition at line 160 of file I_NetVConnection.h.
Referenced by UnixNetProcessor::connect_re_internal(), ClusterHandler::connectClusterEvent(), and reset().
Make the socket blocking on I/O (default: false
).
Definition at line 133 of file I_NetVConnection.h.
Referenced by Connection::connect(), and reset().
Make socket block on connect (default: false
).
Definition at line 135 of file I_NetVConnection.h.
Referenced by Connection::connect(), HttpSM::do_http_server_open(), Connection::open(), and reset().
uint16_t NetVCOptions::ip_family |
IP address family.
This is used for inbound connections only if local_ip
is not set, which is sometimes more convenient for the client. This defaults to AF_INET
so if the client sets neither this nor local_ip
then IPv4 is used.
For outbound connections this is ignored and the family of the remote address used.
Definition at line 84 of file I_NetVConnection.h.
Referenced by UnixNetVConnection::connectUp(), HttpSM::do_http_server_open(), Connection::open(), and reset().
IP (TCP or UDP) protocol to use on socket.
Definition at line 67 of file I_NetVConnection.h.
Referenced by Connection::open(), and reset().
Local address for the connection.
For outbound connections this must have the same family as the remote address (which is not stored in this structure). For inbound connections the family of this value overrides ip_family if set.
ANY_ADDR
. Definition at line 123 of file I_NetVConnection.h.
Referenced by ClusterHandler::connectClusterEvent(), UnixNetVConnection::connectUp(), HttpSM::do_http_server_open(), Connection::open(), reset(), and TSNetConnectTransparent().
uint16_t NetVCOptions::local_port |
Local port for connection.
Set to 0 for "don't care" (default).
Definition at line 127 of file I_NetVConnection.h.
Referenced by UnixNetVConnection::connectUp(), HttpSM::do_http_server_open(), Connection::open(), reset(), and TSNetConnectTransparent().
uint32_t NetVCOptions::packet_mark |
Definition at line 157 of file I_NetVConnection.h.
Referenced by Connection::apply_options(), ClusterHandler::connectClusterEvent(), HttpSM::handle_http_server_open(), reset(), set_sock_param(), TSHttpTxnClientPacketMarkSet(), and TSHttpTxnServerPacketMarkSet().
uint32_t NetVCOptions::packet_tos |
Definition at line 158 of file I_NetVConnection.h.
Referenced by Connection::apply_options(), ClusterHandler::connectClusterEvent(), HttpSM::handle_http_server_open(), reset(), set_sock_param(), TSHttpTxnClientPacketTosSet(), and TSHttpTxnServerPacketTosSet().
Definition at line 162 of file I_NetVConnection.h.
Referenced by operator=(), reset(), set_sni_servername(), SSLNetVConnection::sslClientHandShakeEvent(), and ~NetVCOptions().
uint32_t const NetVCOptions::SOCK_OPT_KEEP_ALIVE = 2 [static] |
Value for keep alive for sockopt_flags
.
Definition at line 155 of file I_NetVConnection.h.
Referenced by Connection::apply_options().
uint32_t const NetVCOptions::SOCK_OPT_NO_DELAY = 1 [static] |
Value for TCP no delay for sockopt_flags
.
Definition at line 153 of file I_NetVConnection.h.
Referenced by Connection::apply_options().
Definition at line 144 of file I_NetVConnection.h.
Referenced by ClusterHandler::connectClusterEvent(), Connection::open(), reset(), and set_sock_param().
Definition at line 145 of file I_NetVConnection.h.
Referenced by ClusterHandler::connectClusterEvent(), Connection::open(), reset(), and set_sock_param().
uint32_t NetVCOptions::sockopt_flags |
Configuration options for sockets.
Definition at line 151 of file I_NetVConnection.h.
Referenced by Connection::apply_options(), ClusterHandler::connectClusterEvent(), HttpSM::handle_http_server_open(), reset(), and set_sock_param().
unsigned char NetVCOptions::socks_support |
Control use of SOCKS.
Set to NO_SOCKS
to disable use of SOCKS. Otherwise SOCKS is used if available.
Definition at line 140 of file I_NetVConnection.h.
Referenced by UnixNetProcessor::connect_re_internal(), SocksProxy::mainEvent(), reset(), and SocksEntry::startEvent().
unsigned char NetVCOptions::socks_version |
Version of SOCKS to use.
Definition at line 142 of file I_NetVConnection.h.
Referenced by UnixNetProcessor::connect_re_internal(), SocksProxy::mainEvent(), and reset().