summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/net/byteorder.323
1 files changed, 20 insertions, 3 deletions
diff --git a/src/lib/libc/net/byteorder.3 b/src/lib/libc/net/byteorder.3
index 09a727fb2a..3bb154b08a 100644
--- a/src/lib/libc/net/byteorder.3
+++ b/src/lib/libc/net/byteorder.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: byteorder.3,v 1.9 2003/06/02 20:18:35 millert Exp $ 1.\" $OpenBSD: byteorder.3,v 1.10 2003/09/21 10:50:15 fgsch Exp $
2.\" 2.\"
3.\" Copyright (c) 1983, 1991, 1993 3.\" Copyright (c) 1983, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -35,14 +35,19 @@
35.Nm htons , 35.Nm htons ,
36.Nm ntohl , 36.Nm ntohl ,
37.Nm ntohs , 37.Nm ntohs ,
38.Nm htobe64 ,
38.Nm htobe32 , 39.Nm htobe32 ,
39.Nm htobe16 , 40.Nm htobe16 ,
41.Nm betoh64 ,
40.Nm betoh32 , 42.Nm betoh32 ,
41.Nm betoh16 , 43.Nm betoh16 ,
44.Nm htole64 ,
42.Nm htole32 , 45.Nm htole32 ,
43.Nm htole16 , 46.Nm htole16 ,
47.Nm letoh64 ,
44.Nm letoh32 , 48.Nm letoh32 ,
45.Nm letoh16 , 49.Nm letoh16 ,
50.Nm swap64 ,
46.Nm swap32 , 51.Nm swap32 ,
47.Nm swap16 52.Nm swap16
48.Nd convert values between different byte orderings 53.Nd convert values between different byte orderings
@@ -57,28 +62,38 @@
57.Fn ntohl "u_int32_t net32" 62.Fn ntohl "u_int32_t net32"
58.Ft u_int16_t 63.Ft u_int16_t
59.Fn ntohs "u_int16_t net16" 64.Fn ntohs "u_int16_t net16"
65.Ft u_int64_t
66.Fn htobe64 "u_int64_t host64"
60.Ft u_int32_t 67.Ft u_int32_t
61.Fn htobe32 "u_int32_t host32" 68.Fn htobe32 "u_int32_t host32"
62.Ft u_int16_t 69.Ft u_int16_t
63.Fn htobe16 "u_int16_t host16" 70.Fn htobe16 "u_int16_t host16"
71.Ft u_int64_t
72.Fn betoh64 "u_int64_t big64"
64.Ft u_int32_t 73.Ft u_int32_t
65.Fn betoh32 "u_int32_t big32" 74.Fn betoh32 "u_int32_t big32"
66.Ft u_int16_t 75.Ft u_int16_t
67.Fn betoh16 "u_int16_t big16" 76.Fn betoh16 "u_int16_t big16"
77.Ft u_int64_t
78.Fn htole64 "u_int64_t host64"
68.Ft u_int32_t 79.Ft u_int32_t
69.Fn htole32 "u_int32_t host32" 80.Fn htole32 "u_int32_t host32"
70.Ft u_int16_t 81.Ft u_int16_t
71.Fn htole16 "u_int16_t host16" 82.Fn htole16 "u_int16_t host16"
83.Ft u_int64_t
84.Fn letoh64 "u_int64_t little64"
72.Ft u_int32_t 85.Ft u_int32_t
73.Fn letoh32 "u_int32_t little32" 86.Fn letoh32 "u_int32_t little32"
74.Ft u_int16_t 87.Ft u_int16_t
75.Fn letoh16 "u_int16_t little16" 88.Fn letoh16 "u_int16_t little16"
89.Ft u_int64_t
90.Fn swap64 "u_int32_t val64"
76.Ft u_int32_t 91.Ft u_int32_t
77.Fn swap32 "u_int32_t val32" 92.Fn swap32 "u_int32_t val32"
78.Ft u_int16_t 93.Ft u_int16_t
79.Fn swap16 "u_int16_t val16" 94.Fn swap16 "u_int16_t val16"
80.Sh DESCRIPTION 95.Sh DESCRIPTION
81These routines convert 16- and 32-bit quantities between different 96These routines convert 16, 32 and 64-bit quantities between different
82byte orderings. 97byte orderings.
83The 98The
84.Dq swap 99.Dq swap
@@ -117,6 +132,8 @@ Short (16-bit, used in conjunction with forms involving
11716-bit. 13216-bit.
118.It 32 133.It 32
11932-bit. 13432-bit.
135.It 64
13664-bit.
120.El 137.El
121.Pp 138.Pp
122The swap functions are of the form: swap{size}. 139The swap functions are of the form: swap{size}.
@@ -149,7 +166,7 @@ The functions involving either
149or 166or
150.Dq swap 167.Dq swap
151use the numbers 168use the numbers
15216 and 32 for specifying the bitwidth of the quantities they operate on. 16916, 32 and 64 for specifying the bitwidth of the quantities they operate on.
153Currently all supported architectures are either big- or little-endian 170Currently all supported architectures are either big- or little-endian
154so either the 171so either the
155.Dq be 172.Dq be