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 19be4d2228..54123455c6 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.12 2003/09/26 16:50:14 millert Exp $ 1.\" $OpenBSD: byteorder.3,v 1.13 2003/09/26 17:06:50 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
@@ -56,28 +61,38 @@
56.Fn ntohl "u_int32_t net32" 61.Fn ntohl "u_int32_t net32"
57.Ft u_int16_t 62.Ft u_int16_t
58.Fn ntohs "u_int16_t net16" 63.Fn ntohs "u_int16_t net16"
64.Ft u_int64_t
65.Fn htobe64 "u_int64_t host64"
59.Ft u_int32_t 66.Ft u_int32_t
60.Fn htobe32 "u_int32_t host32" 67.Fn htobe32 "u_int32_t host32"
61.Ft u_int16_t 68.Ft u_int16_t
62.Fn htobe16 "u_int16_t host16" 69.Fn htobe16 "u_int16_t host16"
70.Ft u_int64_t
71.Fn betoh64 "u_int64_t big64"
63.Ft u_int32_t 72.Ft u_int32_t
64.Fn betoh32 "u_int32_t big32" 73.Fn betoh32 "u_int32_t big32"
65.Ft u_int16_t 74.Ft u_int16_t
66.Fn betoh16 "u_int16_t big16" 75.Fn betoh16 "u_int16_t big16"
76.Ft u_int64_t
77.Fn htole64 "u_int64_t host64"
67.Ft u_int32_t 78.Ft u_int32_t
68.Fn htole32 "u_int32_t host32" 79.Fn htole32 "u_int32_t host32"
69.Ft u_int16_t 80.Ft u_int16_t
70.Fn htole16 "u_int16_t host16" 81.Fn htole16 "u_int16_t host16"
82.Ft u_int64_t
83.Fn letoh64 "u_int64_t little64"
71.Ft u_int32_t 84.Ft u_int32_t
72.Fn letoh32 "u_int32_t little32" 85.Fn letoh32 "u_int32_t little32"
73.Ft u_int16_t 86.Ft u_int16_t
74.Fn letoh16 "u_int16_t little16" 87.Fn letoh16 "u_int16_t little16"
88.Ft u_int64_t
89.Fn swap64 "u_int32_t val64"
75.Ft u_int32_t 90.Ft u_int32_t
76.Fn swap32 "u_int32_t val32" 91.Fn swap32 "u_int32_t val32"
77.Ft u_int16_t 92.Ft u_int16_t
78.Fn swap16 "u_int16_t val16" 93.Fn swap16 "u_int16_t val16"
79.Sh DESCRIPTION 94.Sh DESCRIPTION
80These routines convert 16- and 32-bit quantities between different 95These routines convert 16, 32 and 64-bit quantities between different
81byte orderings. 96byte orderings.
82The 97The
83.Dq swap 98.Dq swap
@@ -116,6 +131,8 @@ Short (16-bit, used in conjunction with forms involving
11616-bit. 13116-bit.
117.It 32 132.It 32
11832-bit. 13332-bit.
134.It 64
13564-bit.
119.El 136.El
120.Pp 137.Pp
121The swap functions are of the form: swap{size}. 138The swap functions are of the form: swap{size}.
@@ -148,7 +165,7 @@ The functions involving either
148or 165or
149.Dq swap 166.Dq swap
150use the numbers 167use the numbers
15116 and 32 for specifying the bitwidth of the quantities they operate on. 16816, 32 and 64 for specifying the bitwidth of the quantities they operate on.
152Currently all supported architectures are either big- or little-endian 169Currently all supported architectures are either big- or little-endian
153so either the 170so either the
154.Dq be 171.Dq be