xref: /illumos-gate/usr/src/man/man3c/byteorder.3c (revision bbf215553c7233fbab8a0afdf1fac74c44781867)
1cc581a18SYuri Pankov.\"
2cc581a18SYuri Pankov.\" The contents of this file are subject to the terms of the
3cc581a18SYuri Pankov.\" Common Development and Distribution License (the "License").
4cc581a18SYuri Pankov.\" You may not use this file except in compliance with the License.
5cc581a18SYuri Pankov.\"
6cc581a18SYuri Pankov.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7cc581a18SYuri Pankov.\" or http://www.opensolaris.org/os/licensing.
8cc581a18SYuri Pankov.\" See the License for the specific language governing permissions
9cc581a18SYuri Pankov.\" and limitations under the License.
10cc581a18SYuri Pankov.\"
11cc581a18SYuri Pankov.\" When distributing Covered Code, include this CDDL HEADER in each
12cc581a18SYuri Pankov.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
13cc581a18SYuri Pankov.\" If applicable, add the following below this CDDL HEADER, with the
14cc581a18SYuri Pankov.\" fields enclosed by brackets "[]" replaced with your own identifying
15cc581a18SYuri Pankov.\" information: Portions Copyright [yyyy] [name of copyright owner]
16cc581a18SYuri Pankov.\"
17cc581a18SYuri Pankov.\"
18cc581a18SYuri Pankov.\" Copyright 1989 AT&T
19cc581a18SYuri Pankov.\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved
20cc581a18SYuri Pankov.\" Copyright 2018 Nexenta Systems, Inc.
21cc581a18SYuri Pankov.\"
22cc581a18SYuri Pankov.Dd August 2, 2018
23cc581a18SYuri Pankov.Dt BYTEORDER 3C
24cc581a18SYuri Pankov.Os
25cc581a18SYuri Pankov.Sh NAME
26cc581a18SYuri Pankov.Nm byteorder ,
27cc581a18SYuri Pankov.Nm htonl ,
28cc581a18SYuri Pankov.Nm htonll ,
29cc581a18SYuri Pankov.Nm htons ,
30cc581a18SYuri Pankov.Nm ntohl ,
31cc581a18SYuri Pankov.Nm ntohll ,
32cc581a18SYuri Pankov.Nm ntohs
33cc581a18SYuri Pankov.Nd convert values between host and network byte order
34cc581a18SYuri Pankov.Sh LIBRARY
35cc581a18SYuri Pankov.Lb libc
36cc581a18SYuri Pankov.Sh SYNOPSIS
37cc581a18SYuri Pankov.In sys/types.h
38cc581a18SYuri Pankov.In netinet/in.h
39cc581a18SYuri Pankov.In inttypes.h
40cc581a18SYuri Pankov.Ft uint32_t
41cc581a18SYuri Pankov.Fo htonl
42cc581a18SYuri Pankov.Fa "uint32_t hostlong"
43cc581a18SYuri Pankov.Fc
44cc581a18SYuri Pankov.Ft uint64_t
45cc581a18SYuri Pankov.Fo htonll
46cc581a18SYuri Pankov.Fa "uint64_t hostlonglong"
47cc581a18SYuri Pankov.Fc
48cc581a18SYuri Pankov.Ft uint16_t
49cc581a18SYuri Pankov.Fo htons
50cc581a18SYuri Pankov.Fa "uint16_t hostshort"
51cc581a18SYuri Pankov.Fc
52cc581a18SYuri Pankov.Ft uint32_t
53cc581a18SYuri Pankov.Fo ntohl
54cc581a18SYuri Pankov.Fa "uint32_t netlong"
55cc581a18SYuri Pankov.Fc
56cc581a18SYuri Pankov.Ft uint64_t
57cc581a18SYuri Pankov.Fo ntohll
58cc581a18SYuri Pankov.Fa "uint64_t netlonglong"
59cc581a18SYuri Pankov.Fc
60cc581a18SYuri Pankov.Ft uint16_t
61cc581a18SYuri Pankov.Fo ntohs
62cc581a18SYuri Pankov.Fa "uint16_t netshort"
63cc581a18SYuri Pankov.Fc
64cc581a18SYuri Pankov.Sh DESCRIPTION
65cc581a18SYuri PankovThese functions convert 16-bit, 32-bit, and 64-bit quantities between network
66cc581a18SYuri Pankovbyte order and host byte order.
67cc581a18SYuri PankovOn some architectures these routines are defined as
68cc581a18SYuri Pankov.Dv NULL
69cc581a18SYuri Pankovmacros in the include file
70cc581a18SYuri Pankov.In netinet/in.h .
71cc581a18SYuri PankovOn other architectures, the routines are functional when the host byte order is
72cc581a18SYuri Pankovdifferent from network byte order.
73cc581a18SYuri Pankov.Pp
74cc581a18SYuri PankovThese functions are most often used in conjunction with Internet addresses and
75cc581a18SYuri Pankovports as returned by
76cc581a18SYuri Pankov.Xr gethostent 3NSL
77cc581a18SYuri Pankovand
789f17ecf0SPeter Tribble.Xr getservent 3SOCKET .
79cc581a18SYuri Pankov.Sh MT-LEVEL
80cc581a18SYuri Pankov.Sy Safe
81cc581a18SYuri Pankov.Sh SEE ALSO
82cc581a18SYuri Pankov.Xr inet.h 3HEAD ,
83cc581a18SYuri Pankov.Xr gethostent 3NSL ,
849f17ecf0SPeter Tribble.Xr getservent 3SOCKET ,
85*bbf21555SRichard Lowe.Xr attributes 7 ,
86*bbf21555SRichard Lowe.Xr byteorder 7
87