Networks Map Type

This section explains the networks map type.

The following is the required prototype for a user-defined networks map class:

 void * nw_pvtinit();
 void nw_close(void *private);
 struct nwent * nw_byname(void *private, const char *name, int addrtype);
 struct nwent * nw_byaddr(void *private, void *net, int length, int addrtype);
 struct nwent * nw_next(void *private);
 void nw_rewind(void *private);
 void nw_minimize(void *private);

Function nw_pvtinit must exist. It is not required to return anything more than NULL. For example, the function can return NULL if the calling routine does not need private data.

Functions other than nw_pvtinit are optional for this class. The module can provide none or only part of the optional functions in its definition.

The operating system provides a data structure required to implement the networks map class, which uses this structure to communicate with the operating system.

   struct nwent {
        char *name;       /* official name of net */
        char **n_aliases; /* alias list */
        int n_addrtype;   /* net address type */
        void *n_addr;     /* network address */
        int n_length;     /* address length, in bits */
   };