OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [common/] [v2_0/] [doc/] [manpages/] [net/] [inet_net.3] - Blame information for rev 307

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
.\"     $OpenBSD: inet_net.3,v 1.6 2000/04/21 15:38:17 aaron Exp $
2
.\"     $NetBSD: inet_net.3,v 1.1 1997/06/18 02:25:27 lukem Exp $
3
.\"
4
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
5
.\" All rights reserved.
6
.\"
7
.\" This code is derived from software contributed to The NetBSD Foundation
8
.\" by Luke Mewburn.
9
.\"
10
.\" Redistribution and use in source and binary forms, with or without
11
.\" modification, are permitted provided that the following conditions
12
.\" are met:
13
.\" 1. Redistributions of source code must retain the above copyright
14
.\"    notice, this list of conditions and the following disclaimer.
15
.\" 2. Redistributions in binary form must reproduce the above copyright
16
.\"    notice, this list of conditions and the following disclaimer in the
17
.\"    documentation and/or other materials provided with the distribution.
18
.\" 3. All advertising materials mentioning features or use of this software
19
.\"    must display the following acknowledgement:
20
.\"        This product includes software developed by the NetBSD
21
.\"        Foundation, Inc. and its contributors.
22
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
23
.\"    contributors may be used to endorse or promote products derived
24
.\"    from this software without specific prior written permission.
25
.\"
26
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
30
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
.\" POSSIBILITY OF SUCH DAMAGE.
37
.\"
38
.Dd June 18, 1997
39
.Dt INET_NET 3
40
.Os
41
.Sh NAME
42
.Nm inet_net_ntop ,
43
.Nm inet_net_pton
44
.Nd Internet network number manipulation routines
45
.Sh SYNOPSIS
46
.Fd #include 
47
.Fd #include 
48
.Fd #include 
49
.Ft char *
50
.Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size"
51
.Ft int
52
.Fn inet_net_pton "int af" "const char *src" "void *dst" "size_t size"
53
.Sh DESCRIPTION
54
The
55
.Fn inet_net_ntop
56
function converts an Internet network number from network format (usually a
57
.Li struct in_addr
58
or some other binary form, in network byte order) to CIDR presentation format
59
(suitable for external display purposes).
60
.Fa bits
61
is the number of bits in
62
.Fa src
63
that are the network number.
64
It returns
65
.Dv NULL
66
if a system error occurs (in which case,
67
.Va errno
68
will have been set), or it returns a pointer to the destination string.
69
.Pp
70
The
71
.Fn inet_net_pton
72
function converts a presentation format Internet network number (that is,
73
printable form as held in a character string) to network format (usually a
74
.Li struct in_addr
75
or some other internal binary representation, in network byte order).
76
It returns the number of bits (either computed based on the class, or
77
specified with /CIDR), or \-1 if a failure occurred
78
(in which case
79
.Va errno
80
will have been set.
81
It will be set to
82
.Er ENOENT
83
if the Internet network number was not valid).
84
.Pp
85
The only value for
86
.Fa af
87
currently supported is
88
.Dv AF_INET .
89
.Fa size
90
is the size of the result buffer
91
.Fa dst .
92
.Sh NETWORK NUMBERS (IP VERSION 4)
93
Internet network numbers may be specified in one of the following forms:
94
.Bd -literal -offset indent
95
a.b.c.d/bits
96
a.b.c.d
97
a.b.c
98
a.b
99
a
100
.Ed
101
.Pp
102
When four parts are specified, each is interpreted
103
as a byte of data and assigned, from left to right,
104
to the four bytes of an Internet network number.
105
Note that when an Internet network number is viewed as a 32-bit
106
integer quantity on a system that uses little-endian
107
byte order (such as the Intel 386, 486, and Pentium processors)
108
the bytes referred to above appear as
109
.Dq Li d.c.b.a .
110
That is, little-endian bytes are ordered from right to left.
111
.Pp
112
When a three part number is specified, the last
113
part is interpreted as a 16-bit quantity and placed
114
in the rightmost two bytes of the Internet network number.
115
This makes the three part number format convenient
116
for specifying Class B network numbers as
117
.Dq Li 128.net.host .
118
.Pp
119
When a two part number is supplied, the last part
120
is interpreted as a 24-bit quantity and placed in
121
the rightmost three bytes of the Internet network number.
122
This makes the two part number format convenient
123
for specifying Class A network numbers as
124
.Dq Li net.host .
125
.Pp
126
When only one part is given, the value is stored
127
directly in the Internet network number without any byte
128
rearrangement.
129
.Pp
130
All numbers supplied as
131
.Dq parts
132
in a
133
.Ql \&.
134
notation
135
may be decimal, octal, or hexadecimal, as specified
136
in the C language (i.e., a leading 0x or 0X implies
137
hexadecimal; otherwise, a leading 0 implies octal;
138
otherwise, the number is interpreted as decimal).
139
.Sh SEE ALSO
140
.Xr byteorder 3 ,
141
.Xr inet 3 ,
142
.Xr networks 5
143
.Sh HISTORY
144
The
145
.Nm inet_net_ntop
146
and
147
.Nm inet_net_pton
148
functions first appeared in BIND 4.9.4.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.