HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
n
netdir(3N) netdir(3N)
NAME
netdir(), netdir_getbyname(), netdir_getbyaddr(), netdir_free(), netdir_options(), taddr2uaddr(),
uaddr2taddr(), netdir_perror(), netdir_sperror() - generic transport name-to-address translation
SYNOPSIS
#include <netdir.h>
int netdir_getbyname(const struct netconfig *config,
const struct nd_hostserv *service,
struct nd_addrlist **addrs );
int netdir_getbyaddr(const struct netconfig *config,
struct nd_hostservlist **service,
const struct netbuf *netaddr );
void netdir_free(void *ptr,const int struct_type );
int netdir_options(const struct netconfig *config,
const int option,const int fildes,char *point_to_args );
char *taddr2uaddr(const struct netconfig *config,
const struct netbuf *addr );
struct netbuf *uaddr2taddr(const struct netconfig *config,
const char *uaddr );
void netdir_perror(char *s );
char *netdir_sperror(void);
MULTITHREAD USAGE
Thread Safe: Yes
Cancel Safe: Yes
Fork Safe: No
Async-cancel Safe: No
Async-signal Safe: No
These functions can be called safely in a multithreaded environment. They may be cancellation points in
that they call functions that are cancel points.
In a multithreaded environment, these functions are not safe to be called by a child process after
fork()
and before exec(). These functions should not be called by a multithreaded application that support
asynchronous cancellationor asynchronous signals.
DESCRIPTION
These routines provide a generic interface for name-to-address mapping that will work with all transport
protocols. This interface provides a generic way for programs to convert transport specific addresses into
common structures and back again. The netconfig structure, described on the netconfig(4) manual
page, identifies the transport.
The netdir_getbyname() routine maps the machine name and service name in the nd_hostserv
structure to a collection of addresses of the type understood by the transport identified in the
netconfig
structure. This routine returns all addresses that are valid for that transport in the nd_addrlist struc-
ture. The
nd_hostserv structure contains the following members:
char *h_host; /* host name */
char *h_serv; /* service name */
The nd_addrlist structure contains the following members:
int n_cnt; /* number of addresses */
struct netbuf *n_addrs;
netdir_getbyname()
accepts some special-case host names. The host names are defined in
<netdir.h>. The currently defined host names are:
HOST_SELF Represents the address to which local programs will bind their endpoints.
HOST_SELF differs from the host name provided by gethostname()
(see gethost-
name(2)), which represents the address to which remote programs will bind their
HP-UX Release 11i: December 2000 − 1 − Section 3−−543
___
___