OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / man7 / ddp.7
1 .\" This man page is Copyright (C) 1998 Alan Cox.
2 .\" Permission is granted to distribute possibly modified copies
3 .\" of this page provided the header is included verbatim,
4 .\" and in case of nontrivial modification author and date
5 .\" of the modification is added to the header.
6 .\" $Id: ddp.7,v 1.3 1999/05/13 11:33:22 freitag Exp $
7 .TH DDP  7 2008-11-20 "Linux" "Linux Programmer's Manual"
8 .SH NAME
9 ddp \- Linux AppleTalk protocol implementation
10 .SH SYNOPSIS
11 .B #include <sys/socket.h>
12 .br
13 .B #include <netatalk/at.h>
14 .sp
15 .IB ddp_socket " = socket(AF_APPLETALK, SOCK_DGRAM, 0);"
16 .br
17 .IB raw_socket " = socket(AF_APPLETALK, SOCK_RAW, " protocol ");"
18 .SH DESCRIPTION
19 Linux implements the Appletalk protocols described in
20 .IR "Inside Appletalk" .
21 Only the DDP layer and AARP are present in
22 the kernel.
23 They are designed to be used via the
24 .B netatalk
25 protocol
26 libraries.
27 This page documents the interface for those who wish or need to
28 use the DDP layer directly.
29 .PP
30 The communication between Appletalk and the user program works using a
31 BSD-compatible socket interface.
32 For more information on sockets, see
33 .BR socket (7).
34 .PP
35 An AppleTalk socket is created by calling the
36 .BR socket (2)
37 function with a
38 .B AF_APPLETALK
39 socket family argument.
40 Valid socket types are
41 .B SOCK_DGRAM
42 to open a
43 .B ddp
44 socket or
45 .B SOCK_RAW
46 to open a
47 .B raw
48 socket.
49 .I protocol
50 is the Appletalk protocol to be received or sent.
51 For
52 .B SOCK_RAW
53 you must specify
54 .BR ATPROTO_DDP .
55 .PP
56 Raw sockets may be only opened by a process with effective user ID 0
57 or when the process has the
58 .B CAP_NET_RAW
59 capability.
60 .SS "Address Format"
61 An Appletalk socket address is defined as a combination of a network number,
62 a node number, and a port number.
63 .PP
64 .in +4n
65 .nf
66 struct at_addr {
67     unsigned short s_net;
68     unsigned char  s_node;
69 };
70
71 struct sockaddr_atalk {
72     sa_family_t    sat_family;    /* address family */
73     unsigned char  sat_port;      /* port */
74     struct at_addr sat_addr;      /* net/node */
75 };
76 .fi
77 .in
78 .PP
79 .I sat_family
80 is always set to
81 .BR AF_APPLETALK .
82 .I sat_port
83 contains the port.
84 The port numbers below 129 are known as
85 .IR "reserved ports" .
86 Only processes with the effective user ID 0 or the
87 .B CAP_NET_BIND_SERVICE
88 capability may
89 .BR bind (2)
90 to these sockets.
91 .I sat_addr
92 is the host address.
93 The
94 .I net
95 member of
96 .I struct at_addr
97 contains the host network in network byte order.
98 The value of
99 .B AT_ANYNET
100 is a
101 wildcard and also implies \(lqthis network.\(rq
102 The
103 .I node
104 member of
105 .I struct at_addr
106 contains the host node number.
107 The value of
108 .B AT_ANYNODE
109 is a
110 wildcard and also implies \(lqthis node.\(rq The value of
111 .B ATADDR_BCAST
112 is a link
113 local broadcast address.
114 .\" FIXME this doesn't make sense [johnl]
115 .SS "Socket Options"
116 No protocol-specific socket options are supported.
117 .SS /proc interfaces
118 IP supports a set of
119 .I /proc
120 interfaces to configure some global AppleTalk parameters.
121 The parameters can be accessed by reading or writing files in the directory
122 .IR /proc/sys/net/atalk/ .
123 .TP
124 .I aarp-expiry-time
125 The time interval (in seconds) before an AARP cache entry expires.
126 .TP
127 .I aarp-resolve-time
128 The time interval (in seconds) before an AARP cache entry is resolved.
129 .TP
130 .I aarp-retransmit-limit
131 The number of retransmissions of an AARP query before the node is declared
132 dead.
133 .TP
134 .I aarp-tick-time
135 The timer rate (in seconds) for the timer driving AARP.
136 .PP
137 The default values match the specification and should never need to be
138 changed.
139 .SS Ioctls
140 All ioctls described in
141 .BR socket (7)
142 apply to DDP.
143 .\" FIXME Add a section about multicasting
144 .SH ERRORS
145 .\" FIXME document all errors. We should really fix the kernels to
146 .\" give more uniform error returns (ENOMEM vs ENOBUFS, EPERM vs
147 .\" EACCES etc.)
148 .TP
149 .B EACCES
150 The user tried to execute an operation without the necessary permissions.
151 These include sending to a broadcast address without
152 having the broadcast flag set,
153 and trying to bind to a reserved port without effective user ID 0 or
154 .BR CAP_NET_BIND_SERVICE .
155 .TP
156 .B EADDRINUSE
157 Tried to bind to an address already in use.
158 .TP
159 .B EADDRNOTAVAIL
160 A nonexistent interface was requested or the requested source address was
161 not local.
162 .TP
163 .B EAGAIN
164 Operation on a nonblocking socket would block.
165 .TP
166 .B EALREADY
167 A connection operation on a nonblocking socket is already in progress.
168 .TP
169 .B ECONNABORTED
170 A connection was closed during an
171 .BR accept (2).
172 .TP
173 .B EHOSTUNREACH
174 No routing table entry matches the destination address.
175 .TP
176 .B EINVAL
177 Invalid argument passed.
178 .TP
179 .B EISCONN
180 .BR connect (2)
181 was called on an already connected socket.
182 .TP
183 .B EMSGSIZE
184 Datagram is bigger than the DDP MTU.
185 .TP
186 .B ENODEV
187 Network device not available or not capable of sending IP.
188 .TP
189 .B ENOENT
190 .B SIOCGSTAMP
191 was called on a socket where no packet arrived.
192 .TP
193 .BR ENOMEM " and " ENOBUFS
194 Not enough memory available.
195 .TP
196 .B ENOPKG
197 A kernel subsystem was not configured.
198 .TP
199 .BR ENOPROTOOPT " and " EOPNOTSUPP
200 Invalid socket option passed.
201 .TP
202 .B ENOTCONN
203 The operation is only defined on a connected socket, but the socket wasn't
204 connected.
205 .TP
206 .B EPERM
207 User doesn't have permission to set high priority,
208 make a configuration change,
209 or send signals to the requested process or group,
210 .TP
211 .B EPIPE
212 The connection was unexpectedly closed or shut down by the other end.
213 .TP
214 .B ESOCKTNOSUPPORT
215 The socket was unconfigured, or an unknown socket type was requested.
216 .SH VERSIONS
217 Appletalk is supported by Linux 2.0 or higher.
218 The
219 .I /proc
220 interfaces exist since Linux 2.2.
221 .SH NOTES
222 Be very careful with the
223 .B SO_BROADCAST
224 option \- it is not privileged in Linux.
225 It is easy to overload the network
226 with careless sending to broadcast addresses.
227 .SS Compatibility
228 The basic AppleTalk socket interface is compatible with
229 .B netatalk
230 on BSD-derived systems.
231 Many BSD systems fail to check
232 .B SO_BROADCAST
233 when sending broadcast frames; this can lead to compatibility problems.
234 .PP
235 The
236 raw
237 socket mode is unique to Linux and exists to support the alternative CAP
238 package and AppleTalk monitoring tools more easily.
239 .SH BUGS
240 There are too many inconsistent error values.
241 .PP
242 The ioctls used to configure routing tables, devices,
243 AARP tables and other devices are not yet described.
244 .SH "SEE ALSO"
245 .BR recvmsg (2),
246 .BR sendmsg (2),
247 .BR capabilities (7),
248 .BR socket (7)