]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/byteorder.3
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man3 / byteorder.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
c13182ef 11.\"
fea681da
MK
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
23.\" References consulted:
24.\" Linux libc source code
25.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26.\" 386BSD man pages
27.\" Modified Sat Jul 24 21:29:05 1993 by Rik Faith (faith@cs.unc.edu)
28.\" Modified Thu Jul 26 14:06:20 2001 by Andries Brouwer (aeb@cwi.nl)
29.\"
30.TH BYTEORDER 3 1993-04-15 "BSD" "Linux Programmer's Manual"
31.SH NAME
32htonl, htons, ntohl, ntohs \- convert values between host and network
33byte order
34.SH SYNOPSIS
35.nf
d1a6e6ff 36.B #include <arpa/inet.h>
fea681da
MK
37.sp
38.BI "uint32_t htonl(uint32_t " hostlong );
39.sp
40.BI "uint16_t htons(uint16_t " hostshort );
41.sp
42.BI "uint32_t ntohl(uint32_t " netlong );
43.sp
44.BI "uint16_t ntohs(uint16_t " netshort );
45.fi
46.SH DESCRIPTION
63aa9df0 47The \fBhtonl\fP() function converts the unsigned integer \fIhostlong\fP
fea681da
MK
48from host byte order to network byte order.
49.PP
63aa9df0 50The \fBhtons\fP() function converts the unsigned short integer \fIhostshort\fP
fea681da
MK
51from host byte order to network byte order.
52.PP
63aa9df0 53The \fBntohl\fP() function converts the unsigned integer \fInetlong\fP
fea681da
MK
54from network byte order to host byte order.
55.PP
63aa9df0 56The \fBntohs\fP() function converts the unsigned short integer \fInetshort\fP
fea681da
MK
57from network byte order to host byte order.
58.PP
c13182ef
MK
59On the i80x86 the host byte order is Least Significant Byte first,
60whereas the network byte order, as used on the Internet, is Most
fea681da
MK
61Significant Byte first.
62.SH "CONFORMING TO"
68e1685c 63POSIX.1-2001.
d1a6e6ff 64
c13182ef
MK
65Some systems require the inclusion of
66.I <netinet/in.h>
67instead of
d1a6e6ff 68.IR <arpa/inet.h> .
fea681da
MK
69.SH "SEE ALSO"
70.BR gethostbyname (3),
71.BR getservent (3)