Xinu7/man/man4/internet.doc




INTERNET(4)         Xinu Programmer's Manual          INTERNET(4)



NAME
     internet - IP-level Internet interface pseudo-device driver
     (types dgm, dg)

SYNOPSIS
     #include <network.h>

     read(device buffer, length)
     write(device, buffer, length)
     open(device, name)
     close(device)
     control(device, function, arg1)
     init(device)

DESCRIPTION
     The _d_g_m and _d_g device drivers, which operate as a related
     pair, provide a network interface at the IP datagram level.
     They accept datagrams from user processes and send them out
     on the DARPA Internet, or receive datagrams from the Inter-
     net and deliver them to user processes.  The standard Xinu
     device name for the datagram master pseudo-device is _I_N_T_E_R_-
     _N_E_T, and the standard name for individual connection
     pseudo-devices is _D_G_R_A_M.

     The drivers cooperate so that users can initiate connection
     by calling OPEN(2) on the datagram master device.  If suc-
     cessful, the call to OPEN(2) returns the device descriptor
     of a _d_g pseudo-device that can be used with READ(2) or
     WRITE(2) to transfer data.  Finally, when finished with the
     connection, the user process calls CLOSE(2) on the _d_g dev-
     ice.

     The _d_g_m driver consists of routines that implement OPEN(2)
     and CONTROL(2), while the _d_g driver consists of routines for
     READ(2), WRITE(2), CLOSE(2), and CONTROL(2).  Primitives
     READ(2) and WRITE(2) operate in one of two basic modes.
     Either they transfer data in Xinugram format complete with
     an address header, or they transfer just the data portion of
     the datagram.

     open(device,name,mode)
          Used with the master device to open a datagram pseudo-
          device.  Name is a string that gives an IP address and
          UDP port number in the form _i_1._i_2._i_3._i_4:_u.

     control(device,function,arg1)
          Used with master device to set the default gateway for
          nonlocal IP datagram traffic.  The only function sup-
          ported is _D_G_M__G_A_T_E which takes an IP address as an
          argument and sets the default gateway to that address.





Version 6b               Printed 1/12/87                        1






INTERNET(4)         Xinu Programmer's Manual          INTERNET(4)



     Used with a _d_g pseudo-device to set the transfer mode.  The
     valid operations include _D_G__C_L_E_A_R, which clears any UDP
     datagrams that happen to be in the receive queue, and
     _D_G__S_E_T_M_O_D_E, which sets the pseudo-device mode.  The mode
     argument composed of a word in which the first two bits con-
     trol the transfer mode and sixth bit controls timeout.  The
     symbolic constants for these bits are:
9       DG_NMODE (001) - Normal mode
       DG_DMODE (002) - Data-only mode
       DG_TMODE (040) - Timeout all reads
9     Note that timeout can be applied to either transfer mode.

     read(device buffer, length)
          Used with a _d_g pseudo-device to await the arrival of a
          UDP datagram and transfer it to the user in the form of
          a Xinugram.

     write(device, buffer, length)
          Used with a _d_g pseudo-device to transfer a xinugram
          into a UDP datagram and send it on the Internet.

     close(device)
          Closes a _d_g pseudo-device.

     init(device)
          When applied to _d_g pseudo-devices initializes each to
          mark it not in use.



























Version 6b               Printed 1/12/87                        2