d1534953b1
Do not begin a line with single quote character. Submitted by: Kazuo Horikawa <k-horik@yk.rim.or.jp>
192 lines
6 KiB
Groff
192 lines
6 KiB
Groff
.\" Copyright (c) 1983, 1990, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" From: @(#)inet.3 8.1 (Berkeley) 6/4/93
|
|
.\" %Id: inet.3,v 1.6 1997/03/19 19:41:20 bde Exp %
|
|
.\"
|
|
.Dd June 17, 1996
|
|
.Dt INET 3
|
|
.Os BSD 4.2
|
|
.Sh ̾¾Î
|
|
.Nm inet_aton ,
|
|
.Nm inet_addr ,
|
|
.Nm inet_network ,
|
|
.Nm inet_ntoa ,
|
|
.Nm inet_makeaddr ,
|
|
.Nm inet_lnaof ,
|
|
.Nm inet_netof
|
|
.Nd ¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥¢¥É¥ì¥¹Áàºî´Ø¿ô
|
|
.Sh ½ñ¼°
|
|
.Fd #include <sys/types.h>
|
|
.Fd #include <sys/socket.h>
|
|
.Fd #include <netinet/in.h>
|
|
.Fd #include <arpa/inet.h>
|
|
.Ft int
|
|
.Fn inet_aton "const char *cp" "struct in_addr *pin"
|
|
.Ft unsigned long
|
|
.Fn inet_addr "const char *cp"
|
|
.Ft unsigned long
|
|
.Fn inet_network "const char *cp"
|
|
.Ft char *
|
|
.Fn inet_ntoa "struct in_addr in"
|
|
.Ft struct in_addr
|
|
.Fn inet_makeaddr "unsigned long net" "unsigned long lna"
|
|
.Ft unsigned long
|
|
.Fn inet_lnaof "struct in_addr in"
|
|
.Ft unsigned long
|
|
.Fn inet_netof "struct in_addr in"
|
|
.Sh ²òÀâ
|
|
.Fn inet_aton ,
|
|
.Fn inet_addr
|
|
¤ª¤è¤Ó
|
|
.Fn inet_network
|
|
¥ë¡¼¥Á¥ó¤Ï¥¤¥ó¥¿¡¼¥Í¥Ã¥Èɸ½à¤Î
|
|
.Ql \&.
|
|
ɽµË¡¤Ç¼¨¤µ¤ì¤ë¿ôÃͤòɽ¸½¤¹¤ë¥¥ã¥é¥¯¥¿¡¦¥¹¥È¥ê¥ó¥°¤ò²ò¼á¤·¤Þ¤¹¡£
|
|
.Fn inet_aton
|
|
¥ë¡¼¥Á¥ó¤Ï»ØÄꥥã¥é¥¯¥¿¡¦¥¹¥È¥ê¥ó¥°¤ò
|
|
¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥¢¥É¥ì¥¹¤È²ò¼á¤·¡¢¥¢¥É¥ì¥¹¤ò¶¡µë¤µ¤ì¤¿¹½Â¤ÂΤÎÃæ¤Ë
|
|
ÃÖ¤¤Þ¤¹¡£
|
|
¥¹¥È¥ê¥ó¥°¤¬Àµ¾ï¤Ë²ò¼á¤µ¤ì¤ë¤ÈƱ¥ë¡¼¥Á¥ó¤Ï 1 ¤òÊÖ¤·¡¢¥¹¥È¥ê¥ó¥°¤¬
|
|
̵¸ú¤Î¤È¤ 0 ¤òÊÖ¤·¤Þ¤¹¡£
|
|
.Fn inet_addr
|
|
¤È
|
|
.Fn inet_network
|
|
´Ø¿ô¤Ï¤½¤ì¤¾¤ì¡¢
|
|
¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥¢¥É¥ì¥¹¤È¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥Í¥Ã¥È¥ï¡¼¥¯ÈÖ¹æ¤È¤·¤Æ»È¤¦¤Î¤Ë
|
|
Ŭ¤·¤¿¿ôÃͤòÊÖ¤·¤Þ¤¹¡£
|
|
.Fn inet_ntoa
|
|
¥ë¡¼¥Á¥ó¤Ï¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥¢¥É¥ì¥¹¤ò¼è¤ê¹þ¤ß¡¢
|
|
.Ql \&.
|
|
ɽµË¡¤Î¥¢¥É¥ì¥¹¤ò¼¨¤¹
|
|
.Tn ASCII
|
|
¥¹¥È¥ê¥ó¥°¤òÊÖ¤·¤Þ¤¹¡£
|
|
.Fn inet_makeaddr
|
|
¥ë¡¼¥Á¥ó¤Ï¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥Í¥Ã¥È¥ï¡¼¥¯ÈÖ¹æ¤È
|
|
¥í¡¼¥«¥ë¡¦¥Í¥Ã¥È¥ï¡¼¥¯¡¦¥¢¥É¥ì¥¹¤ò¼è¤ê¹þ¤ß¡¢
|
|
¤½¤ì¤ò´ð¤Ë¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥¢¥É¥ì¥¹¤òÀ¸À®¤·¤Þ¤¹¡£
|
|
.Fn inet_netof
|
|
¤È
|
|
.Fn inet_lnaof
|
|
¥ë¡¼¥Á¥ó¤Ï¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥Û¥¹¥È¡¦¥¢¥É¥ì¥¹¤òʬ³ä¤·¤Æ¡¢
|
|
¤½¤ì¤¾¤ì¥Í¥Ã¥È¥ï¡¼¥¯ÈÖ¹æ¤È¥í¡¼¥«¥ë¡¦¥Í¥Ã¥È¥ï¡¼¥¯¡¦¥¢¥É¥ì¥¹Éô¤È¤·¤ÆÊÖ¤·¤Þ¤¹¡£
|
|
.Pp
|
|
¤¹¤Ù¤Æ¤Î¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥¢¥É¥ì¥¹¤Ï¥Í¥Ã¥È¥ï¡¼¥¯½ç½ø ( º¸¤«¤é±¦¤Ø¤Î
|
|
¥Ð¥¤¥È½ç ) ¤ÇÊÖ¤µ¤ì¤Þ¤¹¡£
|
|
¥Í¥Ã¥È¥ï¡¼¥¯ÈÖ¹æ¤È¥í¡¼¥«¥ë¡¦¥¢¥É¥ì¥¹Éô¤Ï¤¹¤Ù¤Æ¥Þ¥·¥ó·Á¼°¤ÎÀ°¿ôÃͤÇ
|
|
ÊÖ¤µ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
.Sh ¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥¢¥É¥ì¥¹
|
|
.Ql \&.
|
|
ɽµË¡¤Ç»ØÄꤵ¤ì¤ëÃͤϼ¡¤Î¤É¤ì¤«°ì¤Ä¤Î·Á¼°¤ò¼è¤ê¤Þ¤¹¡£
|
|
.Bd -literal -offset indent
|
|
a.b.c.d
|
|
a.b.c
|
|
a.b
|
|
a
|
|
.Ed
|
|
.Pp
|
|
4 ¸Ä¤ÎÉôʬ¥¢¥É¥ì¥¹¤¬»ØÄꤵ¤ì¤ë¤È¡¢³ÆÉôʬ¤Ï 1 ¥Ð¥¤¥È¤Î¥Ç¡¼¥¿¤È²ò¼á¤µ¤ì¤Æ¡¢
|
|
º¸¤«¤é±¦¤Î½ç¤Ç¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥¢¥É¥ì¥¹¤Î 4 ¥Ð¥¤¥È¤Ë³ä¤êÅö¤Æ¤é¤ì¤Þ¤¹¡£
|
|
¥¤¥ó¥¿¡¼¥Í¥Ã¥È¡¦¥¢¥É¥ì¥¹¤¬
|
|
.Tn VAX
|
|
¾å¤Ç32 ¥Ó¥Ã¥È¤ÎÀ°¿ôÎ̤Ǥ¢¤ë¤È¸«¤Ê¤µ¤ì¤ë¤È¤¡¢¾åµ¤Ë³ºÅö¤¹¤ë¥Ð¥¤¥È¤Ï¡¢
|
|
.Dq Li d.c.b.a .
|
|
¤Èɽ¼¨¤µ¤ì¤Þ¤¹¡£¤¹¤Ê¤ï¤Á¡¢
|
|
.Tn VAX
|
|
¤Î¥Ð¥¤¥È½ç½ø¤Ï±¦¤«¤éº¸½ç¤Ë¤Ê¤ê¤Þ¤¹¡£
|
|
.Pp
|
|
3 ¸Ä¤ÎÉôʬ¥¢¥É¥ì¥¹¤¬»ØÄꤵ¤ì¤ë¤È¡¢ºÇ¸å¤ÎÉôʬ¤¬ 16 ¥Ó¥Ã¥ÈÎ̤Ȳò¼á¤µ¤ì¤Æ¡¢
|
|
¥Í¥Ã¥È¥ï¡¼¥¯¡¦¥¢¥É¥ì¥¹¤Î±¦Ã¼¤Î 2 ¥Ð¥¤¥È¤Ë¤Ê¤ê¤Þ¤¹¡£¤³¤ì¤Ï¡¢ 3 ¤Ä¤ÎÉôʬ
|
|
¥¢¥É¥ì¥¹·Á¼°¤Ç¤â Class B ¥Í¥Ã¥È¥ï¡¼¥¯¡¦¥¢¥É¥ì¥¹¤ò
|
|
.Dq Li 128.net.host
|
|
¤È¤·¤Æ»ØÄê²Äǽ¤Ë¤¹¤ëÊص¹Áàºî¤Ç¤¹¡£
|
|
.Pp
|
|
2 ¸Ä¤ÎÉôʬ¥¢¥É¥ì¥¹¤¬¶¡µë¤µ¤ì¤ë¤È¡¢ºÇ¸å¤ÎÉôʬ¥¢¥É¥ì¥¹¤¬ 24 ¥Ó¥Ã¥ÈÎ̤Ȥ·¤Æ
|
|
²ò¼á¤µ¤ì¤Æ¡¢¥Í¥Ã¥È¥ï¡¼¥¯¡¦¥¢¥É¥ì¥¹¤Î±¦Ã¼¤Î 3 ¥Ð¥¤¥È¤Ë¤Ê¤ê¤Þ¤¹¡£
|
|
¤³¤ì¤Ï 2 ¸Ä¤ÎÉôʬ¥¢¥É¥ì¥¹·Á¼°¤Ç¤â Class A ¥Í¥Ã¥È¥ï¡¼¥¯¡¦¥¢¥É¥ì¥¹¤ò
|
|
.Dq Li net.host .
|
|
¤È¤·¤Æ»ØÄê²Äǽ¤Ë¤¹¤ëÊص¹Áàºî¤Ç¤¹¡£
|
|
.Pp
|
|
1 ¸Ä¤ÎÉôʬ¥¢¥É¥ì¥¹¤À¤±»ØÄꤵ¤ì¤ë¤È¡¢ÃͤϥХ¤¥È¤ÎºÆÄ´À°¤Ê¤·¤Ë
|
|
ľÀܥͥåȥ¥¯¡¦¥¢¥É¥ì¥¹¤ËÊݸ¤µ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
.Ql \&.
|
|
ɽµË¡¤Ç
|
|
.Dq Éôʬ
|
|
¤È¤·¤Æ¶¡µë¤µ¤ì¤ë¿ôÃͤϤ¹¤Ù¤Æ¡¢ C ¸À¸ì¤Ç
|
|
»ØÄꤵ¤ì¤ë 10 ¿Ê¿ô¡¢ 8 ¿Ê¿ô¡¢ 16 ¿Ê¿ô¤Î¤¤¤Å¤ì¤«¤Î·Á¼°¤ò¼è¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹
|
|
( ¤¹¤Ê¤ï¤Á¡¢Àè¹Ô¤Î 0x ¤Þ¤¿¤Ï 0X ¤Ï 16 ¿Ê¿ô¡¢
|
|
¤½¤Î¾¤ÏÀè¹Ô¤¹¤ë 0 ¤¬ 8 ¿Ê¿ô¡¢¤Þ¤¿¤Ï¿ôÃͤ¬ 10 ¿Ê¿ô¤È²ò¼á¤µ¤ì¤Þ¤¹ ) ¡£
|
|
.Pp
|
|
.Fn inet_aton
|
|
¤È
|
|
.Fn inet_ntoa
|
|
´Ø¿ô¤Ï
|
|
.Xr addr2ascii 3
|
|
¥Õ¥¡¥ß¥ê¤ËÂŶ¨¤·¤¿´°Á´¤Ë³ÎΩ¤µ¤ì¤Æ¤¤¤Ê¤¤´Ø¿ô¤Ç¤¹¡£
|
|
¤·¤«¤·¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï¤Þ¤À¹¤¯»ÈÍѤµ¤ì¤Æ¤¤¤Ê¤¤¤¿¤á¡¢
|
|
ÅöÌ̤ϰܿ¢À¤Î¤¢¤ë¥×¥í¥°¥é¥à¤Ï¤³¤ì¤é¤Î¸ºß¤Ë°Í¸¤»¤º¤Ë
|
|
.Xr inet 3
|
|
´Ø¿ô¤Î»ÈÍѤò·Ñ³¤·¤Þ¤¹¡£
|
|
.Sh ¿ÇÃÇ
|
|
.Fn inet_addr
|
|
¤È
|
|
.Fn inet_network
|
|
¤Ï·Á¼°°ãÈ¿¤ÎÍ×µá¤Ë
|
|
.Dv INADDR_NONE
|
|
Äê¿ô¤òÊÖ¤·¤Þ¤¹¡£
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr addr2ascii 3 ,
|
|
.Xr gethostbyname 3 ,
|
|
.Xr getnetent 3 ,
|
|
.Xr hosts 5 ,
|
|
.Xr networks 5
|
|
.Sh Îò»Ë
|
|
¤³¤³¤Ç°·¤¦´Ø¿ô¤Ï
|
|
.Bx 4.2
|
|
¤Ç¼è¤êÆþ¤ì¤é¤ì¤Þ¤·¤¿¡£
|
|
.Pp
|
|
.Sh ¥Ð¥°
|
|
.Dv INADDR_NONE
|
|
(0xffffffff) ÃͤÏ͸ú¤ÊƱÊóÄÌ¿®¥¢¥É¥ì¥¹¤Ç¤¹¤¬¡¢
|
|
.Fn inet_addr
|
|
¤Ï¥¨¥é¡¼É½¼¨¤Ê¤·¤Ë¤³¤ÎÃͤòÊÖ¤¹¤³¤È¤¬¤Ç¤¤Þ¤»¤ó¡£
|
|
¿·¤·¤¤
|
|
.Fn inet_aton
|
|
´Ø¿ô¤Ï¤³¤ÎÌäÂê¤ò²ò·è¤·¤Þ¤·¤¿¡£
|
|
¥Û¥¹¥È¡¦¥Ð¥¤¥È½ç½øÂХͥåȥ¥¯¡¦¥Ð¥¤¥È½ç½ø¤ÎÌäÂê¤Ïº®Í𤷤¬¤Á¤Ç¤¹¡£
|
|
.Fn inet_ntoa
|
|
¤¬ÊÖ¤¹¥¹¥È¥ê¥ó¥°¤Ï¥¹¥¿¥Á¥Ã¥¯¡¦¥á¥â¥êÎΰè¤Ë¾ïÃó¤·¤Þ¤¹¡£
|
|
.Pp
|
|
Inet_addr ¤Ï
|
|
.Fa struct in_addr
|
|
¤òÊÖ¤¹É¬Íפ¬¤¢¤ê¤Þ¤¹¡£
|