summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2000-07-25 04:39:54 +0000
committeritojun <itojun@NetBSD.org>2000-07-25 04:39:54 +0000
commitf69808cddd9a5fab939cc9ddb644ef70955a0dec (patch)
tree69a230c0353915c7d54672df7b0b3134d14a9fc2 /lib/libc
parentc54917029b6db1b4483ecfb39708f8f479fad9c5 (diff)
move pitfall example to downwards. wording fixes. sync with kame.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/getaddrinfo.3132
1 files changed, 63 insertions, 69 deletions
diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3
index a835fe18562..3713f11cbb7 100644
--- a/lib/libc/net/getaddrinfo.3
+++ b/lib/libc/net/getaddrinfo.3
@@ -1,5 +1,5 @@
-.\" $NetBSD: getaddrinfo.3,v 1.13 2000/07/25 02:33:30 itojun Exp $
-.\" $KAME: getaddrinfo.3,v 1.19 2000/07/25 02:27:44 itojun Exp $
+.\" $NetBSD: getaddrinfo.3,v 1.14 2000/07/25 04:39:54 itojun Exp $
+.\" $KAME: getaddrinfo.3,v 1.20 2000/07/25 04:36:52 itojun Exp $
.\"
.\" Copyright (c) 1983, 1987, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -169,73 +169,6 @@ structure initialized to zero with
set to
.Dv PF_UNSPEC .
.Pp
-Though the
-.Fa hints
-argument allows you to leave
-.Fa ai_socktype
-or
-.Fa ai_protocol
-unspecified
-.Pq by setting those members to zero ,
-the arguments must sufficiently be consistent and unambiguous.
-Here are pitfall cases you may encounter:
-.Bl -bullet
-.It
-.Fn getaddrinfo
-will raise error if members in
-.Fa hints
-structure is not consistent.
-For example, for internet address families,
-.Fn getaddrinfo
-will raise error if you specify
-.Dv SOCK_STREAM
-to
-.Fa ai_socktype
-while you specify
-.Dv IPPROTO_UDP
-to
-.Fa ai_protocol .
-.It
-If you specify a
-.Fa servname
-which is defined only for certain
-.Fa ai_socktype ,
-.Fn getaddrinfo
-will raise error because the arguments are not consistent.
-For example,
-.Fn getaddrinfo
-will raise error if you ask for
-.Dq Li tftp
-service on
-.Dv SOCK_STREAM .
-.It
-For internet address families, if you specify
-.Fa servname
-while you set
-.Fa ai_socktype
-to
-.Dv SOCK_RAW ,
-.Fa getaddrinfo
-will raise error, because service names are not defined for the internet
-.Dv SOCK_RAW
-space.
-.It
-If you specify numeric
-.Fa servname ,
-while leaving
-.Fa ai_socktype
-and
-.Fa ai_protocol
-unspecified,
-.Fn getaddrinfo
-will raise error.
-This is because the numeric
-.Fa servname
-does not identify any socket type, and
-.Fn getaddrinfo
-is not allowed to glob the argument in such case.
-.El
-.Pp
Upon successful return a pointer to a linked list of one or more
.Li addrinfo
structures is returned through the final argument.
@@ -338,6 +271,67 @@ is returned.
This flag prevents any type of name resolution service (e.g., the DNS)
from being called.
.Pp
+The arguments to
+.Fn getaddrinfo
+must sufficiently be consistent and unambiguous.
+Here are pitfall cases you may encounter:
+.Bl -bullet
+.It
+.Fn getaddrinfo
+will raise error if members in
+.Fa hints
+structure is not consistent.
+For example, for internet address families,
+.Fn getaddrinfo
+will raise error if you specify
+.Dv SOCK_STREAM
+to
+.Fa ai_socktype
+while you specify
+.Dv IPPROTO_UDP
+to
+.Fa ai_protocol .
+.It
+If you specify a
+.Fa servname
+which is defined only for certain
+.Fa ai_socktype ,
+.Fn getaddrinfo
+will raise error because the arguments are not consistent.
+For example,
+.Fn getaddrinfo
+will raise error if you ask for
+.Dq Li tftp
+service on
+.Dv SOCK_STREAM .
+.It
+For internet address families, if you specify
+.Fa servname
+while you set
+.Fa ai_socktype
+to
+.Dv SOCK_RAW ,
+.Fa getaddrinfo
+will raise error, because service names are not defined for the internet
+.Dv SOCK_RAW
+space.
+.It
+If you specify numeric
+.Fa servname ,
+while leaving
+.Fa ai_socktype
+and
+.Fa ai_protocol
+unspecified,
+.Fn getaddrinfo
+will raise error.
+This is because the numeric
+.Fa servname
+does not identify any socket type, and
+.Fn getaddrinfo
+is not allowed to glob the argument in such case.
+.El
+.Pp
All of the information returned by
.Fn getaddrinfo
is dynamically allocated: