1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" References consulted:
.\" Linux libc source code
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" libc.info (from glibc distribution)
.\" Modified Sat Jul 24 19:12:00 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified Sun Sep 3 20:29:36 1995 by Jim Van Zandt <jrv@vanzandt.mv.com>
.\" Changed network into host byte order (for inet_network),
.\" Andreas Jaeger <aj@arthur.rhein-neckar.de>, 980130.
.\"
.\" Japanese Version Copyright (c) 1998 Ueyama Rui
.\" all rights reserved.
.\" Translated 1998-05-23, Ueyama Rui <rui@linux.or.jp>
.\" Updated & Modefied 1999-02-26, Shouichi Saito
.\" Updated 1999-12-26, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2005-10-04, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2007-05-01, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.46
.\"
.\"WORD: numbers-and-dots notation ֿͤȥɥåȡˡ
.\"WORD: feature test macro ǽޥ
.\"
.TH INET 3 2007-07-26 "GNU" "Linux Programmer's Manual"
.SH ̾
inet_aton, inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof,
inet_netof \- ͥåȥɥ쥹롼
.SH
.nf
.B #include <sys/socket.h>
.B #include <netinet/in.h>
.B #include <arpa/inet.h>
.sp
.BI "int inet_aton(const char *" cp ", struct in_addr *" inp );
.sp
.BI "in_addr_t inet_addr(const char *" cp );
.sp
.BI "in_addr_t inet_network(const char *" cp );
.sp
.BI "char *inet_ntoa(struct in_addr " in );
.sp
.BI "struct in_addr inet_makeaddr(int " net ", int " host );
.sp
.BI "in_addr_t inet_lnaof(struct in_addr " in );
.sp
.BI "in_addr_t inet_netof(struct in_addr " in );
.fi
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.BR inet_aton (),
.BR inet_ntoa ():
_BSD_SOURCE || _SVID_SOURCE
.SH
.BR inet_aton ()
ϡͥåȥۥȤΥɥ쥹 \fIcp\fP
ֿͤȥɥåȡˡХʥͤѴ롣
̤ \fIinp\fP ؤƤ빽¤Τ롣
֤ͤϡꤷɥ쥹ʤ 0 ʳʤ 0 Ǥ롣
.PP
.BR inet_addr ()
ؿϡͥåȥۥȤΥɥ쥹 \fIcp\fP
ֿͤȥɥåȡˡͥåȥХȥǤΥХʥͤ
Ѵ֤ʤ
.B INADDR_NONE
(̤ \-1) ֤롣
δؿľ
.BR inet_aton ()
Фơ\fI٤\fPեǤ롣ʤʤ \-1
ɥ쥹 (255.255.255.255) Ǥ롣
.BR inet_aton ()
顼֤뤳ȤäȼȤǤ롣
.PP
.BR inet_network ()
ؿϡ
ֿͤȥɥåȡˡʸǤ \fIcp\fP 顢
ͥåȥɥ쥹ȤƻѤǤͤ
ۥȥХȥǼФ
ʤ \-1 ֤롣
.PP
.BR inet_ntoa ()
ؿϡ
ͥåȥХȥǤΥͥåȥۥȥɥ쥹 \fIin\fP
ֿͤȥɥåȡˡѴ롣ʸ
Ū˳Ƥ줿Хåե֤Τǡ
⤦ 1δؿƤ֤ʸϾ롣
.PP
.BR inet_makeaddr ()
ؿϡͥåȥ \fInet\fP ȡ
ΥͥåȥǤΥۥȤΥ륢ɥ쥹 \fIhost\fP äĤơ
ͥåȥۥȤΥɥ쥹롣֤ͤϥͥåȥХȥ
\fIhost\fP\fInet\fP ϥۥȥХȥǤ롣
.PP
.BR inet_lnaof ()
ؿϡͥåȥɥ쥹 \fIin\fP
Υۥ֤֤ͤϥۥȥХȥǤ롣
.PP
.BR inet_netof ()
ؿϡͥåȥɥ쥹 \fIin\fP
Υͥåȥ֤֤ͤϥۥȥХȥǤ롣
.PP
.BR inet_ntoa (),
.BR inet_makeaddr (),
.BR inet_lnaof (),
.BR inet_netof ()
ǻѤ빽¤ \fIin_addr\fP ϡ
.I <netinet/in.h>
ǼΤ褦Ƥ:
.sp
.in +4n
.nf
typedef uint32_t in_addr_t;
struct in_addr {
in_addr_t s_addr;
};
.fi
.in
.PP
i386 ǤΥۥȥХȥ LSB first (ȥ륨ǥ)
ͥåȤǻȤͥåȥХȥ
MSB first (ӥåǥ) Ǥդ뤳ȡ
.SH
4.3BSD.
.BR inet_addr (),
.BR inet_aton (),
.BR inet_ntoa ()
POSIX.1-2001 ǵꤵƤ롣
.SH
ɥ쥹ФơֿͤȥɥåȡˡѤ硢
줾οͤƬ 0 8 ʿȲᤵ졢
Ƭ 0x 16 ʿȲᤵդ뤳ȡ
㤨С\fBinet_aton("226.000.000.037", &t)\fP
\fI226.0.0.37\fP ǤϤʤ \fI226.0.0.31\fP Ȳᤵ롣
.SH Ϣ
.BR gethostbyname (3),
.BR getnetent (3),
.BR inet_ntop (3),
.BR inet_pton (3),
.BR hosts (5),
.BR networks (5)
|