chiark / gitweb /
found on zealot wip.ipif-counted-packet
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 27 Jan 2013 13:47:58 +0000 (13:47 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 27 Jan 2013 13:47:58 +0000 (13:47 +0000)
ipif/service.c

index 4c9b52463623a2a2437f6f5c0d318724f8f102af..a1f50cf4ff2b09954203ded67b76d733d78db048 100644 (file)
  *
  *  <local-addr>,<peer-addr>,<mtu>,<proto>
  *
- *      As for slattach.  The only supported protocol is slip.
- *      Alternatively, set to `debug' to print debugging info and
- *      exit.  <local-addr> is address of the interface to be created
- *      on the local system; <peer-addr> is the address of the
- *      point-to-point peer.  They must be actual addresses (not
- *      hostnames).
+ *      The supported protocols are:
+ *         slip     transfer IP packets using the SLIP protocol
+ *         debug    simply print debugging info and exit
+ *         counted  our own "counted packet" protocol, see below
+ *
+ *      <local-addr> is address of the interface to be created on the
+ *      local system; <peer-addr> is the address of the point-to-point
+ *      peer.  They must be actual addresses (not hostnames).
  *
  *  <prefix>/<mask>,<prefix>/<mask>,...
  *
  *
  * The service program should be run from userv with no-disconnect-hup.
  */
+/*
+ * Counted packet protocol:
+ *
+ *  In each direction a bytestream is sent, containing a series
+ *  of messages.
+ *
+ *  Messages are:
+ *     32 bits in network byte order        length L
+ *     8 bits                               message flags F
+ *     24 bits in network byte order        sub-opcode O
+ *     L bytes                              payload
+ *
+ *  Where the flags F are as follows:
+ *     0x01   first 4 bytes of payload are a command tag
+ *             allocated by caller and to be returned by service in response
+ *     0x02   response message indicates an error; opcode is an error code
+ *             and remainder of response depends on error code
+ *
+ *  And the flags and opcode (F | O) combinations are
+ *     0x00 | 0x000000  message is an IPv4 or IPv6 datagram
+ *     0x01 | 0x000001  add local address; payload is tag + V4 or V6 address
+ *     0x01 | 0x000002  remove local address
+ *                       command payload: tag + V4 or V6 address
+ *                       successful response payload: tag only
+ *     0x01 | 0x000003  add route
+ *                       command payload: tag + 1 byte prefix len + addr
+ */
 /*
  * Copyright (C) 1999-2000,2003 Ian Jackson
  * This file is part of ipif, part of userv-utils