*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> getnetent (3c)              
Title
Content
Arch
Section
 

Contents


GETNETENT(3N)							 GETNETENT(3N)


NAME    [Toc]    [Back]

     getnetent,	getnetent_r, fgetnetent, fgetnetent_r, getnetbyaddr,
     getnetbyaddr_r, getnetbyname, getnetbyname_r, setnetent, endnetent	- get
     network entry

SYNOPSIS    [Toc]    [Back]

     #include <netdb.h>

     struct netent *getnetent(void);

     struct netent *getnetent_r(struct netent *nent, char *buffer, int bufsize);

     struct netent *fgetnetent(FILE *);

     struct netent *fgetnetent_r(FILE *, struct	netent *nent, char *buffer, int	bufsize);

     struct netent *getnetbyname(const char *name);

     struct netent *getnetbyname_r(const char *name, struct netent *nent, char *buffer,	int bufsize);

     struct netent *getnetbyaddr(long net, int type);

     struct netent *getnetbyaddr_r(long	net, int type, struct netent *nent, char *buffer, int bufsize);

     void setnetent(int	stayopen);

     void endnetent(void);

DESCRIPTION    [Toc]    [Back]

     Getnetent,	fgetnetent, getnetbyname, getnetbyaddr and each	of their
     reentrant counterparts each return	a pointer to an	object with the
     following structure containing the	broken-out fields of a line in the
     network data base file, /etc/networks, or some other back-end networks
     database.

	  struct    netent {
	       char	 *n_name;  /* official name of net */
	       char	 **n_aliases;	/* alias list */
	       int	 n_addrtype;	/* net number type */
	       unsigned	long  n_net;	     /*	net number */
	  };

     The members of this structure are:

     n_name	 The official name of the network.

     n_aliases	 A zero	terminated list	of alternate names for the network.

     n_addrtype	 The type of  the  network  number  returned;  currently  only
		 AF_INET.





									Page 1






GETNETENT(3N)							 GETNETENT(3N)



     n_net	 The network number.  Network numbers are returned in  machine
		 byte order.

     Getnetent reads the next line of the file,	opening	the file if necessary.

     Setnetent opens and rewinds the file.  If the stayopen flag is  non-zero,
     the  net  data base will not be closed after each call to getnetbyname or
     getnetbyaddr.

     Endnetent closes the file.

     Getnetbyname and getnetbyaddr sequentially	search from the	 beginning  of
     the  file	until a	matching net name or net address and type is found, or
     until EOF is encountered.	Network	numbers	are supplied in	host order.

     The routines fgetnetent and fgetnetent_r will return the next line	in the
     supplied file parsed into a struct	netent structure.  The file must be in
     the same format as	the /etc/networks file.

     The routines getnetent, fgetnetent, getnetbyaddr,	and  getnetbyname  all
     return  pointers  into  static  space  which  is  modified	 on each call.
     Reentrant	 versions   of	 each	routine	  getnetent_r,	 fgetnetent_r,
     getnetbyaddr_r  and getnetbyname_r.  These	routines parse the result into
     supplied space.  They each	take  a	 pointer  to  a	 netent	 structure,  a
     pointer to	some buffer, and a length for the buffer.

     The routines documented in	this file only parse files of the format given
     in	 networks(4).	These  can  be	static files on	the system such	as the
     /etc/networks file, or files supplied dynamically by the  nsd(1M)	daemon
     from some other backend database such as NIS.

NOTE    [Toc]    [Back]

     The Mips ABI specifies nothing but	local files so applications which wish
     to	use anything else must compile with libc prior to libnsl in the
     library list.

     When nsd is running changes in the	local networks file may	not be noticed
     by	getnetent() until the enumeration cache	file has timed out.

DIAGNOSTICS    [Toc]    [Back]

     All functions that	return struct netent * will return a null (0) pointer
     in	the case of EOF	or failure.

FILES    [Toc]    [Back]

     /etc/networks /var/ns/cache/networks.byname.m
     /var/ns/cache/networks.byaddr.m

SEE ALSO    [Toc]    [Back]

      
      
     nsd(1M), networks(4)






									Page 2






GETNETENT(3N)							 GETNETENT(3N)


DIAGNOSTICS    [Toc]    [Back]

     Null pointer (0) returned on EOF or error.

BUGS    [Toc]    [Back]

     Only Internet network numbers are currently understood.

     Expecting network numbers to fit in no more than 32 bits is probably
     naive.


									PPPPaaaaggggeeee 3333
[ Back ]
 Similar pages
Name OS Title
getnetbyname_r Tru64 Get a network entry by name
getnetent_r Tru64 Get a network entry
getnetbyname Tru64 Get a network entry by name
getnetent Tru64 Get a network entry
gethostbyaddr FreeBSD get network host entry
getnetgrent Tru64 Get network group entry
endhostent NetBSD get network host entry
endhostent OpenBSD get network host entry
getnetgrent IRIX get NIS network group entry
sethostent NetBSD get network host entry
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service