📄 tcpip-manpages.sgml
字号:
<!-- HEY YOU!!!!!!!!! --><!-- this file is automatically generated by the script --><!-- ./prepare-manpages.sh --><!-- so PLEASE do not modify it: your changes will be lost --><chapter id="tcpip-library-reference"> <title>TCP/IP Library Reference</title> <sect1 id="net-common-tcpip-manpages-getdomainname"> <title>getdomainname</title> <screen>GETDOMAINNAME(3) System Library Functions Manual GETDOMAINNAME(3)NAME getdomainname, setdomainname - get/set YP domain name of current hostSYNOPSIS #include <unistd.h> int getdomainname(char *name, size_t namelen); int setdomainname(const char *name, size_t namelen);DESCRIPTION The getdomainname() function returns the YP domain name for the current processor, as previously set by setdomainname(). The parameter namelen specifies the size of the name array. If insufficient space is provided, the returned name is truncated. The returned name is always null termi- nated. setdomainname() sets the domain name of the host machine to be name, which has length namelen. This call is restricted to the superuser and is normally used only when the system is bootstrapped.RETURN VALUES If the call succeeds a value of 0 is returned. If the call fails, a value of -1 is returned and an error code is placed in the global vari- able errno.ERRORS The following errors may be returned by these calls: [EFAULT] The name or namelen parameter gave an invalid address. [EPERM] The caller tried to set the domain name and was not the superuser.SEE ALSO domainname(1), gethostid(3), gethostname(3), sysctl(3), sysctl(8), yp(8)BUGS Domain names are limited to MAXHOSTNAMELEN (from <sys/param.h>) charac- ters, currently 256. This includes the terminating NUL character. If the buffer passed to getdomainname() is too small, other operating systems may not guarantee termination with NUL.HISTORY The getdomainname function call appeared in SunOS 3.x.BSD May 6, 1994 BSD </screen> </sect1> <sect1 id="net-common-tcpip-manpages-gethostname"> <title>gethostname</title> <screen>GETHOSTNAME(3) System Library Functions Manual GETHOSTNAME(3)NAME gethostname, sethostname - get/set name of current hostSYNOPSIS #include <unistd.h> int gethostname(char *name, size_t namelen); int sethostname(const char *name, size_t namelen);DESCRIPTION The gethostname() function returns the standard host name for the current processor, as previously set by sethostname(). The parameter namelen specifies the size of the name array. If insufficient space is provided, the returned name is truncated. The returned name is always null termi- nated. sethostname() sets the name of the host machine to be name, which has length namelen. This call is restricted to the superuser and is normally used only when the system is bootstrapped.RETURN VALUES If the call succeeds a value of 0 is returned. If the call fails, a value of -1 is returned and an error code is placed in the global vari- able errno.ERRORS The following errors may be returned by these calls: [EFAULT] The name or namelen parameter gave an invalid address. [EPERM] The caller tried to set the hostname and was not the superuser.SEE ALSO hostname(1), getdomainname(3), gethostid(3), sysctl(3), sysctl(8), yp(8)STANDARDS The gethostname() function call conforms to X/Open Portability Guide Issue 4.2 (``XPG4.2'').HISTORY The gethostname() function call appeared in 4.2BSD.BUGS Host names are limited to MAXHOSTNAMELEN (from <sys/param.h>) characters, currently 256. This includes the terminating NUL character. If the buffer passed to gethostname() is smaller than MAXHOSTNAMELEN, other operating systems may not guarantee termination with NUL.BSD June 4, 1993 BSD </screen> </sect1> <sect1 id="net-common-tcpip-manpages-byteorder"> <title>byteorder</title> <screen>BYTEORDER(3) System Library Functions Manual BYTEORDER(3)NAME htonl, htons, ntohl, ntohs, htobe32, htobe16, betoh32, betoh16, htole32, htole16, letoh32, letoh16, swap32, swap16 - convert values between dif- ferent byte orderingsSYNOPSIS #include <sys/types.h> #include <machine/endian.h> u_int32_t htonl(u_int32_t host32); u_int16_t htons(u_int16_t host16); u_int32_t ntohl(u_int32_t net32); u_int16_t ntohs(u_int16_t net16); u_int32_t htobe32(u_int32_t host32); u_int16_t htobe16(u_int16_t host16); u_int32_t betoh32(u_int32_t big32); u_int16_t betoh16(u_int16_t big16); u_int32_t htole32(u_int32_t host32); u_int16_t htole16(u_int16_t host16); u_int32_t letoh32(u_int32_t little32); u_int16_t letoh16(u_int16_t little16); u_int32_t swap32(u_int32_t val32); u_int16_t swap16(u_int16_t val16);DESCRIPTION These routines convert 16- and 32-bit quantities between different byte orderings. The ``swap'' functions reverse the byte ordering of the given quantity, the others converts either from/to the native byte order used by the host to/from either little- or big-endian (a.k.a network) order. Apart from the swap functions, the names can be described by this form: {src-order}to{dst-order}{size}. Both {src-order} and {dst-order} can take the following forms: h Host order. n Network order (big-endian). be Big-endian (most significant byte first). le Little-endian (least significant byte first). One of the specified orderings must be `h'. {size} will take these forms: l Long (32-bit, used in conjunction with forms involving `n'). s Short (16-bit, used in conjunction with forms involving `n'). 16 16-bit. 32 32-bit. The swap functions are of the form: swap{size}. Names involving `n' convert quantities between network byte order and host byte order. The last letter (`s' or `l') is a mnemonic for the tra- ditional names for such quantities, short and long, respectively. Today, the C concept of short and long integers need not coincide with this tra- ditional misunderstanding. On machines which have a byte order which is the same as the network order, routines are defined as null macros. The functions involving either ``be'', ``le'', or ``swap'' use the num- bers 16 and 32 for specifying the bitwidth of the quantities they operate on. Currently all supported architectures are either big- or little- endian so either the ``be'' or ``le'' variants are implemented as null macros. The routines mentioned above which have either {src-order} or {dst-order} set to `n' are most often used in conjunction with Internet addresses and ports as returned by gethostbyname(3) and getservent(3).SEE ALSO gethostbyname(3), getservent(3)HISTORY The byteorder functions appeared in 4.2BSD.BUGS On the vax, alpha, i386, and so far mips, bytes are handled backwards from most everyone else in the world. This is not expected to be fixed in the near future.BSD June 4, 1993 BSD </screen> </sect1> <sect1 id="net-common-tcpip-manpages-ethers"> <title>ethers</title> <screen>ETHERS(3) System Library Functions Manual ETHERS(3)NAME ether_aton, ether_ntoa, ether_addr, ether_ntohost, ether_hostton, ether_line - get ethers entrySYNOPSIS #include <netinet/if_ether.h> char * ether_ntoa(struct ether_addr *e); struct ether_addr * ether_aton(char *s); int ether_ntohost(char *hostname, struct ether_addr *e); int ether_hostton(char *hostname, struct ether_addr *e); int ether_line(char *l, struct ether_addr *e, char *hostname);DESCRIPTION Ethernet addresses are represented by the following structure: struct ether_addr { u_int8_t ether_addr_octet[6]; }; The ether_ntoa() function converts this structure into an ASCII string of the form ``xx:xx:xx:xx:xx:xx'', consisting of 6 hexadecimal numbers sepa- rated by colons. It returns a pointer to a static buffer that is reused for each call. The ether_aton() converts an ASCII string of the same form and to a structure containing the 6 octets of the address. It returns a pointer to a static structure that is reused for each call. The ether_ntohost() and ether_hostton() functions interrogate the database mapping host names to Ethernet addresses, /etc/ethers. The ether_ntohost() function looks up the given Ethernet address and writes the associated host name into the character buffer passed. This buffer should be MAXHOSTNAMELEN characters in size. The ether_hostton() func- tion looks up the given host name and writes the associated Ethernet address into the structure passed. Both functions return zero if they find the requested host name or address, and -1 if not. Each call reads /etc/ethers from the beginning; if a `+' appears alone on a line in the file, then ether_hostton() will consult the ethers.byname YP map, and ether_ntohost() will consult the ethers.byaddr YP map. The ether_line() function parses a line from the /etc/ethers file and fills in the passed struct ether_addr and character buffer with the Eth- ernet address and host name on the line. It returns zero if the line was successfully parsed and -1 if not. The character buffer should be MAXHOSTNAMELEN characters in size.FILES /etc/ethersSEE ALSO ethers(5)HISTORY The ether_ntoa(), ether_aton(), ether_ntohost(), ether_hostton(), and ether_line() functions were adopted from SunOS and appeared in NetBSD 0.9 b.BUGS The data space used by these functions is static; if future use requires the data, it should be copied before any subsequent calls to these func- tions overwrite it.BSD December 16, 1993 BSD </screen> </sect1> <sect1 id="net-common-tcpip-manpages-getaddrinfo"> <title>getaddrinfo</title> <screen>GETADDRINFO(3) System Library Functions Manual GETADDRINFO(3)NAME getaddrinfo, freeaddrinfo, gai_strerror - nodename-to-address translation in protocol-independent mannerSYNOPSIS #include <sys/types.h>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -