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

HttpProxyPort Struct Reference

Description of an proxy port. More...

#include <I_RecHttp.h>

Collaboration diagram for HttpProxyPort:
Collaboration graph
[legend]

Public Types

enum  TransportType {
  TRANSPORT_DEFAULT = 0, TRANSPORT_COMPRESSED, TRANSPORT_BLIND_TUNNEL, TRANSPORT_SSL,
  TRANSPORT_PLUGIN
}
 

Type of transport on the connection.

More...
typedef Vec< selfGroup
 Explicitly supported collection of proxy ports.

Public Member Functions

 HttpProxyPort ()
 Default constructor.
IpAddroutboundIp (uint16_t family)
 Select the local outbound address object.
bool isSSL () const
 Check for SSL port.
bool isPlugin () const
 Check for SSL port.
bool processOptions (char const *opts)
 Process options text.
int print (char *out, size_t n)
 Create text description to be used for inter-process access.

Static Public Member Functions

static Vec< self > & global ()
 Global instance.
static bool hasSSL (Group const &ports)
 Check for SSL ports.
static bool hasSSL ()
 Check for SSL ports.
static bool loadConfig (Vec< self > &ports)
 Load all relevant configuration data.
static bool loadConfig ()
 Load all relevant configuration data into the global ports.
static bool loadValue (Vec< self > &ports, char const *value)
 Load ports from a value string.
static bool loadValue (char const *value)
 Load ports from a value string into the global ports.
static bool loadDefaultIfEmpty (Vec< self > &ports)
 Load default value if ports is empty.
static bool loadDefaultIfEmpty ()
 Load default value into the global set if it is empty.
static selffindHttp (Group const &ports, uint16_t family=AF_UNSPEC)
 Find an HTTP port in ports.
static selffindHttp (uint16_t family=AF_UNSPEC)
 Find an HTTP port in the global ports.

Data Fields

int m_fd
 Pre-opened file descriptor if present.
TransportType m_type
 Type of connection.
in_port_t m_port
 Port on which to listen.
uint8_t m_family
 IP address family.
bool m_inbound_transparent_p
 True if inbound connects (from client) are transparent.
bool m_outbound_transparent_p
 True if outbound connections (to origin servers) are transparent.
bool m_transparent_passthrough
IpAddr m_inbound_ip
 Local address for inbound connections (listen address).
IpAddr m_outbound_ip4
 Local address for outbound connections (to origin server).
IpAddr m_outbound_ip6
 Local address for outbound connections (to origin server).
HostResPreferenceOrder m_host_res_preference
 Ordered preference for DNS resolution family ( FamilyPrefence ) A value of PREFER_NONE indicates that entry and subsequent ones are invalid.
SessionProtocolSet m_session_protocol_preference
 Enabled session transports for this port.

Static Public Attributes

static HostResPreferenceOrder const DEFAULT_HOST_RES_PREFERENCE
 Static preference list that is the default value.
static char const *const PORTS_CONFIG_NAME = "proxy.config.http.server_ports"
 New unified port descriptor.
static char const *const DEFAULT_VALUE = "8080"
 Default value if no other values can be found.
static char const *const OPT_FD_PREFIX = "fd"
 Prefix for file descriptor value.
static char const *const OPT_OUTBOUND_IP_PREFIX = "ip-out"
 Prefix for inbound IP address.
static char const *const OPT_INBOUND_IP_PREFIX = "ip-in"
 Prefix for outbound IP address.
static char const *const OPT_IPV6 = "ipv6"
 IPv6.
static char const *const OPT_IPV4 = "ipv4"
 IPv4.
static char const *const OPT_TRANSPARENT_INBOUND = "tr-in"
 Inbound transparent.
static char const *const OPT_TRANSPARENT_OUTBOUND = "tr-out"
 Outbound transparent.
static char const *const OPT_TRANSPARENT_FULL = "tr-full"
 Full transparency.
static char const *const OPT_TRANSPARENT_PASSTHROUGH = "tr-pass"
 Pass-through non-HTTP.
static char const *const OPT_SSL = "ssl"
 SSL (experimental).
static char const *const OPT_PLUGIN = "plugin"
 Protocol Plugin handle (experimental).
static char const *const OPT_BLIND_TUNNEL = "blind"
 Blind tunnel.
static char const *const OPT_COMPRESSED = "compressed"
 Compressed.
