A union to hold the standard IP address structures. More...
#include <ink_inet.h>
Public Types | |
typedef IpEndpoint | self |
Self reference type. | |
Public Member Functions | |
operator sockaddr * () | |
operator sockaddr const * () const | |
is passed to @c getaddrinfo which does a host lookup if @a | |
Get the best address info for name. name is not in IP address format. The results are examined for the "best" addresses. This is only significant for the host name case (for IP address data, there is at most one result). The preference is Global > Non-Routable > Multicast > Loopback. IPv4 and IPv4 results are handled independently and stored in ip4 and ip6 respectively. If name is known to be a numeric IP address ip4 or ip6 can be
| |
self & | assign (sockaddr const *ip) |
self & | assign (IpAddr const &addr, in_port_t port=0) |
Construct from an addr and port. | |
bool | isValid () const |
Test for valid IP address. | |
bool | isIp4 () const |
Test for IPv4. | |
bool | isIp6 () const |
Test for IPv6. | |
uint16_t | family () const |
self & | setToAnyAddr (int family) |
Set to be any address for family family. | |
self & | setToLoopback (int family) |
Set to be loopback for family family. | |
in_port_t & | port () |
Port in network order. | |
in_port_t | port () const |
Port in network order. | |
Data Fields | |
struct sockaddr | sa |
Generic address. | |
struct sockaddr_in | sin |
IPv4. | |
struct sockaddr_in6 | sin6 |
IPv6. |
A union to hold the standard IP address structures.
By standard we mean sockaddr
compliant.
We use the term "endpoint" because these contain more than just the raw address, all of the data for an IP endpoint is present.
Definition at line 65 of file ink_inet.h.
typedef IpEndpoint IpEndpoint::self |
Self reference type.
Definition at line 66 of file ink_inet.h.
IpEndpoint & IpEndpoint::assign | ( | sockaddr const * | ip | ) | [inline] |
ip | Source address, family, port. |
Definition at line 1253 of file ink_inet.h.
References ats_ip_copy(), and sa.
Referenced by UnixNetProcessor::accept_internal(), LogHost::connect(), IpMap::contains(), FetchSM::ext_init(), FetchSM::init(), main(), IpMap::mark(), Connection::open(), PluginVCCore::set_active_addr(), PluginVCCore::set_passive_addr(), Connection::setup_mc_receive(), and IpAddr::toString().
IpEndpoint & IpEndpoint::assign | ( | IpAddr const & | addr, | |
in_port_t | port = 0 | |||
) | [inline] |
Construct from an addr and port.
addr | Address and address family. | |
port | Port (network order). |
Definition at line 1247 of file ink_inet.h.
References ats_ip_set(), and sa.
uint16_t IpEndpoint::family | ( | ) | const [inline] |
bool IpEndpoint::isIp4 | ( | ) | const [inline] |
Test for IPv4.
Definition at line 1273 of file ink_inet.h.
References sa.
Referenced by detail::HttpSessionAcceptOptions::setOutboundIp().
bool IpEndpoint::isIp6 | ( | ) | const [inline] |
Test for IPv6.
Definition at line 1274 of file ink_inet.h.
References sa.
Referenced by detail::HttpSessionAcceptOptions::setOutboundIp().
bool IpEndpoint::isValid | ( | ) | const [inline] |
Test for valid IP address.
Definition at line 1269 of file ink_inet.h.
References ats_is_ip().
Referenced by DNSHandler::failover(), and LogSock::listen().
IpEndpoint::operator sockaddr * | ( | ) | [inline] |
Definition at line 109 of file ink_inet.h.
References sa.
IpEndpoint::operator sockaddr const * | ( | ) | const [inline] |
Definition at line 110 of file ink_inet.h.
References sa.
in_port_t IpEndpoint::port | ( | ) | const [inline] |
Port in network order.
Definition at line 1264 of file ink_inet.h.
References ats_ip_port_cast(), and sa.
in_port_t & IpEndpoint::port | ( | ) | [inline] |
Port in network order.
Definition at line 1259 of file ink_inet.h.
References ats_ip_port_cast(), and sa.
Referenced by LogSock::accept(), UnixNetProcessor::accept_internal(), NetAccept::do_listen(), SSLCertLookup::findInfoInHash(), ICPlog::GetClientPort(), PrefetchBlaster::httpClient(), LogSock::listen(), ObjectReloadCont::ObjectReloadEvent(), Connection::open(), and SSLAddressLookupKey::SSLAddressLookupKey().
IpEndpoint & IpEndpoint::setToAnyAddr | ( | int | family | ) | [inline] |
Set to be any address for family family.
family must be AF_INET
or AF_INET6
.
family | Address family. |
Definition at line 1278 of file ink_inet.h.
Referenced by UnixNetProcessor::accept_internal(), LogSock::listen(), and Connection::open().
IpEndpoint & IpEndpoint::setToLoopback | ( | int | family | ) | [inline] |
Set to be loopback for family family.
family must be AF_INET
or AF_INET6
.
family | Address family. |
Definition at line 1296 of file ink_inet.h.
Referenced by UnixNetProcessor::accept_internal(), DNSHandler::failover(), PrefetchBlaster::httpClient(), and ObjectReloadCont::ObjectReloadEvent().
struct sockaddr IpEndpoint::sa |
Generic address.
Definition at line 68 of file ink_inet.h.
Referenced by LogSock::accept(), Server::accept(), NetAccept::acceptFastEvent(), HttpTransact::add_client_ip_to_outgoing_request(), assign(), ats_ip4_addr_cast(), ats_ip_addr8_cast(), ats_ip_addr_cmp(), ats_ip_addr_eq(), ats_ip_addr_size(), ats_ip_are_compatible(), ats_ip_copy(), ats_ip_invalidate(), ats_ip_nptop(), ats_ip_ntop(), ats_ip_port_cast(), ats_ip_port_host_order(), ats_ip_pton(), ats_ip_size(), ats_is_ip(), ats_is_ip4(), ats_is_ip6(), ats_is_ip_linklocal(), ats_is_ip_loopback(), ats_is_ip_multicast(), ats_is_ip_private(), PrefetchBlaster::blastObject(), br(), HttpTransact::build_error_response(), client_handler(), CongestionEntry::CongestionEntry(), LogHost::connect(), DNSConnection::connect(), UnixNetVConnection::connectUp(), IpMap::contains(), HttpTransact::delete_server_rr_entry(), DNSProcessor::dns_init(), HttpSM::do_hostdb_reverse_lookup(), HttpSM::do_http_server_open(), HttpServerSession::do_io_close(), ExtractIpRange(), DNSHandler::failover(), family(), IpMap::fill(), SocksEntry::findServer(), HttpRequestData::get_client_ip(), get_hostinfo_ClusterFunction(), HttpRequestData::get_ip(), CongestionEntry::get_ip(), NetVConnection::get_local_addr(), NetVConnection::get_remote_addr(), ICPlog::GetClientIP(), MultiCastPeer::GetIP(), ParentSiblingPeer::GetIP(), HttpTransact::handle_response_from_parent(), HttpTransact::handle_response_from_server(), KeepAliveConn::handleEvent(), HttpTransact::HandleICPLookup(), ConnectionCount::ConnAddrHashFns::hash(), PrefetchBlaster::httpClient(), FetchSM::httpConnect(), KeepAliveConn::init(), PrefetchBlaster::init(), Ink_Inet(), ink_res_getservers(), ink_res_init(), ink_res_setservers(), KeepAliveConnTable::ip_hash(), IpAddr::IpAddr(), isIp4(), isIp6(), ServerSessionPool::IPHashing::key(), LogSock::listen(), Server::listen(), Load_IpMap_From_File(), Machine::Machine(), main(), HostDBTestReverse::mainEvent(), CCCongestionDBTestCont::mainEvent(), HostDBContinuation::make_get_message(), HostDBContinuation::make_put_message(), IpMap::mark(), LogAccessTest::marshal_client_host_ip(), LogAccessTest::marshal_server_host_ip(), IpAllow::match(), MultiCastPeer::MultiCastPeer(), HttpServerSession::new_connection(), IpMatcher< Data, Result >::NewEntry(), ObjectReloadCont::ObjectReloadEvent(), Connection::open(), DNSProcessor::open(), DNSHandler::open_con(), operator sockaddr *(), operator sockaddr const *(), operator!=(), IpAddr::operator=(), operator==(), HttpTransact::OSDNSLookup(), ParentSiblingPeer::ParentSiblingPeer(), ICPPeerReadCont::PeerReadStateMachine(), port(), HttpTransact::PPDNSLookup(), HttpSM::process_hostdb_info(), CoreUtils::process_NetVC(), HttpTransact::process_quick_http_filter(), put_hostinfo_ClusterFunction(), DNSHandler::recover(), DNSHandler::recv_dns(), HttpTransact::ReDNSRoundRobin(), register_ShowNet(), remap_validate_filter_args(), remove_congested_entry(), request_to_data(), DNSHandler::retry_named(), HttpTransact::retry_server_connection_not_open(), DNSHandler::rr_failure(), SDK_API_TSNetVConn(), SDK_API_TSPortDescriptor(), UnixNetVConnection::set_local_addr(), setToAnyAddr(), setToLoopback(), Connection::setup_mc_receive(), CongestionEntry::sprint(), SSLAddressLookupKey::SSLAddressLookupKey(), SocksEntry::startEvent(), DNSHandler::startEvent(), DNSHandler::startEvent_sdns(), HttpTransact::StartRemapRequest(), DNSHandler::try_primary_named(), UDPNetProcessor::UDPBind(), IpMap::unmark(), LogAccess::unmarshal_ip_to_hex(), and CongestionEntry::validate().
struct sockaddr_in IpEndpoint::sin |
IPv4.
Definition at line 69 of file ink_inet.h.
Referenced by ats_ip4_set(), DNSConnection::connect(), Ink_Inet(), SocksEntry::mainEvent(), HostDBTestReverse::mainEvent(), setToAnyAddr(), and setToLoopback().
struct sockaddr_in6 IpEndpoint::sin6 |
IPv6.
Definition at line 70 of file ink_inet.h.
Referenced by ats_ip6_addr_cast(), ats_ip6_set(), DNSConnection::connect(), NetVConnection::get_local_addr(), Ink_Inet(), SocksEntry::mainEvent(), setToAnyAddr(), and setToLoopback().