|
|
1.1 root 1: .\" Copyright (c) 1983 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)getnetent.3 6.5 (Berkeley) 6/23/90
19: .\"
20: .TH GETNETENT 3 "June 23, 1990"
21: .UC 5
22: .SH NAME
23: getnetent, getnetbyaddr, getnetbyname, setnetent, endnetent \- get network entry
24: .SH SYNOPSIS
25: .nf
26: .ft B
27: #include <netdb.h>
28: .PP
29: .ft B
30: struct netent *getnetent()
31: .PP
32: .ft B
33: struct netent *getnetbyname(name)
34: char *name;
35: .PP
36: .ft B
37: struct netent *getnetbyaddr(net, type)
38: long net;
39: int type;
40: .PP
41: .ft B
42: setnetent(stayopen)
43: int stayopen;
44: .PP
45: .ft B
46: endnetent()
47: .fi
48: .SH DESCRIPTION
49: .IR Getnetent ,
50: .IR getnetbyname ,
51: and
52: .I getnetbyaddr
53: each return a pointer to an object with the
54: following structure
55: containing the broken-out
56: fields of a line in the network data base,
57: .IR /etc/networks .
58: .RS
59: .PP
60: .nf
61: struct netent {
62: char *n_name; /* official name of net */
63: char **n_aliases; /* alias list */
64: int n_addrtype; /* net number type */
65: unsigned long n_net; /* net number */
66: };
67: .ft R
68: .ad
69: .fi
70: .RE
71: .PP
72: The members of this structure are:
73: .TP \w'n_addrtype'u+2n
74: n_name
75: The official name of the network.
76: .TP \w'n_addrtype'u+2n
77: n_aliases
78: A zero terminated list of alternate names for the network.
79: .TP \w'n_addrtype'u+2n
80: n_addrtype
81: The type of the network number returned; currently only AF_INET.
82: .TP \w'n_addrtype'u+2n
83: n_net
84: The network number. Network numbers are returned in machine byte
85: order.
86: .PP
87: .I Getnetent
88: reads the next line of the file, opening the file if necessary.
89: .PP
90: .I Setnetent
91: opens and rewinds the file. If the
92: .I stayopen
93: flag is non-zero,
94: the net data base will not be closed after each call to
95: .I getnetbyname
96: or
97: .IR getnetbyaddr .
98: .PP
99: .I Endnetent
100: closes the file.
101: .PP
102: .I Getnetbyname
103: and
104: .I getnetbyaddr
105: sequentially search from the beginning
106: of the file until a matching
107: net name or
108: net address and type is found,
109: or until EOF is encountered.
110: Network numbers are supplied in host order.
111: .SH FILES
112: /etc/networks
113: .SH "SEE ALSO"
114: networks(5)
115: .SH DIAGNOSTICS
116: Null pointer
117: (0) returned on EOF or error.
118: .SH BUGS
119: All information
120: is contained in a static area
121: so it must be copied if it is
122: to be saved. Only Internet network
123: numbers are currently understood.
124: Expecting network numbers to fit
125: in no more than 32 bits is probably
126: naive.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.