65 std::string
str()
const;
97 std::vector<NetIfAddr> m_addrs;
99 static int parse_flags(
unsigned);
100 static int find_index(
const std::string&);
102 NetIf(
const std::string&,
const std::string&,
int);
103 friend class NetIfIterator;
112 enum class SocketType
129 static std::vector<InetAddr>
host_addrs(
const std::string&
name, SocketType=SocketType::any);
132 const std::string&
name()
const {
return m_name; }
135 const int index()
const {
return m_index; }
138 const std::string&
hw_addr()
const {
return m_hwaddr; }
141 const size_t speed()
const {
return m_speed; }
144 const size_t mtu()
const {
return m_mtu; }
149 int flags()
const {
return m_flags; }
150 bool test_flags(
int f)
const {
return (m_flags&f)==f; }
153 const std::vector<NetIfAddr>&
addrs()
const {
return m_addrs; }
155 std::string
str()
const;
InetAddr()
ipv6 internet address, initialized with "any" address
Named address within an interface.
std::string str() const
String representation of a network interface address.
const std::string & if_addr_name() const
The interface address name.
const std::string & hw_addr() const
Hardware address for the interface.
const int index() const
The interface index.
std::string str() const
String representation of network interface.
const size_t speed() const
Link speed in bytes / second, 0 means loopback.
const size_t mtu() const
Maximum transmission unit.
static std::vector< NetIf > all_interfaces()
List network interfaces on the local system.
static std::vector< InetAddr > host_addrs(const std::string &name, SocketType=SocketType::any)
List addresses for the specified host (do a name lookup).
int flags() const
Flags for this interface.
const std::string & name() const
Name of the interface.
const std::vector< NetIfAddr > & addrs() const
Zero or more addresses associated with this interface.
NetIfFlag
Interface flags.
@ if_loopback
Interface is a loopback interface.
@ if_broadcast
Valid broadcast address set.
@ if_multicast
Supports multicast.
@ if_running
Resources allocated.
@ if_noarp
No arp protocol, L2 destination address not set.
@ if_dynamic
The addresses are lost when the interface goes down.
@ if_up
Interface is running.
@ if_pointtopoint
Interface is a point-to-point link.
@ if_allmulti
Receives all multicast packets.
@ if_promisc
Interface is in promiscuous mode.
@ if_echo
Echoes sent packets.
Internet tcp and udp networking.
std::ostream & operator<<(std::ostream &, const scc::net::InetAddr &)
Print the socket address details to an output stream.