|
|
1.1 ! root 1: .\" Copyright (c) 1983 Regents of the University of California. ! 2: .\" All rights reserved. The Berkeley software License Agreement ! 3: .\" specifies the terms and conditions for redistribution. ! 4: .\" ! 5: .\" @(#)getnetent.3n 6.3 (Berkeley) 5/19/86 ! 6: .\" ! 7: .TH GETNETENT 3N "May 19, 1986" ! 8: .UC 5 ! 9: .SH NAME ! 10: getnetent, getnetbyaddr, getnetbyname, setnetent, endnetent \- get network entry ! 11: .SH SYNOPSIS ! 12: .nf ! 13: .ft B ! 14: #include <netdb.h> ! 15: .PP ! 16: .ft B ! 17: struct netent *getnetent() ! 18: .PP ! 19: .ft B ! 20: struct netent *getnetbyname(name) ! 21: char *name; ! 22: .PP ! 23: .ft B ! 24: struct netent *getnetbyaddr(net, type) ! 25: long net; ! 26: int type; ! 27: .PP ! 28: .ft B ! 29: setnetent(stayopen) ! 30: int stayopen; ! 31: .PP ! 32: .ft B ! 33: endnetent() ! 34: .fi ! 35: .SH DESCRIPTION ! 36: .IR Getnetent , ! 37: .IR getnetbyname , ! 38: and ! 39: .I getnetbyaddr ! 40: each return a pointer to an object with the ! 41: following structure ! 42: containing the broken-out ! 43: fields of a line in the network data base, ! 44: .IR /etc/networks . ! 45: .RS ! 46: .PP ! 47: .nf ! 48: struct netent { ! 49: char *n_name; /* official name of net */ ! 50: char **n_aliases; /* alias list */ ! 51: int n_addrtype; /* net number type */ ! 52: unsigned long n_net; /* net number */ ! 53: }; ! 54: .ft R ! 55: .ad ! 56: .fi ! 57: .RE ! 58: .PP ! 59: The members of this structure are: ! 60: .TP \w'n_addrtype'u+2n ! 61: n_name ! 62: The official name of the network. ! 63: .TP \w'n_addrtype'u+2n ! 64: n_aliases ! 65: A zero terminated list of alternate names for the network. ! 66: .TP \w'n_addrtype'u+2n ! 67: n_addrtype ! 68: The type of the network number returned; currently only AF_INET. ! 69: .TP \w'n_addrtype'u+2n ! 70: n_net ! 71: The network number. Network numbers are returned in machine byte ! 72: order. ! 73: .PP ! 74: .I Getnetent ! 75: reads the next line of the file, opening the file if necessary. ! 76: .PP ! 77: .I Setnetent ! 78: opens and rewinds the file. If the ! 79: .I stayopen ! 80: flag is non-zero, ! 81: the net data base will not be closed after each call to ! 82: .I getnetbyname ! 83: or ! 84: .IR getnetbyaddr . ! 85: .PP ! 86: .I Endnetent ! 87: closes the file. ! 88: .PP ! 89: .I Getnetbyname ! 90: and ! 91: .I getnetbyaddr ! 92: sequentially search from the beginning ! 93: of the file until a matching ! 94: net name or ! 95: net address and type is found, ! 96: or until EOF is encountered. ! 97: Network numbers are supplied in host order. ! 98: .SH FILES ! 99: /etc/networks ! 100: .SH "SEE ALSO" ! 101: networks(5) ! 102: .SH DIAGNOSTICS ! 103: Null pointer ! 104: (0) returned on EOF or error. ! 105: .SH BUGS ! 106: All information ! 107: is contained in a static area ! 108: so it must be copied if it is ! 109: to be saved. Only Internet network ! 110: numbers are currently understood. ! 111: Expecting network numbers to fit ! 112: in no more than 32 bits is probably ! 113: naive.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.