ddpのヘルプ・マニュアル
日本語 英語
ddp --help
man ddp
DDP(7) Linux Programmer’s Manual DDP(7)
名前
ddp - Linux での AppleTalk プロトコルの実装
書式
#include
#include
ddp_socket = socket(AF_APPLETALK, SOCK_DGRAM, 0);
raw_socket = socket(AF_APPLETALK, SOCK_RAW, protocol);
説明
Linux は Inside Appletalk に記述されている Appletalk プロトコルを実装し
ている。カーネルにあるのは DDP 層と AARP だけである。これらは netatalk
プ ロトコルライブラリを通して利用されるように設計されている。このページ
は DDP 層を直接利用したいユーザーのために、インターフェースを記述したも
のである。
Appletalk とユーザープログラムとの通信には、 BSD 互換のソケットインター
フェースを利用する。ソケットに関するより詳しい情報は socket(7) を見よ。
Appletalk ソケットは、ソケットファミリーの引数に AF_APPLETALK を指定し
て socket(2) 関数を呼び出すことによって生成される。指定できるソケットタ
イプは、 ddp ソケットをオープンする場合には SOCK_DGRAM、 raw ソケットを
オープンする場合には SOCK_RAW である。 protocol は 送 受 信 さ れ る
Appletalk プロトコルである。ソケットタイプに SOCK_RAW を指定した場合は
、プロトコルに ATPROTO_DDP を指定しなければならない。
raw ソケットは実効ユーザー ID が 0 のプロセスか、 CAT_NEW_RAW 権限を 持
ったプロセスでないとオープンできない。
アドレスのフォーマット
Appletalk ソケットアドレスはネットワーク番号・ノード番号・ポート番号の
組み合わせで定義される。
struct at_addr {
unsigned short s_net;
unsigned char s_node;
};
struct sockaddr_atalk {
sa_family_t sat_family; /* address family */
unsigned char sat_port; /* port */
struct at_addr sat_addr; /* net/node */
};
sat_family は常に AF_APPLETALK に設定する。 sat_port はポートを与える。
ポ ート番号が 129 以下のポートは「予約ポート (reserved port)」 と呼ばれ
る。実効ユーザー ID が 0 のプロセスか、 CAP_NET_BIND_SERVICE 権限を持つ
プロセスだけが、このようなソケットを bind(2) できる。 sat_addr はホスト
アドレスである。 struct at_addr のメンバー s_net にはホストのネットワー
クをネットワークバイトオーダーで与える。値 AT_ANYNET はワイルドカードで
、「このネットワーク」も暗黙のうちに含まれる。 struct at_addr のメン バ
ー s_node にはホストのノード番号を与える。値 AT_ANYNODE はワイルドカー
ドで、「このノード」も暗黙のうちに含まれる。値 ATADDR_BCAST はローカ ル
なブロードキャストアドレスである。
ソケットオプション
プロトコル固有のソケットオプションはない。
/proc インタフェース
Appletalk のグローバルパラメータのいくつかは、 /proc インタフェースを通
して設定することができる。これらのパラメータには、 /proc/sys/net/atalk/
ディレクトリ内のファイルの読み書きでアクセスできる。
aarp-expiry-time
AARP キャッシュエントリを破棄するまでのタイムインターバル (秒単
位)。
aarp-resolve-time
AARP キャッシュエントリが解決されるまでのタイムインターバル ( 秒
単位)。
aarp-retransmit-limit
AARP クエリーの最大再送信回数。この回数を越えると、そのノードは
dead であるとみなされる。
aarp-tick-time
タイマー動作する AARP のタイマーレート (秒単位)
デフォルトの値で仕様にマッチしているので、変更する必要は全くないはず で
ある。
ioctl
socket(7) に記述されているすべての ioctl が DDP にも適用される。
エラー
EACCES ユ ーザが行おうとした操作に必要な権限を持っていない。 broadcast
フラグをセットせずにブロードキャストアドレスへ送信を行おうとした
、 実効ユーザー ID が 0 でなく、 CAP_NET_BIND_SERVICE 権限のない
プロセスで特権ポートをバインドしようとした、などが考えられる。
EADDRINUSE
既に使用されているアドレスにバインドしようとした。
EADDRNOTAVAIL
存在しないインターフェースが要求された。または要求されたソースア
ドレスがローカルなものでない。
EAGAIN 非ブロッキングソケットに対してブロックする操作を行った。
EALREADY
非ブロッキングソケットに対する接続操作が既に実行中である。
ECONNABORTED
accept(2) の途中で接続がクローズされた。
EHOSTUNREACH
行き先アドレスにマッチするエントリがルーティングテーブルにない。
EINVAL 渡した引数が不正。
EISCONN
接続済みのソケットに対して connect(2) が呼ばれた。
EMSGSIZE
データグラムが DDP MTU より大きい。
ENODEV ネットワークデバイスがない。あるいは IP を送ることができない。
ENOENT パケットが到着していないソケットに対して SIOCGSTAMP が呼ばれた。
ENOMEM と ENOBUFS
メモリが足りない。
ENOPKG カーネルのサブシステムが設定されていない。
ENOPROTOOPT と EOPNOTSUPP
渡したソケットオプションが不正。
ENOTCONN
行おうとした操作は接続済みのソケットに対してのみ定義されているも
のだが、そのソケットは接続されていなかった。
EPERM 高い優先度に設定したり、設定を変更したり、指定したプロセスやグル
ープにシグナルを送るのに必要な権限をユーザが持っていない。
EPIPE 接続が先方によって、通常以外のやり方でクローズまたはシャットダウ
ンされた。
ESOCKTNOSUPPORT
ソケットが設定されていない。または未知のソケットタイプが要求され
た。
バージョン
Appletalk は Linux 2.0 以降でサポートされている。 /proc インタフェース
は Linux 2.2 以降に存在する。
注意
SO_BROADCAST オプションを用いる時には慎重の上にも慎重になってほし い 。
Linux ではこれに特権を必要としない。不注意にブロードキャストアドレスに
送信を行うと、ネットワークの状態が簡単に変更されてしまう。
移植性
基本的な Appletalk ソケットインターフェースは BSD 由来のシステムにお け
る netatalk と互換性がある。多くの BSD システムでは、ブロードキャストフ
レームを送信しようとしたときの SO_BROADCAST のチェックに失敗する。こ れ
は互換性の問題となるかもしれない。
raw ソケットモードは Linux 独特のもので、もう一方の実装である CAP パッ
ケージや、 Appletalk モニタツールをより簡単に実装できるようになる。
バグ
エラーの値がまったく首尾一貫していない。
ルーティングテーブル・デバイス・ AARP テーブル・その他のデバイスを設 定
するために用いられる ioctl がまだ記述されていない。
関連項目
recvmsg(2), sendmsg(2), capabilities(7), socket(7)
Linux 2008-11-20 DDP(7)
DDP(7) Linux Programmer’s Manual DDP(7)
NAME
ddp - Linux AppleTalk protocol implementation
SYNOPSIS
#include
#include
ddp_socket = socket(AF_APPLETALK, SOCK_DGRAM, 0);
raw_socket = socket(AF_APPLETALK, SOCK_RAW, protocol);
DESCRIPTION
Linux implements the Appletalk protocols described in Inside Appletalk.
Only the DDP layer and AARP are present in the kernel. They are
designed to be used via the netatalk protocol libraries. This page
documents the interface for those who wish or need to use the DDP layer
directly.
The communication between Appletalk and the user program works using a
BSD-compatible socket interface. For more information on sockets, see
socket(7).
An AppleTalk socket is created by calling the socket(2) function with a
AF_APPLETALK socket family argument. Valid socket types are SOCK_DGRAM
to open a ddp socket or SOCK_RAW to open a raw socket. protocol is the
Appletalk protocol to be received or sent. For SOCK_RAW you must spec-
ify ATPROTO_DDP.
Raw sockets may be only opened by a process with effective user ID 0 or
when the process has the CAP_NET_RAW capability.
Address Format
An Appletalk socket address is defined as a combination of a network
number, a node number, and a port number.
struct at_addr {
unsigned short s_net;
unsigned char s_node;
};
struct sockaddr_atalk {
sa_family_t sat_family; /* address family */
unsigned char sat_port; /* port */
struct at_addr sat_addr; /* net/node */
};
sat_family is always set to AF_APPLETALK. sat_port contains the port.
The port numbers below 129 are known as reserved ports. Only processes
with the effective user ID 0 or the CAP_NET_BIND_SERVICE capability may
bind(2) to these sockets. sat_addr is the host address. The net mem-
ber of struct at_addr contains the host network in network byte order.
The value of AT_ANYNET is a wildcard and also implies “this network.”
The node member of struct at_addr contains the host node number. The
value of AT_ANYNODE is a wildcard and also implies “this node.” The
value of ATADDR_BCAST is a link local broadcast address.
Socket Options
No protocol-specific socket options are supported.
/proc interfaces
IP supports a set of /proc interfaces to configure some global
AppleTalk parameters. The parameters can be accessed by reading or
writing files in the directory /proc/sys/net/atalk/.
aarp-expiry-time
The time interval (in seconds) before an AARP cache entry
expires.
aarp-resolve-time
The time interval (in seconds) before an AARP cache entry is
resolved.
aarp-retransmit-limit
The number of retransmissions of an AARP query before the node
is declared dead.
aarp-tick-time
The timer rate (in seconds) for the timer driving AARP.
The default values match the specification and should never need to be
changed.
Ioctls
All ioctls described in socket(7) apply to DDP.
ERRORS
EACCES The user tried to execute an operation without the necessary
permissions. These include sending to a broadcast address with-
out having the broadcast flag set, and trying to bind to a
reserved port without effective user ID 0 or CAP_NET_BIND_SER-
VICE.
EADDRINUSE
Tried to bind to an address already in use.
EADDRNOTAVAIL
A nonexistent interface was requested or the requested source
address was not local.
EAGAIN Operation on a non-blocking socket would block.
EALREADY
A connection operation on a non-blocking socket is already in
progress.
ECONNABORTED
A connection was closed during an accept(2).
EHOSTUNREACH
No routing table entry matches the destination address.
EINVAL Invalid argument passed.
EISCONN
connect(2) was called on an already connected socket.
EMSGSIZE
Datagram is bigger than the DDP MTU.
ENODEV Network device not available or not capable of sending IP.
ENOENT SIOCGSTAMP was called on a socket where no packet arrived.
ENOMEM and ENOBUFS
Not enough memory available.
ENOPKG A kernel subsystem was not configured.
ENOPROTOOPT and EOPNOTSUPP
Invalid socket option passed.
ENOTCONN
The operation is only defined on a connected socket, but the
socket wasn’t connected.
EPERM User doesn’t have permission to set high priority, make a con-
figuration change, or send signals to the requested process or
group,
EPIPE The connection was unexpectedly closed or shut down by the other
end.
ESOCKTNOSUPPORT
The socket was unconfigured, or an unknown socket type was
requested.
VERSIONS
Appletalk is supported by Linux 2.0 or higher. The /proc interfaces
exist since Linux 2.2.
NOTES
Be very careful with the SO_BROADCAST option - it is not privileged in
Linux. It is easy to overload the network with careless sending to
broadcast addresses.
Compatibility
The basic AppleTalk socket interface is compatible with netatalk on
BSD-derived systems. Many BSD systems fail to check SO_BROADCAST when
sending broadcast frames; this can lead to compatibility problems.
The raw socket mode is unique to Linux and exists to support the alter-
native CAP package and AppleTalk monitoring tools more easily.
BUGS
There are too many inconsistent error values.
The ioctls used to configure routing tables, devices, AARP tables and
other devices are not yet described.
SEE ALSO
recvmsg(2), sendmsg(2), capabilities(7), socket(7)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-11-20 DDP(7)