A brief file description. More...
#include <netinet/in.h>
#include <netdb.h>
#include <ink_memory.h>
#include <sys/socket.h>
#include <ts/ink_apidefs.h>
#include <ts/TsBuffer.h>
Go to the source code of this file.
Data Structures | |
union | IpEndpoint |
A union to hold the standard IP address structures. More... | |
struct | ink_gethostbyname_r_data |
struct | ink_gethostbyaddr_r_data |
struct | IpAddr |
Storage for an IP address. More... | |
Defines | |
#define | INK_GETHOSTBYNAME_R_DATA_SIZE 1024 |
#define | INK_GETHOSTBYADDR_R_DATA_SIZE 1024 |
Typedefs | |
typedef char | ip_text_buffer [INET6_ADDRSTRLEN] |
Convenience type for address formatting. | |
typedef char | ip_port_text_buffer [INET6_ADDRPORTSTRLEN] |
Convenience type for address formatting. | |
Functions | |
struct hostent * | ink_gethostbyname_r (char *hostname, ink_gethostbyname_r_data *data) |
Wrapper for gethostbyname_r(). | |
struct hostent * | ink_gethostbyaddr_r (char *ip, int len, int type, ink_gethostbyaddr_r_data *data) |
Wrapper for gethostbyaddr_r(). | |
int | ats_ip_parse (ts::ConstBuffer src, ts::ConstBuffer *addr, ts::ConstBuffer *port) |
Parse a string for pieces of an IP address. | |
int | ats_ip_check_characters (ts::ConstBuffer text) |
Check to see if a buffer contains only IP address characters. | |
inkcoreapi uint32_t | ats_inet_addr (const char *s) |
Wrapper for inet_addr(). | |
const char * | ats_ip_ntop (const struct sockaddr *addr, char *dst, size_t size) |
void | ats_ip_invalidate (sockaddr *addr) |
Reset an address to invalid. | |
void | ats_ip_invalidate (sockaddr_in6 *addr) |
void | ats_ip_invalidate (IpEndpoint *ip) |
char const * | ats_ip_family_name (int family) |
Get a string name for an IP address family. | |
bool | ats_is_ip (sockaddr const *addr) |
Test for IP protocol. | |
bool | ats_is_ip (IpEndpoint const *addr) |
bool | ats_is_ip (int family) |
Test for IP protocol. | |
bool | ats_is_ip4 (sockaddr const *addr) |
Test for IPv4 protocol. | |
bool | ats_is_ip4 (IpEndpoint const *addr) |
Test for IPv4 protocol. | |
bool | ats_is_ip6 (sockaddr const *addr) |
Test for IPv6 protocol. | |
bool | ats_is_ip6 (IpEndpoint const *addr) |
Test for IPv6 protocol. | |
bool | ats_ip_are_compatible (sockaddr const *lhs, sockaddr const *rhs) |
bool | ats_ip_are_compatible (IpEndpoint const *lhs, IpEndpoint const *rhs) |
bool | ats_ip_are_compatible (int lhs, sockaddr const *rhs) |
bool | ats_ip_are_compatible (sockaddr const *lhs, int rhs) |
sockaddr * | ats_ip_sa_cast (sockaddr_storage *a) |
sockaddr const * | ats_ip_sa_cast (sockaddr_storage const *a) |
sockaddr * | ats_ip_sa_cast (sockaddr_in *a) |
sockaddr const * | ats_ip_sa_cast (sockaddr_in const *a) |
sockaddr * | ats_ip_sa_cast (sockaddr_in6 *a) |
sockaddr const * | ats_ip_sa_cast (sockaddr_in6 const *a) |
sockaddr_storage * | ats_ip_ss_cast (sockaddr *a) |
sockaddr_storage const * | ats_ip_ss_cast (sockaddr const *a) |
sockaddr_in * | ats_ip4_cast (sockaddr *a) |
sockaddr_in const * | ats_ip4_cast (sockaddr const *a) |
sockaddr_in & | ats_ip4_cast (sockaddr &a) |
sockaddr_in const & | ats_ip4_cast (sockaddr const &a) |
sockaddr_in * | ats_ip4_cast (sockaddr_in6 *a) |
sockaddr_in const * | ats_ip4_cast (sockaddr_in6 const *a) |
sockaddr_in & | ats_ip4_cast (sockaddr_in6 &a) |
sockaddr_in const & | ats_ip4_cast (sockaddr_in6 const &a) |
sockaddr_in6 * | ats_ip6_cast (sockaddr *a) |
sockaddr_in6 const * | ats_ip6_cast (sockaddr const *a) |
sockaddr_in6 & | ats_ip6_cast (sockaddr &a) |
sockaddr_in6 const & | ats_ip6_cast (sockaddr const &a) |
size_t | ats_ip_size (sockaddr const *addr) |
size_t | ats_ip_size (IpEndpoint const *addr) |
size_t | ats_ip_addr_size (sockaddr const *addr) |
size_t | ats_ip_addr_size (IpEndpoint const *addr) |
in_port_t & | ats_ip_port_cast (sockaddr *sa) |
Get a reference to the port in an address. | |
in_port_t const & | ats_ip_port_cast (sockaddr const *sa) |
in_port_t const & | ats_ip_port_cast (IpEndpoint const *ip) |
in_port_t & | ats_ip_port_cast (IpEndpoint *ip) |
in_addr_t & | ats_ip4_addr_cast (sockaddr *addr) |
Access the IPv4 address. | |
in_addr_t const & | ats_ip4_addr_cast (sockaddr const *addr) |
Access the IPv4 address. | |
in_addr_t & | ats_ip4_addr_cast (IpEndpoint *ip) |
Access the IPv4 address. | |
in_addr_t const & | ats_ip4_addr_cast (IpEndpoint const *ip) |
Access the IPv4 address. | |
in6_addr & | ats_ip6_addr_cast (sockaddr *addr) |
Access the IPv6 address. | |
in6_addr const & | ats_ip6_addr_cast (sockaddr const *addr) |
in6_addr & | ats_ip6_addr_cast (IpEndpoint *ip) |
in6_addr const & | ats_ip6_addr_cast (IpEndpoint const *ip) |
uint32_t * | ats_ip_addr32_cast (sockaddr *addr) |
Cast an IP address to an array of uint32_t . | |
uint32_t const * | ats_ip_addr32_cast (sockaddr const *addr) |
uint8_t * | ats_ip_addr8_cast (sockaddr *addr) |
Cast an IP address to an array of uint8_t . | |
uint8_t const * | ats_ip_addr8_cast (sockaddr const *addr) |
uint8_t * | ats_ip_addr8_cast (IpEndpoint *ip) |
uint8_t const * | ats_ip_addr8_cast (IpEndpoint const *ip) |
bool | ats_is_ip_loopback (sockaddr const *ip) |
Check for loopback. | |
bool | ats_is_ip_loopback (IpEndpoint const *ip) |
Check for loopback. | |
bool | ats_is_ip_multicast (sockaddr const *ip) |
Check for multicast. | |
bool | ats_is_ip_multicast (IpEndpoint const *ip) |
Check for multicast. | |
bool | ats_is_ip_private (sockaddr const *ip) |
Check for Private. | |
bool | ats_is_ip_private (IpEndpoint const *ip) |
Check for Private. | |
bool | ats_is_ip_linklocal (sockaddr const *ip) |
Check for Link Local. | |
bool | ats_is_ip_linklocal (IpEndpoint const *ip) |
Check for Link Local. | |
bool | ats_is_ip_any (sockaddr const *ip) |
Check for being "any" address. | |
in_port_t | ats_ip_port_host_order (sockaddr const *addr) |
Get IP TCP/UDP port. | |
in_port_t | ats_ip_port_host_order (IpEndpoint const *ip) |
Get IP TCP/UDP port. | |
in_addr_t | ats_ip4_addr_host_order (sockaddr const *addr) |
Extract the IPv4 address. | |
sockaddr * | ats_ip4_set (sockaddr_in *dst, in_addr_t addr, in_port_t port=0) |
Write IPv4 data to storage dst. | |
sockaddr * | ats_ip4_set (IpEndpoint *dst, in_addr_t ip4, in_port_t port=0) |
Write IPv4 data to dst. | |
sockaddr * | ats_ip4_set (sockaddr *dst, in_addr_t ip4, in_port_t port=0) |
Write IPv4 data to storage dst. | |
sockaddr * | ats_ip6_set (sockaddr_in6 *dst, in6_addr const &addr, in_port_t port=0) |
Write IPv6 data to storage dst. | |
sockaddr * | ats_ip6_set (sockaddr *dst, in6_addr const &addr, in_port_t port=0) |
Write IPv6 data to storage dst. | |
sockaddr * | ats_ip6_set (IpEndpoint *dst, in6_addr const &addr, in_port_t port=0) |
Write IPv6 data to storage dst. | |
char const * | ats_ip_ntop (const sockaddr *addr, char *dst, size_t size) |
Write a null terminated string for addr to dst. | |
char const * | ats_ip_ntop (IpEndpoint const *addr, char *dst, size_t size) |
Write a null terminated string for addr to dst. | |
char const * | ats_ip_nptop (const sockaddr *addr, char *dst, size_t size) |
Write a null terminated string for addr to dst with port. | |
char const * | ats_ip_nptop (IpEndpoint const *addr, char *dst, size_t size) |
Write a null terminated string for addr to dst with port. | |
int | ats_ip_pton (const ts::ConstBuffer &text, sockaddr *addr) |
Convert text to an IP address and write it to addr. | |
int | ats_ip_pton (char const *text, sockaddr_in6 *addr) |
Convert text to an IP address and write it to addr. | |
int | ats_ip_pton (const ts::ConstBuffer &text, IpEndpoint *addr) |
int | ats_ip_pton (const char *text, IpEndpoint *addr) |
int | ats_ip_pton (const char *text, sockaddr *addr) |
Address operators | |
bool | ats_ip_copy (sockaddr *dst, sockaddr const *src) |
Copy the address from src to dst if it's IP. | |
bool | ats_ip_copy (IpEndpoint *dst, sockaddr const *src) |
bool | ats_ip_copy (IpEndpoint *dst, IpEndpoint const *src) |
bool | ats_ip_copy (sockaddr *dst, IpEndpoint const *src) |
int | ats_ip_addr_cmp (sockaddr const *lhs, sockaddr const *rhs) |
Compare two addresses. | |
int | ats_ip_addr_cmp (IpEndpoint const *lhs, IpEndpoint const *rhs) |
Compare two addresses. | |
bool | ats_ip_addr_eq (sockaddr const *lhs, sockaddr const *rhs) |
Check if two addresses are equal. | |
bool | ats_ip_addr_eq (IpEndpoint const *lhs, IpEndpoint const *rhs) |
bool | operator== (IpEndpoint const &lhs, IpEndpoint const &rhs) |
bool | operator!= (IpEndpoint const &lhs, IpEndpoint const &rhs) |
bool | ats_ip_addr_port_eq (sockaddr const *lhs, sockaddr const *rhs) |
Compare address and port for equality. | |
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
| |
int | ats_ip_getbestaddrinfo (char const *name, IpEndpoint *ip4, IpEndpoint *ip6) |
uint32_t | ats_ip_hash (sockaddr const *addr) |
Generic IP address hash function. | |
int | ats_ip_to_hex (sockaddr const *addr, char *dst, size_t len) |
Convert address to string as a hexidecimal value. | |
bool | operator== (IpAddr const &lhs, sockaddr const *rhs) |
bool | operator== (sockaddr const *lhs, IpAddr const &rhs) |
bool | operator!= (IpAddr const &lhs, sockaddr const *rhs) |
bool | operator!= (sockaddr const *lhs, IpAddr const &rhs) |
bool | operator== (IpAddr const &lhs, IpEndpoint const &rhs) |
bool | operator== (IpEndpoint const &lhs, IpAddr const &rhs) |
bool | operator!= (IpAddr const &lhs, IpEndpoint const &rhs) |
bool | operator!= (IpEndpoint const &lhs, IpAddr const &rhs) |
sockaddr * | ats_ip_set (sockaddr *dst, IpAddr const &addr, in_port_t port=0) |
Write IP addr to storage dst. | |
int | ats_ip_pton (char const *text, IpAddr &addr) |
Convert text to an IP address and write it to addr. | |
Variables | |
static size_t const | TS_IP6_SIZE = sizeof(in6_addr) |
Size in bytes of an IPv6 address. | |
static size_t const | INET6_ADDRPORTSTRLEN = INET6_ADDRSTRLEN + 6 |
Buffer size sufficient for IPv6 address and port. |
A brief file description.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file ink_inet.h.
#define INK_GETHOSTBYADDR_R_DATA_SIZE 1024 |
Definition at line 36 of file ink_inet.h.
#define INK_GETHOSTBYNAME_R_DATA_SIZE 1024 |
Definition at line 35 of file ink_inet.h.
typedef char ip_port_text_buffer[INET6_ADDRPORTSTRLEN] |
Convenience type for address formatting.
Definition at line 916 of file ink_inet.h.
typedef char ip_text_buffer[INET6_ADDRSTRLEN] |
Convenience type for address formatting.
Definition at line 914 of file ink_inet.h.
inkcoreapi uint32_t ats_inet_addr | ( | const char * | s | ) |
Wrapper for inet_addr().
s | IP address in the Internet standard dot notation. |
in_addr_t& ats_ip4_addr_cast | ( | sockaddr * | addr | ) | [inline] |
Access the IPv4 address.
If this is not an IPv4 address a zero valued address is returned.
Definition at line 424 of file ink_inet.h.
References ats_ip4_cast(), and ats_is_ip4().
Referenced by IpAddr::assign(), ats_ip4_addr_cast(), ats_ip4_addr_host_order(), ats_ip_addr32_cast(), ats_ip_addr8_cast(), ats_ip_hash(), ats_ip_ntop(), ats_is_ip_any(), ats_is_ip_linklocal(), ats_is_ip_private(), checkHttpTxnClientIPGet(), checkHttpTxnNextHopIPGet(), checkHttpTxnServerIPGet(), IpMap::contains(), ExtractIpRange(), IpMap::fill(), NetVConnection::get_local_addr(), NetVConnection::get_local_ip(), NetVConnection::get_remote_ip(), HOSTDB_CLIENT_IP_HASH(), INKUDPPacketFromAddressGet(), IpMap::mark(), LogAccess::marshal_ip(), operator==(), Connection::setup_mc_receive(), Connection::setup_mc_send(), HttpTransact::StartRemapRequest(), and IpMap::unmark().
in_addr_t const& ats_ip4_addr_cast | ( | sockaddr const * | addr | ) | [inline] |
Access the IPv4 address.
If this is not an IPv4 address a zero valued address is returned.
Definition at line 440 of file ink_inet.h.
References ats_ip4_cast(), and ats_is_ip4().
in_addr_t& ats_ip4_addr_cast | ( | IpEndpoint * | ip | ) | [inline] |
Access the IPv4 address.
If this is not an IPv4 address a zero valued address is returned.
Definition at line 457 of file ink_inet.h.
References ats_ip4_addr_cast(), and IpEndpoint::sa.
in_addr_t const& ats_ip4_addr_cast | ( | IpEndpoint const * | ip | ) | [inline] |
Access the IPv4 address.
If this is not an IPv4 address a zero valued address is returned.
Definition at line 470 of file ink_inet.h.
References ats_ip4_addr_cast(), and IpEndpoint::sa.
in_addr_t ats_ip4_addr_host_order | ( | sockaddr const * | addr | ) | [inline] |
Extract the IPv4 address.
addr | Address object. |
Definition at line 808 of file ink_inet.h.
References ats_ip4_addr_cast().
sockaddr_in const& ats_ip4_cast | ( | sockaddr const & | a | ) | [inline] |
Definition at line 324 of file ink_inet.h.
sockaddr_in* ats_ip4_cast | ( | sockaddr_in6 * | a | ) | [inline] |
Definition at line 328 of file ink_inet.h.
sockaddr_in const* ats_ip4_cast | ( | sockaddr_in6 const * | a | ) | [inline] |
Definition at line 331 of file ink_inet.h.
sockaddr_in& ats_ip4_cast | ( | sockaddr_in6 & | a | ) | [inline] |
Definition at line 335 of file ink_inet.h.
sockaddr_in const& ats_ip4_cast | ( | sockaddr_in6 const & | a | ) | [inline] |
Definition at line 338 of file ink_inet.h.
sockaddr_in& ats_ip4_cast | ( | sockaddr & | a | ) | [inline] |
Definition at line 321 of file ink_inet.h.
sockaddr_in* ats_ip4_cast | ( | sockaddr * | a | ) | [inline] |
Definition at line 314 of file ink_inet.h.
Referenced by ats_ip4_addr_cast(), ats_ip4_set(), ats_ip_addr_cmp(), ats_ip_addr_port_eq(), and ats_ip_port_cast().
sockaddr_in const* ats_ip4_cast | ( | sockaddr const * | a | ) | [inline] |
Definition at line 317 of file ink_inet.h.
sockaddr* ats_ip4_set | ( | sockaddr_in * | dst, | |
in_addr_t | addr, | |||
in_port_t | port = 0 | |||
) | [inline] |
Write IPv4 data to storage dst.
dst | Destination storage. | |
addr | address, IPv4 network order. | |
port | port, network order. |
Definition at line 815 of file ink_inet.h.
References ats_ip_sa_cast().
Referenced by ats_ip4_set(), ats_ip_pton(), ats_ip_set(), client_handler(), ClusterHandler::connectClusterEvent(), ExtractIpRange(), HttpTransact::HandleICPLookup(), INKUDPBind(), INKUDPSendTo(), ts::detail::Ip4Node::Ip4Node(), ip_addr_set(), Server::listen(), SocksProxy::mainEvent(), CCCongestionDBTestCont::mainEvent(), LogAccessTest::marshal_client_host_ip(), LogAccessTest::marshal_server_host_ip(), SDK_API_TSHttpConnectIntercept(), SDK_API_TSHttpConnectServerIntercept(), SDK_API_TSNetVConn(), SDK_API_TSPortDescriptor(), PluginVCCore::set_active_addr(), PluginVCCore::set_passive_addr(), HostDBProcessor::setbyaddr_appinfo(), HostDBProcessor::setbyname_appinfo(), HttpUpdateSM::start_scheduled_update(), synclient_txn_send_request(), and LogAccess::unmarshal_ip().
sockaddr* ats_ip4_set | ( | IpEndpoint * | dst, | |
in_addr_t | ip4, | |||
in_port_t | port = 0 | |||
) | [inline] |
Write IPv4 data to dst.
dst | Destination storage. | |
ip4 | address, IPv4 network order. | |
port | port, network order. |
Definition at line 833 of file ink_inet.h.
References ats_ip4_set(), and IpEndpoint::sin.
sockaddr* ats_ip4_set | ( | sockaddr * | dst, | |
in_addr_t | ip4, | |||
in_port_t | port = 0 | |||
) | [inline] |
Write IPv4 data to storage dst.
This is the generic overload. Caller must verify that dst is at least sizeof(sockaddr_in)
bytes.
dst | Destination storage. | |
ip4 | address, IPv4 network order. | |
port | port, network order. |
Definition at line 846 of file ink_inet.h.
References ats_ip4_cast(), and ats_ip4_set().
in6_addr& ats_ip6_addr_cast | ( | sockaddr * | addr | ) | [inline] |
Access the IPv6 address.
If this is not an IPv6 address a zero valued address is returned.
Definition at line 482 of file ink_inet.h.
References ats_ip6_cast().
Referenced by IpAddr::assign(), ats_ip_addr32_cast(), ats_ip_addr8_cast(), ats_ip_ntop(), ats_is_ip_any(), ats_is_ip_linklocal(), ats_is_ip_loopback(), ats_is_ip_multicast(), ats_is_ip_private(), LogAccess::marshal_ip(), and operator==().
in6_addr const& ats_ip6_addr_cast | ( | sockaddr const * | addr | ) | [inline] |
Definition at line 485 of file ink_inet.h.
References ats_ip6_cast().
in6_addr& ats_ip6_addr_cast | ( | IpEndpoint * | ip | ) | [inline] |
Definition at line 488 of file ink_inet.h.
References IpEndpoint::sin6.
in6_addr const& ats_ip6_addr_cast | ( | IpEndpoint const * | ip | ) | [inline] |
Definition at line 491 of file ink_inet.h.
References IpEndpoint::sin6.
sockaddr_in6* ats_ip6_cast | ( | sockaddr * | a | ) | [inline] |
Definition at line 342 of file ink_inet.h.
Referenced by ats_ip6_addr_cast(), ats_ip6_set(), ats_ip_addr_cmp(), ats_ip_addr_port_eq(), ats_ip_port_cast(), IpMap::contains(), IpMap::fill(), UDPReadContinuation::init_read(), IpMap::mark(), and IpMap::unmark().
sockaddr_in6 const* ats_ip6_cast | ( | sockaddr const * | a | ) | [inline] |
Definition at line 345 of file ink_inet.h.
sockaddr_in6& ats_ip6_cast | ( | sockaddr & | a | ) | [inline] |
Definition at line 348 of file ink_inet.h.
sockaddr_in6 const& ats_ip6_cast | ( | sockaddr const & | a | ) | [inline] |
Definition at line 351 of file ink_inet.h.
sockaddr* ats_ip6_set | ( | sockaddr_in6 * | dst, | |
in6_addr const & | addr, | |||
in_port_t | port = 0 | |||
) | [inline] |
Write IPv6 data to storage dst.
sockaddr*
. dst | Destination storage. | |
addr | address in network order. | |
port | Port, network order. |
Definition at line 856 of file ink_inet.h.
References ats_ip_sa_cast(), and memcpy.
Referenced by ats_ip6_set(), ats_ip_pton(), ats_ip_set(), ip_addr_set(), and LogAccess::unmarshal_ip().
sockaddr* ats_ip6_set | ( | sockaddr * | dst, | |
in6_addr const & | addr, | |||
in_port_t | port = 0 | |||
) | [inline] |
Write IPv6 data to storage dst.
sockaddr*
. dst | Destination storage. | |
addr | address in network order. | |
port | Port, network order. |
Definition at line 873 of file ink_inet.h.
References ats_ip6_cast(), and ats_ip6_set().
sockaddr* ats_ip6_set | ( | IpEndpoint * | dst, | |
in6_addr const & | addr, | |||
in_port_t | port = 0 | |||
) | [inline] |
Write IPv6 data to storage dst.
sockaddr*
. dst | Destination storage. | |
addr | address in network order. | |
port | Port, network order. |
Definition at line 883 of file ink_inet.h.
References ats_ip6_set(), and IpEndpoint::sin6.
uint32_t* ats_ip_addr32_cast | ( | sockaddr * | addr | ) | [inline] |
Cast an IP address to an array of uint32_t
.
NULL
if addr is not an IP address. Definition at line 501 of file ink_inet.h.
References ats_ip4_addr_cast(), and ats_ip6_addr_cast().
Referenced by ats_ip_addr32_cast(), and HOSTDB_CLIENT_IP_HASH().
uint32_t const* ats_ip_addr32_cast | ( | sockaddr const * | addr | ) | [inline] |
Definition at line 509 of file ink_inet.h.
References ats_ip_addr32_cast().
uint8_t* ats_ip_addr8_cast | ( | sockaddr * | addr | ) | [inline] |
Cast an IP address to an array of uint8_t
.
NULL
if addr is not an IP address. Definition at line 520 of file ink_inet.h.
References ats_ip4_addr_cast(), and ats_ip6_addr_cast().
Referenced by ats_ip_addr8_cast(), ats_ip_hash(), ats_ip_to_hex(), ats_is_ip_loopback(), ats_is_ip_multicast(), and make_key().
uint8_t const* ats_ip_addr8_cast | ( | sockaddr const * | addr | ) | [inline] |
Definition at line 528 of file ink_inet.h.
References ats_ip_addr8_cast().
uint8_t* ats_ip_addr8_cast | ( | IpEndpoint * | ip | ) | [inline] |
Definition at line 531 of file ink_inet.h.
References ats_ip_addr8_cast(), and IpEndpoint::sa.
uint8_t const* ats_ip_addr8_cast | ( | IpEndpoint const * | ip | ) | [inline] |
Definition at line 534 of file ink_inet.h.
References ats_ip_addr8_cast(), and IpEndpoint::sa.
int ats_ip_addr_cmp | ( | sockaddr const * | lhs, | |
sockaddr const * | rhs | |||
) | [inline] |
Compare two addresses.
This is useful for IPv4, IPv6, and the unspecified address type. If the addresses are of different types they are ordered
Non-IP < IPv4 < IPv6
AF_UNSPEC
)lhs | Left hand operand. | |
rhs | Right hand operand. |
Definition at line 698 of file ink_inet.h.
References ats_ip4_cast(), and ats_ip6_cast().
Referenced by ats_ip_addr_cmp(), ats_ip_addr_eq(), src_ip_info_t::contains(), ExtractIpRange(), PeerConfigData::GetHostIPByName(), HttpTransact::HandleICPLookup(), IpMap_Fill(), operator!=(), operator==(), and IpAllow::Print().
int ats_ip_addr_cmp | ( | IpEndpoint const * | lhs, | |
IpEndpoint const * | rhs | |||
) | [inline] |
Compare two addresses.
Definition at line 746 of file ink_inet.h.
References ats_ip_addr_cmp(), and IpEndpoint::sa.
bool ats_ip_addr_eq | ( | sockaddr const * | lhs, | |
sockaddr const * | rhs | |||
) | [inline] |
Check if two addresses are equal.
true
if lhs and rhs point to equal addresses, false
otherwise. Definition at line 754 of file ink_inet.h.
References ats_ip_addr_cmp().
Referenced by KeepAliveConnTable::append(), HttpSM::do_hostdb_update_if_necessary(), ConnectionCount::ConnAddrHashFns::equal(), HostDBRoundRobin::index_of(), LogFilterIP::operator==(), HttpTransact::OSDNSLookup(), HttpSM::process_hostdb_info(), DNSHandler::recv_dns(), restore_info(), HttpSM::state_mark_os_down(), MultiCastPeer::ValidSender(), ParentSiblingPeer::ValidSender(), and HttpTransact::will_this_request_self_loop().
bool ats_ip_addr_eq | ( | IpEndpoint const * | lhs, | |
IpEndpoint const * | rhs | |||
) | [inline] |
Definition at line 757 of file ink_inet.h.
References ats_ip_addr_cmp(), and IpEndpoint::sa.
bool ats_ip_addr_port_eq | ( | sockaddr const * | lhs, | |
sockaddr const * | rhs | |||
) | [inline] |
Compare address and port for equality.
Definition at line 769 of file ink_inet.h.
References ats_ip4_cast(), ats_ip6_cast(), and ats_ip_port_cast().
Referenced by HttpSM::do_http_server_open(), ServerSessionPool::IPHashing::equal(), and ServerSessionPool::match().
size_t ats_ip_addr_size | ( | sockaddr const * | addr | ) | [inline] |
addr | Address object. |
Definition at line 373 of file ink_inet.h.
Referenced by ats_ip_to_hex(), and make_key().
size_t ats_ip_addr_size | ( | IpEndpoint const * | addr | ) | [inline] |
addr | Address object. |
Definition at line 381 of file ink_inet.h.
References IpEndpoint::sa.
bool ats_ip_are_compatible | ( | IpEndpoint const * | lhs, | |
IpEndpoint const * | rhs | |||
) | [inline] |
true
if the address families are compatible. lhs | Address to test. | |
rhs | Address to test. |
Definition at line 259 of file ink_inet.h.
References ats_ip_are_compatible(), and IpEndpoint::sa.
bool ats_ip_are_compatible | ( | sockaddr const * | lhs, | |
sockaddr const * | rhs | |||
) | [inline] |
true
if the address families are compatible. lhs | Address to test. | |
rhs | Address to test. |
Definition at line 252 of file ink_inet.h.
Referenced by ats_ip_are_compatible(), UDPNetProcessor::CreateUDPSocket(), HOSTDB_CLIENT_IP_HASH(), and TSNetConnectTransparent().
bool ats_ip_are_compatible | ( | int | lhs, | |
sockaddr const * | rhs | |||
) | [inline] |
true
if the address families are compatible. lhs | Address family to test. | |
rhs | Address to test. |
Definition at line 266 of file ink_inet.h.
bool ats_ip_are_compatible | ( | sockaddr const * | lhs, | |
int | rhs | |||
) | [inline] |
true
if the address families are compatible. lhs | Address to test. | |
rhs | Family to test. |
Definition at line 273 of file ink_inet.h.
int ats_ip_check_characters | ( | ts::ConstBuffer | text | ) |
Check to see if a buffer contains only IP address characters.
Definition at line 458 of file ink_inet.cc.
References ts::ConstBuffer::data(), and ts::ConstBuffer::size().
Referenced by LogHost::set_name_or_ipstr().
bool ats_ip_copy | ( | IpEndpoint * | dst, | |
IpEndpoint const * | src | |||
) | [inline] |
dst | Destination object. | |
src | Source object. |
Definition at line 667 of file ink_inet.h.
References ats_ip_copy(), and IpEndpoint::sa.
bool ats_ip_copy | ( | sockaddr * | dst, | |
sockaddr const * | src | |||
) | [inline] |
Copy the address from src to dst if it's IP.
This attempts to do a minimal copy based on the type of src. If src is not an IP address type it is not copied and dst is marked as invalid.
true
if src was an IP address, false
otherwise. dst | Destination object. | |
src | Source object. |
Definition at line 639 of file ink_inet.h.
References ats_ip_invalidate(), and memcpy.
Referenced by UnixNetProcessor::accept_internal(), NetAccept::acceptFastEvent(), IpEndpoint::assign(), ats_ip_copy(), ats_ip_getbestaddrinfo(), HttpSM::attach_client_session(), PrefetchBlaster::blastObject(), br(), check_n_attach_prefetch_transform(), CongestionEntry::CongestionEntry(), DNSConnection::connect(), UnixNetProcessor::connect_re_internal(), NetAccept::do_blocking_accept(), ExtractIpRange(), ParentSiblingPeer::ExtToIntRecvSockAddr(), MultiCastPeer::ExtToIntRecvSockAddr(), DNSHandler::failover(), SocksEntry::findServer(), SocksEntry::free(), get_congest_entry(), UDPConnection::getBinding(), HttpTransact::HandleRequest(), SocksEntry::init(), KeepAliveLockHandler::init(), HttpTransact::initialize_state_variables_from_request(), ink_res_getservers(), ink_res_init(), ink_res_setservers(), PrefetchBlaster::invokeBlaster(), Server::listen(), Machine::Machine(), HostDBContinuation::make_put_message(), net_accept(), new_incoming_UDPPacket(), new_UDPPacket(), DNSProcessor::open(), DNSHandler::open_con(), HttpTransact::OSDNSLookup(), PrefetchTransform::parse_data(), HttpTransact::PPDNSLookup(), HttpSM::process_hostdb_info(), HttpTransact::ReDNSRoundRobin(), request_to_data(), PluginVC::set_local_addr(), HttpSM::set_next_state(), PluginVC::set_remote_addr(), UnixNetVConnection::set_remote_addr(), UDPConnection::setBinding(), ts::detail::Ip6Node::setMax(), ts::detail::Ip6Node::setMin(), Connection::setRemote(), Connection::setup_mc_send(), HttpSM::state_http_server_open(), TSHttpTxnServerAddrSet(), and PrefetchUrlBlaster::udpUrlBlaster().
bool ats_ip_copy | ( | IpEndpoint * | dst, | |
sockaddr const * | src | |||
) | [inline] |
dst | Destination object. | |
src | Source object. |
Definition at line 661 of file ink_inet.h.
References ats_ip_copy(), and IpEndpoint::sa.
bool ats_ip_copy | ( | sockaddr * | dst, | |
IpEndpoint const * | src | |||
) | [inline] |
Definition at line 673 of file ink_inet.h.
References ats_ip_copy(), and IpEndpoint::sa.
char const* ats_ip_family_name | ( | int | family | ) |
Get a string name for an IP address family.
NULL
). Definition at line 176 of file ink_inet.cc.
Referenced by HttpSM::do_http_server_open(), and HttpProxyPort::processOptions().
int ats_ip_getbestaddrinfo | ( | char const * | name, | |
IpEndpoint * | ip4, | |||
IpEndpoint * | ip6 | |||
) |
[in] | name | Address name (IPv4, IPv6, or host name) |
[out] | ip4 | Storage for IPv4 address. |
[out] | ip6 | Storage for IPv6 address |
Definition at line 372 of file ink_inet.cc.
References ats_ip_copy(), ats_ip_invalidate(), ats_ip_parse(), ats_ip_port_cast(), 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(), ts::ConstBuffer::data(), memcpy, ts::ConstBuffer::set(), and ts::ConstBuffer::size().
Referenced by RecHttpLoadIp(), and setup_socks_servers().
uint32_t ats_ip_hash | ( | sockaddr const * | addr | ) |
Generic IP address hash function.
Definition at line 285 of file ink_inet.cc.
References ats_ip4_addr_cast(), ats_ip_addr8_cast(), ats_is_ip4(), ats_is_ip6(), ink_code_md5(), and TS_IP6_SIZE.
Referenced by ParentRecord::FindParent(), ServerSessionPool::IPHashing::hash(), ConnectionCount::ConnAddrHashFns::hash(), and KeepAliveConnTable::ip_hash().
void ats_ip_invalidate | ( | IpEndpoint * | ip | ) | [inline] |
Definition at line 202 of file ink_inet.h.
References IpEndpoint::sa.
void ats_ip_invalidate | ( | sockaddr_in6 * | addr | ) | [inline] |
Definition at line 199 of file ink_inet.h.
void ats_ip_invalidate | ( | sockaddr * | addr | ) | [inline] |
Reset an address to invalid.
Definition at line 196 of file ink_inet.h.
Referenced by ats_ip_copy(), ats_ip_getbestaddrinfo(), ats_ip_pton(), ats_ip_set(), DNSProcessor::dns_init(), DNSHandler::DNSHandler(), HttpTransact::HandleRequest(), ip_addr_set(), DNSProcessor::open(), HostDBInfo::reset(), HostDBInfo::set_failed(), ShowHostDB::ShowHostDB(), and LogAccess::unmarshal_ip().
char const* ats_ip_nptop | ( | const sockaddr * | addr, | |
char * | dst, | |||
size_t | size | |||
) |
Write a null terminated string for addr to dst with port.
A buffer of size INET6_ADDRPORTSTRLEN suffices, including a terminating nul.
addr | Address. | |
dst | Output buffer. | |
size | Length of buffer. |
Definition at line 183 of file ink_inet.cc.
References ats_ip_ntop(), and ats_ip_port_host_order().
Referenced by HttpSessionAccept::accept(), Http2SessionAccept::accept(), Server::accept(), ats_ip_nptop(), LogSock::connect(), LogHost::connect(), DNSConnection::connect(), UnixNetProcessor::connect_re_internal(), UDPNetProcessor::CreateUDPSocket(), DNSProcessor::dns_init(), HttpSM::do_hostdb_update_if_necessary(), HttpSM::do_http_server_open(), ParentSiblingPeer::ExpectedReplies(), ICPPeerReadCont::ICPPeerQueryCont(), ICPPeerReadCont::ICPPeerQueryEvent(), Peer::LogRecvMsg(), HttpSM::mark_host_failure(), DNSHandler::open_con(), ICPPeerReadCont::PeerReadStateMachine(), ICPPeerReadCont::StaleCheck(), SocksEntry::startEvent(), DNSHandler::startEvent(), and HttpSM::state_http_server_open().
char const* ats_ip_nptop | ( | IpEndpoint const * | addr, | |
char * | dst, | |||
size_t | size | |||
) | [inline] |
Write a null terminated string for addr to dst with port.
A buffer of size INET6_ADDRPORTSTRLEN suffices, including a terminating nul.
addr | Address. | |
dst | Output buffer. | |
size | Length of buffer. |
Definition at line 930 of file ink_inet.h.
References ats_ip_nptop(), and IpEndpoint::sa.
char const* ats_ip_ntop | ( | const sockaddr * | addr, | |
char * | dst, | |||
size_t | size | |||
) |
Write a null terminated string for addr to dst.
A buffer of size INET6_ADDRSTRLEN suffices, including a terminating nul.
addr | Address. | |
dst | Output buffer. | |
size | Length of buffer. |
char const* ats_ip_ntop | ( | IpEndpoint const * | addr, | |
char * | dst, | |||
size_t | size | |||
) | [inline] |
Write a null terminated string for addr to dst.
A buffer of size INET6_ADDRSTRLEN suffices, including a terminating nul.
addr | Address. | |
dst | Output buffer. | |
size | Length of buffer. |
Definition at line 903 of file ink_inet.h.
References ats_ip_ntop(), and IpEndpoint::sa.
const char* ats_ip_ntop | ( | const struct sockaddr * | addr, | |
char * | dst, | |||
size_t | size | |||
) |
Definition at line 156 of file ink_inet.cc.
References ats_ip4_addr_cast(), and ats_ip6_addr_cast().
Referenced by HttpSessionAccept::accept(), HttpTransact::add_client_ip_to_outgoing_request(), MultiCastPeer::AddMultiCastChild(), ats_ip_nptop(), ats_ip_ntop(), HttpTransact::build_error_response(), check_n_attach_prefetch_transform(), client_handler(), config_read_proto(), DNSConnection::connect(), HttpTransact::delete_server_rr_entry(), HttpSM::do_http_server_open(), HttpServerSession::do_io_close(), DNSHandler::failover(), SocksEntry::findServer(), CCCongestionDBTestCont::gen_CongestionEntry(), HttpTransact::handle_response_from_parent(), HttpTransact::HandleBlindTunnel(), KeepAliveConn::handleEvent(), IpMap_Fill(), IpMapTestPrint(), Machine::Machine(), HttpSM::mark_host_failure(), HttpServerSession::new_connection(), HttpTransact::OSDNSLookup(), ICPPeerReadCont::PeerReadStateMachine(), HttpTransact::PPDNSLookup(), IpAllow::Print(), IpMatcher< Data, Result >::Print(), acl_filter_rule::print(), CoreUtils::process_NetVC(), HttpTransact::process_quick_http_filter(), DNSHandler::recover(), DNSHandler::recv_dns(), HttpTransact::ReDNSRoundRobin(), remap_parse_config_bti(), remove_round_robin(), reply_to_cont(), HttpTransact::retry_server_connection_not_open(), DNSHandler::rr_failure(), HttpSM::set_next_state(), setup_socks_servers(), ShowNet::showConnectionsOnThread(), ShowHostDB::showLookupDone(), ShowHostDB::showOne(), CongestionEntry::sprint(), SSLDiagnostic(), IpAddr::toString(), LogAccess::unmarshal_ip_to_str(), and HttpSM::update_stats().
int ats_ip_parse | ( | ts::ConstBuffer | src, | |
ts::ConstBuffer * | addr, | |||
ts::ConstBuffer * | port | |||
) |
Parse a string for pieces of an IP address.
This doesn't parse the actual IP address, but picks it out from src. It is intended to deal with the brackets that can optionally surround an IP address (usually IPv6) which in turn are used to differentiate between an address and an attached port. E.g.
[FE80:9312::192:168:1:1]:80
addr or port can be NULL
in which case that value isn't returned.
[in] | src | String to search. |
[out] | addr | Range containing IP address. |
[out] | port | Range containing port. |
Definition at line 196 of file ink_inet.cc.
References ts::ConstBuffer::after(), ts::ConstBuffer::clip(), ts::ConstBuffer::data(), ts::ConstBuffer::find(), ts::ConstBuffer::reset(), and ts::ConstBuffer::splitOn().
Referenced by ats_ip_getbestaddrinfo(), ats_ip_pton(), Ink_Inet(), and LogHost::set_name_or_ipstr().
in_port_t const& ats_ip_port_cast | ( | sockaddr const * | sa | ) | [inline] |
Definition at line 406 of file ink_inet.h.
References ats_ip_port_cast().
in_port_t& ats_ip_port_cast | ( | IpEndpoint * | ip | ) | [inline] |
Definition at line 412 of file ink_inet.h.
References ats_ip_port_cast(), and IpEndpoint::sa.
in_port_t const& ats_ip_port_cast | ( | IpEndpoint const * | ip | ) | [inline] |
Definition at line 409 of file ink_inet.h.
References ats_ip_port_cast(), and IpEndpoint::sa.
in_port_t& ats_ip_port_cast | ( | sockaddr * | sa | ) | [inline] |
Get a reference to the port in an address.
Definition at line 397 of file ink_inet.h.
References ats_ip4_cast(), ats_ip6_cast(), ats_is_ip4(), and ats_is_ip6().
Referenced by ServerSessionPool::acquireSession(), ats_ip_addr_port_eq(), ats_ip_getbestaddrinfo(), ats_ip_port_cast(), ats_ip_port_host_order(), ats_ip_pton(), PrefetchBlaster::blastObject(), LogSock::connect(), DNSConnection::connect(), DNSProcessor::dns_init(), HttpSM::do_hostdb_update_if_necessary(), HttpSM::do_http_server_open(), MultiCastPeer::ExtToIntRecvSockAddr(), SocksEntry::findServer(), NetVConnection::get_local_addr(), SocksEntry::mainEvent(), ServerSessionPool::match(), ICPPeerReadCont::PeerReadStateMachine(), IpEndpoint::port(), register_ShowNet(), Connection::setup_mc_receive(), HttpSM::state_http_server_open(), TSHttpConnectTransparent(), TSHttpConnectWithPluginId(), TSHttpTxnServerAddrSet(), PrefetchUrlBlaster::udpUrlBlaster(), MultiCastPeer::ValidSender(), and ParentSiblingPeer::ValidSender().
in_port_t ats_ip_port_host_order | ( | IpEndpoint const * | ip | ) | [inline] |
Get IP TCP/UDP port.
ip | Address with port. |
Definition at line 796 of file ink_inet.h.
References ats_ip_port_cast(), and IpEndpoint::sa.
in_port_t ats_ip_port_host_order | ( | sockaddr const * | addr | ) | [inline] |
Get IP TCP/UDP port.
addr | Address with port. |
Definition at line 785 of file ink_inet.h.
References ats_ip_port_cast().
Referenced by UnixNetProcessor::accept_internal(), NetAccept::acceptEvent(), MultiCastPeer::AddMultiCastChild(), ats_ip_nptop(), checkHttpTxnClientAddrGet(), checkHttpTxnIncomingAddrGet(), client_handler(), UDPNetProcessor::CreateUDPSocket(), MultiCastPeer::FindMultiCastChild(), ICPProcessor::FindPeer(), SocksEntry::findServer(), get_hostinfo_ClusterFunction(), NetVConnection::get_local_port(), NetVConnection::get_remote_port(), UDPConnection::getPortNum(), INKUDPPacketFromPortGet(), Server::listen(), MultiCastPeer::LogSendMsg(), CoreUtils::process_NetVC(), put_hostinfo_ClusterFunction(), HostDBProcessor::setby(), ShowNet::showConnectionsOnThread(), TSHttpTxnOutgoingAddrSet(), TSNetConnectTransparent(), HttpSM::update_stats(), and HttpTransact::will_this_request_self_loop().
int ats_ip_pton | ( | const ts::ConstBuffer & | text, | |
IpEndpoint * | addr | |||
) | [inline] |
[in] | text | text. |
[out] | addr | address |
Definition at line 978 of file ink_inet.h.
References ats_ip_pton(), and IpEndpoint::sa.
int ats_ip_pton | ( | const char * | text, | |
sockaddr * | addr | |||
) | [inline] |
[in] | text | text. |
[out] | addr | address |
Definition at line 992 of file ink_inet.h.
References ats_ip_pton().
int ats_ip_pton | ( | const ts::ConstBuffer & | text, | |
sockaddr * | addr | |||
) |
Convert text to an IP address and write it to addr.
text is expected to be an explicit address, not a hostname. No hostname resolution is done. The call must provide an ip large enough to hold the address value.
This attempts to recognize and process a port value if present. The port in ip is set appropriately, or to zero if no port was found or it was malformed.
inet_pton
. getaddrinfo
internally and so involves memory allocation.[in] | text | text. |
[out] | addr | address |
Definition at line 249 of file ink_inet.cc.
References ats_ip4_set(), ats_ip6_set(), ats_ip_invalidate(), ats_ip_parse(), ats_ip_port_cast(), ats_is_ip(), ts::ConstBuffer::data(), ts::ConstBuffer::find(), memcpy, ts::ConstBuffer::set(), and ts::ConstBuffer::size().
Referenced by ats_ip_pton(), config_read_proto(), DNSProcessor::dns_init(), HttpSM::do_hostdb_reverse_lookup(), ExtractIpRange(), SocksEntry::findServer(), HttpTransact::HandleRequest(), PrefetchBlaster::init(), Ink_Inet(), IpMap_Fill(), IpMap_Unmark(), IpAddr::load(), PARENTSELECTION(), read_addr(), register_ShowHostDB(), register_ShowNet(), remove_congested_entry(), NetVCOptions::set_sni_servername(), and ssl_store_ssl_context().
int ats_ip_pton | ( | char const * | text, | |
sockaddr_in6 * | addr | |||
) | [inline] |
Convert text to an IP address and write it to addr.
text is expected to be an explicit address, not a hostname. No hostname resolution is done.
getaddrinfo
internally and so involves memory allocation. [in] | text | text. |
[out] | addr | address |
Definition at line 971 of file ink_inet.h.
References ats_ip_pton(), and ats_ip_sa_cast().
int ats_ip_pton | ( | const char * | text, | |
IpEndpoint * | addr | |||
) | [inline] |
[in] | text | text. |
[out] | addr | address |
Definition at line 985 of file ink_inet.h.
References ats_ip_pton(), and IpEndpoint::sa.
int ats_ip_pton | ( | char const * | text, | |
IpAddr & | addr | |||
) | [inline] |
Convert text to an IP address and write it to addr.
Convenience overload.
[in] | text | text. |
[out] | addr | address |
Definition at line 1239 of file ink_inet.h.
References IpAddr::load().
sockaddr const* ats_ip_sa_cast | ( | sockaddr_storage const * | a | ) | [inline] |
Definition at line 289 of file ink_inet.h.
sockaddr* ats_ip_sa_cast | ( | sockaddr_storage * | a | ) | [inline] |
Definition at line 286 of file ink_inet.h.
Referenced by ats_ip4_set(), ats_ip6_set(), ats_ip_pton(), check_n_attach_prefetch_transform(), config_read_proto(), ClusterHandler::connectClusterEvent(), ExtractIpRange(), INKUDPBind(), PrefetchBlaster::invokeBlaster(), ts::detail::Ip4Node::Ip4Node(), IpAddr::IpAddr(), SocksProxy::mainEvent(), ts::detail::Ip6Node::max(), ts::detail::Ip4Node::max(), ts::detail::Ip6Node::min(), ts::detail::Ip4Node::min(), UDPReadContinuation::readPollEvent(), SDK_API_TSHttpConnectIntercept(), SDK_API_TSHttpConnectServerIntercept(), HostDBProcessor::setbyaddr_appinfo(), HostDBProcessor::setbyname_appinfo(), ts::detail::Ip6Node::setMax(), ts::detail::Ip6Node::setMin(), synclient_txn_send_request(), TSFetchPages(), and UDPNetProcessorInternal::udp_read_from_net().
sockaddr* ats_ip_sa_cast | ( | sockaddr_in6 * | a | ) | [inline] |
Definition at line 300 of file ink_inet.h.
sockaddr const* ats_ip_sa_cast | ( | sockaddr_in6 const * | a | ) | [inline] |
Definition at line 303 of file ink_inet.h.
sockaddr const* ats_ip_sa_cast | ( | sockaddr_in const * | a | ) | [inline] |
Definition at line 296 of file ink_inet.h.
sockaddr* ats_ip_sa_cast | ( | sockaddr_in * | a | ) | [inline] |
Definition at line 293 of file ink_inet.h.
sockaddr* ats_ip_set | ( | sockaddr * | dst, | |
IpAddr const & | addr, | |||
in_port_t | port = 0 | |||
) |
Write IP addr to storage dst.
dst | Destination storage. | |
addr | source address. | |
port | port, network order. |
size_t ats_ip_size | ( | IpEndpoint const * | addr | ) | [inline] |
addr | Address object. |
Definition at line 364 of file ink_inet.h.
References IpEndpoint::sa.
size_t ats_ip_size | ( | sockaddr const * | addr | ) | [inline] |
sockaddr
size for the family of addr. addr | Address object. |
Definition at line 356 of file ink_inet.h.
Referenced by Connection::connect(), LogSock::connect(), DNSConnection::connect(), UDPNetProcessor::CreateUDPSocket(), LogSock::listen(), Server::listen(), Machine::Machine(), Connection::open(), Connection::setup_mc_receive(), Connection::setup_mc_send(), and UDPNetProcessor::UDPBind().
sockaddr_storage* ats_ip_ss_cast | ( | sockaddr * | a | ) | [inline] |
Definition at line 307 of file ink_inet.h.
sockaddr_storage const* ats_ip_ss_cast | ( | sockaddr const * | a | ) | [inline] |
Definition at line 310 of file ink_inet.h.
int ats_ip_to_hex | ( | sockaddr const * | addr, | |
char * | dst, | |||
size_t | len | |||
) |
Convert address to string as a hexidecimal value.
The string is always nul terminated, the output string is clipped if dst is insufficient.
addr | Address to convert. Must be IP. | |
dst | Destination buffer. | |
len | Length of dst. |
Definition at line 301 of file ink_inet.cc.
References ats_ip_addr8_cast(), ats_ip_addr_size(), ats_is_ip(), and ink_assert.
Referenced by Machine::Machine(), SSLAddressLookupKey::SSLAddressLookupKey(), and LogAccess::unmarshal_ip_to_hex().
bool ats_is_ip | ( | IpEndpoint const * | addr | ) | [inline] |
true
if the address is IP, false
otherwise. Definition at line 219 of file ink_inet.h.
References IpEndpoint::sa.
bool ats_is_ip | ( | sockaddr const * | addr | ) | [inline] |
Test for IP protocol.
true
if the address is IP, false
otherwise. Definition at line 214 of file ink_inet.h.
Referenced by HttpTransact::add_client_ip_to_outgoing_request(), ats_ip_getbestaddrinfo(), ats_ip_pton(), ats_ip_to_hex(), PrefetchBlaster::blastObject(), LogSock::connect(), DNSConnection::connect(), UnixNetProcessor::connect_re_internal(), HostDBInfo::failed(), find_server_and_update_current_info(), HttpProxyPort::findHttp(), NetVConnection::get_local_addr(), PeerConfigData::GetHostIPByName(), HttpTransact::handle_response_from_icp_suggested_host(), HttpTransact::HandleCacheOpenReadHit(), HttpTransact::HandleCacheOpenReadMiss(), HttpTransact::HandleICPLookup(), HttpTransact::HandleRequest(), ink_res_init(), ink_res_setservers(), IpEndpoint::isValid(), Server::listen(), Machine::Machine(), LogAccessHttp::marshal_server_host_ip(), Connection::open(), ConnectionCount::ConnAddr::operator bool(), UrlRewrite::PerformACLFiltering(), HttpTransact::PPDNSLookup(), HttpSM::process_hostdb_info(), HostDBCache::rebuild_callout(), remap_parse_config_bti(), remove_congested_entry(), HttpSM::set_next_state(), ShowNet::showConnectionsOnThread(), CongestionEntry::sprint(), SocksEntry::startEvent(), DNSHandler::startEvent(), TSFetchCreate(), TSHttpConnectTransparent(), TSHttpConnectWithPluginId(), TSNetConnect(), TSNetConnectTransparent(), LogAccess::unmarshal_ip_to_hex(), LogAccess::unmarshal_ip_to_str(), and HttpTransact::will_this_request_self_loop().
bool ats_is_ip | ( | int | family | ) | [inline] |
Test for IP protocol.
true
if the value is an IP address family, false
otherwise. Definition at line 225 of file ink_inet.h.
bool ats_is_ip4 | ( | IpEndpoint const * | addr | ) | [inline] |
Test for IPv4 protocol.
true
if the address is IPv4, false
otherwise. Definition at line 236 of file ink_inet.h.
References IpEndpoint::sa.
bool ats_is_ip4 | ( | sockaddr const * | addr | ) | [inline] |
Test for IPv4 protocol.
true
if the address is IPv4, false
otherwise. Definition at line 230 of file ink_inet.h.
Referenced by IpAddr::assign(), ats_host_res_match(), ats_ip4_addr_cast(), ats_ip_getbestaddrinfo(), ats_ip_hash(), ats_ip_port_cast(), ats_is_ip_any(), ats_is_ip_linklocal(), ats_is_ip_private(), DNSConnection::connect(), DNSProcessor::dns_init(), ExtractIpRange(), NetVConnection::get_local_addr(), NetVConnection::get_local_ip(), NetVConnection::get_remote_ip(), HOSTDB_CLIENT_IP_HASH(), SocksEntry::init(), Machine::Machine(), SocksEntry::mainEvent(), LogAccess::marshal_ip(), RecHttpLoadIp(), Connection::setup_mc_receive(), and TSHttpTxnOutgoingAddrSet().
bool ats_is_ip6 | ( | sockaddr const * | addr | ) | [inline] |
Test for IPv6 protocol.
true
if the address is IPv6, false
otherwise. Definition at line 241 of file ink_inet.h.
Referenced by IpAddr::assign(), ats_host_res_match(), ats_ip_getbestaddrinfo(), ats_ip_hash(), ats_ip_port_cast(), ats_is_ip_any(), ats_is_ip_linklocal(), ats_is_ip_private(), DNSConnection::connect(), db_mark_for(), DNSProcessor::dns_init(), NetVConnection::get_local_addr(), host_res_style_for(), HOSTDB_CLIENT_IP_HASH(), Machine::Machine(), SocksEntry::mainEvent(), LogAccess::marshal_ip(), RecHttpLoadIp(), Server::setup_fd_for_listen(), setup_socks_servers(), and TSHttpTxnOutgoingAddrSet().
bool ats_is_ip6 | ( | IpEndpoint const * | addr | ) | [inline] |
Test for IPv6 protocol.
true
if the address is IPv6, false
otherwise. Definition at line 247 of file ink_inet.h.
References IpEndpoint::sa.
bool ats_is_ip_any | ( | sockaddr const * | ip | ) | [inline] |
Check for being "any" address.
true
if ip is the any / unspecified address. Definition at line 624 of file ink_inet.h.
References ats_ip4_addr_cast(), ats_ip6_addr_cast(), ats_is_ip4(), and ats_is_ip6().
Referenced by remap_parse_config_bti(), and TSHttpConnectTransparent().
bool ats_is_ip_linklocal | ( | IpEndpoint const * | ip | ) | [inline] |
Check for Link Local.
Definition at line 618 of file ink_inet.h.
References ats_is_ip_linklocal(), and IpEndpoint::sa.
bool ats_is_ip_linklocal | ( | sockaddr const * | ip | ) | [inline] |
Check for Link Local.
Definition at line 601 of file ink_inet.h.
References a, ats_ip4_addr_cast(), ats_ip6_addr_cast(), ats_is_ip4(), and ats_is_ip6().
Referenced by ats_ip_getbestaddrinfo(), ats_is_ip_linklocal(), and Machine::Machine().
bool ats_is_ip_loopback | ( | sockaddr const * | ip | ) | [inline] |
Check for loopback.
true
if this is an IP loopback address, false
otherwise. Definition at line 540 of file ink_inet.h.
References ats_ip6_addr_cast(), and ats_ip_addr8_cast().
Referenced by ats_ip_getbestaddrinfo(), ats_is_ip_loopback(), client_handler(), and Machine::Machine().
bool ats_is_ip_loopback | ( | IpEndpoint const * | ip | ) | [inline] |
Check for loopback.
true
if this is an IP loopback address, false
otherwise. Definition at line 551 of file ink_inet.h.
References ats_is_ip_loopback(), and IpEndpoint::sa.
bool ats_is_ip_multicast | ( | IpEndpoint const * | ip | ) | [inline] |
Check for multicast.
Definition at line 567 of file ink_inet.h.
References ats_is_ip_multicast(), and IpEndpoint::sa.
bool ats_is_ip_multicast | ( | sockaddr const * | ip | ) | [inline] |
Check for multicast.
Definition at line 557 of file ink_inet.h.
References ats_ip6_addr_cast(), and ats_ip_addr8_cast().
Referenced by ats_ip_getbestaddrinfo(), ats_is_ip_multicast(), Machine::Machine(), and UDPNetProcessor::UDPBind().
bool ats_is_ip_private | ( | sockaddr const * | ip | ) | [inline] |
Check for Private.
Definition at line 574 of file ink_inet.h.
References a, ats_ip4_addr_cast(), ats_ip6_addr_cast(), ats_is_ip4(), and ats_is_ip6().
Referenced by ats_ip_getbestaddrinfo(), ats_is_ip_private(), and Machine::Machine().
bool ats_is_ip_private | ( | IpEndpoint const * | ip | ) | [inline] |
Check for Private.
Definition at line 594 of file ink_inet.h.
References ats_is_ip_private(), and IpEndpoint::sa.
struct hostent* ink_gethostbyaddr_r | ( | char * | ip, | |
int | len, | |||
int | type, | |||
ink_gethostbyaddr_r_data * | data | |||
) | [read] |
Wrapper for gethostbyaddr_r().
If successful, returns a pointer to the hostent structure. Returns NULL and sets data->herrno to the appropriate error code on failure.
ip | IP address of the host | |
len | length of the buffer indicated by ip | |
type | family of the address | |
data | pointer to ink_gethostbyname_r_data allocated by the caller |
Definition at line 68 of file ink_inet.cc.
References ink_gethostbyaddr_r_data::buf, ink_gethostbyaddr_r_data::ent, ink_gethostbyaddr_r_data::herrno, and INK_GETHOSTBYNAME_R_DATA_SIZE.
Referenced by ClusterMachine::ClusterMachine().
struct hostent* ink_gethostbyname_r | ( | char * | hostname, | |
ink_gethostbyname_r_data * | data | |||
) | [read] |
Wrapper for gethostbyname_r().
If successful, returns a pointer to the hostent structure. Returns NULL and sets data->herrno to the appropriate error code on failure.
hostname | null-terminated host name string | |
data | pointer to ink_gethostbyname_r_data allocated by the caller |
Definition at line 39 of file ink_inet.cc.
References ink_gethostbyname_r_data::buf, ink_gethostbyname_r_data::ent, ink_gethostbyname_r_data::herrno, and INK_GETHOSTBYNAME_R_DATA_SIZE.
bool operator!= | ( | IpEndpoint const & | lhs, | |
IpEndpoint const & | rhs | |||
) | [inline] |
Definition at line 764 of file ink_inet.h.
References ats_ip_addr_cmp(), and IpEndpoint::sa.
bool operator!= | ( | IpAddr const & | lhs, | |
sockaddr const * | rhs | |||
) | [inline] |
Definition at line 1208 of file ink_inet.h.
bool operator!= | ( | sockaddr const * | lhs, | |
IpAddr const & | rhs | |||
) | [inline] |
Definition at line 1211 of file ink_inet.h.
bool operator!= | ( | IpAddr const & | lhs, | |
IpEndpoint const & | rhs | |||
) | [inline] |
Definition at line 1220 of file ink_inet.h.
References IpEndpoint::sa.
bool operator!= | ( | IpEndpoint const & | lhs, | |
IpAddr const & | rhs | |||
) | [inline] |
Definition at line 1223 of file ink_inet.h.
References IpEndpoint::sa.
bool operator== | ( | IpAddr const & | lhs, | |
sockaddr const * | rhs | |||
) |
Definition at line 357 of file ink_inet.cc.
References IpAddr::_addr, IpAddr::_family, IpAddr::_ip4, IpAddr::_ip6, ats_ip4_addr_cast(), and ats_ip6_addr_cast().
bool operator== | ( | IpAddr const & | lhs, | |
IpEndpoint const & | rhs | |||
) | [inline] |
Definition at line 1214 of file ink_inet.h.
References IpEndpoint::sa.
bool operator== | ( | IpEndpoint const & | lhs, | |
IpAddr const & | rhs | |||
) | [inline] |
Definition at line 1217 of file ink_inet.h.
References IpEndpoint::sa.
bool operator== | ( | IpEndpoint const & | lhs, | |
IpEndpoint const & | rhs | |||
) | [inline] |
Definition at line 761 of file ink_inet.h.
References ats_ip_addr_cmp(), and IpEndpoint::sa.
bool operator== | ( | sockaddr const * | lhs, | |
IpAddr const & | rhs | |||
) | [inline] |
Definition at line 1205 of file ink_inet.h.
size_t const INET6_ADDRPORTSTRLEN = INET6_ADDRSTRLEN + 6 [static] |
Buffer size sufficient for IPv6 address and port.
Definition at line 912 of file ink_inet.h.
Referenced by UnixNetProcessor::connect_re_internal(), UDPNetProcessor::CreateUDPSocket(), HttpSM::do_hostdb_update_if_necessary(), HttpSM::do_http_server_open(), HttpSM::mark_host_failure(), and SocksEntry::startEvent().
size_t const TS_IP6_SIZE = sizeof(in6_addr) [static] |
Size in bytes of an IPv6 address.
Definition at line 192 of file ink_inet.h.
Referenced by ats_ip_hash(), ts::detail::cmp(), ts::detail::Ip6Node::dec(), ts::detail::Ip6Node::inc(), SocksEntry::mainEvent(), make_ipv6_ptr(), IpAddr::operator==(), and HostDBMD5::refresh().