This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.1'.
[unix-history] / share / man / man4 / tp.4
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)tp.4 6.4 (Berkeley) 3/28/91
33.\"
34.Dd March 28, 1991
35.Dt TP 4
36.Os
37.Sh NAME
38.Nm TP
39.Nd
40.Tn ISO
41Transport Protocol
42.Sh SYNOPSIS
43.Fd #include <sys/socket.h>
44.Fd #include <netiso/iso_errno.h>
45.Fd #include <netiso/tp_param.h>
46.Fd #include <netiso/tp_user.h>
47.Ft int
48.Fn socket "[AF_INET, AF_ISO]" SOCK_SEQPACKET 0
49.Sh DESCRIPTION
50.Pp
51The
52.Tn TP
53protocol provides reliable, flow-controlled, two-way
54transmission of data and record boundaries.
55It is a byte-stream protocol and is accessed according to
56the
57.Dv SOCK_SEQPACKET
58abstraction.
59The
60.Tn TP
61protocol makes use of a standard
62.Tn ISO
63address format,
64including a Network Service Access Point, and a Transport Service Entity
65Selector.
66Subclass 4 may make use of the internet
67Internet address format.
68.Pp
69Sockets utilizing the tp protocol are either
70.Dq active
71or
72.Dq passive .
73Active sockets initiate connections to passive
74sockets. By default
75.Tn TCP
76sockets are created active; to create a
77passive socket the
78.Xr listen 2
79system call must be used
80after binding the socket with the
81.Xr bind 2
82system call. Only
83passive sockets may use the
84.Xr accept 2
85call to accept incoming connections. Only active sockets may
86use the
87.Xr connect 2
88call to initiate connections.
89.Pp
90Passive sockets may
91.Dq underspecify
92their location to match
93incoming connection requests from multiple networks. This
94technique, termed
95.Dq wildcard addressing ,
96allows a single
97server to provide service to clients on multiple networks.
98To create a socket which listens on all networks, the
99.Tn NSAP
100portion
101of the bound address must be void (of length zero).
102The Transport Selector may still be specified
103at this time; if the port is not specified the system will assign one.
104Once a connection has been established the socket's address is
105fixed by the peer entity's location. The address assigned the
106socket is the address associated with the network interface
107through which packets are being transmitted and received.
108.Pp
109The
110.Tn ISO
111Transport Protocol implemented for
112.Tn AOS R2
113at the University of Wisconsin - Madison,
114and modified for inclusion in the Berkeley Software Distribution,
115includes classes 0 and 4
116of the
117.Tn ISO
118transport protocols
119as specified in
120the June 1986 version of
121.Tn IS
1228073.
123Class 4 of the protocol provides reliable, sequenced,
124flow-controlled, two-way
125transmission of data packets with an alternate stop-and-wait data path called
126the "expedited data" service.
127Class 0 is essentially a null transport protocol, which is used
128when the underlying network service provides reliable, sequenced,
129flow-controlled, two-way data transmission.
130Class 0 does not provide the expedited data service.
131The protocols are implemented as a single transport layer entity
132that coexists with the Internet protocol suite.
133Class 0 may be used only in the
134.Tn ISO
135domain.
136Class 4 may be used in the Internet domain as well as in the
137.Tn ISO
138domain.
139.Pp
140Two system calls were modified from the previous
141release of the Berkeley Software Distribution
142to permit the support the end-of-transport-service-data-unit
143.Pq Dv EOTSDU
144indication, and for the receipt and transmission of user
145connect, confirm, and disconnect data.
146See
147.Xr sendmsg 2
148and
c2714ef5 149.Xr recvmsg 2 ,
15637ed4
RG
150and further discussion
151below for the formats of the data in the ancillary data buffer.
152If the
153.Dv EOTSDU
154is not needed, the normal
155.Xr read 2 ,
156and
157.Xr write 2
158system calls may be used.
159.Pp
160Through the
161.Xr getsockopt
162and
163.Xr setsockopt
164system calls,
165.Tn TP
166supports several options
167to control such things as negotiable options
168in the protocol and protocol strategies.
169The options are defined in
170.Aq Pa netiso/tp_user.h ,
171and are described below.
172.Pp
173In the tables below,
174the options marked with a pound sign
175.Ql \&#
176may be used
177with
178.Xr setsockopt
179after a connection is established.
180Others must be used before the connection
181is established, in other words,
182before calling
183.Xr connect
184or
185.Xr accept .
186All options may be used
187with
188.Xr getsockopt
189before or
190after a connection is established.
191.Bl -tag -width TPOPT_PSTATISTICS
192.It Dv TPOPT_CONN_DATA
193(char *) [none]
194.br
195Data to send on
196.Xr connect .
197The passive user may issue a
198.Xr getsockopt
199call to retrieve a connection request's user data,
200after having done the
201.Xr accept
202system call without implying confirmation of the connection.
203.Pp
204The data may also be retrieved by issuing a
205.Xr recvmsg
206request for ancillary data only,
207without implying confirmation of the connection.
208The returned
209.Va cmsghdr
210will contain
211.Dv SOL_TRANSPORT
212for the
213.Va csmg_level
214and
215.Dv TPOPT_CONN_DATA
216for
217.Va cmsg_type.
218.It Dv TPOPT_DISC_DATA \&#
219(char *) [none]
220.br
221Data to send on
222.Xr close .
223Disconnect data may be sent by the side initiating the close
224but not by the passive side ("passive" with respect to the closing
225of the connection), so there is no need to read disconnect data
226after calling
227.Xr close .
228This may be sent by a
229.Xr setsockopt
230system call, or by issuing a
231.Xr sendmsg
232request specifying ancillary data only.
233The user-provided
234.Va cmsghdr
235must contain
236.Dv SOL_TRANSPORT
237for
238.Va csmg_level
239and
240.Dv TPOPT_DISC_DATA
241for
242.Va cmsg_type .
243Sending of disconnect data will in of itself tear down (or reject)
244the connection.
245.It Dv TPOPT_CFRM_DATA \&#
246(char *) [none]
247.br
248Data to send when confirming a connection.
249This may aslo be sent by a
250.Xr setsockopt
251system call, or by issuing a
252.Xr sendmsg
253request, as above.
254Sending of connect confirm data will cause the connection
255to be confirmed rather than rejected.
256.It Dv TPOPT_PERF_MEAS \&#
257Boolean.
258.br
259When
260.Xr true ,
261performance measurements will be kept
262for this connection.
263When set before a connection is established, the
264active side will use a locally defined parameter on the
265connect request packet; if the peer is another
266.Tn ARGO
267implementation, this will cause performance measurement to be
268turned on
269on the passive side as well.
270See
271.Xr tpperf 8 .
272.It Dv TPOPT_PSTATISTICS
273No associated value on input.
274On output,
275.Ar struct tp_pmeas .
276.Pp
277This command is used to read the performance statistics accumulated
278during a connection's lifetime.
279It can only be used with
280.Xr getsockopt .
281The structure it returns is described in
282.Aq Pa netiso/tp_stat.h .
283See
284.Xr tpperf 8 .
285.It Dv TPOPT_FLAGS
286unsigned integer. [0x0]
287.br
288This command can only be used with
289.Xr getsockopt .
290See the description of the flags below.
291.It Dv TPOPT_PARAMS
292.Ar struct tp_conn_param
293.br
294Used to get or set a group parameters for a connection.
295The
296.Ar struct tp_conn_param
297is the argument used with the
298.Xr getsockopt
299or
300.Xr setsockopt
301system call.
302It is described in
303.Aq Pa netiso/tp_user.h .
304.Pp
305The fields of the
306.Ar tp_conn_param
307structure are
308described below.
309.El
310.Pp
311.Em Values for TPOPT_PARAMS:
312.Bl -tag -width p_sendack_ticks
313.It Ar p_Nretrans
314nonzero short integer [1]
315.br
316Number of times a TPDU
317will be retransmitted before the
318local TP entity closes a connection.
319.It Ar p_dr_ticks
320nonzero short integer [various]
321.br
322Number of clock ticks between retransmissions of disconnect request
323TPDUs.
324.It Ar p_dt_ticks
325nonzero short integer [various]
326.br
327Number of clock ticks between retransmissions of data
328TPDUs.
329This parameter applies only to class 4.
330.It Ar p_cr_ticks
331nonzero short integer [various]
332.br
333Number of clock ticks between retransmissions of connection request
334TPDUs.
335.It Ar p_cc_ticks
336nonzero short integer [various]
337.br
338Number of clock ticks between retransmissions of connection confirm
339TPDUs.
340This parameter applies only to class 4.
341.It Ar p_x_ticks
342nonzero short integer [various]
343.br
344Number of clock ticks between retransmissions of expedited data
345TPDUs.
346This parameter applies only to class 4.
347.It Ar p_sendack_ticks
348nonzero short integer [various]
349.br
350Number of clock ticks that the local TP entity
351will wait before sending an acknowledgment for normal data
c2714ef5 352(not applicable if the acknowledgement strategy is
15637ed4
RG
353.Dv TPACK_EACH ) .
354This parameter applies only to class 4.
355.It Ar p_ref_ticks
356nonzero short integer [various]
357.br
358Number of clock ticks for which a reference will
359be considered frozen after the connection to which
360it applied is closed.
361This parameter applies to classes 4 and 0 in the
362.Tn ARGO
363implementation, despite the fact that
364the frozen reference function is required only for
365class 4.
366.It Ar p_inact_ticks
367nonzero short integer [various]
368.br
369Number of clock ticks without an incoming packet from the peer after which
370.Tn TP
371close the connection.
372This parameter applies only to class 4.
373.It Ar p_keepalive_ticks
374nonzero short integer [various]
375.br
376Number of clock ticks between acknowledgments that are sent
377to keep an inactive connection open (to prevent the peer's
378inactivity control function from closing the connection).
379This parameter applies only to class 4.
380.It Ar p_winsize
381short integer between 128 and 16384. [4096 bytes]
382.br
383The buffer space limits in bytes for incoming and outgoing data.
384There is no way to specify different limits for incoming and outgoing
385paths.
386The actual window size at any time
387during the lifetime of a connection
388is a function of the buffer size limit, the negotiated
389maximum TPDU
390size, and the
391rate at which the user program receives data.
392This parameter applies only to class 4.
393.It Ar p_tpdusize
394unsigned char between 0x7 and 0xd.
395[0xc for class 4] [0xb for class 0]
396.br
397Log 2 of the maximum TPDU size to be negotiated.
398The
399.Tn TP
400standard
401.Pf ( Tn ISO
4028473) gives an upper bound of
4030xd for class 4 and 0xb for class 0.
404The
405.Tn ARGO
406implementation places upper bounds of
4070xc on class 4 and 0xb on class 0.
408.It Ar p_ack_strat
409.Dv TPACK_EACH
410or
411.Dv TPACK_WINDOW.
412.Bq Dv TPACK_WINDOW
413.br
414This parameter applies only to class 4.
415Two acknowledgment strategies are supported:
416.Pp
417.Dv TPACK_EACH means that each data TPDU
418is acknowledged
419with an AK TPDU.
420.Pp
421.Dv TPACK_WINDOW
422means that upon receipt of the packet that represents
423the high edge of the last window advertised, and AK TPDU is generated.
424.It Ar p_rx_strat
4254 bit mask
426.Bq Dv TPRX_USE_CW No \&|\ Dv TPRX_FASTSTART
427over
428connectionless network protocols]
429.Pf [ Dv TPRX_USE_CW
430over
431connection-oriented network protocols]
432.br
433This parameter applies only to class 4.
434The bit mask may include the following values:
435.Pp
436.Dv TPRX_EACH :
437When a retransmission timer expires, retransmit
438each packet in the send window rather than
439just the first unacknowledged packet.
440.Pp
441.Dv TPRX_USE_CW :
442Use a "congestion window" strategy borrowed
443from Van Jacobson's congestion window strategy for TCP.
444The congestion window size is set to one whenever
445a retransmission occurs.
446.Pp
447.Dv TPRX_FASTSTART :
448Begin sending the maximum amount of data permitted
449by the peer (subject to availability).
450The alternative is to start sending slowly by
451pretending the peer's window is smaller than it is, and letting
452it slowly grow up to the real peer's window size.
453This is to smooth the effect of new connections on a congested network
454by preventing a transport connection from suddenly
455overloading the network with a burst of packets.
456This strategy is also due to Van Jacobson.
457.It Ar p_class
4585 bit mask
459.Bq Dv TP_CLASS_4 No \&|\ Dv TP_CLASS_0
460.br
461Bit mask including one or both of the values
462.Dv TP_CLASS_4
463and
464.Dv TP_CLASS_0 .
465The higher class indicated is the preferred class.
466If only one class is indicated, negotiation will not occur
467during connection establishment.
468.It Ar p_xtd_format
469Boolean.
470[false]
471.br
472Boolean indicating that extended format shall be negotiated.
473This parameter applies only to class 4.
474.It Ar p_xpd_service
475Boolean.
476[true]
477.br
478Boolean indicating that
479the expedited data transport service will be negotiated.
480This parameter applies only to class 4.
481.It Ar p_use_checksum
482Boolean.
483[true]
484.br
485Boolean indicating the the use of checksums will be negotiated.
486This parameter applies only to class 4.
487.It Ar p_use_nxpd
488Reserved for future use.
489.It Ar p_use_rcc
490Reserved for future use.
491.It Ar p_use_efc
492Reserved for future use.
493.It Ar p_no_disc_indications
494Boolean.
495[false]
496.Pp
497Boolean indicating that the local
498.Tn TP
499entity shall not issue
500indications (signals) when a
501.Tn TP
502connection is disconnected.
503.It Ar p_dont_change_params
504Boolean. [false]
505.br
506If
507.Em true
508the
509.Tn TP
510entity will not override
511any of the other values given in this structure.
512If the values cannot be used, the
513.Tn TP
514entity will drop, disconnect,
515or refuse to establish the connection to which this structure pertains.
516.It Ar p_netservice
517One of {
518.Dv ISO_CLNS ,
519.Dv ISO_CONS ,
520.Dv ISO_COSNS ,
521.Dv IN_CLNS } .
522.Pf [ Dv ISO_CLNS ]
523.br
524Indicates which network service is to be used.
525.Pp
526.Dv ISO_CLNS
527indicates the connectionless network service provided
528by CLNP
529.Pf ( Tn ISO
5308473).
531.Pp
532.Dv ISO_CONS
533indicates the connection-oriented network service provided
534by X.25
535.Pf ( Tn ISO
5368208) and
537.Tn ISO
5388878.
539.Pp
540.Dv ISO_COSNS
541indicates the
542connectionless network service running over a
543connection-oriented subnetwork service: CLNP
544.Pf ( Tn ISO
5458473) over X.25
546.Pf ( Tn ISO
5478208).
548.Pp
549.Dv IN_CLNS
550indicates the
551DARPA Internet connectionless network service provided by IP (RFC 791).
552.It Ar p_dummy
553Reserved for future use.
554.El
555.Pp
556The
557.Dv TPOPT_FLAGS
558option is used for obtaining
559various boolean-valued options.
560Its meaning is as follows.
561The bit numbering used is that of the RT PC, which means that bit
5620 is the most significant bit, while bit 8 is the least significant bit.
563.sp 1
564.Em Values for TPOPT_FLAGS:
565.Bl -tag -width Bitsx
566.It Sy Bits
567.Sy Description [Default]
568.It \&0
569.Dv TPFLAG_NLQOS_PDN :
570set when the quality of the
571network service is
572similar to that of a public data network.
573.It \&1
574.Dv TPFLAG_PEER_ON_SAMENET :
575set when the peer
576.Tn TP
577entity
578is considered to be on the same network as the local
579.Tn TP
580entity.
581.It \&2
582Not used.
583.It \&3
584.Dv TPFLAG_XPD_PRES :
585set when expedited data are present
586[0]
587.It 4\&..7
588Reserved.
589.El
590.Sh ERROR VALUES
591.Pp
592The
593.Tn TP
594entity returns
595.Va errno
596error values as defined in
597.Aq Pa sys/errno.h
598and
599.Aq Pa netiso/iso_errno.h .
600User programs may print messages associated with these value by
601using an expanded version of
602.Xr perror
603found in the
604.Tn ISO
605library,
606.Pa libisodir.a .
607.Pp
608If the
609.Tn TP
610entity encounters asynchronous events
611that will cause a transport connection to be closed,
612such as
613timing out while retransmitting a connect request TPDU,
614or receiving a DR TPDU,
615the
616.Tn TP
617entity issues a
618.Dv SIGURG
619signal, indicating that
620disconnection has occurred.
621If the signal is issued during a
622a system call, the system call may be interrupted,
623in which case the
624.Va errno
625value upon return from the system call is
626.Er EINTR.
627If the signal
628.Dv SIGURG
629is being handled by reading
630from the socket, and it was a
631.Xr accept 2
632that
633timed out, the read may result in
634.Er ENOTSOCK ,
635because the
636.Xr accept
637call had not yet returned a
638legitimate socket descriptor when the signal was handled.
639.Dv ETIMEDOUT
640(or a some other errno value appropriate to the
641type of error) is returned if
642.Dv SIGURG
643is blocked
644for the duration of the system call.
645A user program should take one of the following approaches:
646.Bl -tag -width Ds
647.It Block Dv SIGURG
648If the program is servicing
649only one connection, it can block or ignore
650.Dv SIGURG
651during connection
652establishment.
653The advantage of this is that the
654.Va errno
655value
656returned is somewhat meaningful.
657The disadvantage of this is that
658if ignored, disconnection and expedited data indications could be
659missed.
660For some programs this is not a problem.
661.It Handle Dv SIGURG
662If the program is servicing more than one connection at a time
663or expedited data may arrive or both, the program may elect to
664service
665.Dv SIGURG .
666It can use the
667.Fn getsockopt ...TPOPT_FLAGS...
668system
669call to see if the signal
670was due to the arrival of expedited data or due to a disconnection.
671In the latter case,
672.Xr getsockopt
673will return
674.Er ENOTCONN .
675.El
676.Sh SEE ALSO
677.Xr tcp 4 ,
678.Xr netstat 1 ,
679.Xr iso 4 ,
680.Xr clnp 4 ,
681.Xr cltp 4 ,
682.Xr ifconfig 8 .
683.Sh HISTORY
684The
685.Nm
686protocol
687.Ud
688.Sh BUGS
689The protocol definition of expedited data is slightly problematic,
690in a way that renders expedited data almost useless,
691if two or more packets of expedited data are send within
692time epsilon, where epsilon
693depends on the application.
694The problem is not of major significance since most applications
695do not use transport expedited data.
696The problem is this:
697the expedited data acknowledgment TPDU
698has no field for conveying
699credit, thus it is not possible for a
700.Tn TP
701entity to inform its peer
702that "I received your expedited data but have no room to receive more."
703The
704.Tn TP
705entity has the choice of acknowledging receipt of the
706XPD TPDU:
707.Bl -tag -width Ds
708.It "when the user receives the" XPD TSDU
709which may be a fairly long time,
710which may cause the sending
711.Tn TP
712entity to retransmit the packet,
713and possibly to close the connection after retransmission, or
714.It "when the" Tn TP No "entity receives it"
715so the sending entity does not retransmit or close the connection.
716If the sending user then tries to send more expedited data
717.Dq soon ,
718the expedited data will not be acknowledged (until the
719receiving user receives the first XPD TSDU).
720.El
721.Pp
722The
723.Tn ARGO
724implementation acknowledges XPD TPDUs
725immediately,
726in the hope that most users will not use expedited data requently
727enough for this to be a problem.