aboutsummaryrefslogblamecommitdiff
path: root/ja_JP.eucJP/man/man3/link_addr.3
blob: fb5a67b530d2bbb6b23147e327afff42b083f09e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
                      
                                                                          













                                                                            

                                                                     















                                                                              

                                                                                     
   
             





                 


                                                  









                                                          
                                                      


                                                                        
                                                                      

                  
                                                          

             
                








                                                                      
                                                                          
   
                                                                  



                                            
      
                     

                                                        


                                                      


                                                                            



                                        
                          
        
             


                


             
      
            
                






                                                  
                                                  





                                                            
                                                
             
                                                              
.\" Copyright (c) 1993
.\"     The Regents of the University of California.  All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Donn Seeley at BSDI.
.\"
.\" 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: @(#)linkaddr.3    8.1 (Berkeley) 7/28/93
.\" %FreeBSD: src/lib/libc/net/linkaddr.3,v 1.8.2.1 2000/04/22 17:06:08 phantom Exp %
.\"
.\" $FreeBSD$
.Dd June 17, 1996
.Dt LINK_ADDR 3
.Os BSD 4.4
.Sh 名称
.Nm link_addr ,
.Nm link_ntoa
.Nd リンクレベルアクセス用基本アドレス指定ルーチン
.Sh ライブラリ
.Lb libc
.Sh 書式
.Fd #include <sys/types.h>
.Fd #include <sys/socket.h>
.Fd #include <net/if_dl.h>
.Ft void
.Fn link_addr "const char *addr" "struct sockaddr_dl *sdl"
.Ft char *
.Fn link_ntoa "const struct sockaddr_dl *sdl"
.Sh 解説
.Fn link_addr
ルーチンは、リンクレベルアドレスを表す文字列を解釈し、
システムコールで使用するのに適したバイナリ情報を返します。
.Fn link_ntoa
ルーチンは、リンクレベルアドレスを引数に取り、リンクレベルアドレス自身、
存在する場合はそのインタフェース名や番号などを含んだ、現在の情報を示す
.Tn ASCII
文字列を返します。
この機能はまだ試用段階であり、変更される可能性があります。
.Pp
.Fn link_addr
に対して、文字列
.Fa addr
には、
.Xr ifconfig 8
の第一引数となりうる
.Dq "name unit-number"
という形の任意指定のネットワークインタフェース識別子を含むことができ、
その後にコロン、そしてピリオドで区切られた 16 進数の組の形の
インタフェースアドレスが続きます。
それぞれの組はアドレスの 1 バイトを示しており、
アドレスバイトは左から右へ、低位のバイトから高位のバイトへと占められます。
.Pp
.\" 正規表現を用いると、この形式がもっとわかりやすくなるでしょう。
.\" .Bd -literal -offset indent
.\" ([a-z]+[0-9]+:)?[0-9a-f]+(\e.[0-9a-f]+)*
.\" .Ed
.\" .Pp
つまり
.Li le0:8.0.9.13.d.30
は 1 つ目の Lance イーサネットインタフェースへ転送される
イーサネットアドレスを表します。
.Pp
これらの関数を直接使うのは避けられる傾向があり、むしろ
.Xr addr2ascii 3
インタフェースが使われます。
しかし、このインタフェースはまだ広くは実装されていないので、
移植性のあるプログラムでは、このインタフェースに依存するわけにはいきません。
.Sh 戻り値
.Fn link_ntoa
は、常にヌルで終了する文字列を返します。
.Fn link_addr
関数は戻り値を返しません (
.Sx バグ
参照のこと)。
.Sh 関連項目
.Xr addr2ascii 3
.Sh 歴史
.Fn link_addr
および
.Fn link_ntoa
関数は
.Bx 4.3-Reno
で登場しました。
.Sh バグ
.Fn link_ntoa
の戻り値は静的なメモリ領域にあります。
.Pp
関数
.Fn link_addr
は、不適切な形式の入力を診断する機能が必要であり、
これを認識するあいまいでない方法が必要となります。
.Pp
リンクソケットアドレスの
.Va sdl_len
フィールドが 0 の場合、
.Fn link_ntoa
は、インタフェースアドレスバイトの前にコロンを挿入しません。
変換されたアドレスが、最初のコロンが挿入されずに
.Fn link_addr
に渡された場合、この関数はアドレスを正しく解釈しないでしょう。