OSDN Git Service

Convert release and draft pages to UTF-8.
[linuxjm/jm.git] / manual / LDP_man-pages / release / man3 / ether_aton.3
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright 2002 Ian Redfern (redferni@logica.com)
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     FreeBSD 4.4 man pages
28 .\"
29 .\" Minor additions, aeb, 2002-07-20
30 .\"
31 .\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI
32 .\"         all rights reserved.
33 .\" Translated Thu Aug 22 2002 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\"
35 .TH ETHER_ATON 3  2002-07-20 "GNU" "Linux Programmer's Manual"
36 .SH 名前
37 ether_aton, ether_ntoa, ether_ntohost, ether_hostton, ether_line,
38 ether_ntoa_r, ether_aton_r \- Ethernet アドレスの操作用関数
39 .SH 書式
40 .nf
41 .B #include <netinet/ether.h>
42 .sp
43 .BI "char *ether_ntoa(const struct ether_addr *" addr );
44 .sp
45 .BI "struct ether_addr *ether_aton(const char *" asc );
46 .sp
47 .BI "int ether_ntohost(char *" hostname ", const struct ether_addr *" addr );
48 .sp
49 .BI "int ether_hostton(const char *" hostname ", struct ether_addr *" addr );
50 .sp
51 .BI "int ether_line(const char *" line ", struct ether_addr *" addr ,
52 .BI "               char *" hostname );
53 .sp
54 /* GNU 拡張 */
55 .br
56 .BI "char *ether_ntoa_r(const struct ether_addr *" addr ", char *" buf );
57 .sp
58 .BI "struct ether_addr *ether_aton_r(const char *" asc ,
59 .BI "                                struct ether_addr *" addr );
60 .fi
61 .SH 説明
62 関数
63 .BR ether_aton ()
64 は、標準的な 16進数とコロンの形式で書かれた 48ビットの
65 Ethernet ホストアドレス \fIasc\fP を、ネットワークでのバイト順 (byte order)
66 のバイナリデータに変換し、静的に割り当てられたバッファに格納されたデータ
67 へのポインタを返す。このバッファは、これ以降の関数呼び出しで上書きされる。
68 アドレスが不正な場合、
69 .BR ether_aton ()
70 は NULL を返す。
71 .PP
72 関数
73 .BR ether_ntoa ()
74 は、ネットワークのバイト順で表された Ethernet
75 ホストアドレス \fIaddr\fP を、標準的な 16進数とコロンの形式の文字列に変換する。
76 但し、先頭の 0 は省略される。変換後の文字列は静的に割り当てられたバッファ
77 に格納されて返される。このバッファは、これ以降の関数呼び出しで上書きされる。
78 .PP
79 関数
80 .BR ether_ntohost ()
81 は、Ethernet アドレスに対応するホスト名を
82 .I /etc/ethers
83 を検索して割り当てる。対応するホスト名が見つからなかった場合は、
84 非 0 を返す。
85 .PP
86 関数
87 .BR ether_hostton ()
88 は、ホスト名に対応する Ethernet アドレスを
89 .I /etc/ethers
90 を検索して割り当てる。対応するホスト名が見つからなかった場合は、
91 非 0 を返す。
92 .PP
93 関数
94 .BR ether_line ()
95 は、
96 .I /etc/ethers
97 形式になった行を解析し、
98 アドレスとホスト名の組を返す
99 .RI ( /etc/ethers
100 形式は、Ethernet アドレス、ホスト名が空白文字 (whitespace)
101 で区切られた書式で、\(aq#\(aq 以降はコメントとみなされる)。
102 解析できなかった場合は、非 0 を返す。
103 .I hostname
104 で指定されたバッファは十分な長さが必要である。つまり、
105 .I line
106 と同じ長さでなければならない。
107 .PP
108 関数
109 .BR ether_ntoa_r ()
110
111 .BR ether_aton_r ()
112 は、
113 それぞれ
114 .BR ether_ntoa ()
115
116 .BR ether_aton ()
117
118 リエントラントでスレッドセーフなバージョンであり、
119 静的なバッファを使用しない。
120 .PP
121 \fIether_addr\fP 構造体は
122 .I <net/ethernet.h>
123 で次のように定義されている:
124 .sp
125 .in +4n
126 .nf
127 struct ether_addr {
128     uint8_t ether_addr_octet[6];
129 }
130 .fi
131 .in
132 .SH 準拠
133 4.3BSD, SunOS.
134 .SH バグ
135 glibc 2.2.5 での
136 .BR ether_line ()
137 の実装はおかしい。
138 .SH 関連項目
139 .BR ethers (5)