static char const *const OPT_HOST_RES_PREFIX = "ip-resolve"
 Set DNS family preference.
static char const *const OPT_PROTO_PREFIX = "proto"
 Transport layer protocols.
static Vec< self > & m_global = GLOBAL_DATA
 Global ("default") data.

Protected Member Functions

void processFamilyPreference (char const *value)
 Process value for DNS resolution family preferences.
void processSessionProtocolPreference (char const *value)
 Process value for session protocol preferences.
char const * checkPrefix (char const *src, char const *prefix, size_t prefix_len)
 Check a prefix option and find the value.

Detailed Description

Description of an proxy port.

This consolidates the options needed for proxy ports, both data and parsing. It provides a static global set of ports for convenience although it can be used with an externally provided set.

Options are described by a colon separated list of keywords without spaces. The options are applied in left to right order. If options do not conflict the order is irrelevant.

IPv6 addresses must be enclosed by brackets. Unfortunate but colon is so overloaded there's no other option.

Definition at line 175 of file I_RecHttp.h.


Member Typedef Documentation

Explicitly supported collection of proxy ports.

Definition at line 180 of file I_RecHttp.h.


Member Enumeration Documentation

Type of transport on the connection.

Enumerator:
TRANSPORT_DEFAULT 

Default (normal HTTP).

TRANSPORT_COMPRESSED 

Compressed HTTP.

TRANSPORT_BLIND_TUNNEL 

Blind tunnel (no processing).

TRANSPORT_SSL 

SSL connection.

TRANSPORT_PLUGIN 

< Protocol plugin connection

Definition at line 183 of file I_RecHttp.h.


Constructor & Destructor Documentation

HttpProxyPort::HttpProxyPort (  ) 

Default constructor.

Definition at line 141 of file RecHttp.cc.

References host_res_default_preference_order, m_host_res_preference, and memcpy.


Member Function Documentation

char const * HttpProxyPort::checkPrefix ( char const *  src,
char const *  prefix,
size_t  prefix_len 
) [protected]

Check a prefix option and find the value.

Returns:
The address of the start of the value, or NULL if the prefix doesn't match.
Parameters:
src Input text
prefix Keyword prefix
prefix_len Length of keyword prefix.

Definition at line 176 of file RecHttp.cc.

Referenced by processOptions().

HttpProxyPort * HttpProxyPort::findHttp ( Group const &  ports,
uint16_t  family = AF_UNSPEC 
) [static]

Find an HTTP port in ports.

If family is specified then only ports for that family are checked.

Returns:
The port if found, NULL if not.
Parameters:
ports Group to search.
family Desired address family.

Definition at line 161 of file RecHttp.cc.

References ats_is_ip(), Vec< C, A, S >::length(), m_family, m_port, m_type, and TRANSPORT_DEFAULT.

Referenced by checkHttpTxnIncomingAddrGet(), findHttp(), ObjectReloadCont::ObjectReloadEvent(), PrefetchConfiguration::readConfiguration(), and synclient_txn_create().

HttpProxyPort * HttpProxyPort::findHttp ( uint16_t  family = AF_UNSPEC  )  [inline, static]

Find an HTTP port in the global ports.

If family is specified then only ports for that family are checked.

Returns:
The port if found, NULL if not.

Definition at line 411 of file I_RecHttp.h.

References findHttp(), and m_global.

Vec< HttpProxyPort > & HttpProxyPort::global (  )  [inline, static]

Global instance.

This is provided because most of the work with this data is used as a singleton and it's handy to encapsulate it here.

Definition at line 404 of file I_RecHttp.h.

References m_global.

Referenced by init_HttpProxyServer(), start_HttpProxyServer(), and TSPluginDescriptorAccept().

bool HttpProxyPort::hasSSL (  )  [inline, static]

Check for SSL ports.

Returns:
true if any global port is an SSL port.

Definition at line 408 of file I_RecHttp.h.

References m_global.

Referenced by getNumSSLThreads().

bool HttpProxyPort::hasSSL ( Group const &  ports  )  [static]

Check for SSL ports.

Returns:
true if any port in ports is an SSL port.
Parameters:
ports Ports to check.

Definition at line 153 of file RecHttp.cc.

References isSSL(), and Vec< C, A, S >::length().

bool HttpProxyPort::isPlugin (  )  const [inline]

