BYTEORDER
Section: Misc. Reference Manual Pages (3bsd)Index Return to Main Contents
BSD mandoc
NAME
be16enc , be16dec , be32enc , be32dec , be64enc , be64dec le16enc , le16dec , le32enc , le32dec , le64enc , le64dec - byte order operationsSYNOPSIS
In sys/endian.h (See libbsd(7) for include usage.) Ft uint16_t Fn be16dec const void * Ft uint32_t Fn be32dec const void * Ft uint64_t Fn be64dec const void * Ft uint16_t Fn le16dec const void * Ft uint32_t Fn le32dec const void * Ft uint64_t Fn le64dec const void * Ft void Fn be16enc void * uint16_t Ft void Fn be32enc void * uint32_t Ft void Fn be64enc void * uint64_t Ft void Fn le16enc void * uint16_t Ft void Fn le32enc void * uint32_t Ft void Fn le64enc void * uint64_tDESCRIPTION
The Fn be16enc , Fn be16dec , Fn be32enc , Fn be32dec , Fn be64enc , Fn be64dec , Fn le16enc , Fn le16dec , Fn le32enc , Fn le32dec , Fn le64enc , and Fn le64dec functions encode and decode integers to/from byte strings on any alignment in big/little endian format.
SEE ALSO
byteorder(3)HISTORY
The encode/decode functions first appeared in Fx 5.1 .
Index
This document was created by man2html, using the manual pages.
Time: 04:45:41 GMT, September 16, 2022 Content-type: text/html; charset=UTF-8
BYTEORDER
Section: Linux Programmer's Manual (3)Updated: 2017-09-15
Index Return to Main Contents
NAME
htonl, htons, ntohl, ntohs - convert values between host and network byte orderSYNOPSIS
#include <arpa/inet.h> uint32_t htonl(uint32_t hostlong); uint16_t htons(uint16_t hostshort); uint32_t ntohl(uint32_t netlong); uint16_t ntohs(uint16_t netshort);
DESCRIPTION
The htonl() function converts the unsigned integer hostlong from host byte order to network byte order.The htons() function converts the unsigned short integer hostshort from host byte order to network byte order.
The ntohl() function converts the unsigned integer netlong from network byte order to host byte order.
The ntohs() function converts the unsigned short integer netshort from network byte order to host byte order.
On the i386 the host byte order is Least Significant Byte first, whereas the network byte order, as used on the Internet, is Most Significant Byte first.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).Interface | Attribute | Value |
htonl(), htons(), ntohl(), ntohs() | Thread safety | MT-Safe |
CONFORMING TO
POSIX.1-2001, POSIX.1-2008.Some systems require the inclusion of <netinet/in.h> instead of <arpa/inet.h>.
SEE ALSO
bswap(3), endian(3), gethostbyname(3), getservent(3)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Index
This document was created by man2html, using the manual pages.
Time: 04:45:51 GMT, September 16, 2022
0 댓글