HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)

n
netdir(3N) netdir(3N)
getnetconfig()
. (See getnetconfig(3N)).
The
netdir_getbyaddr()
routine maps addresses to service names. This routine returns service ,a
list of host and service pairs that would yield this address. If more than one tuple of host and service name
is returned, then the first tuple contains the preferred host and service names:
struct nd_hostservlist {
int *h_cnt; /* number of hostservs found */
struct hostserv *h_hostservs;
};
The netdir_free()
function is used to free the structures allocated by the name to address translation
routines. The ptr parameter points to the structure that has to be freed. The parameter
struct_type
identifies the structure:
struct netbuf ND_ADDR
struct nd_addrlist ND_ADDRLIST
struct hostserv ND_HOSTSERV
struct nd_hostservlist ND_HOSTSERVLIST
The universal address returned by taddr2uaddr()
should be freed by free().
The
netdir_options()
routine is used to do all transport-specific setups and option management.
fildes is the associated file descriptor. option, fildes, and pointer_to_args are passed to the
netdir_options()
routine for the transport specified in config. Currently four values are defined for
option:
ND_SET_BROADCAST
ND_SET_RESERVEDPORT
ND_CHECK_RESERVEDPORT
ND_MERGEADDR
The taddr2uaddr() and uaddr2taddr()
routines support translation between universal addresses
and TLI type
netbufs. The taddr2uaddr()
routine takes a struct netbuf data structure and
returns a pointer to a string that contains the universal address. It returns NULL if the conversion is not
possible. This is not a fatal condition as some transports may not support a universal address form.
uaddr2taddr() is the reverse of
taddr2uaddr(). It returns the struct netbuf data structure
for the given universal address.
If a transport provider does not support an option,
netdir_options()
returns -1 and the error mes-
sage can be printed through
netdir_perror()
or netdir_sperror().
The specific actions of each option follow.
ND_SET_BROADCAST
Sets the transport provider up to allow broadcast, if the transport sup-
ports broadcast. fildes is a file descriptor into the transport (i.e., the
result of a
t_open of /dev/udp). pointer_to_args is not used. If this
completes, broadcast operations may be performed on file descriptor
fildes.
ND_SET_RESERVEDPORT
Allows the application to bind to a reserved port, if that concept exists
for the transport provider. fildes is an unbound file descriptor into the
transport. If pointer_to_args is NULL, fildes will be bound to a reserved
port. If pointer_to_args is a pointer to a
netbuf structure, an attempt
will be made to bind to any reserved port on the specified address.
ND_CHECK_RESERVEDPORT Used to verify that the address corresponds to a reserved port, if that
concept exists for the transport provider. fildes is not used.
pointer_to_args is a pointer to a netbuf structure that contains the
address. This option returns 0 only if the address specified in
pointer_to_args is reserved.
ND_MERGEADDR Used to take a "local address", such as a 0.0.0.0 TCP address, and
return a "real address" to which client machines can connect. fildes is
not used. pointer_to_args is a pointer to a struct nd_mergearg
which has the following members:
char s_uaddr; /* server’s universal addr */
HP-UX 11i Version 3: February 2007 2 Hewlett-Packard Company 73