.\" Copyright 2002 Ian Redfern (redferni@logica.com) .\" .\" %%%LICENSE_START(VERBATIM) .\" 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. .\" %%%LICENSE_END .\" .\" References consulted: .\" Linux libc source code .\" FreeBSD 4.4 man pages .\" .\" Minor additions, aeb, 2013-06-21 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI .\" all rights reserved. .\" Translated Thu Aug 22 2002 by Akihiro MOTOKI .\" .TH ETHER_ATON 3 2014\-07\-08 GNU "Linux Programmer's Manual" .SH 名前 ether_aton, ether_ntoa, ether_ntohost, ether_hostton, ether_line, ether_ntoa_r, ether_aton_r \- Ethernet アドレスの操作用関数 .SH 書式 .nf \fB#include \fP .sp \fBchar *ether_ntoa(const struct ether_addr *\fP\fIaddr\fP\fB);\fP .sp \fBstruct ether_addr *ether_aton(const char *\fP\fIasc\fP\fB);\fP .sp \fBint ether_ntohost(char *\fP\fIhostname\fP\fB, const struct ether_addr *\fP\fIaddr\fP\fB);\fP .sp \fBint ether_hostton(const char *\fP\fIhostname\fP\fB, struct ether_addr *\fP\fIaddr\fP\fB);\fP .sp \fBint ether_line(const char *\fP\fIline\fP\fB, struct ether_addr *\fP\fIaddr\fP\fB,\fP \fB char *\fP\fIhostname\fP\fB);\fP .sp /* GNU 拡張 */ .br \fBchar *ether_ntoa_r(const struct ether_addr *\fP\fIaddr\fP\fB, char *\fP\fIbuf\fP\fB);\fP .sp \fBstruct ether_addr *ether_aton_r(const char *\fP\fIasc\fP\fB,\fP \fB struct ether_addr *\fP\fIaddr\fP\fB);\fP .fi .SH 説明 関数 \fBether_aton\fP() は、標準的な 16進数とコロンの形式で書かれた 48ビットの Ethernet ホストアドレス \fIasc\fP を、ネットワークでのバイト順 (byte order) のバイナリデータに変換し、静的に割り当てられたバッファーに格納されたデータ へのポインターを返す。このバッファーは、これ以降の関数呼び出しで上書きされる。 アドレスが不正な場合、 \fBether_aton\fP() は NULL を返す。 .PP 関数 \fBether_ntoa\fP() は、ネットワークのバイト順で表された Ethernet ホストアドレス \fIaddr\fP を、標準的な 16進数とコロンの形式の文字列に変換する。 但し、先頭の 0 は省略される。変換後の文字列は静的に割り当てられたバッファー に格納されて返される。このバッファーは、これ以降の関数呼び出しで上書きされる。 .PP 関数 \fBether_ntohost\fP() は、Ethernet アドレスに対応するホスト名を \fI/etc/ethers\fP を検索して割り当てる。対応するホスト名が見つからなかった場合は、 非 0 を返す。 .PP 関数 \fBether_hostton\fP() は、ホスト名に対応する Ethernet アドレスを \fI/etc/ethers\fP を検索して割り当てる。対応するホスト名が見つからなかった場合は、 非 0 を返す。 .PP 関数 \fBether_line\fP() は、 \fI/etc/ethers\fP 形式になった行を解析し、 アドレスとホスト名の組を返す (\fI/etc/ethers\fP 形式は、Ethernet アドレス、ホスト名が空白文字 (whitespace) で区切られた書式で、\(aq#\(aq 以降はコメントとみなされる)。 解析できなかった場合は、非 0 を返す。 \fIhostname\fP で指定されたバッファーは十分な長さが必要である。つまり、 \fIline\fP と同じ長さでなければならない。 .PP 関数 \fBether_ntoa_r\fP() と \fBether_aton_r\fP() は、 それぞれ \fBether_ntoa\fP() と \fBether_aton\fP() の リエントラントでスレッドセーフなバージョンであり、 静的なバッファーを使用しない。 .PP \fIether_addr\fP 構造体は \fI\fP で次のように定義されている: .sp .in +4n .nf struct ether_addr { uint8_t ether_addr_octet[6]; } .fi .in .SH 属性 この節で使用されている用語の説明は \fBattributes\fP(7) を参照のこと。 .ad l .TS allbox; lbw33 lb lb l l l. Interface Attribute Value T{ \fBether_aton\fP(), \fBether_ntoa\fP() T} Thread safety MT\-Unsafe T{ \fBether_ntohost\fP(), \fBether_hostton\fP(), \fBether_line\fP(), \fBether_ntoa_r\fP(), \fBether_aton_r\fP() T} Thread safety MT\-Safe .TE .ad .SH 準拠 4.3BSD, SunOS. .SH バグ .\" The fix was presumably commit c0a0f9a32c8baa6ab93d00eb42d92c02e9e146d7 .\" which was in glibc 2.3 glibc 2.2.5 以前では、 \fBether_line\fP() の実装はおかしい。 .SH 関連項目 \fBethers\fP(5) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。