Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
Stroika::Foundation::IO::Network Namespace Reference

Namespaces

namespace  ConnectionlessSocket
 ConnectionlessSocket is typically a UDP socket you use for packet oriented communications (ie not tcp/streams)
 
namespace  ConnectionOrientedMasterSocket
 
namespace  ConnectionOrientedStreamSocket
 ConnectionOrientedStreamSocket is typically a tcp stream, either setup with Connect, or ConnectionOrientedMasterSocket::Accept ()
 
namespace  HTTP
 
namespace  Socket
 
namespace  Transfer
 
namespace  WellKnownPorts
 

Classes

class  CIDR
 
class  DNS
 
struct  Interface
 
class  InternetAddress
 
struct  LinkMonitor
 
class  NeighborsMonitor
 Monitor - either immediately or in the background fetches a list of network neighbors (1 hop away network devices). Also fetches their hardware address (so like 'arp' kind of but may employ other means) More...
 
class  SocketAddress
 
class  SystemInterfacesMgr
 
class  URI
 

Typedefs

using InterfacesByID = Containers::KeyedCollection< Interface, Interface::SystemIDType, Containers::KeyedCollection_DefaultTraits< Interface, Interface::SystemIDType, Interface::IDExtractor > >
 Interfaces seen at one moment (e.g. one SystemInterfacesMgr::GetAll ()), keyed by fInterfaceID.
 
using in_addr_t = uint32_t
 

Functions

optional< InternetAddress > GetLocalAddressToReach (const SocketAddress &peer)
 This machine's address for reaching peer - the local address a datagram sent to peer would carry, so the address peer can reach this machine at, on the network between them.
 
Traversal::Iterable< InternetAddress > InternetAddresses_Any (InternetProtocol::IP::IPVersionSupport ipSupport=InternetProtocol::IP::IPVersionSupport::eDEFAULT)
 
Traversal::Iterable< InternetAddress > InternetAddresses_Localhost (InternetProtocol::IP::IPVersionSupport ipSupport=InternetProtocol::IP::IPVersionSupport::eDEFAULT)
 
InternetAddress GetPrimaryInternetAddress ()
 
Traversal::Iterable< SocketAddress > SocketAddresses (const Traversal::Iterable< InternetAddress > &internetAddresses, PortType portNumber)
 
constexpr InternetAddress LocalHost (SocketAddress::FamilyType fm)
 return V4::kLocalhost or V6::kLocalhost depending on argument address family
 

Detailed Description

Note
Code-Status: Beta

Typedef Documentation

◆ InterfacesByID

Interfaces seen at one moment (e.g. one SystemInterfacesMgr::GetAll ()), keyed by fInterfaceID.

Note
fInterfaceID is unique only among the interfaces there at one moment (
See also
Interface::SystemIDType) - so interfaces kept across time (a history of the networks seen, say) do not belong in one of these.

Definition at line 395 of file Interface.h.

◆ in_addr_t

v4 ip addr as a long.

Definition at line 71 of file InternetAddress.h.

Function Documentation

◆ GetLocalAddressToReach()

optional< InternetAddress > Stroika::Foundation::IO::Network::GetLocalAddressToReach ( const SocketAddress &  peer)

This machine's address for reaching peer - the local address a datagram sent to peer would carry, so the address peer can reach this machine at, on the network between them.

Asks the routing table (via a UDP socket connected to peer - which sends nothing). peer's port does not matter. A link-local IPv6 peer must carry its scope id - as the sender's address from ConnectionlessSocket::Ptr::ReceiveFrom does.

Returns nullopt if there is no route to peer.

Note
peer is a SocketAddress, not an InternetAddress, only because an InternetAddress cannot hold the scope id a link-local IPv6 peer needs. Once it can, this should take an InternetAddress - https://github.com/SophistSolutions/Stroika/issues/1201

Definition at line 1053 of file Interface.cpp.

◆ InternetAddresses_Any()

Traversal::Iterable< InternetAddress > Stroika::Foundation::IO::Network::InternetAddresses_Any ( InternetProtocol::IP::IPVersionSupport  ipSupport = InternetProtocol::IP::IPVersionSupport::eDEFAULT)

IN_ADDR_ANY This address is a wildcard, matching any address.

Note
Cannot declare here cuz then declaration and definition differ, and cannot define here because we have the constexpr CTOR methods in the .inl file.

namespace V4 { constexpr InternetAddress kAddrAny{in_addr{}}; } namespace V6 { constexpr InternetAddress kAddrAny{in6_addr{}}; } LOCALHOST address this address is for the current machine on its loopback interface.

Note
Cannot declare here cuz then declaration and definition differ, and cannot define here because we have the constexpr CTOR methods in the .inl file.

namespace V4 { constexpr InternetAddress kLocalhost{0x7f, 0x0, 0x0, 0x1}; } namespace V6 { constexpr InternetAddress kLocalhost{in6_addr{{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}}}; } v4 localhost address rendered as v6 (mapped).

Note
Cannot declare here cuz then declaration and definition differ, and cannot define here because we have the constexpr CTOR methods in the .inl file.

namespace V6 { constexpr InternetAddress kV4MappedLocalhost{in6_addr{{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0x7f, 0, 0, 1}}}}; } Return kAddrAny - both the IPv4 and IPv6 variants (depending on ipSupport argument) - which defaults to both.

Definition at line 430 of file InternetAddress.cpp.

◆ InternetAddresses_Localhost()

Traversal::Iterable< InternetAddress > Stroika::Foundation::IO::Network::InternetAddresses_Localhost ( InternetProtocol::IP::IPVersionSupport  ipSupport = InternetProtocol::IP::IPVersionSupport::eDEFAULT)

Return kLocalhost - both the IPv4 and IPv6 variants (depending on ipSupport argument) - which defaults to both.

Definition at line 447 of file InternetAddress.cpp.

◆ GetPrimaryInternetAddress()

InternetAddress Stroika::Foundation::IO::Network::GetPrimaryInternetAddress ( )

HORRIBLY KLUDGY BAD IMPL!!!

Definition at line 148 of file LinkMonitor.cpp.

◆ SocketAddresses()

Traversal::Iterable< SocketAddress > Stroika::Foundation::IO::Network::SocketAddresses ( const Traversal::Iterable< InternetAddress > &  internetAddresses,
PortType  portNumber 
)

Take the argument list of internet addresses and convert them to an equivalent list of SocketAddresses - with the given port.

Example Usage
Listener l{SocketAddresses (InternetAddresses_Any (), usingPortNumber), options.fBindFlags.Value (), ....
Traversal::Iterable< SocketAddress > SocketAddresses(const Traversal::Iterable< InternetAddress > &internetAddresses, PortType portNumber)
Traversal::Iterable< InternetAddress > InternetAddresses_Any(InternetProtocol::IP::IPVersionSupport ipSupport=InternetProtocol::IP::IPVersionSupport::eDEFAULT)

Definition at line 52 of file SocketAddress.cpp.