Annotation of researchv10dc/man/man4/tcp.4, revision 1.1.1.1

1.1       root        1: .TH TCP 4
                      2: .CT comm_mach
                      3: .SH NAME
                      4: tcp, tcp_ld \- DARPA transmission control protocol
                      5: .SH SYNOPSIS
                      6: .B #include <sys/inio.h>
                      7: .br
                      8: .B #include <sys/inet/tcp_user.h>
                      9: .SH DESCRIPTION
                     10: The
                     11: .I tcp_ld
                     12: line discipline
                     13: and the
                     14: .F /dev/tcp*
                     15: devices together implement the DARPA TCP circuit protocol.
                     16: They are normally used through
                     17: .IR tcpmgr (8)
                     18: and the routines in
                     19: .IR ipc (3).
                     20: .PP
                     21: One instance of
                     22: .I tcp_ld
                     23: should be pushed on an IP device stream,
                     24: usually
                     25: .FR /dev/ip6 ;
                     26: see
                     27: .IR ip (4).
                     28: Thereafter,
                     29: data written on the
                     30: .I tcp
                     31: devices is turned into IP packets
                     32: written to the IP device,
                     33: and vice versa.
                     34: .PP
                     35: Different
                     36: .I tcp
                     37: devices represent different software channels.
                     38: Files with odd minor device numbers
                     39: are for placing calls;
                     40: while such a file is open,
                     41: it may not be opened again.
                     42: Files with even device numbers
                     43: receive calls.
                     44: .PP
                     45: To place a call,
                     46: open an unused odd-numbered
                     47: .I tcp
                     48: file;
                     49: write a
                     50: .B struct tcpuser
                     51: describing the address to be called;
                     52: and read a
                     53: .B struct tcpuser
                     54: for status.
                     55: The structure is defined in
                     56: .BR <sys/inet/tcp_user.h> :
                     57: .PP
                     58: .EX
                     59: struct tcpuser {
                     60:        int code;
                     61:        tcp_port lport, fport;
                     62:        in_addr laddr, faddr;
                     63:        int param;
                     64: };
                     65: 
                     66: #define TCPC_LISTEN    1
                     67: #define TCPC_CONNECT   2
                     68: 
                     69: #define TCPC_OK                3
                     70: #define TCPC_SORRY     4       /* unknown error */
                     71: #define TCPC_BADDEV    5       /* tcp device is bad */
                     72: #define TCPC_NOROUTE   6       /* no routing to dest */
                     73: #define TCPC_BADLOCAL  7       /* bad local address */
                     74: #define TCPC_BOUND     8       /* address already bound */
                     75: 
                     76: #define SO_KEEPALIVE   0x2     /* generate keepalives */
                     77: .EE
                     78: .PP
                     79: In the structure describing the call,
                     80: .B code
                     81: should be
                     82: .BR TCPC_CONNECT ;
                     83: .B faddr
                     84: and
                     85: .B fport
                     86: are the destination IP address and TCP port number;
                     87: .B laddr
                     88: is the IP address associated with a local IP interface,
                     89: or
                     90: .B INADDR_ANY
                     91: to let the system pick;
                     92: .B lport
                     93: is the local TCP port number,
                     94: or
                     95: 0
                     96: to let the system pick;
                     97: .B param
                     98: is 0 or
                     99: .BR SO_KEEPALIVE .
                    100: .PP
                    101: In the structure returned for status,
                    102: .B code
                    103: is
                    104: .B TCPC_OK
                    105: if the call completed correctly;
                    106: henceforth data written to and read from the file
                    107: is transported on the circuit.
                    108: Other codes mean the circuit was not set up.
                    109: .PP
                    110: To listen for incoming calls,
                    111: open an odd-numbered device
                    112: and write a
                    113: .B struct tcpuser
                    114: with
                    115: .B code
                    116: set to
                    117: .BR TCPC_LISTEN ;
                    118: .B laddr
                    119: set to the local IP address for which calls should be taken,
                    120: or
                    121: .B INADDR_ANY
                    122: to catch any calls not explicitly taken by another listener;
                    123: .B lport
                    124: set to the port on which to listen,
                    125: or 0 for any port;
                    126: and
                    127: .B param
                    128: set to 0.
                    129: Thereafter,
                    130: reads return successive
                    131: .B tcpuser
                    132: structures,
                    133: each describing a new call;
                    134: .B faddr
                    135: and
                    136: .B fport
                    137: identify the caller,
                    138: .B laddr
                    139: and
                    140: .B lport
                    141: the assigned local address.
                    142: The local
                    143: .I tcp
                    144: device number,
                    145: .I n,
                    146: assigned to the call
                    147: is returned in
                    148: .BR param .
                    149: The corresponding device,
                    150: .BI /dev/tcp n,
                    151: should be opened;
                    152: data read and written there is transported by the circuit.
                    153: .PP
                    154: Several
                    155: .IR ioctl (2)
                    156: calls, defined in
                    157: .BR <sys/inio.h> ,
                    158: apply to
                    159: .I tcp
                    160: devices:
                    161: .nr Pw \w'\f5TCPIOMAXSEG 'u
                    162: .TP \n(Pwu
                    163: .B TCPIOHUP
                    164: When the remote end of the circuit is disconnected,
                    165: send signal
                    166: .B SIGHUP
                    167: to the local process group associated with the stream.
                    168: .TP
                    169: .B TCPMAXSEG
                    170: The third argument points to an integer
                    171: giving the maximum segment size for this connection:
                    172: the greatest number of bytes to be packed into one IP packet.
                    173: .TP
                    174: .B TCPGETADDR
                    175: The third argument points to a
                    176: .BR "struct tcpuser" ;
                    177: fill in
                    178: .BR laddr ,
                    179: .BR lport ,
                    180: .BR faddr ,
                    181: and
                    182: .BR fport
                    183: with the local and foreign addresses associated with the circuit.
                    184: .SH FILES
                    185: .F /dev/tcp??
                    186: .br
                    187: .F /dev/ip6
                    188: .SH SEE ALSO
                    189: .IR ip (4),
                    190: .IR internet (3),
                    191: .IR tcpmgr (8)
                    192: .br
                    193: DARPA standards RFC 793, 1122

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.