home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / comms / a / freenet / !FreeNet_Docs_SWIs < prev    next >
Encoding:
Text File  |  1995-05-18  |  24.8 KB  |  669 lines

  1.           The Programmer Interface to the FreeNet TCP/IP Stack
  2.  
  3.                           (C) Tom Hughes 1995
  4.  
  5. 0. Copyright
  6.  
  7.   The FreeNet module and application and the tools and documentation
  8.   that go with them are all copyright. They are however released as
  9.   freeware subject to certain terms and conditions. These are described
  10.   in the file named 'Licence' which should have accompanied this
  11.   document.
  12.  
  13. 1. Overview
  14.  
  15.   The FreeNet TCP/IP Stack provides the same interface to the programmer
  16.   that the Acorn TCP/IP stack does, namely a BSD sockets interface
  17.   provided via SWI calls. There is also a library of AOF object files
  18.   available that provides a BSD sockets interface to these calls for use
  19.   by C programmers.
  20.  
  21.   There is a one to one mapping between the SWI calls provided by the
  22.   FreeNet stack, and the normal BSD socket calls. The arguments are
  23.   passed in order starting with register 0 and working up, with the
  24.   return value being passed back in R0.
  25.  
  26.   The only difference is that errors are signaled by returning a RISC OS
  27.   error in the normal way (with V set and R0 pointing to an error block)
  28.   instead of by returning a value of -1. The error number in the error
  29.   block will be a normal Unix error code however, and the C library
  30.   veneers convert these errors back into a -1 return code with errno
  31.   set.
  32.  
  33.   The mapping between BSD calls and SWI calls is decribed by the
  34.   following table:
  35.  
  36.          SWI Number    SWI Name                BSD Call
  37.  
  38.            &41200      Socket_Creat            socket()
  39.            &41201      Socket_Bind             bind()
  40.            &41202      Socket_Listen           listen()
  41.            &41203      Socket_Accept           accept()
  42.            &41204      Socket_Connect          connect()
  43.            &41205      Socket_Recv             recv()
  44.            &41206      Socket_Recvfrom         recvfrom()
  45.            &41207      Socket_Recvmsg          recvmsg()
  46.            &41208      Socket_Send             send()
  47.            &41209      Socket_Sendto           sendto()
  48.            &4120A      Socket_Sendmsg          sendmsg()
  49.            &4120B      Socket_Shutdown         shutdown()
  50.            &4120C      Socket_Setsockopt       setsockopt()
  51.            &4120D      Socket_Getsockopt       getsockopt()
  52.            &4120E      Socket_Getpeername      getpeername()
  53.            &4120F      Socket_Getsockname      getsockname()
  54.            &41210      Socket_Close            close()
  55.            &41211      Socket_Select           select()
  56.            &41212      Socket_Ioctl            ioctl()
  57.            &41213      Socket_Read             read()
  58.            &41214      Socket_Write            write()
  59.            &41215      Socket_Stat             stat()
  60.            &41216      Socket_Readv            readv()
  61.            &41217      Socket_Writev           writev()
  62.            &41218      Socket_Gettsize         FD_SETSIZE
  63.            &41219      Socket_Sendtosm         ?
  64.  
  65.   The remainder of this document details each of these SWIs in full,
  66.   describing the arguments and possible return values.
  67.  
  68. 2. Error Codes
  69.  
  70.   The errors returned by the Socket SWIs are normal RISC OS errors,
  71.   complete with suitable explanatory text. The error number will be a
  72.   Unix error code. These numbers (and the sybolic names associated with
  73.   them) are as follows:
  74.  
  75.        Name            Number    Explanation
  76.  
  77.        EBADF              9      Invalid socket descriptor given
  78.        EFAULT            14      Buffer is invalid or too small
  79.        EINVAL            22      Invalid argument
  80.        EWOULDBLOCK       35      Socket is marked non-blocking, and
  81.                                  this operation would normally block
  82.        EINPROGRESS       36      Operation now in progress
  83.        EALREADY          37      Operation already in progress
  84.        EMSGSIZE          40      Message too long
  85.        ENOPROTOOPT       42      Option not supported by protocol
  86.        EPROTONOSUPPORT   43      Protocol not supported
  87.        ESOCKTNOSUPPORT   44      Socket type not supported
  88.        EOPNOTSUPP        45      Operation not supported
  89.        EAFNOSUPPORT      47      Address family not supported
  90.        EADDRINUSE        48      Address already in use
  91.        ENETUNREACH       51      Network unreachable
  92.        ECONNRESET        54      Connection reset by peer
  93.        ENOBUFS           55      No buffer space available
  94.        EISCONN           56      Socket is already connected
  95.        ENOTCONN          57      Socket is not connected
  96.        ECONNREFUSED      61      Connection refused
  97.        EHOSTUNREACH      65      Host unreachable
  98.  
  99.   Throughout the rest of this document, the symbolic names referred to
  100.   above will be used when talking about specific errors.
  101.  
  102. 3. Other Symbolic Constants
  103.  
  104.   Various other constants are used as arguments to Socket SWIs, and these
  105.   are referred to in this document by the symbolic names used for them
  106.   in the BSD library code. Their values are as follows:
  107.  
  108.        Name            Value           Name            Value
  109.  
  110.        SOCK_STREAM       1             SO_DEBUG        &0001
  111.        SOCK_DGRAM        2             SO_ACCEPTCONN   &0002
  112.        SOCK_RAW          3             SO_REUSEADDR    &0004
  113.                                        SO_KEEPALIVE    &0008
  114.        PF_INET           2             SO_DONTROUTE    &0010
  115.                                        SO_BROADCAST    &0020
  116.        AF_INET           2             SO_LINGER       &0080
  117.                                        SO_OOBINLINE    &0100
  118.        MSG_OOB          &01            SO_SNDBUF       &1001
  119.        MSG_PEEK         &02            SO_RCVBUF       &1002
  120.        MSG_EOR          &08            SO_SNDLOWAT     &1003
  121.        MSG_TRUNC        &10            SO_RCVLOWAT     &1004
  122.        MSG_WAITALL      &40            SO_SNDTIMEO     &1005
  123.        MSG_DONTWAIT     &80            SO_RCVTIMEO     &1006
  124.                                        SO_ERROR        &1007
  125.        SOL_SOCKET      &FFFF           SO_TYPE         &1008
  126.                                        
  127.        IP_OPTIONS        1             FIOASYNC      &8004667D
  128.        IP_HDRINCL        2             FIONBIO       &8004667E
  129.        IP_TOS            3             FIONREAD      &8004667F
  130.        IP_TTL            4             
  131.                                        
  132.        TCP_NODELAY       1             
  133.        TCP_MAXSEG        2             
  134.  
  135. 4. Socket_Creat
  136.  
  137.   In: R0 = Protocol family
  138.       R1 = Socket type
  139.       R2 = Protocol
  140.  
  141.   Out: R0 = Socket descriptor
  142.  
  143.   This call creates a new socket of a given type and using a given
  144.   protocol.  If the protocol is left unspecified (passed as zero), a
  145.   default applicable to that socket type will be used.
  146.  
  147.   The internet protocol family (PF_INET) is the only one supported by this
  148.   module. Three socket type are supported:
  149.  
  150.     SOCK_STREAM - Stream orientated connections providing bi-directional
  151.                   sequenced, reliable transfer of byte streams. The only
  152.                   protocol of this type currently supported is the
  153.                   transmission control protocol (TCP).
  154.  
  155.     SOCK_DGRAM  - Connectionless, messages based protocols providing
  156.                   unreliable, non-sequence communication. The only
  157.                   protocol of this type currently supported is the user
  158.                   datagram protocol (UDP).
  159.  
  160.     SOCK_RAW    - Low level access to the underlying packet based
  161.                   transport mechanism to allow the implementation of
  162.                   alternative higher level protocols.
  163.  
  164.   Note that this call will not give the socket an address, or connect it
  165.   to any remote address. The socket can be given an address explicitly
  166.   using the Socket_Bind call, or it will be assigned one automatically
  167.   when it is first used to send data or to connect to a remote address.
  168.  
  169. 5. Socket_Bind
  170.  
  171.   In: R0 = Socket descriptor
  172.       R1 = Pointer to local address to bind socket to
  173.       R2 = Size of local address
  174.  
  175.   Out: R0 corrupted
  176.  
  177.   This call binds a socket to a specified local address. The format of
  178.   the address (for Internet addresses) is:
  179.  
  180.     R1 + 0 = Address family
  181.          2 = Port number
  182.          4 = IP address
  183.          8 = Reserved (should be zero)
  184.  
  185.   The address family is always AF_INET for internet addresses. The
  186.   reserved portion of the address can be omitted, provided that the
  187.   address size is passed correctly to indicate this.
  188.  
  189.   Note that the port number and IP address need to be in network byte
  190.   order, which is the reverse of the normal byte order on all current
  191.   Acorn machines.
  192.  
  193. 6. Socket_Listen
  194.  
  195.   In: R0 = Socket descriptor
  196.       R1 = Maximum backlog
  197.  
  198.   Out: R0 corrupted
  199.  
  200.   This call causes a socket of type SOCK_STREAM to begin listening for
  201.   incoming connection attempts. The backlog parameter specifies the
  202.   maximum length that the queue of pending connections may grow to
  203.   before connection attempts will be refused.
  204.  
  205. 7. Socket_Accept
  206.  
  207.   In: R0 = Socket descriptor of listening socket
  208.       R1 = Pointer to address to be filled in
  209.       R2 = Pointer to word giving the size of the address block
  210.  
  211.   Out: R0 = Socket descriptor for new connection
  212.  
  213.   This call is used to accept connections from server sockets that have
  214.   been told to listen for new connections. A new socket will be created
  215.   for each incoming connection, and this call in then used to obtain the
  216.   descriptor for the next pending connection.
  217.  
  218.   The address of the host which initiated the returned connection will
  219.   also be returned, in the supplied address block. This block is in the
  220.   same format as that given to Socket_Bind.
  221.  
  222.   If there are no connections waiting to be accepted, this call will
  223.   block until a connection is available to be returned, unless the
  224.   socket has been marked as non-blocking using Socket_Ioctl, in which
  225.   case the error EWOULDBLOCK will be returned.
  226.  
  227. 8. Socket_Connect
  228.  
  229.   In: R0 = Socket descriptor
  230.       R1 = Pointer to address of remote host
  231.       R2 = Size of supplied address block
  232.  
  233.   Out: R0 corrupted
  234.  
  235.   This call initiates a connection from the specified socket to a given
  236.   address on another host. When used on a raw or datagram socket, this
  237.   will simply fix the remote address for future calls to Socket_Send,
  238.   and this remote address can be changed by calling this routine again.
  239.  
  240.   For stream sockets, FreeNet will attempt to make a connection to the
  241.   specified address, and will block until the connection is achieved or
  242.   the attempt fails. If the socket has been marked non-blocking it will
  243.   instead return immediately with the error EINPROGRESS and will continue
  244.   with the connection attempt on its own.
  245.  
  246. 9. Socket_Recv
  247.  
  248.   In: R0 = Socket descriptor
  249.       R1 = Pointer to buffer for received data
  250.       R2 = Size of buffer
  251.       R3 = Flags
  252.  
  253.   Out: R0 = Amount of data received
  254.  
  255.   This call reads as much data as possible from the specified socket, and
  256.   returns it in the supplied buffer. If no data is available, the call
  257.   will block until data is available, unless the socket has been marked
  258.   non-blocking, in which case EWOULDBLOCK will be returned.
  259.  
  260.   Various bits in the flags word can be set to affect how how the read
  261.   is performed:
  262.  
  263.     MSG_PEEK     - Just peek at the data, leaving it in place to be
  264.                       read by a subsequent call.
  265.  
  266.     MSG_OOB      - Read any out-of-band data that is waiting on the
  267.                       socket, in place of the normal data.
  268.  
  269.     MSG_DONTWAIT - Treat this particular call as non-blocking, ignoring
  270.                    the sockets normal blocking/non-blocking status.
  271.  
  272.     MSG_WAITALL  - Try and completely fill the supplied buffer, blocking
  273.                    for more data if necessary.
  274.  
  275.   For stream sockets, this call may return zero as an indication that the
  276.   other end has closed the connection.
  277.  
  278. 10. Socket_Recvfrom
  279.  
  280.   In: R0 = Socket descriptor
  281.       R1 = Pointer to buffer for received data
  282.       R2 = Size of buffer
  283.       R3 = Flags
  284.       R4 = Pointer to address to be filled in
  285.       R5 = Size of supplied address block
  286.  
  287.   Out: R0 = Amount of data received
  288.  
  289.   This call has identical functionality to Socket_Recv except that the
  290.   address of the host that sent the data will be returned in the block
  291.   supplied, in the same format as used by Socket_Bind.
  292.  
  293. 11. Socket_Recvmsg
  294.  
  295.   In: R0 = Socket descriptor
  296.       R1 = Pointer to message descriptor
  297.       R2 = Flags
  298.  
  299.   Out: R0 = Amount of data received
  300.  
  301.   This call behaves in the same way as Socket_Recvfrom, except that the
  302.   message descriptor is used to indicate where the address should be
  303.   placed and to give a list of buffers to return the data in. The format
  304.   of the message descriptor is:
  305.  
  306.     R1 + 0  = Pointer to address to be filled in
  307.        + 4  = Size of supplied address block
  308.        + 8  = Pointer to array of buffer descriptors
  309.        + 12 = Number of buffer descriptors in use
  310.        + 16 = Pointer to list of access rights (unused by FreeNet)
  311.        + 20 = Size of access rights list
  312.        + 24 = Flags for received data
  313.  
  314.   Each buffer descriptor consists of two words. The first is a pointer
  315.   to the buffer, and the second the size of the buffer. The flags which
  316.   can be returned in the message descriptor are:
  317.   
  318.     MSG_TRUNC - Message was truncated.
  319.     
  320.     MSG_EOR   - This data completes a record.
  321.  
  322. 12. Socket_Send
  323.  
  324.   In: R0 = Socket descriptor
  325.       R1 = Pointer to data to be sent
  326.       R2 = Size of buffer
  327.       R3 = Flags
  328.  
  329.   Out: R0 = Amount of data sent
  330.  
  331.   This call sends data on a socket. In the case of datagram and raw sockets,
  332.   a single datagram containing the data will be sent, and EMSGSIZE will be
  333.   returned if the data is too large to be sent in this way. For stream
  334.   sockets, the call will block until all the data has been sent, unless
  335.   the socket has been marked non-blocking, in which case as much data as
  336.   possible will be sent.
  337.  
  338.   Various bits in the flags word can be set to affect how how the send is
  339.   performed:
  340.  
  341.     MSG_OOB      - Send data as out-of-band data instead of normal
  342.                     in-band data.
  343.  
  344.   Because this call does not specify the address to send to, the socket
  345.   used for this call must be a connected socket.
  346.  
  347. 13. Socket_Sendto
  348.  
  349.   In: R0 = Socket descriptor
  350.       R1 = Pointer to data to be sent
  351.       R2 = Size of buffer
  352.       R3 = Flags
  353.       R4 = Pointer to address to send to
  354.       R5 = Size of supplied address block
  355.  
  356.   Out: R0 = Amount of data sent
  357.  
  358.   This call performs the same job as Socket_Send, except that the remote
  359.   address is specified so that it can be used on unconnected sockets. This
  360.   call is only useful for sockets that do not require a connection such
  361.   as those using the UDP protocol. For sockets that require a connection
  362.   such as those using the TCP protocol, you need to call Socket_Connect
  363.   before you can use this routine, and the address given to this call
  364.   is then ignored anyway.
  365.  
  366. 14. Socket_Sendmsg
  367.  
  368.   In: R0 = Socket descriptor
  369.       R1 = Pointer to message descriptor
  370.       R2 = Flags
  371.  
  372.   Out: R0 = Amount of data sent
  373.  
  374.   This call behaves in the same way as Socket_Sendto, except that the
  375.   message descriptor is used to indicate where the address should be
  376.   taken from and to give a list of buffers containing the data in. The
  377.   format of the message descriptor is as given for Socket_Recvmsg.
  378.  
  379. 15. Socket_Shutdown
  380.  
  381.   In: R0 = Socket descriptor
  382.       R1 = Direction of shutdown
  383.  
  384.   Out: R0 corrupted
  385.  
  386.   Perform a half close on a stream socket. This call is able to shut
  387.   down either the send or received side of the socket, or both. The
  388.   direction parameter is either 0 to shut down the receive side, 1 to
  389.   shut down the send side, or 2 to shut down both sides of the socket.
  390.  
  391. 16. Socket_Setsockopt
  392.  
  393.   In: R0 = Socket descriptor
  394.       R1 = Option level
  395.       R2 = Option
  396.       R3 = Pointer to option value
  397.       R4 = Size of option value
  398.  
  399.   Out: R0 corrupted
  400.  
  401.   This is used to set a particular option on a socket. The level is
  402.   either SOL_SOCKET for options applicable to all sockets, or a protocol
  403.   number for options applicable to a certain protocol. Currently
  404.   supported socket level options are:
  405.  
  406.     SO_REUSEADDR - Enables or disables the reuse of local addresses
  407.                    during the wait period that normally occurs when
  408.                    a TCP stream socket is closed. The argument is a
  409.                    single word which contains zero to disable this
  410.                    option, or a non-zero value to enable it.
  411.  
  412.     SO_KEEPALIVE - Enable or disable attempts by FreeNet to probe the
  413.                    remote end of a TCP connection when the link has
  414.                    been idle for some time.
  415.  
  416.     SO_SNDBUF    - Set the size of the send buffer to the value given
  417.                    by the argument, which is a single word.
  418.  
  419.     SO_RCVBUF    - Set the size of the receive buffer to the value given
  420.                    by the argument, which is a single word.
  421.  
  422.     SO_SNDLOWAT  - Set the low water mark of the send buffer. The stack
  423.                    will block a send until there is this much space in
  424.                    the send buffer before it starts to send the data.
  425.  
  426.     SO_RCVLOWAT  - Set the low water mark of the receive buffer. The
  427.                    stack will always try and return at least this many
  428.                    bytes on a read, blocking if necessary.
  429.  
  430.     SO_SNDTIMEO  - Set the send timeout. This is the maximum length
  431.                    of time that a send call will block for before
  432.                    returning. The argument is a pointer to a timeout
  433.                    block as described under Socket_Select.
  434.  
  435.     SO_RCVTIMEO  - Set the receive timeout. This is the maximum length
  436.                    of time that a receive call will block for before
  437.                    returning. The argument is a pointer to a timeout
  438.                    block as described under Socket_Select.
  439.  
  440.   The IP protocol also supports several options:
  441.  
  442.     IP_OPTIONS   - Set some IP options which will be added to each
  443.                    packet sent on a socket.
  444.  
  445.     IP_HDRINCL   - This toggles whether data sent on a socket already
  446.                    has an IP header included or not. This should only
  447.                    ever be set on raw sockets.
  448.  
  449.     IP_TOS       - Set the type of service field in packets sent using
  450.                    this socket to the specified value.
  451.  
  452.     IP_TTL       - Set the time to live field in packets sent using
  453.                    this socket to the specified value.
  454.  
  455.   Finally, there are a number of options supported by the TCP protocol:
  456.  
  457.     TCP_NODELAY - Disable the Nagle algorithm for this connection, to
  458.                   ensure that data is always sent immediately.
  459.  
  460.     TCP_MAXSEG  - Set the maximum segment size to use for data sent on
  461.                   this connection.
  462.  
  463. 16. Socket_Getsockopt
  464.  
  465.   In: R0 = Socket descriptor
  466.       R1 = Option level
  467.       R2 = Option
  468.       R3 = Pointer to buffer for option value
  469.       R4 = Size of option value buffer
  470.  
  471.   Out: R0 corrupted
  472.  
  473.   This call can be used to read the current value of any of the options
  474.   set using Socket_Setsockopt. In addition, there are two more socket
  475.   level options that can be read but not written:
  476.  
  477.     SO_ERROR - Return the Unix error code for any error which has
  478.                occurred on the socket, and clear the sockets error
  479.                flag.
  480.  
  481.     SO_TYPE  - Return the socket type set when the socket was
  482.                created.
  483.  
  484. 17. Socket_Getpeername
  485.  
  486.   In: R0 = Socket descriptor
  487.       R1 = Pointer to address to be filled in
  488.       R2 = Pointer to word giving the size of the address block
  489.  
  490.   Out: R0 corrupted
  491.  
  492.   This call returns the address that the socket is connected to (if any)
  493.   in the supplied address block.
  494.  
  495. 18. Socket_Getsockname
  496.  
  497.   In: R0 = Socket descriptor
  498.       R1 = Pointer to address to be filled in
  499.       R2 = Pointer to word giving the size of the address block
  500.  
  501.   Out: R0 corrupted
  502.  
  503.   This call returns the local address that the socket is bound to (if
  504.   any) in the supplied address block.
  505.  
  506. 19. Socket_Close
  507.  
  508.   In: R0 = Socket descriptor
  509.   
  510.   Out: R0 corrupted
  511.  
  512.   Close a socket, freeing the descriptor for reuse. For stream sockets,
  513.   this is roughly equivalent to calling Socket_Shutdown with a type code
  514.   of 2, whilst for datagram sockets this call immediately deletes the
  515.   socket.
  516.  
  517. 20. Socket_Select
  518.  
  519.   In: R0 = Number of descriptors to consider in each set
  520.       R1 = Pointer to read descriptor set
  521.       R2 = Pointer to write descriptor set
  522.       R3 = Pointer to exception descriptor set
  523.       R4 = Pointer to timeout block
  524.  
  525.   Out: Number of ready descriptors
  526.  
  527.   This call polls a specified groups of sockets to see which are ready
  528.   for reading, which are ready for writing and which had exceptional
  529.   conditions pending.
  530.  
  531.   Each of the three descriptor sets is a bitmask, where bit zero refers
  532.   to socket zero, bit one to socket one and so on. Only those sockets
  533.   whose bit is set in a mask will be considered when performing the
  534.   checks. As FreeNet currently supports 128 sockets, the bitmasks are
  535.   arrays of four words - descriptors 0 to 31 are in the first word and
  536.   so on.
  537.  
  538.   The value in R0 is the number of bits in the descriptor sets which
  539.   should be considered as having meaning, so if R0 is 9 only the
  540.   first 9 bits (descriptors 0 to 8) will be considered.
  541.  
  542.   This call will return as soon as one or more of the sockets being
  543.   tested is ready or when a timeout occurs. Passing a null pointer
  544.   for the timeout means the call will never timeout, and will block
  545.   until a socket is ready. The timeout takes the following form:
  546.  
  547.     R4 + 0 = Number of seconds to wait
  548.          4 = Number of microseconds to wait
  549.  
  550.   A timeout with both fields set to zero will cause the call to return
  551.   immediately, regardless of how many sockets are ready.
  552.  
  553. 21. Socket_Ioctl
  554.  
  555.   In: R0 = Socket descriptor
  556.       R1 = Operation
  557.       R2 = Pointer to argument
  558.  
  559.   Out: R0 corrupted
  560.  
  561.   This call is used to perform miscellaneous control operations on
  562.   individual sockets and on the TCP/IP stack as a whole. At the moment,
  563.   three operations are supported:
  564.  
  565.     FIOASYNC - Mark a socket for asynchronous operation. This means that
  566.                a RISC OS event will be raised when important changes
  567.                occur in the sockets status. See the section on events
  568.                for more detail of the events that are raised. The argument
  569.                is a single word acting as a boolean flag.
  570.  
  571.     FIONBIO  - Mark a socket non-blocking so that no attempted operations
  572.                on the socket will block. They will instead fail with the
  573.                error EWOULDBLOCK if they are unable to complete straight
  574.                away. The argument is a single word acting as a boolean
  575.                flag.
  576.  
  577.     FIONREAD - Read the number of bytes available for reading from the
  578.                socket. The argument is an integer which will be filled in
  579.                with the number of bytes available.
  580.  
  581.   In the future, this call will support the operations used to read and
  582.   modify the interface and routing tables.
  583.  
  584. 22. Socket_Read
  585.  
  586.   In: R0 = Socket descriptor
  587.       R1 = Pointer to buffer for received data
  588.       R2 = Size of buffer
  589.  
  590.   Out: R0 = Amount of data received
  591.  
  592.   This call reads data from a socket in the same style as Socket_Recv
  593.   except that there is no flags argument, so all flags are treated as
  594.   being zero.
  595.  
  596. 23. Socket_Write
  597.  
  598.   In: R0 = Socket descriptor
  599.       R1 = Pointer to data to be sent
  600.       R2 = Size of buffer
  601.  
  602.   Out: R0 = Amount of data sent
  603.  
  604.   This call sends data on a socket in the same style as Socket_Send
  605.   except that there is no flags argument, so all flags are treated as
  606.   being zero.
  607.  
  608. 24. Socket_Stat
  609.  
  610.   This call is not supported by FreeNet yet.
  611.  
  612. 25. Socket_Readv
  613.  
  614.   In: R0 = Socket descriptor
  615.       R1 = Pointer to array of buffer descriptors
  616.       R2 = Number of buffer descriptors
  617.  
  618.   Out: R0 = Amount of data received
  619.  
  620.   This call reads data into a gather array. The buffer descriptors are
  621.   the same as those described for Socket_Recvmsg, and as with Socket_Read
  622.   the flags are all treated as being zero.
  623.  
  624. 25. Socket_Writev
  625.  
  626.   In: R0 = Socket descriptor
  627.       R1 = Pointer to array of buffer descriptors
  628.       R2 = Number of buffer descriptors
  629.  
  630.   Out: R0 = Amount of data received
  631.  
  632.   This call sends data from a scatter array. The buffer descriptors are
  633.   the same as those described for Socket_Recvmsg, and as with Socket_Write
  634.   the flags are all treated as being zero.
  635.  
  636. 26. Socket_Gettsize
  637.  
  638.   In: Nothing
  639.  
  640.   Out: R0 = Number of descriptors available
  641.  
  642.   This call returns the number of descriptors available to the caller,
  643.   including those currently in use.
  644.  
  645. 27. Socket_Sendtosm
  646.  
  647.   This call is not supported by FreeNet yet.
  648.  
  649. 28. The Internet Event
  650.  
  651.   If a socket has been marked for asynchronous operation using Socket_Ioctl
  652.   the TCP/IP stack will raise a RISC OS event (event 19) when important
  653.   changes occur which affect the socket. When the event occurs, registers
  654.   will be set as follows:
  655.  
  656.      R0 = 19
  657.      R1 = Event code
  658.      R2 = Socket descriptor
  659.  
  660.   Where the socket descriptor is the socket affected by the event, and the
  661.   event code is on of the following values:
  662.  
  663.      0   Socket has input waiting to be read
  664.      1   An urgent event has occured (eg arrival of OOB data )
  665.      2   Socket's connection has been broken
  666.  
  667.   This event can be trapped and used to know when to read data from the
  668.   socket, and when a connection has been closed.
  669.