Public Types | Public Member Functions | Data Fields | Static Public Attributes

NetVCOptions Struct Reference

Holds client options for NetVConnection. More...

#include <I_NetVConnection.h>

Collaboration diagram for NetVCOptions:
Collaboration graph
[legend]

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

Detailed Description

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.

Note:
Binding addresses is a bit complex. It is not currently possible to bind indiscriminately across protocols, which means any connection must commit to IPv4 or IPv6. For this reason the connection logic will look at the address family of local_addr even if addr_binding is 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.


Member Typedef Documentation

Self reference type.

Definition at line 58 of file I_NetVConnection.h.


Member Enumeration Documentation

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.

Note:
The difference between 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.

See also:
local_addr
addr_binding
Enumerator:
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.

Enumerator:
USE_TCP 

TCP protocol.

USE_UDP 

UDP protocol.

Definition at line 61 of file I_NetVConnection.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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


Field Documentation

How to bind the local address.

Note:
Default is 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().

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

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.

Note:
This is (inconsistently) called "domain" and "protocol" in other places. "family" is used here because that's what the standard IP data structures use.

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.

Note:
Ignored if addr_binding is ANY_ADDR.
See also:
addr_binding
ip_family

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

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

Configuration options for sockets.

Note:
These are not identical to internal socket options but specifically defined for configuration. These are mask values and so must be powers of 2.

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

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

Version of SOCKS to use.

Definition at line 142 of file I_NetVConnection.h.

Referenced by UnixNetProcessor::connect_re_internal(), SocksProxy::mainEvent(), and reset().


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