BSD 4_3_Net_2 development
[unix-history] / usr / src / contrib / isode / tsap / libtsap.3n
CommitLineData
9319b3c3
C
1.TH LIBTSAP 3N "31 May 1988"
2.\" $Header: /f/osi/tsap/RCS/libtsap.3n,v 7.1 91/02/22 09:47:06 mrose Interim $
3.\"
4.\"
5.\" $Log: libtsap.3n,v $
6.\" Revision 7.1 91/02/22 09:47:06 mrose
7.\" Interim 6.8
8.\"
9.\" Revision 7.0 89/11/23 22:30:28 mrose
10.\" Release 6.0
11.\"
12.SH NAME
13libtsap \- Transport Services library
14.SH SYNOPSIS
15.B "#include <isode/tsap.h>"
16.sp
17\fIcc\fR\0...\0\fB\-ltsap\fR
18.SH DESCRIPTION
19The \fIlibtsap\fR library contains a set of routines which implement
20transport services on top of the TCP.
21In essence,
22they implement a Transport Service Access Point (TSAP) interface to the
23native TCP/IP implementation on Berkeley UNIX.
24.PP
25Although the ISO model is symmetric,
26the TCP/IP model (and this implementation) is based on a client/server
27paradigm and hence asymmetric.
28The information herein is skeletal:
29consult the \fIUser's Manual\fR for actual examples of how ISO servers and
30clients are coded and interact with the \fIlibtsap\fR library.
31.SH ADDRESSES
32TSAP addresses are represented by the \fBTSAPaddr\fR structure.
33This contains one more more network addresses,
34and a transport-selector as found in the \fIisoservices\fR\0(5)
35database.
36.SH "SERVER INITIALIZATION"
37A program providing an ISO service is invoked under \fItsapd\fR\0(8c),
38with the argument vector listed in the ISODE services database.
39The server's very first action is to re\-capture the TSAP
40state as recorded by \fItsapd\fR.
41This is accomplished by calling \fBTInit\fR.
42Information returned by this call is equivalent to the parameters passed by a
43T\-CONNECTION.INDICATION event.
44If the call is successful,
45the program can then examine the argument vector that was passed via
46\fIexecvp\fR
47(it's important to call \fBTInit\fR prior to reading \fBargc\fR and
48\fBargv\fR).
49If the call to \fBTInit\fR is not successful,
50information returned by the call indicates the reason for failure.
51.PP
52After examining the information provided by \fBTInit\fR
53(and possibly the argument vector),
54the server should either accept or reject the connection.
55If accepting, the \fBTConnResponse\fR routine is called
56(which corresponds to the T\-CONNECT.RESPONSE action).
57If the call is successful,
58the interaction is henceforth symmetric.
59If un\-successful,
60information returned by the call indicates the reason for failure.
61If rejecting, the \fBTDiscRequest\fR routine is called
62(which corresponds to the T\-DISCONNECT.REQUEST action),
63and the program may exit.
64.SH "CLIENT INITIALIZATION"
65A program requesting an ISO service calls \fBTConnRequest\fR
66(which corresponds to the T\-CONNECT.REQUEST action).
67If successful,
68the interaction is henceforth symmetric.
69If un\-successful,
70information returned by the call indicates the reason for failure.
71.SH TRANSPORT\-DESCRIPTORS
72Once a connection has been established via a successful return from
73\fBTConnResponse\fR (for servers) or \fBTConnRequest\fR (for clients),
74a connection is referenced by a small integer
75(returned in a structure passed to these calls) called a
76\fItransport\-descriptor\fR.
77The transport\-descriptor appears as an argument to the peer routines described
78below.
79.PP
80By default,
81events associated with a transport\-descriptor are synchronous in nature:
82activity in the network won't generate an INDICATION event without program
83first asking to be told of any activity.
84To mark a transport\-descriptor as asynchronous,
85a call to \fBTSetIndications\fR is made with the addresses of an integer
86function to handle these events:
87.sp
88.in +.5i
89.nf
90.ta \w'\fIroutine\fR 'u
91\fIroutine\fR \fIevents\fR
92\fBfunc1\fR T\-DATA.INDICATION, T\-EXPEDITED DATA.INDICATION
93\fBfunc2\fR T\-DISCONNECT.INDICATION
94.re
95.fi
96.in -.5i
97.sp
98Upon a successful return from \fBTSetIndications\fR,
99these functions will be called as appropriate in this fashion:
100.sp
101.in +.5i
102.B "(*func1) (sd, tx);"
103.sp
104.B "(*func2) (sd, td);"
105.in -.5i
106.sp
107where \fBsd\fR is the transport\-descriptor,
108\fBtx\fR is a pointer to a \fBTSAPdata\fR structure,
109and \fBtd\fR is a pointer to a \fBTSAPdisconnect\fR structure.
110Any value returned by these functions is ignored.
111.PP
112Note well: the \fB\-ltsap\fR library uses the SIGEMT signal to provide this
113interface.
114Programs loaded with \fB\-ltsap\fR that use asynchronous transport\-descriptors
115should NOT use SIGEMT for other purposes.
116.PP
117For synchronous multiplexing of several connections,
118the routine \fBTSelectMask\fR updates a file\-descriptor mask and counter for
119use with \fIselect\fR\0(2).
120.SH PEER
121As a rule,
122a fatal failure (consult the \fIUser's Manual\fR)
123on return from any of these routines is equivalent to a
124T\-DISCONNECT.INDICATION.
125.sp
126.in +.5i
127.nf
128.ta \w'\fBTWriteRequest\fR 'u
129\fIroutine\fR \fIaction\fR
130\fBTDataRequest\fR T\-DATA.REQUEST
131\fBTExpdRequest\fR T\-EXPEDITED\-DATA.REQUEST
132\fBTWriteRequest\fR T\-WRITE.REQUEST (write user data vectors)
133\fBTReadRequest\fR T\-READ.REQUEST (synchronous read)
134\fBTDiscRequest\fR T\-DISCONNECT.REQUEST
135.re
136.fi
137.in -.5i
138.sp
139Note that the \fBTReadRequest\fR routine returns data from the peer by
140allocating memory.
141It should be freed before the structure is re\-used.
142.PP
143Finally,
144the routine \fBTErrString\fR takes a failure code from a \fBTSAPdisconnect\fR
145structure and returns a null\-terminated diagnostic string.
146Also,
147the routine \fBTLocalHostName\fR returns a null\-terminated string
148denoting the name of the localhost.
149.SH FILES
150.nf
151.ta \w'\*(EDisoservices 'u
152\*(EDisoservices ISODE services database
153.re
154.fi
155.SH "SEE ALSO"
156isoc(1c), isoservices(5), isod(8c), isore(8c), tsapd(8c),
157.br
158\fIThe ISO Development Environment: User's Manual\fR,
159.br
160\fIRFC1006: ISO Transport Services on top of the TCP, Version: 3\fR,
161.br
162ISO 8072:
163\fIInformation Processing Systems \-\- Open Systems Interconnection \-\-
164Transport Service Definition\fR,
165.br
166CCITT Recommendation X.214:
167\fITransport Service Definition for Open Systems Interconnection (OSI) for
168CCITT Applications\fR
169.SH DIAGNOSTICS
170All routines return the manifest constant \fBNOTOK\fR (\-1) on error.
171In addition,
172those routines which take a pointer to a \fBTSAPdisconnect\fR structure
173fill\-in the structure as appropriate.
174.SH AUTHORS
175Marshall T. Rose
176.br
177Dwight E. Cass,
178Northrop Research and Technology Center
179.SH BUGS
180Do not confuse transport\-descriptors with file\-descriptors.
181Unlike file\-descriptors which are implemented by the kernel,
182transport\-descriptors do not work across \fIfork\fRs and \fIexec\fRs.