OSDN Git Service

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