index previous next




file name: netgen.hpp, netgen.cpp
classification: pure simulation
contents: functions NodeToNetwork(), NetworkToNode()
use: for converting a nodeID (type SINT32) into a network address (type addr) and vice versa

For the convenience of the user, nodes are identified through an integer, the nodeID. The network uses internet addresses, which are six byte addresses. In order to conform to the hardware, the simulated network converts all node identifiers into network addresses. The exact nature of the conversion is not important, as long as every nodeID corresponds to exactly one unique network address and vice versa.


global items used by the functions:


 void NetworkToNode (const addr* networkAddress, SINT32& nodeID): Computes the user node ID for a network address and copies it into nodeID. If the networkAddress is NULL, an assert fails.

 void NodeToNetwork (SINT32 nodeID, addr* networkAddress): Computes the network address for a node with the user identifier nodeID and copies it into networkAddress. If the networkAddress is NULL or the nodeID is negative, an assert fails.


last modified: Fri Feb 5 18:56:29 1999