31 #ifndef _SCC_NET_INET_H
32 #define _SCC_NET_INET_H
121 sockaddr_in6* m_addr;
137 InetAddr(
const std::string&,
unsigned);
166 virtual operator const sockaddr*()
const;
170 virtual operator sockaddr*();
174 virtual unsigned len()
const;
178 virtual std::string
str()
const;
182 virtual std::string
host()
const;
187 operator const sockaddr_in6*()
const {
return m_addr; }
204 void host(
const std::string&);
208 unsigned port()
const;
242 return (
flags() & f) == f;
264 virtual void reset();
278 std::shared_ptr<InetTcpSock> accept_shared();
287 std::shared_ptr<InetTcpSock> accept_shared(
InetAddr&);
305 virtual void reset();
bool test_flags(int f) const
Test if flags are set in this address.
virtual unsigned len() const
Socket address length in bytes.
unsigned port() const
Get the port.
InetAddr & operator=(const InetAddr &)
ipv6 internet address, copy assigned.
uint32_t scope_id() const
Get the scope id of the address.
void any_host()
Set to "any" host address ::
void local_host()
Set to local (loopback) address ::1.
virtual std::string host() const
Get host.
virtual ~InetAddr()
ipv6 internet address destructor.
virtual std::string str() const
Readable address string.
InetAddr()
ipv6 internet address, initialized with "any" address
int flags() const
Return the address flags.
Internet transmission control protocol (tcp) socket.
virtual void reset()
Close the connection and reset the socket.
InetTcpSock accept()
Accept a connection from an anonymous peer.
InetTcpSock()
Create an IPv6 stream socket.
InetAddr get_addr()
Get the socket address.
Internet user datagram protocol (udp) socket.
virtual void reset()
Reset the socket.
InetUdpSock()
Create an IPv6 datagram socket.
void mcast_leave_group(const InetAddr &, unsigned=0)
Leave a multicast group.
InetAddr get_addr()
Get the socket address.
void mcast_interface(unsigned=0)
Set the default interface for outgoing multicast messages.
void mcast_loopback(bool=true)
Enable or disable multicast loopback.
void mcast_hops(unsigned=1)
Hop limit for outgoing multicast messages.
void mcast_join_group(const InetAddr &, unsigned=0)
Join a multicast group.
Socket address base class.
int fd() const
Return the underlying socket handle.
InetAddrFlag
Internet address flags.
@ unicast
Unicast address.
@ link_local
Traffic is restricted to the local link.
@ realm_local
Traffic is restricted to the local realm.
@ scope_mask
Scope for multicast addresses mask.
@ mcast_all_nodes
Reaches all nodes in the scope, e.g. ff0X::1.
@ mcast_rendezvous
Address has a rendezvous point embedded.
@ mcast_flags_mask
Multicast flags mask.
@ admin_local
Traffic is restricted to the local admin.
@ unicast_special_mask
Some special unicast addresses.
@ global
Global traffic is allowed.
@ org_local
Traffic is restricted to the local organization.
@ mcast_all_routers
Reaches all routers in the scope, e.g. ff0X::2.
@ loopback
Loopback address.
@ prot_mask
Protocol mask.
@ if_local
Traffic is restricted to the local interface.
@ mcast_reserved_mask
Some reserved multicast addresses.
@ mcast_dynamic
Dynamic (temporary) address, otherwise permanent (assigned).
@ site_local
Traffic is restricted to the local site.
@ multicast
Multicast address.
@ unique_local_address
Address which can be used freely within a site: e.g. fd00::/8.
@ mcast_prefix
Prefix-based address.
std::ostream & operator<<(std::ostream &, const scc::net::InetAddr &)
Print the socket address details to an output stream.
Low-level tcp and udp sockets.