network


A network is a set of computers that communicate using one or more protocols. The Internet, a well-known example of a network, links computers throughout the world using TCP/IP. Every network has a name, a set of aliases, and an IP network address. Information about a network is usually stored in the /etc/networks directory.

An os_network represents a single network and can be constructed from its name or from an IP address.

Library

Platform<ToolKit> for UNIX

Declaration

#include <ospace/unix/network.h>

class os_network

Interface

Constructor
os_network()
Constructs a network with an empty name.
Constructor
os_network( const netent& network )
Constructs a network from the netent structure network .
Constructor
os_network( const os_ip_address& address )
Constructs a network from the IP address address .

Throws: os_unix_toolkit_error

Constructor
os_network( const os_network& network )
Constructs a network that is a copy of network .
Constructor
os_network( const string& name )
Constructs a network from name .

Throws: os_unix_toolkit_error

<
bool operator<( const os_network& network ) const
Returns true if the object's name is less than network .
=
os_network& operator=( const os_network& network )
Assigns network from network .
==
bool operator==( const os_network& network ) const
Returns true if the network's name is the same as network .
aliases
const vector< string >& aliases() const
Returns a vector of the object's aliases.
defined
bool defined() const
Returns true if the object's name is not empty.
ip_address
const os_ip_address& ip_address() const
Returns the object's IP address.
name
string name() const
Returns the object's name.
networks
/* static */ vector< os_network* > networks()
Returns a vector of pointers to objects on the heap representing all of the networks in the network database. The caller is responsible for proper deletion of the vector objects.
print
void print( ostream& stream ) const
Prints the object's name and IP address to stream .

Non-Member Functions

<<
ostream& operator<<( ostream& stream , const os_network& network )
Prints network to stream .

Universal Streaming Service

#include <ospace/uss/network.h>
<<
os_bstream& operator<<( os_bstream& stream , const os_network& network )
Writes network to stream .
>>
os_bstream& operator>>( os_bstream& stream , os_network& network )
Reads network from stream .

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only. - For use by licensed users only.