386BSD 0.1 development
[unix-history] / usr / othersrc / contrib / isode / ssap / libssap.3n
.TH LIBSSAP 3N "31 May 1988"
.\" $Header: /f/osi/ssap/RCS/libssap.3n,v 7.1 91/02/22 09:45:35 mrose Interim $
.\"
.\"
.\" $Log: libssap.3n,v $
.\" Revision 7.1 91/02/22 09:45:35 mrose
.\" Interim 6.8
.\"
.\" Revision 7.0 89/11/23 22:25:17 mrose
.\" Release 6.0
.\"
.SH NAME
libssap \- Session Services library
.SH SYNOPSIS
.B "#include <isode/ssap.h>"
.sp
\fIcc\fR\0...\0\fB\-lssap\fR
.SH DESCRIPTION
The \fIlibssap\fR library contains a set of routines which implement
session services.
In essence,
they implement an Session Service Access Point (SSAP) interface for user
applications.
This manual page describes only the interface to the Basic Combined Subset
(BCS) of session;
consult the \fIUser's Manual\fR for the full details on the entire SSAP
interface.
.PP
Although the ISO model is symmetric,
this implementation is based on a client/server paradigm and hence asymmetric.
The information herein is skeletal:
consult the \fIUser's Manual\fR for actual examples of how ISO servers and
clients are coded and interact with the \fIlibssap\fR library.
.SH ADDRESSES
SSAP addresses are represented by the \fBSSAPaddr\fR structure.
This contains a transport address,
and a session-selector as found in the \fIisoservices\fR\0(5)
database.
.PP
SSAP references,
represented by the \fBSSAPref\fR structure,
consist of three attributes:
the user reference, the common reference, and the additional reference.
These are preserved by the SSAP but otherwise ignored.
.SH "SERVER INITIALIZATION"
A program providing an ISO service is usually invoked under \fItsapd\fR\0(8c),
with the argument vector listed in the ISODE services database.
The server's very first action is to re\-capture the SSAP state as
recorded by \fItsapd\fR.
This is accomplished by calling \fBSInit\fR.
Information returned by this call is equivalent to the parameters passed by a
S\-CONNECTION.INDICATION event.
If the call is successful,
the program can then examine the argument vector that was passed via
\fIexecvp\fR
(it's important to call \fBSInit\fR prior to reading \fBargc\fR and
\fBargv\fR).
If the call to \fBSInit\fR is not successful,
information returned by the call indicates the reason for failure.
.PP
After examining the information provided by \fBSInit\fR
(and possibly the argument vector),
the server should either accept or reject the connection.
If accepting, the \fBSConnResponse\fR routine is called with the parameter
\fBresult\fR set to
.sp
.in +.5i
.nf
.ta \w'SC_NOTSPECIFIED 'u
SC_ACCEPT connection accepted
.re
.fi
.in -.5i
.sp
(which corresponds to the accepting S\-CONNECT.RESPONSE action).
If the call is successful,
the interaction is henceforth symmetric.
If un\-successful,
information returned by the call indicates the reason for failure.
If rejecting, the \fBSConnResponse\fR routine is also called,
but with the parameter \fBresult\fR set to one of:
.sp
.in +.5i
.nf
.ta \w'SC_NOTSPECIFIED 'u
SC_NOTSPECIFIED reason not specified
SC_CONGESTION temporary congestion
SC_REJECTED rejected
.re
.fi
.in -.5i
.sp
(which corresponds to the refusing S\-CONNECT.RESPONSE action),
and the program may exit.
.SH "CLIENT INITIALIZATION"
A program requesting an ISO service calls \fBSConnRequest\fR
(which corresponds to the S\-CONNECT.REQUEST action).
If successful (depending on the responder's choice of \fBresult\fR),
the interaction is henceforth symmetric.
If un\-successful,
information returned by the call indicates the reason for failure.
.SH SESSION\-DESCRIPTORS
Once a connection has been established via a successful return from
\fBSConnResponse\fR (for servers) or \fBSConnRequest\fR (for clients),
a connection is referenced by a small integer
(returned in a structure passed to these calls) called a
\fIsession\-descriptor\fR.
The session\-descriptor appears as an argument to the peer routines described
below.
.PP
By default,
events associated with a session\-descriptor are synchronous in nature:
activity in the network won't generate an INDICATION event without program
first asking to be told of any activity.
To mark a session\-descriptor as asynchronous,
a call to \fBSSetIndications\fR is made with the addresses of an integer
function to handle these events:
.sp
.in +.5i
.nf
.ta \w'\fIroutine\fR 'u
\fIroutine\fR \fIevents\fR
\fBfunc1\fR data
\fBfunc2\fR tokens
\fBfunc3\fR synchronization
\fBfunc4\fR activities
\fBfunc5\fR reports
\fBfunc6\fR release
\fBfunc7\fR aborts
.re
.fi
.in -.5i
.sp
Upon a successful return from \fBSSetIndications\fR,
these functions will be called as appropriate in this fashion:
.sp
.in +.5i
.B "(*func1) (sd, sx);"
.sp
.B "(*func2) (sd, st);"
.sp
.B "(*func3) (sd, sn);"
.sp
.B "(*func4) (sd, sv);"
.sp
.B "(*func5) (sd, sp);"
.sp
.B "(*func6) (sd, sf);"
.sp
.B "(*func7) (sd, sa);"
.in -.5i
.sp
where \fBsd\fR is the session\-descriptor,
\fBsx\fR is a pointer to a \fBSSAPdata\fR structure,
\fBst\fR is a pointer to a \fBSSAPtoken\fR structure,
\fBsn\fR is a pointer to a \fBSSAPsync\fR structure,
\fBsv\fR is a pointer to a \fBSSAPactivity\fR structure,
\fBsp\fR is a pointer to a \fBSSAPreport\fR structure,
\fBsf\fR is a pointer to a \fBSSAPfinish\fR structure,
and \fBsa\fR is a pointer to a \fBSSAPabort\fR structure.
Any value returned by these functions is ignored.
.PP
Note well: the \fB\-lssap\fR library uses the \fB\-ltsap\fR library to
provide this interface.
The latter library uses the SIGEMT signal to provide this service.
Programs loaded with \fB\-ltsap\fR that use asynchronous session\-descriptors
should NOT use SIGEMT for other purposes.
.PP
For synchronous multiplexing of several connections,
the routine \fBSSelectMask\fR
updates a file\-descriptor mask and counter for use with \fIselect\fR\0(2).
.SH PEER
A fatal failure (consult the \fIUser's Manual\fR)
on return from any of these routines is equivalent to a
S\-P\-ABORT.INDICATION.
.sp
.in +.5i
.nf
.ta \w'\fBSUAbortRequest\fR 'u
\fIroutine\fR \fIaction\fR
\fBSDataRequest\fR S\-DATA.REQUEST
\fBSExpdRequest\fR S\-EXPEDITED\-DATA.REQUEST
\fBSReadRequest\fR S\-READ.REQUEST (synchronous read)
\fBSGTokenRequest\fR S\-TOKEN\-GIVE.REQUEST
\fBSPTokenRequest\fR S\-TOKEN\-PLEASE.REQUEST
\fBSRelRequest\fR S\-RELEASE.REQUEST
\fBSRelResponse\fR S\-RELEASE.RESPONSE
\fBSUAabortRequest\fR S\-U\-ABORT.REQUEST
.re
.fi
.in -.5i
.sp
Note that the \fBSReadRequest\fR routine returns data from the peer by
allocating memory.
It should be freed before the structure is re\-used.
.PP
Also note that session utilizes a graceful closing mechanism.
Upon receipt of a S\-RELEASE\-INDICATION event,
the peer must immediately respond with an S\-RELEASE\-RESPONSE.
Depending on the setting of the session requirements (described next),
the peer may indicate refusal in the response.
.PP
Finally,
the routine \fBSErrString\fR takes a failure code from a \fBSSAPabort\fR
structure and returns a null\-terminated diagnostic string.
Also,
the routine \fBSLocalHostName\fR returns a null\-terminated string denoting
the name of the localhost;
.SH "SESSION REQUIREMENTS"
During the connection\-establishment phase,
the session\-users and session\-providers negotiate the characteristics of
the connection.
In particular,
they negotiate the \*(lqsession requirements\*(rq.
These requirements describe functional aspects of the connection,
and are always negotiated downwards.
primitives.
.SH FILES
.nf
.ta \w'\*(EDisoservices 'u
\*(EDisoservices ISODE services database
.re
.fi
.SH "SEE ALSO"
isoservices(5), tsapd(8c),
.br
\fIThe ISO Development Environment: User's Manual\fR,
.br
ISO 8326:
\fIInformation Processing Systems \-\- Open Systems Interconnection~---~
Connection Oriented Session Service Definition\fR,
.br
CCITT Recommendation X.215:
\fISession Service Definition for Open Systems Interconnection (OSI) for
CCITT Applications\fR
.SH DIAGNOSTICS
All routines return the manifest constant \fBNOTOK\fR (\-1) on error.
In addition,
those routines which take a pointer to a \fBSSAPindication\fR structure
fill\-in the structure as appropriate.
.SH AUTHORS
Marshall T. Rose
.br
Dwight E. Cass,
Northrop Research and Technology Center
.SH BUGS
Do not confuse session\-descriptors with file\-descriptors.
Unlike file\-descriptors which are implemented by the kernel,
session\-descriptors do not work across \fIfork\fRs and \fIexec\fRs.