An IP address and host_order_port, modeled on an SRV type for DNS.
More...
#include <IPSrv.h>
An IP address and host_order_port, modeled on an SRV type for DNS.
Definition at line 224 of file IPSrv.h.
◆ IPSrv() [1/8]
| swoc::IPSrv::IPSrv |
( |
IP4Addr | addr, |
|
|
in_port_t | port = 0 ) |
|
inlineexplicit |
◆ IPSrv() [2/8]
| swoc::IPSrv::IPSrv |
( |
IP6Addr | addr, |
|
|
in_port_t | port = 0 ) |
|
inlineexplicit |
Construct for IPv6 address and port.
Definition at line 232 of file IPSrv.h.
◆ IPSrv() [3/8]
| swoc::IPSrv::IPSrv |
( |
IPAddr | addr, |
|
|
in_port_t | port = 0 ) |
|
explicit |
Construct from generic address and port.
Definition at line 816 of file swoc_ip.cc.
◆ IPSrv() [4/8]
| swoc::IPSrv::IPSrv |
( |
sockaddr const * | sa | ) |
|
|
inlineexplicit |
Construct from socket address.
Definition at line 555 of file IPSrv.h.
◆ IPSrv() [5/8]
| swoc::IPSrv::IPSrv |
( |
sockaddr_in const * | s | ) |
|
|
inlineexplicit |
Construct IPv4 service from socket address.
Definition at line 553 of file IPSrv.h.
◆ IPSrv() [6/8]
| swoc::IPSrv::IPSrv |
( |
sockaddr_in6 const * | s | ) |
|
|
inlineexplicit |
Construct IPv6 service from socket address.
Definition at line 554 of file IPSrv.h.
◆ IPSrv() [7/8]
Construct from Endpoint.
Definition at line 826 of file swoc_ip.cc.
◆ IPSrv() [8/8]
Construct from a string.
- Parameters
-
If the port is not present it is set to zero.
Definition at line 790 of file swoc_ip.cc.
◆ addr()
| IPAddr swoc::IPSrv::addr |
( |
| ) |
const |
|
inline |
- Returns
- The address.
Definition at line 560 of file IPSrv.h.
◆ assign() [1/10]
| auto swoc::IPSrv::assign |
( |
in_port_t | port | ) |
|
|
inline |
Assign port.
- Parameters
-
- Returns
- this.
Definition at line 628 of file IPSrv.h.
◆ assign() [2/10]
| auto swoc::IPSrv::assign |
( |
IP4Addr const & | addr | ) |
|
|
inline |
Change the address.
- Parameters
-
- Returns
- this
Definition at line 621 of file IPSrv.h.
◆ assign() [3/10]
| auto swoc::IPSrv::assign |
( |
IP4Addr const & | addr, |
|
|
in_port_t | port ) |
|
inline |
Assign an IPv4 address and port.
- Parameters
-
| addr | Address. |
| port | Port [host order]. |
- Returns
- this
Definition at line 607 of file IPSrv.h.
◆ assign() [4/10]
| auto swoc::IPSrv::assign |
( |
IP6Addr const & | addr | ) |
|
|
inline |
Change the address.
- Parameters
-
- Returns
- this
Definition at line 600 of file IPSrv.h.
◆ assign() [5/10]
| auto swoc::IPSrv::assign |
( |
IP6Addr const & | addr, |
|
|
in_port_t | port ) |
|
inline |
Assign an IPv6 address and port.
- Parameters
-
| addr | Address. |
| port | Port [host order]. |
- Returns
- this
Definition at line 614 of file IPSrv.h.
◆ assign() [6/10]
| auto swoc::IPSrv::assign |
( |
IPAddr const & | addr | ) |
|
|
inline |
Assign an address.
- Parameters
-
- Returns
- this
If addr isn't valid then no assignment is made, otherwise the family is changed to that of addr.
Definition at line 638 of file IPSrv.h.
◆ assign() [7/10]
| auto swoc::IPSrv::assign |
( |
IPAddr const & | addr, |
|
|
in_port_t | port ) |
|
inline |
Assign an address and port.
- Parameters
-
| addr | Address. |
| port | Port [host order]. |
- Returns
- this
If addr isn't valid then no assignment is made, otherwise the family is changed to match addr.
Definition at line 648 of file IPSrv.h.
◆ assign() [8/10]
| auto swoc::IPSrv::assign |
( |
sockaddr const * | sa | ) |
|
Assogm address amd [prt/
- Parameters
-
- Returns
- this
The assignment is ignored if sa is not a valid IP family, otherwise the family is changed to that of sa.
Definition at line 837 of file swoc_ip.cc.
◆ assign() [9/10]
| auto swoc::IPSrv::assign |
( |
sockaddr_in const * | s | ) |
|
|
inline |
Assign an IPv4 address and port.
- Parameters
-
- Returns
- this
Definition at line 674 of file IPSrv.h.
◆ assign() [10/10]
| auto swoc::IPSrv::assign |
( |
sockaddr_in6 const * | s | ) |
|
|
inline |
Assign an IPv6 address and port.
- Parameters
-
- Returns
- this
Definition at line 681 of file IPSrv.h.
◆ family()
| sa_family_t swoc::IPSrv::family |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
- The protocol of the current value.
Definition at line 565 of file IPSrv.h.
◆ host_order_port()
| in_port_t swoc::IPSrv::host_order_port |
( |
| ) |
const |
|
inlineconstexpr |
- Returns
- The host_order_port in host order..
Definition at line 590 of file IPSrv.h.
◆ ip4()
| IP4Srv const & swoc::IPSrv::ip4 |
( |
| ) |
const |
|
inline |
- Returns
- The IPv4 data.
Definition at line 581 of file IPSrv.h.
◆ ip6()
| IP6Srv const & swoc::IPSrv::ip6 |
( |
| ) |
const |
|
inline |
- Returns
- The IPv6 data.
Definition at line 585 of file IPSrv.h.
◆ is_ip4()
| bool swoc::IPSrv::is_ip4 |
( |
| ) |
const |
|
inline |
- Returns
true if the data is IPv4, false if not.
Definition at line 572 of file IPSrv.h.
◆ is_ip6()
| bool swoc::IPSrv::is_ip6 |
( |
| ) |
const |
|
inline |
- Returns
true if hte data is IPv6, false if not.
Definition at line 577 of file IPSrv.h.
◆ is_valid()
| bool swoc::IPSrv::is_valid |
( |
| ) |
const |
|
inline |
- Returns
true if this is a valid service, false if not.
Definition at line 569 of file IPSrv.h.
◆ load()
Load from a string.
- Parameters
-
- Returns
true if text in a valid format, false if not.
Definition at line 795 of file swoc_ip.cc.
◆ network_order_port()
| in_port_t swoc::IPSrv::network_order_port |
( |
| ) |
const |
|
inline |
- Returns
- The host_order_port in network order.
Definition at line 595 of file IPSrv.h.
◆ operator=() [1/5]
| auto swoc::IPSrv::operator= |
( |
IP4Srv const & | that | ) |
|
|
inline |
Assign from IPv4.
Definition at line 660 of file IPSrv.h.
◆ operator=() [2/5]
| auto swoc::IPSrv::operator= |
( |
IP6Srv const & | that | ) |
|
|
inline |
Assign from IPv6.
Definition at line 667 of file IPSrv.h.
◆ operator=() [3/5]
Assign from generic socket address.
Definition at line 687 of file IPSrv.h.
◆ operator=() [4/5]
Assign from IPv4 socket address.
Definition at line 691 of file IPSrv.h.
◆ operator=() [5/5]
Assign from IPv6 socket address.
Definition at line 695 of file IPSrv.h.
◆ _family
| sa_family_t swoc::IPSrv::_family = AF_UNSPEC |
|
protected |
Protocol family.
Definition at line 399 of file IPSrv.h.
The documentation for this class was generated from the following files: