X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=draft%2Fman3%2Finet.3;h=f81afd766e95eba09fbfc0c6c7a8f492c68fb512;hb=1d98b26905be2ad5ba08a94d65f57d872bae4f85;hp=a94205c51c2aace757b758b2c58f900c4eff99e9;hpb=633a2252e0be3c867dce264a180a89ce8181d36f;p=linuxjm%2FLDP_man-pages.git diff --git a/draft/man3/inet.3 b/draft/man3/inet.3 index a94205c5..f81afd76 100644 --- a/draft/man3/inet.3 +++ b/draft/man3/inet.3 @@ -39,277 +39,88 @@ .\" Add discussion of Classful Addressing, noting that it is obsolete. .\" Added an EXAMPLE program. .\" -.\" Japanese Version Copyright (c) 1998 Ueyama Rui -.\" all rights reserved. -.\" Translated 1998-05-23, Ueyama Rui -.\" Updated & Modefied 1999-02-26, Shouichi Saito -.\" Updated 1999-12-26, Kentaro Shirakata -.\" Updated 2005-10-04, Kentaro Shirakata -.\" Updated 2007-05-01, Akihiro MOTOKI , LDP v2.46 -.\" Updated 2008-08-13, Akihiro MOTOKI, LDP v3.05 +.\"******************************************************************* .\" -.\"WORD: numbers-and-dots notation ¿ôÃͤȥɥåȤˤè¤ëµ­Ë¡ -.\"WORD: dotted-decimal notation ¥É¥Ã¥È¶èÀÚ¤ê¤Î 10 ¿Ê¿ôµ­Ë¡ -.\"WORD: feature test macro µ¡Ç½¸¡ºº¥Þ¥¯¥í +.\" This file was generated with po4a. Translate the source file. .\" -.TH INET 3 2008-06-19 "GNU" "Linux Programmer's Manual" -.\"O .SH NAME -.SH ̾Á° -.\"O inet_aton, inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof, -.\"O inet_netof \- Internet address manipulation routines +.\"******************************************************************* +.TH INET 3 2008\-06\-19 GNU "Linux Programmer's Manual" +.SH 名前 inet_aton, inet_addr, inet_network, inet_ntoa, inet_makeaddr, inet_lnaof, -inet_netof \- ¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥¢¥É¥ì¥¹Áàºî¥ë¡¼¥Á¥ó -.\"O .SH SYNOPSIS -.SH ½ñ¼° +inet_netof \- インターネットアドレス操作ルーチン +.SH 書式 .nf -.B #include -.B #include -.B #include +\fB#include \fP +\fB#include \fP +\fB#include \fP .sp -.BI "int inet_aton(const char *" cp ", struct in_addr *" inp ); +\fBint inet_aton(const char *\fP\fIcp\fP\fB, struct in_addr *\fP\fIinp\fP\fB);\fP .sp -.BI "in_addr_t inet_addr(const char *" cp ); +\fBin_addr_t inet_addr(const char *\fP\fIcp\fP\fB);\fP .sp -.BI "in_addr_t inet_network(const char *" cp ); +\fBin_addr_t inet_network(const char *\fP\fIcp\fP\fB);\fP .sp -.BI "char *inet_ntoa(struct in_addr " in ); +\fBchar *inet_ntoa(struct in_addr \fP\fIin\fP\fB);\fP .sp -.BI "struct in_addr inet_makeaddr(int " net ", int " host ); +\fBstruct in_addr inet_makeaddr(int \fP\fInet\fP\fB, int \fP\fIhost\fP\fB);\fP .sp -.BI "in_addr_t inet_lnaof(struct in_addr " in ); +\fBin_addr_t inet_lnaof(struct in_addr \fP\fIin\fP\fB);\fP .sp -.BI "in_addr_t inet_netof(struct in_addr " in ); +\fBin_addr_t inet_netof(struct in_addr \fP\fIin\fP\fB);\fP .fi .sp .in -4n -.\"O Feature Test Macro Requirements for glibc (see -.\"O .BR feature_test_macros (7)): -glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï -.RB ( feature_test_macros (7) -»²¾È): +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp -.BR inet_aton (), -.BR inet_ntoa (): -_BSD_SOURCE || _SVID_SOURCE -.\"O .SH DESCRIPTION -.SH ÀâÌÀ -.\"O .BR inet_aton () -.\"O converts the Internet host address \fIcp\fP from the -.\"O IPv4 numbers-and-dots notation into binary form (in network byte order) -.\"O and stores it in the structure that \fIinp\fP points to. -.\"O .BR inet_aton () -.\"O returns nonzero if the address is valid, zero if not. -.\"O The address supplied in -.\"O .I cp -.\"O can have one of the following forms: -.BR inet_aton () -¤Ï¡¢¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥Û¥¹¥È¤Î¥¢¥É¥ì¥¹ \fIcp\fP ¤ò¡¢ -IPv4 ¤Î¿ôÃͤȥɥåȤˤè¤ëɽµ­¤«¤é (¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤Î) ¥Ð¥¤¥Ê¥êÃÍ¤Ø -ÊÑ´¹¤·¡¢ÊÑ´¹·ë²Ì¤ò \fIinp\fP ¤¬»Ø¤·¤Æ¤¤¤ë¹½Â¤ÂΤ˳ÊǼ¤¹¤ë¡£ -¥¢¥É¥ì¥¹¤¬Í­¸ú¤Ê¾ì¹ç 0 °Ê³°¤òÊÖ¤·¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£ -.I cp -¤ÇÅϤ¹¥¢¥É¥ì¥¹¤È¤·¤Æ¡¢°Ê²¼¤Î·Á¼°¤òÍѤ¤¤ë¤³¤È¤¬¤Ç¤­¤ë¡£ -.TP 10 -.I a.b.c.d -.\"O Each of the four numeric parts specifies a byte of the address; -.\"O the bytes are assigned in left-to-right order to produce the binary address. -4 ¤Ä¤Î¿ô»ú¤Î¤½¤ì¤¾¤ì¤Ï¥¢¥É¥ì¥¹¤Î³Æ¥Ð¥¤¥È¤ò¼¨¤¹¡£ -¤³¤ì¤é¤Î¥Ð¥¤¥È¤Ïº¸¤«¤é±¦¤Î½ç½ø¤Ç¥Ð¥¤¥Ê¥ê¥¢¥É¥ì¥¹¤Ë³ä¤êÅö¤Æ¤é¤ì¤ë¡£ -.TP -.I a.b.c -.\"O Parts -.\"O .I a -.\"O and -.\"O .I b -.\"O specify the first two bytes of the binary address. -.\"O Part -.\"O .I c -.\"O is interpreted as a 16-bit value that defines the rightmost two bytes -.\"O of the binary address. -.\"O This notation is suitable for specifying (outmoded) Class B -.\"O network addresses. -.I a -¤È -.I b -¤Ï¥Ð¥¤¥Ê¥ê¥¢¥É¥ì¥¹¤ÎºÇ½é¤Î 2 ¥Ð¥¤¥È¤ò¼¨¤¹¡£ -.I c -¤Ï 16 ¥Ó¥Ã¥ÈÃͤȲò¼á¤µ¤ì¡¢¥Ð¥¤¥Ê¥ê¥¢¥É¥ì¥¹¤Î±¦Â¦¤Î 2 ¥Ð¥¤¥È¤òɽ¤¹¡£ -¤³¤Îɽµ­¤Ï¡¢(²áµî¤Î¤â¤Î¤È¤Ê¤Ã¤¿) ¥¯¥é¥¹ B ¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤ò -»ØÄꤹ¤ë¤Î¤ËŬ¤·¤Æ¤¤¤ë¡£ -.TP -.I a.b -.\"O Part -.\"O .I a -.\"O specifies the first byte of the binary address. -.\"O Part -.\"O .I b -.\"O is interpreted as a 24-bit value that defines the rightmost three bytes -.\"O of the binary address. -.\"O This notation is suitable for specifying (outmoded) Class C -.\"O network addresses. -.I a -¤Ï¥Ð¥¤¥Ê¥ê¥¢¥É¥ì¥¹¤ÎºÇ½é¤Î¥Ð¥¤¥È¤ò¼¨¤¹¡£ -.I b -¤Ï 24 ¥Ó¥Ã¥ÈÃͤȲò¼á¤µ¤ì¡¢¥Ð¥¤¥Ê¥ê¥¢¥É¥ì¥¹¤Î±¦Â¦¤Î 3 ¥Ð¥¤¥È¤òɽ¤¹¡£ -¤³¤Îɽµ­¤Ï¡¢(²áµî¤Î¤â¤Î¤È¤Ê¤Ã¤¿) ¥¯¥é¥¹ C ¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤ò -»ØÄꤹ¤ë¤Î¤ËŬ¤·¤Æ¤¤¤ë¡£ -.TP -.I a -.\"O The value -.\"O .I a -.\"O is interpreted as a 32-bit value that is stored directly -.\"O into the binary address without any byte rearrangement. -ÃÍ -.I a -¤Ï 32 ¥Ó¥Ã¥ÈÃͤȲò¼á¤µ¤ì¡¢¥Ð¥¤¥È¤ÎºÆÇÛÃ֤ϹԤï¤ì¤º¡¢ -¤½¤Î¤Þ¤Þ¥Ð¥¤¥Ê¥ê¥¢¥É¥ì¥¹¤È¤·¤Æ³ÊǼ¤µ¤ì¤ë¡£ +\fBinet_aton\fP(), \fBinet_ntoa\fP(): _BSD_SOURCE || _SVID_SOURCE +.SH 説明 +\fBinet_aton\fP() は、インターネットホストのアドレス \fIcp\fP を、 IPv4 の数値とドットによる表記から +(ネットワークバイトオーダの) バイナリ値へ 変換し、変換結果を \fIinp\fP が指している構造体に格納する。 アドレスが有効な場合 0 +以外を返し、そうでない場合は 0 を返す。 \fIcp\fP で渡すアドレスとして、以下の形式を用いることができる。 +.TP 10 +\fIa.b.c.d\fP +4 つの数字のそれぞれはアドレスの各バイトを示す。 これらのバイトは左から右の順序でバイナリアドレスに割り当てられる。 +.TP +\fIa.b.c\fP +\fIa\fP と \fIb\fP はバイナリアドレスの最初の 2 バイトを示す。 \fIc\fP は 16 ビット値と解釈され、バイナリアドレスの右側の 2 +バイトを表す。 この表記は、(過去のものとなった) クラス B ネットワークアドレスを 指定するのに適している。 +.TP +\fIa.b\fP +\fIa\fP はバイナリアドレスの最初のバイトを示す。 \fIb\fP は 24 ビット値と解釈され、バイナリアドレスの右側の 3 バイトを表す。 +この表記は、(過去のものとなった) クラス C ネットワークアドレスを 指定するのに適している。 +.TP +\fIa\fP +値 \fIa\fP は 32 ビット値と解釈され、バイトの再配置は行われず、 そのままバイナリアドレスとして格納される。 .PP -.\"O In all of the above forms, -.\"O components of the dotted address can be specified in decimal, -.\"O octal (with a leading -.\"O .IR 0 ), -.\"O or hexadecimal, with a leading -.\"O .IR 0X ). -.\"O Addresses in any of these forms are collectively termed -.\"O .IR "IPV4 numbers-and-dots notation" . -.\"O The form that uses exactly four decimal numbers is referred to as -.\"O .IR "IPv4 dotted-decimal notation" -.\"O (or sometimes: -.\"O .IR "IPv4 dotted-quad notation" ). -¾åµ­¤ÎÁ´¤Æ¤Î·Á¼°¤Ç¡¢¥É¥Ã¥È¶èÀÚ¤ê¤Î¥¢¥É¥ì¥¹¤Î³ÆÍ×ÁǤϡ¢10 ¿Ê¿ô¡¢ -8 ¿Ê¿ô (ÀèƬ¤Ë -.I 0 -¤òÉÕ¤±¤ë)¡¢ -16 ¿Ê¿ô (ÀèƬ¤Ë -.I 0X -¤òÉÕ¤±¤ë) ¤Ç»ØÄê¤Ç¤­¤ë¡£ -¤³¤ì¤é¤Î·Á¼°¤Î¥¢¥É¥ì¥¹¤ò¤Þ¤È¤á¤Æ -.I "IPv4 ¤Î¿ôÃͤȥɥåȤˤè¤ëɽµ­ (IPv4 numbers-and-dots notation)" -¤È¸Æ¤Ö¡£ -¤Þ¤¿¡¢10 ¿Ê¿ô 4 ¤Ä¤À¤±¤ò»È¤Ã¤¿·Á¼°¤ò -.I "IPv4 ¤Î¥É¥Ã¥È¶èÀÚ¤ê¤Î 10 ¿Ê¿ôɽµ­ (IPv4 dotted-decimal notation)" -¤È¸Æ¤Ö -.RI ( "IPv4 ¤Î¥É¥Ã¥È¶èÀÚ¤ê 4 ʬ³äɽµ­ (IPv4 dotted-decimal notation)" -¤È¸Æ¤Ö¤³¤È¤â¤¢¤ë)¡£ +上記の全ての形式で、ドット区切りのアドレスの各要素は、10 進数、 8 進数 (先頭に \fI0\fP を付ける)、 16 進数 (先頭に \fI0X\fP +を付ける) で指定できる。 これらの形式のアドレスをまとめて \fIIPv4 の数値とドットによる表記 (IPv4 numbers\-and\-dots +notation)\fP と呼ぶ。 また、10 進数 4 つだけを使った形式を \fIIPv4 のドット区切りの 10 進数表記 (IPv4 +dotted\-decimal notation)\fP と呼ぶ (\fIIPv4 のドット区切り 4 分割表記 (IPv4 dotted\-decimal +notation)\fP と呼ぶこともある)。 .PP -.\"O The -.\"O .BR inet_addr () -.\"O function converts the Internet host address -.\"O \fIcp\fP from IPv4 numbers-and-dots notation into binary data in network -.\"O byte order. -.\"O If the input is invalid, -.\"O .B INADDR_NONE -.\"O (usually \-1) is returned. -.\"O Use of this function is problematic because \-1 is a valid address -.\"O (255.255.255.255). -.\"O Avoid its use in favor of -.\"O .BR inet_aton (), -.\"O .BR inet_pton (3), -.\"O or -.\"O .BR getaddrinfo (3) -.\"O which provide a cleaner way to indicate error return. -.BR inet_addr () -´Ø¿ô¤Ï¡¢¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥Û¥¹¥È¤Î¥¢¥É¥ì¥¹ \fIcp\fP ¤ò¡¢ -IPv4 ¤Î¿ôÃͤȥɥåȤˤè¤ëɽµ­¤«¤é¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤Ç¤Î -¥Ð¥¤¥Ê¥êÃͤØÊÑ´¹¤·¤ÆÊÖ¤¹¡£ -ÆþÎϤ¬ÉÔÀµ¤Ê¾ì¹ç¡¢ -.B INADDR_NONE -(ÉáÄÌ¤Ï \-1) ¤òÊÖ¤¹¡£ -\-1 ¤ÏÍ­¸ú¤Ê¥¢¥É¥ì¥¹ (255.255.255.255) ¤Ê¤Î¤Ç¡¢¤³¤Î´Ø¿ô¤ò»È¤¦¤È -ÌäÂê¤Ë¤Ê¤ë¤«¤â¤·¤ì¤Ê¤¤¡£ -¤³¤Î´Ø¿ô¤ò»È¤¦¤Î¤ÏÈò¤±¡¢Âå¤ï¤ê¤Ë -.BR inet_aton (), -.BR inet_pton (3), -.BR getaddrinfo (3) -¤ò»È¤¦¤Î¤¬¤è¤¤¡£ -¤³¤ì¤é¤Î´Ø¿ô¤ÎÊý¤¬¡¢¥¨¥é¡¼¤ÎÄÌÃΤ¬¤è¤ê¤­¤ì¤¤¤ÊÊýË¡¤Ç¹Ô¤ï¤ì¤ë¡£ +\fBinet_addr\fP() 関数は、インターネットホストのアドレス \fIcp\fP を、 IPv4 +の数値とドットによる表記からネットワークバイトオーダでの バイナリ値へ変換して返す。 入力が不正な場合、 \fBINADDR_NONE\fP (普通は \-1) +を返す。 \-1 は有効なアドレス (255.255.255.255) なので、この関数を使うと 問題になるかもしれない。 +この関数を使うのは避け、代わりに \fBinet_aton\fP(), \fBinet_pton\fP(3), \fBgetaddrinfo\fP(3) +を使うのがよい。 これらの関数の方が、エラーの通知がよりきれいな方法で行われる。 .PP -.\"O The -.\"O .BR inet_network () -.\"O function converts -.\"O .IR cp , -.\"O a string in IPv4 numbers-and-dots notation, -.\"O into a number in host byte order suitable for use as an -.\"O Internet network address. -.\"O On success, the converted address is returned. -.\"O If the input is invalid, \-1 is returned. -.BR inet_network () -´Ø¿ô¤Ï¡¢ -IPv4 ¤Î¿ôÃͤȥɥåȤˤè¤ëɽµ­¤Îʸ»úÎó \fIcp\fP ¤ò¡¢ -¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥¢¥É¥ì¥¹¤È¤·¤Æ¤Î»ÈÍѤËŬ¤·¤¿ -¥Û¥¹¥È¥Ð¥¤¥È¥ª¡¼¥À¤Î¿ôÃͤËÊÑ´¹¤¹¤ë¡£ -À®¸ù¤¹¤ë¤È¡¢ÊÑ´¹¤µ¤ì¤¿¥¢¥É¥ì¥¹¤òÊÖ¤¹¡£ -ÆþÎϤ¬ÉÔÀµ¤Ê¾ì¹ç¤Ï \-1 ¤òÊÖ¤¹¡£ +\fBinet_network\fP() 関数は、 IPv4 の数値とドットによる表記の文字列 \fIcp\fP を、 インターネットアドレスとしての使用に適した +ホストバイトオーダの数値に変換する。 成功すると、変換されたアドレスを返す。 入力が不正な場合は \-1 を返す。 .PP -.\"O The -.\"O .BR inet_ntoa () -.\"O function converts the Internet host address -.\"O \fIin\fP, given in network byte order, to a string in IPv4 -.\"O dotted-decimal notation. -.\"O The string is returned in a statically -.\"O allocated buffer, which subsequent calls will overwrite. -.BR inet_ntoa () -´Ø¿ô¤Ï¡¢¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤ÇÅϤµ¤ì¤¿¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥Û¥¹¥È¥¢¥É¥ì¥¹ -\fIin\fP ¤ò¡¢ IPv4 ¤Î¥É¥Ã¥È¶èÀÚ¤ê¤Î 10 ¿Ê¿ôɽµ­¤Îʸ»úÎó¤ËÊÑ´¹¤¹¤ë¡£ -ʸ»úÎó¤ÏÀÅŪ¤Ë³äÅö¤Æ¤é¤ì¤¿¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤µ¤ì¤ÆÊÖ¤µ¤ì¤ë¤Î¤Ç¡¢ -¤³¤Î¸å¤Ç¤³¤Î´Ø¿ô¤òºÆÅٸƤӽФ¹¤Èʸ»úÎó¤Ï¾å½ñ¤­¤µ¤ì¤ë¡£ +\fBinet_ntoa\fP() 関数は、ネットワークバイトオーダで渡されたインターネットホストアドレス \fIin\fP を、 IPv4 のドット区切りの +10 進数表記の文字列に変換する。 文字列は静的に割当てられたバッファに格納されて返されるので、 この後でこの関数を再度呼び出すと文字列は上書きされる。 .PP -.\"O The -.\"O .BR inet_lnaof () -.\"O function returns the local network address part -.\"O of the Internet address \fIin\fP. -.\"O The returned value is in host byte order. -.BR inet_lnaof () -´Ø¿ô¤Ï¡¢¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥¢¥É¥ì¥¹ \fIin\fP ¤Î¥í¡¼¥«¥ë¥Í¥Ã¥È¥ï¡¼¥¯Éôʬ¤òÊÖ¤¹¡£ -¤³¤ÎÊÖ¤êÃͤϥۥ¹¥È¥Ð¥¤¥È¥ª¡¼¥À¤Ç¤¢¤ë¡£ +\fBinet_lnaof\fP() 関数は、インターネットアドレス \fIin\fP のローカルネットワーク部分を返す。 この返り値はホストバイトオーダである。 .PP -.\"O The -.\"O .BR inet_netof () -.\"O function returns the network number part of -.\"O the Internet address \fIin\fP. -.\"O The returned value is in host byte order. -.BR inet_netof () -´Ø¿ô¤Ï¡¢¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥¢¥É¥ì¥¹ \fIin\fP ¤Î¥Í¥Ã¥È¥ï¡¼¥¯Éôʬ¤òÊÖ¤¹¡£ -¤³¤ÎÊÖ¤êÃͤϥۥ¹¥È¥Ð¥¤¥È¥ª¡¼¥À¤Ç¤¢¤ë¡£ +\fBinet_netof\fP() 関数は、インターネットアドレス \fIin\fP のネットワーク部分を返す。 この返り値はホストバイトオーダである。 .PP -.\"O The -.\"O .BR inet_makeaddr () -.\"O function is the converse of -.\"O .BR inet_netof () -.\"O and -.\"O .BR inet_lnaof (). -.\"O It returns an Internet host address in network byte order, -.\"O created by combining the network number \fInet\fP -.\"O with the local address \fIhost\fP, both in -.\"O host byte order. -.BR inet_makeaddr () -´Ø¿ô¤Ï -.BR inet_netof () -¤È -.BR inet_lnaof () -¤ÎµÕ¤Îµ¡Ç½¤ò»ý¤Ä¡£ -¥Í¥Ã¥È¥ï¡¼¥¯ÈÖ¹æ \fInet\fP ¤È¡¢¥í¡¼¥«¥ë¥¢¥É¥ì¥¹ \fIhost\fP ¤ò -ÁȤ߹ç¤ï¤»¤ÆÀ¸À®¤·¤¿¡¢¥¤¥ó¥¿¡¼¥Í¥Ã¥È¥Û¥¹¥È¥¢¥É¥ì¥¹¤ò -¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤ÇÊÖ¤¹¡£ -\fIhost\fP, \fInet\fP ¤Ï¤È¤â¤Ë¥Û¥¹¥È¥Ð¥¤¥È¥ª¡¼¥À¤Ç¤¢¤ë¡£ +\fBinet_makeaddr\fP() 関数は \fBinet_netof\fP() と \fBinet_lnaof\fP() の逆の機能を持つ。 +ネットワーク番号 \fInet\fP と、ローカルアドレス \fIhost\fP を 組み合わせて生成した、インターネットホストアドレスを +ネットワークバイトオーダで返す。 \fIhost\fP, \fInet\fP はともにホストバイトオーダである。 .PP -.\"O The structure \fIin_addr\fP as used in -.\"O .BR inet_ntoa (), -.\"O .BR inet_makeaddr (), -.\"O .BR inet_lnaof () -.\"O and -.\"O .BR inet_netof () -.\"O is defined in -.\"O .I -.\"O as: -.BR inet_ntoa (), -.BR inet_makeaddr (), -.BR inet_lnaof (), -.BR inet_netof () -¤Ç»ÈÍѤ¹¤ë¹½Â¤ÂÎ \fIin_addr\fP ¤Ï -.I -¤Ç¼¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë: +\fBinet_ntoa\fP(), \fBinet_makeaddr\fP(), \fBinet_lnaof\fP(), \fBinet_netof\fP() +で使用する構造体 \fIin_addr\fP は \fI\fP で次のように定義されている: .sp .in +4n .nf @@ -320,110 +131,44 @@ struct in_addr { }; .fi .in -.\"O .SH "CONFORMING TO" -.SH ½àµò -4.3BSD. -.\"O .BR inet_addr () -.\"O and -.\"O .BR inet_ntoa () -.\"O are specified in POSIX.1-2001. -.BR inet_addr (), -.BR inet_ntoa () -¤Ï POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£ -.\"O .BR inet_aton () -.\"O is not specified in POSIX.1-2001, but is available on most systems. -.BR inet_aton () -¤Ï POSIX.1-2001 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¤¬¡¢¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£ -.\"O .SH NOTES -.SH Ãí°Õ -.\"O On the i386 the host byte order is Least Significant Byte -.\"O first (little endian), whereas the network byte order, as used on the -.\"O Internet, is Most Significant Byte first (big endian). -i386 ¤Ç¤Ï¥Û¥¹¥È¥Ð¥¤¥È¥ª¡¼¥À¤Ï Least Significant Byte (LSB) first -(¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó) ¤À¤¬¡¢ -¥¤¥ó¥¿¡¼¥Í¥Ã¥È¤Ç»È¤ï¤ì¤ë¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤Ï -Most Significant Byte (MSB) first (¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó) -¤Ç¤¢¤ëÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£ +.SH 準拠 +4.3BSD. \fBinet_addr\fP(), \fBinet_ntoa\fP() は POSIX.1\-2001 で規定されている。 +\fBinet_aton\fP() は POSIX.1\-2001 で規定されていないが、ほとんどのシステムで利用可能である。 +.SH 注意 +i386 ではホストバイトオーダは Least Significant Byte (LSB) first (リトルエンディアン) だが、 +インターネットで使われるネットワークバイトオーダは Most Significant Byte (MSB) first (ビッグエンディアン) +である点に注意すること。 -.\"O .BR inet_lnaof (), -.\"O .BR inet_netof (), -.\"O and -.\"O .BR inet_makeaddr () -.\"O are legacy functions that assume they are dealing with -.\"O .IR "classful network addresses" . -.\"O Classful networking divides IPv4 network addresses into host and network -.\"O components at byte boundaries, as follows: -.BR inet_lnaof (), -.BR inet_netof (), -.BR inet_makeaddr () -¤Ï²áµî¤Î̾»Ä¤Ç¤¢¤ê¡¢ÅϤµ¤ì¤¿¥¢¥É¥ì¥¹¤¬ -.I "¥¯¥é¥¹¥Õ¥ë¡¦¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹ (classful network addresses)" -¤Ç¤¢¤ë¤È²¾Äꤷ¤Æ½èÍý¤ò¹Ô¤¦¡£ -¥¯¥é¥¹¥Õ¥ë¡¦¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤Ç¤Ï¡¢°Ê²¼¤Ë¤¢¤ë¤è¤¦¤Ë¡¢ -IPv4 ¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤ò¥Ð¥¤¥È¶­³¦¤Ç¥Í¥Ã¥È¥ï¡¼¥¯Éô¤È¥Û¥¹¥ÈÉô¤Ëʬ³ä¤¹¤ë¡£ -.TP 10 +\fBinet_lnaof\fP(), \fBinet_netof\fP(), \fBinet_makeaddr\fP() は過去の名残であり、渡されたアドレスが +\fIクラスフル・ネットワークアドレス (classful network addresses)\fP であると仮定して処理を行う。 +クラスフル・ネットワークアドレスでは、以下にあるように、 IPv4 ネットワークアドレスをバイト境界でネットワーク部とホスト部に分割する。 +.TP 10 Class A -.\"O This address type is indicated by the value 0 in the -.\"O most significant bit of the (network byte ordered) address. -.\"O The network address is contained in the most significant byte, -.\"O and the host address occupies the remaining three bytes. -(¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤Î) ¥¢¥É¥ì¥¹¤ÎºÇ¾å°Ì¥Ó¥Ã¥È¤¬ 0 ¤Î¾ì¹ç¡¢ -¤³¤Î¥¢¥É¥ì¥¹¼ïÊ̤Ȥʤ롣¤³¤Î¥¢¥É¥ì¥¹¼ïÊ̤Ǥϡ¢ -ºÇ¾å°Ì¥Ð¥¤¥È¤¬¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤òɽ¤·¡¢ -»Ä¤ê¤Î 3 ¥Ð¥¤¥È¤¬¥Û¥¹¥È¥¢¥É¥ì¥¹¤òɽ¤¹¡£ -.TP +(ネットワークバイトオーダの) アドレスの最上位ビットが 0 の場合、 このアドレス種別となる。このアドレス種別では、 +最上位バイトがネットワークアドレスを表し、 残りの 3 バイトがホストアドレスを表す。 +.TP Class B -.\"O This address type is indicated by the binary value 10 in the -.\"O most significant two bits of the address. -.\"O The network address is contained in the two most significant bytes, -.\"O and the host address occupies the remaining two bytes. -(¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤Î) ¥¢¥É¥ì¥¹¤Î¾å°Ì¦ 2 ¥Ó¥Ã¥È¤¬¥Ð¥¤¥Ê¥êÃÍ¤Ç -10 ¤Î¾ì¹ç¡¢¤³¤Î¥¢¥É¥ì¥¹¼ïÊ̤Ȥʤ롣¤³¤Î¥¢¥É¥ì¥¹¼ïÊ̤Ǥϡ¢ -¾å°Ì 2 ¥Ð¥¤¥È¤¬¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤òɽ¤·¡¢ -»Ä¤ê¤Î 2 ¥Ð¥¤¥È¤¬¥Û¥¹¥È¥¢¥É¥ì¥¹¤òɽ¤¹¡£ -.TP +(ネットワークバイトオーダの) アドレスの上位側 2 ビットがバイナリ値で 10 の場合、このアドレス種別となる。このアドレス種別では、 上位 2 +バイトがネットワークアドレスを表し、 残りの 2 バイトがホストアドレスを表す。 +.TP Class C -.\"O This address type is indicated by the binary value 110 in the -.\"O most significant three bits of the address. -.\"O The network address is contained in the three most significant bytes, -.\"O and the host address occupies the remaining byte. -(¥Í¥Ã¥È¥ï¡¼¥¯¥Ð¥¤¥È¥ª¡¼¥À¤Î) ¥¢¥É¥ì¥¹¤Î¾å°Ì¦ 3 ¥Ó¥Ã¥È¤¬¥Ð¥¤¥Ê¥êÃÍ¤Ç -110 ¤Î¾ì¹ç¡¢¤³¤Î¥¢¥É¥ì¥¹¼ïÊ̤Ȥʤ롣¤³¤Î¥¢¥É¥ì¥¹¼ïÊ̤Ǥϡ¢ -¾å°Ì 3 ¥Ð¥¤¥È¤¬¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤òɽ¤·¡¢ -»Ä¤ê¤Î 1 ¥Ð¥¤¥È¤¬¥Û¥¹¥È¥¢¥É¥ì¥¹¤òɽ¤¹¡£ +(ネットワークバイトオーダの) アドレスの上位側 3 ビットがバイナリ値で 110 の場合、このアドレス種別となる。このアドレス種別では、 上位 3 +バイトがネットワークアドレスを表し、 残りの 1 バイトがホストアドレスを表す。 .PP -.\"O Classful network addresses are now obsolete, -.\"O having been superseded by Classless Inter-Domain Routing (CIDR), -.\"O which divides addresses into network and host components at -.\"O arbitrary bit (rather than byte) boundaries. -¥¯¥é¥¹¥Õ¥ë¡¦¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹¤Ï¸½ºß¤Ç¤ÏÇѻߤµ¤ì¡¢ -¥¯¥é¥¹¥ì¥¹¡¦¥É¥á¥¤¥ó´Ö¥ë¡¼¥Á¥ó (CIDR) ¤Ë¼è¤Ã¤ÆÂå¤ï¤é¤ì¤¿¡£ -CIDR ¤Ç¤Ï¡¢¥¢¥É¥ì¥¹¤òǤ°Õ¤Î¥Ó¥Ã¥È¶­³¦ (¥Ð¥¤¥È¶­³¦¤Ç¤Ï¤Ê¤¤) ¤Ç -¥Í¥Ã¥È¥ï¡¼¥¯Éô¤È¥Û¥¹¥ÈÉô¤Ëʬ³ä¤¹¤ë¡£ -.\"O .SH EXAMPLE -.SH Îã -.\"O An example of the use of -.\"O .BR inet_aton () -.\"O and -.\"O .BR inet_ntoa () -.\"O is shown below. -.\"O Here are some example runs: -°Ê²¼¤Ï -.BR inet_aton () -¤È -.BR inet_ntoa () -¤Î»ÈÍÑÎã¤Ç¤¢¤ë¡£¤³¤Î¤è¤¦¤Ë¼Â¹Ô¤¹¤ë¡£ +クラスフル・ネットワークアドレスは現在では廃止され、 クラスレス・ドメイン間ルーチン (CIDR) に取って代わられた。 CIDR +では、アドレスを任意のビット境界 (バイト境界ではない) で ネットワーク部とホスト部に分割する。 +.SH 例 +以下は \fBinet_aton\fP() と \fBinet_ntoa\fP() の使用例である。このように実行する。 .in +4n .nf -.RB "$" " ./a.out 226.000.000.037" " # Last byte is in octal" +$\fB ./a.out 226.000.000.037\fP # Last byte is in octal 226.0.0.31 -.RB "$" " ./a.out 0x7f.1 " " # First byte is in hex" +$\fB ./a.out 0x7f.1 \fP # First byte is in hex 127.0.0.1 .fi .in -.\"O .SS Program source -.SS ¥×¥í¥°¥é¥à¤Î¥½¡¼¥¹ +.SS プログラムのソース \& .nf #define _BSD_SOURCE @@ -437,7 +182,7 @@ main(int argc, char *argv[]) struct in_addr addr; if (argc != 2) { - fprintf(stderr, "%s \\n", argv[0]); + fprintf(stderr, "%s \en", argv[0]); exit(EXIT_FAILURE); } @@ -446,18 +191,11 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } - printf("%s\\n", inet_ntoa(addr)); + printf("%s\en", inet_ntoa(addr)); exit(EXIT_SUCCESS); } .fi -.\"O .SH "SEE ALSO" -.SH ´ØÏ¢¹àÌÜ -.BR byteorder (3), -.BR getaddrinfo (3), -.BR gethostbyname (3), -.BR getnameinfo (3), -.BR getnetent (3), -.BR inet_ntop (3), -.BR inet_pton (3), -.BR hosts (5), -.BR networks (5) +.SH 関連項目 +\fBbyteorder\fP(3), \fBgetaddrinfo\fP(3), \fBgethostbyname\fP(3), \fBgetnameinfo\fP(3), +\fBgetnetent\fP(3), \fBinet_ntop\fP(3), \fBinet_pton\fP(3), \fBhosts\fP(5), +\fBnetworks\fP(5)