Check for SSL port.

Definition at line 380 of file I_RecHttp.h.

References m_type, and TRANSPORT_PLUGIN.

Referenced by start_HttpProxyServer(), and TSPluginDescriptorAccept().

bool HttpProxyPort::isSSL (  )  const [inline]

Check for SSL port.

Definition at line 379 of file I_RecHttp.h.

References m_type, and TRANSPORT_SSL.

Referenced by hasSSL(), MakeHttpProxyAcceptor(), print(), processOptions(), start_HttpProxyServer(), and TSPortDescriptorAccept().

bool HttpProxyPort::loadConfig (  )  [inline, static]

Load all relevant configuration data into the global ports.

Returns:
true if at least one valid port description was found, false if none.

Definition at line 396 of file I_RecHttp.h.

References m_global.

Referenced by main().

bool HttpProxyPort::loadConfig ( Vec< self > &  ports  )  [static]

Load all relevant configuration data.

This is hardwired to look up the appropriate values in the configuration files. It clears ports and then loads all found values in to it.

Returns:
true if at least one valid port description was found, false if none.
Parameters:
ports Destination for found port data.

Definition at line 187 of file RecHttp.cc.

References ats_free(), Vec< C, A, S >::length(), loadValue(), PORTS_CONFIG_NAME, and REC_readString().

bool HttpProxyPort::loadDefaultIfEmpty (  )  [inline, static]

Load default value into the global set if it is empty.

Returns:
true if the default was needed / loaded.

Definition at line 400 of file I_RecHttp.h.

References m_global.

Referenced by main().

static bool HttpProxyPort::loadDefaultIfEmpty ( Vec< self > &  ports  )  [static]

Load default value if ports is empty.

Returns:
true if the default was needed / loaded.
Parameters:
ports Load target.
bool HttpProxyPort::loadValue ( char const *  value  )  [inline, static]

Load ports from a value string into the global ports.

Load ports from single string of port descriptors into the global set of ports. value may safely be NULL or empty.

Returns:
true if a valid port was found, false if none.
Parameters:
value Source port data.

Definition at line 392 of file I_RecHttp.h.

References loadValue(), and m_global.

bool HttpProxyPort::loadValue ( Vec< self > &  ports,
char const *  value 
) [static]

Load ports from a value string.

Load ports from single string with port descriptors. Ports found are added to ports. value may safely be NULL or empty.

Note:
This is used primarily internally but is available if needed.
Returns:
true if a valid port was found, false if none.
Parameters:
ports Destination for found port data.
value Source port data.

Definition at line 207 of file RecHttp.cc.

References Tokenizer::Initialize(), Vec< C, A, S >::length(), processOptions(), Vec< C, A, S >::push_back(), and Warning.

Referenced by loadConfig(), loadValue(), and main().

IpAddr & HttpProxyPort::outboundIp ( uint16_t  family  )  [inline]

Select the local outbound address object.

Returns:
The IP address for family
Parameters:
family IP address family.

Definition at line 383 of file I_RecHttp.h.

References ink_release_assert, m_outbound_ip4, and m_outbound_ip6.

Referenced by processOptions().

int HttpProxyPort::print ( char *  out,
size_t  n 
)
void HttpProxyPort::processFamilyPreference ( char const *  value  )  [protected]

Process value for DNS resolution family preferences.

Definition at line 392 of file RecHttp.cc.

References m_host_res_preference, and parse_host_res_preference().

Referenced by processOptions().

bool HttpProxyPort::processOptions ( char const *  opts  ) 
void HttpProxyPort::processSessionProtocolPreference ( char const *  value  )  [protected]

Process value for session protocol preferences.

Definition at line 397 of file RecHttp.cc.

References m_session_protocol_preference, SessionProtocolSet::markAllOut(), and SessionProtocolNameRegistry::markIn().

Referenced by processOptions().


Field Documentation

Static preference list that is the default value.

Definition at line 212 of file I_RecHttp.h.

char const *const HttpProxyPort::DEFAULT_VALUE = "8080" [static]

Default value if no other values can be found.

Definition at line 342 of file I_RecHttp.h.

IP address family.

Definition at line 194 of file I_RecHttp.h.

Referenced by findHttp(), make_net_accept_options(), print(), and processOptions().

Pre-opened file descriptor if present.

Definition at line 191 of file I_RecHttp.h.

