man-pages/man7/ddp.7.html
2021-03-31 01:06:50 +01:00

400 lines
8.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of DDP</TITLE>
</HEAD><BODY>
<H1>DDP</H1>
Section: Linux Programmer's Manual (7)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
ddp - Linux AppleTalk protocol implementation
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>#include &lt;<A HREF="file:///usr/include/sys/socket.h">sys/socket.h</A>&gt;</B>
<BR>
<B>#include &lt;<A HREF="file:///usr/include/netatalk/at.h">netatalk/at.h</A>&gt;</B>
<P>
<I>ddp_socket</I><B> = socket(AF_APPLETALK, SOCK_DGRAM, 0);</B>
<BR>
<I>raw_socket</I><B> = socket(AF_APPLETALK, SOCK_RAW, </B><I>protocol</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Linux implements the AppleTalk protocols described in
<I>Inside AppleTalk</I>.
Only the DDP layer and AARP are present in
the kernel.
They are designed to be used via the
<B>netatalk</B>
protocol
libraries.
This page documents the interface for those who wish or need to
use the DDP layer directly.
<P>
The communication between AppleTalk and the user program works using a
BSD-compatible socket interface.
For more information on sockets, see
<B><A HREF="/cgi-bin/man/man2html?7+socket">socket</A></B>(7).
<P>
An AppleTalk socket is created by calling the
<B><A HREF="/cgi-bin/man/man2html?2+socket">socket</A></B>(2)
function with a
<B>AF_APPLETALK</B>
socket family argument.
Valid socket types are
<B>SOCK_DGRAM</B>
to open a
<B>ddp</B>
socket or
<B>SOCK_RAW</B>
to open a
<B>raw</B>
socket.
<I>protocol</I>
is the AppleTalk protocol to be received or sent.
For
<B>SOCK_RAW</B>
you must specify
<B>ATPROTO_DDP</B>.
<P>
Raw sockets may be opened only by a process with effective user ID 0
or when the process has the
<B>CAP_NET_RAW</B>
capability.
<A NAME="lbAE">&nbsp;</A>
<H3>Address format</H3>
An AppleTalk socket address is defined as a combination of a network number,
a node number, and a port number.
<P>
struct at_addr {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;short&nbsp;s_net;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;&nbsp;s_node;
};
<P>
struct sockaddr_atalk {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;sa_family_t&nbsp;&nbsp;&nbsp;&nbsp;sat_family;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;address&nbsp;family&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;&nbsp;sat_port;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;port&nbsp;*/
<BR>&nbsp;&nbsp;&nbsp;&nbsp;struct&nbsp;at_addr&nbsp;sat_addr;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;net/node&nbsp;*/
};
<P>
<I>sat_family</I>
is always set to
<B>AF_APPLETALK</B>.
<I>sat_port</I>
contains the port.
The port numbers below 129 are known as
<I>reserved ports</I>.
Only processes with the effective user ID 0 or the
<B>CAP_NET_BIND_SERVICE</B>
capability may
<B><A HREF="/cgi-bin/man/man2html?2+bind">bind</A></B>(2)
to these sockets.
<I>sat_addr</I>
is the host address.
The
<I>net</I>
member of
<I>struct at_addr</I>
contains the host network in network byte order.
The value of
<B>AT_ANYNET</B>
is a
wildcard and also implies "this network."
The
<I>node</I>
member of
<I>struct at_addr</I>
contains the host node number.
The value of
<B>AT_ANYNODE</B>
is a
wildcard and also implies "this node." The value of
<B>ATADDR_BCAST</B>
is a link
local broadcast address.
<A NAME="lbAF">&nbsp;</A>
<H3>Socket options</H3>
No protocol-specific socket options are supported.
<A NAME="lbAG">&nbsp;</A>
<H3>/proc interfaces</H3>
IP supports a set of
<I>/proc</I>
interfaces to configure some global AppleTalk parameters.
The parameters can be accessed by reading or writing files in the directory
<I>/proc/sys/net/atalk/</I>.
<DL COMPACT>
<DT id="1"><I>aarp-expiry-time</I>
<DD>
The time interval (in seconds) before an AARP cache entry expires.
<DT id="2"><I>aarp-resolve-time</I>
<DD>
The time interval (in seconds) before an AARP cache entry is resolved.
<DT id="3"><I>aarp-retransmit-limit</I>
<DD>
The number of retransmissions of an AARP query before the node is declared
dead.
<DT id="4"><I>aarp-tick-time</I>
<DD>
The timer rate (in seconds) for the timer driving AARP.
</DL>
<P>
The default values match the specification and should never need to be
changed.
<A NAME="lbAH">&nbsp;</A>
<H3>Ioctls</H3>
All ioctls described in
<B><A HREF="/cgi-bin/man/man2html?7+socket">socket</A></B>(7)
apply to DDP.
<A NAME="lbAI">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="5"><B>EACCES</B>
<DD>
The user tried to execute an operation without the necessary permissions.
These include sending to a broadcast address without
having the broadcast flag set,
and trying to bind to a reserved port without effective user ID 0 or
<B>CAP_NET_BIND_SERVICE</B>.
<DT id="6"><B>EADDRINUSE</B>
<DD>
Tried to bind to an address already in use.
<DT id="7"><B>EADDRNOTAVAIL</B>
<DD>
A nonexistent interface was requested or the requested source address was
not local.
<DT id="8"><B>EAGAIN</B>
<DD>
Operation on a nonblocking socket would block.
<DT id="9"><B>EALREADY</B>
<DD>
A connection operation on a nonblocking socket is already in progress.
<DT id="10"><B>ECONNABORTED</B>
<DD>
A connection was closed during an
<B><A HREF="/cgi-bin/man/man2html?2+accept">accept</A></B>(2).
<DT id="11"><B>EHOSTUNREACH</B>
<DD>
No routing table entry matches the destination address.
<DT id="12"><B>EINVAL</B>
<DD>
Invalid argument passed.
<DT id="13"><B>EISCONN</B>
<DD>
<B><A HREF="/cgi-bin/man/man2html?2+connect">connect</A></B>(2)
was called on an already connected socket.
<DT id="14"><B>EMSGSIZE</B>
<DD>
Datagram is bigger than the DDP MTU.
<DT id="15"><B>ENODEV</B>
<DD>
Network device not available or not capable of sending IP.
<DT id="16"><B>ENOENT</B>
<DD>
<B>SIOCGSTAMP</B>
was called on a socket where no packet arrived.
<DT id="17"><B>ENOMEM</B> and <B>ENOBUFS</B>
<DD>
Not enough memory available.
<DT id="18"><B>ENOPKG</B>
<DD>
A kernel subsystem was not configured.
<DT id="19"><B>ENOPROTOOPT</B> and <B>EOPNOTSUPP</B>
<DD>
Invalid socket option passed.
<DT id="20"><B>ENOTCONN</B>
<DD>
The operation is defined only on a connected socket, but the socket wasn't
connected.
<DT id="21"><B>EPERM</B>
<DD>
User doesn't have permission to set high priority,
make a configuration change,
or send signals to the requested process or group.
<DT id="22"><B>EPIPE</B>
<DD>
The connection was unexpectedly closed or shut down by the other end.
<DT id="23"><B>ESOCKTNOSUPPORT</B>
<DD>
The socket was unconfigured, or an unknown socket type was requested.
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H2>VERSIONS</H2>
AppleTalk is supported by Linux 2.0 or higher.
The
<I>/proc</I>
interfaces exist since Linux 2.2.
<A NAME="lbAK">&nbsp;</A>
<H2>NOTES</H2>
Be very careful with the
<B>SO_BROADCAST</B>
option; it is not privileged in Linux.
It is easy to overload the network
with careless sending to broadcast addresses.
<A NAME="lbAL">&nbsp;</A>
<H3>Compatibility</H3>
The basic AppleTalk socket interface is compatible with
<B>netatalk</B>
on BSD-derived systems.
Many BSD systems fail to check
<B>SO_BROADCAST</B>
when sending broadcast frames; this can lead to compatibility problems.
<P>
The
raw
socket mode is unique to Linux and exists to support the alternative CAP
package and AppleTalk monitoring tools more easily.
<A NAME="lbAM">&nbsp;</A>
<H2>BUGS</H2>
There are too many inconsistent error values.
<P>
The ioctls used to configure routing tables, devices,
AARP tables, and other devices are not yet described.
<A NAME="lbAN">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+recvmsg">recvmsg</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+sendmsg">sendmsg</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?7+capabilities">capabilities</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+socket">socket</A></B>(7)
<A NAME="lbAO">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="24"><A HREF="#lbAB">NAME</A><DD>
<DT id="25"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="26"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="27"><A HREF="#lbAE">Address format</A><DD>
<DT id="28"><A HREF="#lbAF">Socket options</A><DD>
<DT id="29"><A HREF="#lbAG">/proc interfaces</A><DD>
<DT id="30"><A HREF="#lbAH">Ioctls</A><DD>
</DL>
<DT id="31"><A HREF="#lbAI">ERRORS</A><DD>
<DT id="32"><A HREF="#lbAJ">VERSIONS</A><DD>
<DT id="33"><A HREF="#lbAK">NOTES</A><DD>
<DL>
<DT id="34"><A HREF="#lbAL">Compatibility</A><DD>
</DL>
<DT id="35"><A HREF="#lbAM">BUGS</A><DD>
<DT id="36"><A HREF="#lbAN">SEE ALSO</A><DD>
<DT id="37"><A HREF="#lbAO">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:08 GMT, March 31, 2021
</BODY>
</HTML>