DDP(4)              Linux Programmer's Manual              DDP(4)

NAME
       ddp - Linux AppleTalk protocol implementation

SYNOPSIS
       #include <sys/socket.h>
       #include <netatalk/at.h>

       ddp_socket = socket(PF_APPLETALK, SOCK_DGRAM, 0);
       raw_socket = socket(PF_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(4).

       An AppleTalk socket is created by  calling  the  socket(2)
       function with a PF_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
       specify 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 capabil-
       ity.

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 {
                  u_short         s_net;
                  u_char          s_node;
              };

              struct sockaddr_atalk {
                  sa_family_t     sat_family; /* address family */
                  u_char          sat_port;   /* port */
                  struct at_addr  sat_addr;   /* net/node */
              };

       sat_family is always set to AF_APPLETALK.   sat_port  con-
       tains  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 attribute set may bind(2) to
       these sockets.  sat_addr is the  host  address.   The  net
       member of struct at_addr contains the host network in net-
       work 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.

SYSCTLS
       IP supports a sysctl interface to  configure  some  global
       AppleTalk  parameters.   The  sysctls  can  be accessed by
       reading or writing the /proc/sys/net/atalk/* files or with
       the sysctl(2) interface.

       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
       These ioctls can be accessed using ioctl(2).  The  correct
       syntax is:
              error = ioctl(atalk_socket, ioctl_type, value_ptr);

       SIOCGSTAMP
              Return  a struct timeval with the receive timestamp
              of the last packet passed to the user. This is use-
              ful  for accurate round trip time measurements. See
              setitimer(2) for a description of struct timeval.

       FIOCSETOWN and SIOCSPGRP
              Set the process or process  group  (negative  value
              passed  with  a  process  group  id of the absolute
              value) to send SIGIO signal to when an asynchronous
              IO  operation  has  finished.  Argument is a pid_t.
              Only processes of effective user id 0 may set  this
              value  to  arbitrary  pids; all others are only for
              processes with a matching  group  id  or  effective
              user id.

       FIOASYNC
              Set  a  flag to enable or disable asynchronous mode
              of the socket. Asynchronous mode means  that  SIGIO
              is raised when a new I/O event occurs.

              Valid  I/O events are: new data arrives; the socket
              send buffer has enough room to queue  new  data;  a
              new  connection  arrives  (for  connection-oriented
              protocols); or the connection is broken.  SIGIO  is
              not  sent  when  the  connection is broken from the
              local end using shutdown(2) or close(2).   In  some
              situations  (multiple processes or the kernel send-
              ing data to a single  socket)  the  condition  that
              caused  the  SIGIO  might  already have disappeared
              when the SIGIO is processed by  the  user  process.
              When this happens the user process should just wait
              again because Linux  guarantees  to  resend  a  new
              SIGIO later.

       FIOCGETOWN and SIOCGPGRP
              Get  the  current  process  or  process  group that
              receive SIGIO or SIGURG signals, or 0 when none  is
              set. Argument is a pid_t.

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.

VERSIONS
       Appletalk  is supported by Linux 2.0 or higher. The sysctl
       interface is new in Linux 2.2.

ERRORS
       ENOTCONN
               The operation  is  only  defined  on  a  connected
               socket, but the socket wasn't connected.

       EINVAL  Invalid argument passed.

       EMSGSIZE
               Datagram is bigger than the DDP MTU.

       EACCES  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 CAP_NET_BIND_SER-
               VICE.

       EADDRINUSE
               Tried to bind to an address already in use.

       ENOMEM and ENOBUFS
               Not enough memory available.

       ENOPROTOOPT and EOPNOTSUPP
               Invalid socket option passed.

       EPERM   User doesn't have permission to set high priority,
               make  a  configuration  change, or send signals to
               the requested process or group,

       EADDRNOTAVAIL
               A non-existent  interface  was  requested  or  the
               requested source address was not local.

       EAGAIN  Operation on a nonblocking socket would block.

       ESOCKTNOSUPPORT
               The  socket was unconfigured, or an unknown socket
               type was requested.

       EISCONN connect(2) was  called  on  an  already  connected
               socket.

       EALREADY
               A connection operation on a non-blocking socket is
               already in progress.

       ECONNABORTED
               A connection was closed during an accept(2).

       EPIPE   The connection was  unexpectedly  closed  or  shut
               down by the other end.

       ENOENT  SIOCGSTAMP  was called on a socket where no packet
               arrived.

       EHOSTUNREACH
               No routing table  entry  matches  the  destination
               address.

       ENODEV  Network  device  not  available  or not capable of
               sending IP.

       ENOPKG  A kernel subsystem was not configured.

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 sup-
       port the alternative 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
       sendmsg(2), recvmsg(2), socket(4)

Linux Man Page              7 Oct 1998                          1