Referenced by print(), processOptions(), start_HttpProxyServer(), TSPluginDescriptorAccept(), and TSPortDescriptorAccept().

Global ("default") data.

Definition at line 361 of file I_RecHttp.h.

Referenced by findHttp(), global(), hasSSL(), loadConfig(), loadDefaultIfEmpty(), and loadValue().

Ordered preference for DNS resolution family ( FamilyPrefence ) A value of PREFER_NONE indicates that entry and subsequent ones are invalid.

Definition at line 210 of file I_RecHttp.h.

Referenced by HttpProxyPort(), MakeHttpProxyAcceptor(), print(), processFamilyPreference(), and processOptions().

Local address for inbound connections (listen address).

Definition at line 202 of file I_RecHttp.h.

Referenced by make_net_accept_options(), print(), and processOptions().

True if inbound connects (from client) are transparent.

Definition at line 196 of file I_RecHttp.h.

Referenced by make_net_accept_options(), print(), and processOptions().

Local address for outbound connections (to origin server).

Definition at line 204 of file I_RecHttp.h.

Referenced by MakeHttpProxyAcceptor(), outboundIp(), and print().

Local address for outbound connections (to origin server).

Definition at line 206 of file I_RecHttp.h.

Referenced by MakeHttpProxyAcceptor(), outboundIp(), and print().

True if outbound connections (to origin servers) are transparent.

Definition at line 198 of file I_RecHttp.h.

Referenced by MakeHttpProxyAcceptor(), print(), and processOptions().

Port on which to listen.

Definition at line 193 of file I_RecHttp.h.

Referenced by checkHttpTxnIncomingAddrGet(), findHttp(), make_net_accept_options(), print(), processOptions(), and synclient_txn_create().

Enabled session transports for this port.

Definition at line 214 of file I_RecHttp.h.

Referenced by MakeHttpProxyAcceptor(), print(), processOptions(), and processSessionProtocolPreference().

Definition at line 200 of file I_RecHttp.h.

Referenced by MakeHttpProxyAcceptor(), print(), and processOptions().

Type of connection.

Definition at line 192 of file I_RecHttp.h.

Referenced by findHttp(), isPlugin(), isSSL(), MakeHttpProxyAcceptor(), print(), and processOptions().

char const *const HttpProxyPort::OPT_BLIND_TUNNEL = "blind" [static]

Blind tunnel.

Definition at line 356 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_COMPRESSED = "compressed" [static]

Compressed.

Definition at line 357 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_FD_PREFIX = "fd" [static]

Prefix for file descriptor value.

Definition at line 345 of file I_RecHttp.h.

Referenced by processOptions().

char const *const HttpProxyPort::OPT_HOST_RES_PREFIX = "ip-resolve" [static]

Set DNS family preference.

Definition at line 358 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_INBOUND_IP_PREFIX = "ip-in" [static]

Prefix for outbound IP address.

Definition at line 347 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_IPV4 = "ipv4" [static]

IPv4.

Definition at line 349 of file I_RecHttp.h.

Referenced by processOptions().

char const *const HttpProxyPort::OPT_IPV6 = "ipv6" [static]

IPv6.

Definition at line 348 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_OUTBOUND_IP_PREFIX = "ip-out" [static]

Prefix for inbound IP address.

Definition at line 346 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_PLUGIN = "plugin" [static]

Protocol Plugin handle (experimental).

Definition at line 355 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_PROTO_PREFIX = "proto" [static]

Transport layer protocols.

Definition at line 359 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_SSL = "ssl" [static]

SSL (experimental).

Definition at line 354 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_TRANSPARENT_FULL = "tr-full" [static]

Full transparency.

Definition at line 352 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_TRANSPARENT_INBOUND = "tr-in" [static]

Inbound transparent.

Definition at line 350 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_TRANSPARENT_OUTBOUND = "tr-out" [static]

Outbound transparent.

Definition at line 351 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::OPT_TRANSPARENT_PASSTHROUGH = "tr-pass" [static]

Pass-through non-HTTP.

Definition at line 353 of file I_RecHttp.h.

Referenced by print(), and processOptions().

char const *const HttpProxyPort::PORTS_CONFIG_NAME = "proxy.config.http.server_ports" [static]

New unified port descriptor.

Definition at line 339 of file I_RecHttp.h.

Referenced by loadConfig().


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