xtrans.xml revision 75ebec6d
1af928962Smrg<?xml version="1.0" encoding="UTF-8" ?>
2af928962Smrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3fe567363Smrg                      "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
4fe567363Smrg[
5fe567363Smrg<!ENTITY % defs SYSTEM "defs.ent"> %defs;
6fe567363Smrg]>
7af928962Smrg
8af928962Smrg<!-- lifted from troff+ms+XMan by doclifter -->
9af928962Smrg<book id="xtrans">
10af928962Smrg
11af928962Smrg<bookinfo>
12af928962Smrg   <title>X Transport Interface</title>
13af928962Smrg   <subtitle>X Consortium Standard</subtitle>
14af928962Smrg   <authorgroup>
15fe567363Smrg     <author>
16fe567363Smrg       <firstname>Stuart</firstname><surname>Anderson</surname>
17fe567363Smrg       <affiliation><orgname>NCR Corporation</orgname></affiliation>
18fe567363Smrg     </author>
19fe567363Smrg     <othercredit><firstname>Ralph</firstname><surname>Mor</surname>
20fe567363Smrg       <affiliation><orgname>X Consortium</orgname></affiliation>
21fe567363Smrg     </othercredit>
22fe567363Smrg     <othercredit><firstname>Alan</firstname><surname>Coopersmith</surname>
23fe567363Smrg       <affiliation><orgname>Oracle Corp.</orgname></affiliation>
24fe567363Smrg     </othercredit>
25af928962Smrg   </authorgroup>
26fe567363Smrg   <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
2775ebec6dSmrg   <releaseinfo>Version 1.2</releaseinfo>
28fe567363Smrg   <copyright><year>1993</year><year>1994</year>
29fe567363Smrg     <holder>NCR Corporation - Dayton, Ohio, USA</holder>
30fe567363Smrg   </copyright>
31af928962Smrg
32af928962Smrg<legalnotice>
33af928962Smrg<para>
34af928962SmrgAll Rights Reserved
35af928962Smrg</para>
36af928962Smrg<para>
37af928962SmrgPermission to use, copy, modify, and distribute this software and its
38af928962Smrgdocumentation for any purpose and without fee is hereby granted, provided
39af928962Smrgthat the above copyright notice appear in all copies and that both that
40af928962Smrgcopyright notice and this permission notice appear in supporting
41af928962Smrgdocumentation, and that the name NCR not be used in advertising
42af928962Smrgor publicity pertaining to distribution of the software without specific,
43af928962Smrgwritten prior permission.  NCR makes no representations about the
44af928962Smrgsuitability of this software for any purpose.  It is provided "as is"
45af928962Smrgwithout express or implied warranty.
46af928962Smrg</para>
47af928962Smrg<para>
48af928962SmrgNCR DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
49af928962SmrgINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
50af928962SmrgNO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
51af928962SmrgCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
52af928962SmrgOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
53af928962SmrgNEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
54af928962SmrgCONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
55af928962Smrg</para>
56af928962Smrg</legalnotice>
57af928962Smrg
58af928962Smrg<legalnotice>
59fe567363Smrg<para role="multiLicensing">
60af928962SmrgCopyright &copy; 1993, 1994, 2002 The Open Group
61af928962Smrg</para>
62af928962Smrg<para>
63af928962SmrgPermission is hereby granted, free of charge, to any person obtaining a copy
64af928962Smrgof this software and associated documentation files (the &ldquo;Software&rdquo;), to deal
65af928962Smrgin the Software without restriction, including without limitation the rights
66af928962Smrgto use, copy, modify, merge, publish, distribute, sublicense, and/or sell
67af928962Smrgcopies of the Software, and to permit persons to whom the Software is
68af928962Smrgfurnished to do so, subject to the following conditions:
69af928962Smrg</para>
70af928962Smrg<para>
71af928962SmrgThe above copyright notice and this permission notice shall be included in
72af928962Smrgall copies or substantial portions of the Software.
73af928962Smrg</para>
74af928962Smrg<para>
75af928962SmrgTHE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
76af928962SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77af928962SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
78af928962SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
79af928962SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
80af928962SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
81af928962Smrg</para>
82af928962Smrg<para>
83af928962SmrgExcept as contained in this notice, the name of The Open Group shall not be
84af928962Smrgused in advertising or otherwise to promote the sale, use or other dealings
85af928962Smrgin this Software without prior written authorization from The Open Group.
86af928962Smrg</para>
87af928962Smrg<para>
88af928962SmrgX Window System is a trademark of The Open Group, Inc.
89af928962Smrg</para>
90af928962Smrg</legalnotice>
91af928962Smrg</bookinfo>
92af928962Smrg
93af928962Smrg<preface><title>The X Transport Interface</title>
94af928962Smrg<para>
95af928962SmrgDesigned by Stuart Anderson (NCR) with help from Ralph Mor (X Consortium)
96af928962Smrg</para>
97af928962Smrg
98af928962Smrg<note><para>
99af928962SmrgThis documentation does not completely match the implementation in R6
100af928962Smrg(as a result of some late changes made in the code). Specifically, support
101af928962Smrgwas added for font server cloning, and conditional compliation was introduced
102af928962Smrgfor client vs. server code.
103af928962Smrg</para></note>
104af928962Smrg</preface>
105af928962Smrg
106fe567363Smrg<chapter id='Purposes_and_Goals'>
107af928962Smrg<title>Purposes and Goals</title>
108af928962Smrg
109af928962Smrg<para>The X Transport Interface is intended to combine all system and
110af928962Smrgtransport specific code into a single place in the source tree. This API
111af928962Smrgshould be used by all libraries, clients and servers of the X Window System.
112af928962SmrgUse of this API should allow the addition of new types of transports and
113af928962Smrgsupport for new platforms without making any changes to the source except
114af928962Smrgin the X Transport Interface code.</para>
115af928962Smrg<para>This interface should solve the problem of multiple
116af928962Smrg<code>#ifdef TRANSPORT</code> and <code>#ifdef PLATFORM</code>
117af928962Smrgstatements scattered throughout the source tree.</para>
118af928962Smrg<para>This interface should provide enough functionality to support all
119af928962Smrgtypes of protocols, including connection oriented protocols such as X11 and
120af928962SmrgFS, and connection-less oriented protocols such as XDMCP.</para>
121af928962Smrg
122af928962Smrg</chapter>
123af928962Smrg
124fe567363Smrg<chapter id='Overview_of_the_Interface'>
125af928962Smrg<title>Overview of the Interface</title>
126af928962Smrg
127af928962Smrg<para>
128af928962SmrgThe interface provides an API for use by applications. The functions in
129af928962Smrgthis API perform work that is common to all transports and systems, such
130af928962Smrgas parsing an address into a host and port number. The functions in this
131af928962SmrgAPI call transport specific functions that are contained in a table whose
132af928962Smrgcontents are defined at compile time. This table contains an entry for each
133af928962Smrgtype of transport. Each entry is a record containing mostly pointers to
134af928962Smrgfunction that implements the interface for the given transport.
135af928962Smrg</para>
136af928962Smrg<para>
137af928962SmrgThis API does not provide an abstraction for <function>select()</function>
138af928962Smrgor <function>poll()</function>.
139af928962SmrgThese functions are themselves transport independent, so an additional
140af928962Smrginterface is not needed for these functions. It is also unclear how such
141af928962Smrgan interface would affect performance.
142af928962Smrg</para>
143af928962Smrg</chapter>
144af928962Smrg
145fe567363Smrg<chapter id='Definition_of_Address_Specification_Format'>
146af928962Smrg<title>Definition of Address Specification Format</title>
147af928962Smrg
148af928962Smrg<para>
149af928962SmrgAddresses are specified in the following syntax,
150af928962Smrg
151af928962Smrg<synopsis>
152af928962Smrg<replaceable>protocol</replaceable>/<replaceable>host</replaceable>:<replaceable>port</replaceable>
153af928962Smrg</synopsis>
154af928962Smrg
155af928962Smrgwhere <replaceable>protocol</replaceable> specifies a protocol family
156af928962Smrgor an alias for a protocol family. A definition of common protocol
157af928962Smrgfamilies is given in a later section.
158af928962Smrg</para>
159af928962Smrg<para>
160af928962SmrgThe <replaceable>host</replaceable> part specifies the name of a host or other
161af928962Smrgtransport dependent entity that could be interpreted as a Network Service Access Point
162af928962Smrg(NSAP).
163af928962Smrg</para>
164af928962Smrg<para>
165af928962SmrgThe <replaceable>port</replaceable> part specifies the name of a Transport Service
166af928962SmrgAccess Point (TSAP). The format of the TSAP is defined by the underlying transport
167af928962Smrgimplementation, but it is represented using a string format when it is
168af928962Smrgpart of an address.
169af928962Smrg</para>
170af928962Smrg</chapter>
171af928962Smrg
172fe567363Smrg<chapter id='Internal_Data_Structures'>
173af928962Smrg<title>Internal Data Structures</title>
174af928962Smrg<para>
175af928962SmrgThere are two major data structures associated with the transport
176af928962Smrgindependent portion of this interface.  Additional data structures
177af928962Smrgmay be used internally by each transport.
178af928962Smrg</para>
179fe567363Smrg<sect1 id='Xtransport'>
180af928962Smrg<title>Xtransport</title>
181af928962Smrg<para>
182af928962SmrgEach transport supported has an entry in the transport table. The transport
183af928962Smrgtable is an array of Xtransport records. Each record contains all the entry
184af928962Smrgpoints for a single transport. This record is defined as:
185af928962Smrg</para>
186af928962Smrg
187af928962Smrg<synopsis>
188af928962Smrgtypedef struct _Xtransport {
189af928962Smrg
190af928962Smrg    char *TransName;
191af928962Smrg    int  flags;
192af928962Smrg
193af928962Smrg    XtransConnInfo (*OpenCOTSClient)(
194af928962Smrg    struct _Xtransport *,     /* transport */
195af928962Smrg    char     *,     /* protocol */
196af928962Smrg    char     *,     /* host */
197af928962Smrg    char     *      /* port */
198af928962Smrg    );
199af928962Smrg
200af928962Smrg    XtransConnInfo (*OpenCOTSServer)(
201af928962Smrg    struct _Xtransport *,     /* transport */
202af928962Smrg    char *,     /* protocol */
203af928962Smrg    char *,     /* host */
204af928962Smrg    char *      /* port */
205af928962Smrg    );
206af928962Smrg
207af928962Smrg    XtransConnInfo (*OpenCLTSClient)(
208af928962Smrg    struct _Xtransport *,     /* transport */
209af928962Smrg    char *,               /* protocol */
210af928962Smrg    char *,               /* host */
211af928962Smrg    char *               /* port */
212af928962Smrg    );
213af928962Smrg
214af928962Smrg    XtransConnInfo (*OpenCLTSServer)(
215af928962Smrg     struct _Xtransport *,   /* transport */
216af928962Smrg     char *,     /* protocol */
217af928962Smrg     char *,     /* host */
218af928962Smrg     char *     /* port */
219af928962Smrg    );
220af928962Smrg
221af928962Smrg    int     (*SetOption)(
222af928962Smrg     XtransConnInfo,          /* connection */
223af928962Smrg     int,               /* option */
224af928962Smrg     int               /* arg */
225af928962Smrg    );
226af928962Smrg
227af928962Smrg    int     (*CreateListener)(
228af928962Smrg     XtransConnInfo,          /* connection */
229af928962Smrg     char *,               /* port */
230af928962Smrg     int               /* flags */
231af928962Smrg    );
232af928962Smrg
233af928962Smrg    int     (*ResetListener)(
234af928962Smrg     XtransConnInfo          /* connection */
235af928962Smrg    );
236af928962Smrg
237af928962Smrg    XtransConnInfo (*Accept)(
238af928962Smrg     XtransConnInfo          /* connection */
239af928962Smrg    );
240af928962Smrg
241af928962Smrg    int     (*Connect)(
242af928962Smrg     XtransConnInfo,          /* connection */
243af928962Smrg     char *,               /* host */
244af928962Smrg     char *               /* port */
245af928962Smrg    );
246af928962Smrg
247af928962Smrg    int     (*BytesReadable)(
248af928962Smrg     XtransConnInfo,          /* connection */
249af928962Smrg     BytesReadable_t *     /* pend */
250af928962Smrg    );
251af928962Smrg
252af928962Smrg    int     (*Read)(
253af928962Smrg     XtransConnInfo,          /* connection */
254af928962Smrg     char *,               /* buf */
255af928962Smrg     int               /* size */
256af928962Smrg    );
257af928962Smrg
258af928962Smrg    int     (*Write)(
259af928962Smrg     XtransConnInfo,          /* connection */
260af928962Smrg     char *,               /* buf */
261af928962Smrg     int               /* size */
262af928962Smrg    );
263af928962Smrg
264af928962Smrg    int     (*Readv)(
265af928962Smrg     XtransConnInfo,          /* connection */
266af928962Smrg     struct iovec *,          /* buf */
267af928962Smrg     int               /* size */
268af928962Smrg    );
269af928962Smrg
270af928962Smrg    int     (*Writev)(
271af928962Smrg     XtransConnInfo,          /* connection */
272af928962Smrg     struct iovec *,          /* buf */
273af928962Smrg     int               /* size */
274af928962Smrg    );
275af928962Smrg
276af928962Smrg    int     (*Disconnect)(
277af928962Smrg     XtransConnInfo          /* connection */
278af928962Smrg    );
279af928962Smrg
280af928962Smrg    int     (*Close)(
281af928962Smrg     XtransConnInfo          /* connection */
282af928962Smrg    );
283af928962Smrg
284af928962Smrg} Xtransport;
285af928962Smrg</synopsis>
286af928962Smrg
287af928962Smrg<para>
288af928962SmrgThe <structfield>flags</structfield> field can contain an OR of
289af928962Smrgthe following masks:
290af928962Smrg<variablelist>
291af928962Smrg  <varlistentry>
292af928962Smrg    <term><symbol>TRANS_ALIAS</symbol></term>
293af928962Smrg    <listitem><para>
294af928962Smrgindicates that this record is providing an alias, and should
295af928962Smrgnot be used to create a listener.
296af928962Smrg      </para></listitem>
297af928962Smrg  </varlistentry>
298af928962Smrg  <varlistentry>
299af928962Smrg    <term><symbol>TRANS_LOCAL</symbol></term>
300af928962Smrg    <listitem><para>
301af928962Smrgindicates that this is a <symbol>LOCALCONN</symbol> transport.
302af928962Smrg    </para></listitem>
303af928962Smrg  </varlistentry>
304af928962Smrg  <varlistentry>
305af928962Smrg    <term><symbol>TRANS_ABSTRACT</symbol></term>
306af928962Smrg    <listitem><para>
307af928962Smrgindicates that a local connection transport uses the abstract socket namespace.
308af928962Smrg    </para></listitem>
309af928962Smrg  </varlistentry>
310af928962Smrg</variablelist>
311af928962Smrg</para>
312af928962Smrg
313af928962Smrg<para>
314af928962SmrgSome additional flags may be set in the <structfield>flags</structfield>
315af928962Smrgfield by the library while it is running:
316af928962Smrg<variablelist>
317af928962Smrg  <varlistentry>
318af928962Smrg    <term><symbol>TRANS_DISABLED</symbol></term>
319af928962Smrg    <listitem><para>
320af928962Smrgindicates that this transport has been disabled.
321af928962Smrg    </para></listitem>
322af928962Smrg  </varlistentry>
323af928962Smrg  <varlistentry>
324af928962Smrg    <term><symbol>TRANS_NOLISTEN</symbol></term>
325af928962Smrg    <listitem><para>
326af928962Smrgindicates that servers should not open new listeners using this transport.
327af928962Smrg    </para></listitem>
328af928962Smrg  </varlistentry>
329af928962Smrg  <varlistentry>
330af928962Smrg    <term><symbol>TRANS_NOUNLINK</symbol></term>
331af928962Smrg    <listitem><para>
332af928962Smrgset by a transport backend to indicate that the endpoints for its connection
333af928962Smrgshould not be unlinked.
334af928962Smrg    </para></listitem>
335af928962Smrg  </varlistentry>
336af928962Smrg</variablelist>
337af928962Smrg</para>
338af928962Smrg</sect1>
339af928962Smrg
340fe567363Smrg<sect1 id='XtransConnInfo'>
341af928962Smrg<title>XtransConnInfo</title>
342af928962Smrg<para>
343af928962SmrgEach connection will have an opaque <structname>XtransConnInfo</structname>
344af928962Smrgtransport connection
345af928962Smrgobject allocated for it. This record contains information specific to the
346af928962Smrgconnection. The record is defined as:
347af928962Smrg
348af928962Smrg<synopsis>
349af928962Smrgtypedef struct _XtransConnInfo *XtransConnInfo;
350af928962Smrg
351af928962Smrgstruct _XtransConnInfo {
352af928962Smrg    struct _Xtransport     *transptr;
353af928962Smrg    char     *priv;
354af928962Smrg    int          flags;
355af928962Smrg    int          fd;
356af928962Smrg    int          family;
357af928962Smrg    char     *addr;
358af928962Smrg    int          addrlen;
359af928962Smrg    char     *peeraddr;
360af928962Smrg    int          peeraddrlen;
361af928962Smrg};
362af928962Smrg</synopsis>
363af928962Smrg</para>
364af928962Smrg</sect1>
365af928962Smrg</chapter>
366af928962Smrg
367fe567363Smrg<chapter id='Exposed_Transport_Independent_API'>
368af928962Smrg<title>Exposed Transport Independent API</title>
369af928962Smrg
370af928962Smrg<para>
371af928962SmrgThis API is included in each library and server that uses it. The API may
372af928962Smrgbe used by the library, but it is not added to the public API for that
373af928962Smrglibrary. This interface is simply an implementation facilitator. This API
374af928962Smrgcontains a low level set of core primitives, and a few utility functions
375af928962Smrgthat are built on top of the primitives.  The utility functions exist to
376af928962Smrgprovide a more familiar interface that can be used to port existing code.
377af928962Smrg</para>
378af928962Smrg<para>
379af928962SmrgA macro is defined in Xtrans.h for TRANS(func) that creates a unique function
380af928962Smrgname depending on where the code is compiled. For example, when built for
38175ebec6dSmrgXlib, <function>TRANS(OpenCOTSClient)</function> becomes
38275ebec6dSmrg<function>_X11TransOpenCOTSClient</function>.
383af928962Smrg</para>
384af928962Smrg<para>
385af928962SmrgAll failures are considered fatal, and the connection should be closed
386af928962Smrgand re-established if desired. In most cases, however, the value of
387af928962Smrgerrno will be available for debugging purposes.
388af928962Smrg</para>
389fe567363Smrg<sect1 id='Core_Interface_API'>
390af928962Smrg<title>Core Interface API</title>
391af928962Smrg<itemizedlist mark='bullet'>
392af928962Smrg  <listitem>
39375ebec6dSmrg    <funcsynopsis id='TRANSOpenCOTSClient'>
39475ebec6dSmrg      <funcprototype>
39575ebec6dSmrg        <funcdef>XtransConnInfo <function>TRANS(OpenCOTSClient)</function></funcdef>
39675ebec6dSmrg        <paramdef>char *<parameter>address</parameter></paramdef>
39775ebec6dSmrg      </funcprototype>
39875ebec6dSmrg    </funcsynopsis>
399af928962Smrg    <para>
400af928962SmrgThis function creates a Connection-Oriented Transport that is
401af928962Smrgsuitable for use by a client. The parameter <parameter>address</parameter>
40275ebec6dSmrgcontains the full address of the server to which this endpoint will be
40375ebec6dSmrgconnected.  This function returns an opaque transport connection object on
40475ebec6dSmrgsuccess, or <constant>NULL</constant> on failure.
405af928962Smrg    </para>
406af928962Smrg  </listitem>
407af928962Smrg  <listitem>
40875ebec6dSmrg    <funcsynopsis id='TRANSOpenCOTSServer'>
40975ebec6dSmrg      <funcprototype>
41075ebec6dSmrg        <funcdef>XtransConnInfo <function>TRANS(OpenCOTSServer)</function></funcdef>
41175ebec6dSmrg        <paramdef>char *<parameter>address</parameter></paramdef>
41275ebec6dSmrg      </funcprototype>
41375ebec6dSmrg    </funcsynopsis>
414af928962Smrg    <para>
415af928962SmrgThis function creates a Connection-Oriented Transport that is suitable
416af928962Smrgfor use by a server. The parameter <parameter>address</parameter> contains the
41775ebec6dSmrgfull address to which this server will be bound. This function returns an
41875ebec6dSmrgopaque transport connection object on success, or <constant>NULL</constant>
41975ebec6dSmrgon failure.
420af928962Smrg    </para>
421af928962Smrg  </listitem>
422af928962Smrg  <listitem>
42375ebec6dSmrg    <funcsynopsis id='TRANSOpenCLTSClient'>
42475ebec6dSmrg      <funcprototype>
42575ebec6dSmrg        <funcdef>XtransConnInfo <function>TRANS(OpenCLTSClient)</function></funcdef>
42675ebec6dSmrg        <paramdef>char *<parameter>address</parameter></paramdef>
42775ebec6dSmrg      </funcprototype>
42875ebec6dSmrg    </funcsynopsis>
429af928962Smrg    <para>
430af928962SmrgThis function creates a Connection-Less Transport that is suitable for
431af928962Smrguse by a client. The parameter <parameter>address</parameter> contains the
43275ebec6dSmrgfull address of the server to which this endpoint will be connected. This
43375ebec6dSmrgfunction returns an opaque transport connection object on success, or
43475ebec6dSmrg<constant>NULL</constant> on failure.
435af928962Smrg    </para>
436af928962Smrg  </listitem>
437af928962Smrg  <listitem>
43875ebec6dSmrg    <funcsynopsis id='TRANSOpenCLTSServer'>
43975ebec6dSmrg      <funcprototype>
44075ebec6dSmrg        <funcdef>XtransConnInfo <function>TRANS(OpenCLTSServer)</function></funcdef>
44175ebec6dSmrg        <paramdef>char *<parameter>address</parameter></paramdef>
44275ebec6dSmrg      </funcprototype>
44375ebec6dSmrg    </funcsynopsis>
444af928962Smrg    <para>
445af928962SmrgThis function creates a Connection-Less Transport that is suitable for
446af928962Smrguse by a server. The parameter <parameter>address</parameter> contains the
44775ebec6dSmrgfull address to which this server will be bound. This function returns an
44875ebec6dSmrgopaque transport connection object on success, or <constant>NULL</constant>
44975ebec6dSmrgon failure.
450af928962Smrg    </para>
451af928962Smrg  </listitem>
452af928962Smrg  <listitem>
45375ebec6dSmrg    <funcsynopsis id='TRANSSetOption'>
45475ebec6dSmrg      <funcprototype>
45575ebec6dSmrg        <funcdef>int <function>TRANS(SetOption)</function></funcdef>
45675ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
45775ebec6dSmrg        <paramdef>int <parameter>option</parameter></paramdef>
45875ebec6dSmrg        <paramdef>int <parameter>arg</parameter></paramdef>
45975ebec6dSmrg      </funcprototype>
46075ebec6dSmrg    </funcsynopsis>
461af928962Smrg    <para>
462af928962SmrgThis function sets transport options, similar to the way
463af928962Smrg<function>setsockopt()</function> and <function>ioctl()</function> work.
464af928962SmrgThe parameter <parameter>connection</parameter> is an endpoint
46575ebec6dSmrgthat was obtained from <function>_XTransOpen*()</function> functions.
46675ebec6dSmrgThe parameter <parameter>option</parameter> contains the option that will
46775ebec6dSmrgbe set. The actual values for <parameter>option</parameter> are defined in a
46875ebec6dSmrg<link linkend='Transport_Option_Definition'>later section</link>.
46975ebec6dSmrgThe parameter <parameter>arg</parameter> can be used to pass
47075ebec6dSmrgin an additional value that may be required by some options.
47175ebec6dSmrgThis function returns 0 on success and -1 on failure.
472af928962Smrg    </para>
473af928962Smrg    <note><para>
474af928962SmrgBased on current usage, the complimentary function
475af928962Smrg<function>TRANS(GetOption)</function> is not necessary.
476af928962Smrg    </para></note>
477af928962Smrg  </listitem>
478af928962Smrg  <listitem>
47975ebec6dSmrg    <funcsynopsis id='TRANSCreateListener'>
48075ebec6dSmrg      <funcprototype>
48175ebec6dSmrg        <funcdef>int <function>TRANS(CreateListener)</function></funcdef>
48275ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
48375ebec6dSmrg        <paramdef>char *<parameter>port</parameter></paramdef>
48475ebec6dSmrg        <paramdef>int <parameter>flags</parameter></paramdef>
48575ebec6dSmrg      </funcprototype>
48675ebec6dSmrg    </funcsynopsis>
487af928962Smrg    <para>
488af928962SmrgThis function sets up the server endpoint for listening. The parameter
489af928962Smrg<parameter>connection</parameter> is an endpoint that was obtained from
490af928962Smrg<function>TRANS(OpenCOTSServer)()</function> or
491af928962Smrg<function>TRANS(OpenCLTSServer)()</function>. The parameter
49275ebec6dSmrg<parameter>port</parameter> specifies the port to which this endpoint
49375ebec6dSmrgshould be bound for listening. If port is <constant>NULL</constant>,
494af928962Smrgthen the transport may attempt to allocate any available TSAP for this
495af928962Smrgconnection. If the transport cannot support this, then this function will
496af928962Smrgreturn a failure. The <parameter>flags</parameter> parameter can be set
497af928962Smrgto <symbol>ADDR_IN_USE_ALLOWED</symbol> to allow the call to the underlying
498af928962Smrgbinding function to fail with a <errorname>EADDRINUSE</errorname> error
499af928962Smrgwithout causing the <function>TRANS(CreateListener)</function>
500af928962Smrgfunction itself to fail. This function return 0 on success and -1 on failure.
501af928962Smrg    </para>
502af928962Smrg  </listitem>
503af928962Smrg  <listitem>
50475ebec6dSmrg    <funcsynopsis id='TRANSResetListener'>
50575ebec6dSmrg      <funcprototype>
50675ebec6dSmrg        <funcdef>int <function>TRANS(ResetListener)</function></funcdef>
50775ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
50875ebec6dSmrg      </funcprototype>
50975ebec6dSmrg    </funcsynopsis>
510af928962Smrg    <para>
511af928962SmrgWhen a server is restarted, certain listen ports may need to be reset.
512af928962SmrgFor example, unix domain needs to check that the file used for
513af928962Smrgcommunication has not been deleted. If it has, it must be recreated.
514af928962SmrgThe parameter <parameter>connection</parameter> is an opened and bound
515af928962Smrgendpoint that was obtained from <function>TRANS(OpenCOTSServer)()</function>
516af928962Smrgand passed to <function>TRANS(CreateListener)()</function>.
517af928962SmrgThis function will return one of the following values:
518af928962Smrg<symbol>TRANS_RESET_NOOP</symbol>,
519af928962Smrg<symbol>TRANS_RESET_NEW_FD</symbol>, or
520af928962Smrg<symbol>TRANS_RESET_FAILURE</symbol>.
521af928962Smrg    </para>
522af928962Smrg  </listitem>
523af928962Smrg  <listitem>
52475ebec6dSmrg    <funcsynopsis id='TRANSAccept'>
52575ebec6dSmrg      <funcprototype>
52675ebec6dSmrg        <funcdef>XtransConnInfo <function>TRANS(Accept)</function></funcdef>
52775ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
52875ebec6dSmrg      </funcprototype>
52975ebec6dSmrg    </funcsynopsis>
530af928962Smrg    <para>
531af928962SmrgOnce a connection indication is received, this function can be called to
532af928962Smrgaccept the connection. The parameter <parameter>connection</parameter> is
533af928962Smrgan opened and bound endpoint that was obtained from
534af928962Smrg<function>TRANS(OpenCOTSServer)()</function> and passed to
535af928962Smrg<function>TRANS(CreateListener)()</function>. This function will return a
53675ebec6dSmrgnew opaque transport connection object upon success,
53775ebec6dSmrg<constant>NULL</constant> otherwise.
538af928962Smrg    </para>
539af928962Smrg  </listitem>
540af928962Smrg  <listitem>
54175ebec6dSmrg    <funcsynopsis id='TRANSConnect'>
54275ebec6dSmrg      <funcprototype>
54375ebec6dSmrg        <funcdef>int <function>TRANS(Connect)</function></funcdef>
54475ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
54575ebec6dSmrg        <paramdef>char *<parameter>address</parameter></paramdef>
54675ebec6dSmrg      </funcprototype>
54775ebec6dSmrg    </funcsynopsis>
548af928962Smrg    <para>
549af928962SmrgThis function creates a connection to a server. The parameter
550af928962Smrg<parameter>connection</parameter> is an endpoint that was obtained
551af928962Smrgfrom <function>TRANS(OpenCOTSClient)()</function>. The parameter
552af928962Smrg<parameter>address</parameter> specifies the TSAP to which this endpoint
55375ebec6dSmrgshould connect. If the protocol is included in the address, it will be
55475ebec6dSmrgignored. This function returns 0 on success and -1 on failure.
555af928962Smrg    </para>
556af928962Smrg  </listitem>
557af928962Smrg  <listitem>
55875ebec6dSmrg    <funcsynopsis id='TRANSBytesReadable'>
55975ebec6dSmrg      <funcprototype>
56075ebec6dSmrg        <funcdef>int <function>TRANS(BytesReadable)</function></funcdef>
56175ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
56275ebec6dSmrg        <paramdef>BytesReadable_t *<parameter>pend</parameter></paramdef>
56375ebec6dSmrg      </funcprototype>
56475ebec6dSmrg    </funcsynopsis>
565af928962Smrg    <para>
56675ebec6dSmrgThis function provides the same functionality as the
56775ebec6dSmrg<function>BytesReadable</function> macro.
568af928962Smrg    </para>
569af928962Smrg  </listitem>
570af928962Smrg  <listitem>
57175ebec6dSmrg    <funcsynopsis id='TRANSRead'>
57275ebec6dSmrg      <funcprototype>
57375ebec6dSmrg        <funcdef>int <function>TRANS(Read)</function></funcdef>
57475ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
57575ebec6dSmrg        <paramdef>char *<parameter>buf</parameter></paramdef>
57675ebec6dSmrg        <paramdef>int <parameter>size</parameter></paramdef>
57775ebec6dSmrg      </funcprototype>
57875ebec6dSmrg    </funcsynopsis>
579af928962Smrg    <para>
580af928962SmrgThis function will return the number of bytes requested on a COTS
581af928962Smrgconnection, and will return the minimum of the number bytes requested or
582af928962Smrgthe size of the incoming packet on a CLTS connection.
583af928962Smrg    </para>
584af928962Smrg  </listitem>
585af928962Smrg  <listitem>
58675ebec6dSmrg    <funcsynopsis id='TRANSWrite'>
58775ebec6dSmrg      <funcprototype>
58875ebec6dSmrg        <funcdef>int <function>TRANS(Write)</function></funcdef>
58975ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
59075ebec6dSmrg        <paramdef>char *<parameter>buf</parameter></paramdef>
59175ebec6dSmrg        <paramdef>int <parameter>size</parameter></paramdef>
59275ebec6dSmrg      </funcprototype>
59375ebec6dSmrg    </funcsynopsis>
594af928962Smrg    <para>
595af928962SmrgThis function will write the requested number of bytes on a COTS
596af928962Smrgconnection, and will send a packet of the requested size on a CLTS connection.
597af928962Smrg    </para>
598af928962Smrg  </listitem>
599af928962Smrg  <listitem>
60075ebec6dSmrg    <funcsynopsis id='TRANSReadv'>
60175ebec6dSmrg      <funcprototype>
60275ebec6dSmrg        <funcdef>int <function>TRANS(Readv)</function></funcdef>
60375ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
60475ebec6dSmrg        <paramdef>struct iovec *<parameter>buf</parameter></paramdef>
60575ebec6dSmrg        <paramdef>int <parameter>size</parameter></paramdef>
60675ebec6dSmrg      </funcprototype>
60775ebec6dSmrg    </funcsynopsis>
608af928962Smrg    <para>
609af928962SmrgSimilar to <function>TRANS(Read)()</function>.
610af928962Smrg    </para>
611af928962Smrg  </listitem>
612af928962Smrg  <listitem>
61375ebec6dSmrg    <funcsynopsis id='TRANSWritev'>
61475ebec6dSmrg      <funcprototype>
61575ebec6dSmrg        <funcdef>  int <function>TRANS(Writev)</function></funcdef>
61675ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
61775ebec6dSmrg        <paramdef>struct iovec *<parameter>buf</parameter></paramdef>
61875ebec6dSmrg        <paramdef>int <parameter>size</parameter></paramdef>
61975ebec6dSmrg      </funcprototype>
62075ebec6dSmrg    </funcsynopsis>
621af928962Smrg    <para>
622af928962SmrgSimilar to <function>TRANS(Write)()</function>.
623af928962Smrg    </para>
624af928962Smrg  </listitem>
625af928962Smrg  <listitem>
62675ebec6dSmrg    <funcsynopsis id='TRANSDisconnect'>
62775ebec6dSmrg      <funcprototype>
62875ebec6dSmrg        <funcdef>int <function>TRANS(Disconnect)</function></funcdef>
62975ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
63075ebec6dSmrg      </funcprototype>
63175ebec6dSmrg    </funcsynopsis>
632af928962Smrg    <para>
633af928962SmrgThis function is used when an orderly disconnect is desired. This function
634af928962Smrgbreaks the connection on the transport. It is similar to the socket function
635af928962Smrg<function>shutdown()</function>.
636af928962Smrg    </para>
637af928962Smrg  </listitem>
638af928962Smrg  <listitem>
63975ebec6dSmrg    <funcsynopsis id='TRANSClose'>
64075ebec6dSmrg      <funcprototype>
64175ebec6dSmrg        <funcdef>int <function>TRANS(Close)</function></funcdef>
64275ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
64375ebec6dSmrg      </funcprototype>
64475ebec6dSmrg    </funcsynopsis>
645af928962Smrg    <para>
646af928962SmrgThis function closes the transport, unbinds it, and frees all resources that
647af928962Smrgwas associated with the transport. If a <function>TRANS(Disconnect)</function>
648af928962Smrgcall was not made on the connection, a disorderly disconnect may occur.
649af928962Smrg    </para>
650af928962Smrg  </listitem>
651af928962Smrg  <listitem>
65275ebec6dSmrg    <funcsynopsis id='TRANSIsLocal'>
65375ebec6dSmrg      <funcprototype>
65475ebec6dSmrg        <funcdef>int <function>TRANS(IsLocal)</function></funcdef>
65575ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
65675ebec6dSmrg      </funcprototype>
65775ebec6dSmrg    </funcsynopsis>
658af928962Smrg    <para>
659af928962SmrgReturns TRUE if it is a local transport.
660af928962Smrg    </para>
661af928962Smrg  </listitem>
662af928962Smrg  <listitem>
66375ebec6dSmrg    <funcsynopsis id='TRANSGetMyAddr'>
66475ebec6dSmrg      <funcprototype>
66575ebec6dSmrg        <funcdef>int <function>TRANS(GetMyAddr)</function></funcdef>
66675ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
66775ebec6dSmrg        <paramdef>int *<parameter>familyp</parameter></paramdef>
66875ebec6dSmrg        <paramdef>int *<parameter>addrlenp</parameter></paramdef>
66975ebec6dSmrg        <paramdef>Xtransaddr **<parameter>addrp</parameter></paramdef>
67075ebec6dSmrg       </funcprototype>
67175ebec6dSmrg    </funcsynopsis>
67275ebec6dSmrg    <para>
67375ebec6dSmrgThis function is similar to <function>getsockname()</function>.
674af928962SmrgThis function will allocate space for the address, so it must be freed by
675af928962Smrgthe caller. Not all transports will have a valid address until a connection
676af928962Smrgis established.  This function should not be used until the connection is
67775ebec6dSmrgestablished with <function>Connect()</function> or
678af928962Smrg<function>Accept()</function>.
679af928962Smrg    </para>
680af928962Smrg  </listitem>
681af928962Smrg  <listitem>
68275ebec6dSmrg    <funcsynopsis id='TRANSGetPeerAddr'>
68375ebec6dSmrg      <funcprototype>
68475ebec6dSmrg        <funcdef>int <function>TRANS(GetPeerAddr)</function></funcdef>
68575ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
68675ebec6dSmrg        <paramdef>int *<parameter>familyp</parameter></paramdef>
68775ebec6dSmrg        <paramdef>int *<parameter>addrlenp</parameter></paramdef>
68875ebec6dSmrg        <paramdef>Xtransaddr **<parameter>addrp</parameter></paramdef>
68975ebec6dSmrg       </funcprototype>
69075ebec6dSmrg    </funcsynopsis>
69175ebec6dSmrg    <para>
69275ebec6dSmrgThis function is similar to <function>getpeername()</function>.
693af928962SmrgThis function will allocate space for the address, so it must be freed by
694af928962Smrgthe caller. Not all transports will have a valid address until a connection
695af928962Smrgis established.  This function should not be used until the connection is
69675ebec6dSmrgestablished with <function>Connect()</function> or
697af928962Smrg<function>Accept()</function>.
698af928962Smrg    </para>
699af928962Smrg  </listitem>
700af928962Smrg  <listitem>
70175ebec6dSmrg    <funcsynopsis id='TRANSGetConnectionNumber'>
70275ebec6dSmrg      <funcprototype>
70375ebec6dSmrg        <funcdef>int <function>TRANS(GetConnectionNumber)</function></funcdef>
70475ebec6dSmrg        <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
70575ebec6dSmrg      </funcprototype>
70675ebec6dSmrg    </funcsynopsis>
707af928962Smrg    <para>
708af928962SmrgReturns the file descriptor associated with this transport.
709af928962Smrg    </para>
710af928962Smrg  </listitem>
711af928962Smrg  <listitem>
71275ebec6dSmrg    <funcsynopsis id='TRANSMakeAllCOTSServerListeners'>
71375ebec6dSmrg      <funcprototype>
71475ebec6dSmrg        <funcdef>int <function>TRANS(MakeAllCOTSServerListeners)</function></funcdef>
71575ebec6dSmrg        <paramdef>char *<parameter>port</parameter></paramdef>
71675ebec6dSmrg        <paramdef>int *<parameter>partial_ret</parameter></paramdef>
71775ebec6dSmrg        <paramdef>int *<parameter>count_ret</parameter></paramdef>
71875ebec6dSmrg        <paramdef>XtransConnInfo **<parameter>connections_ret</parameter></paramdef>
71975ebec6dSmrg      </funcprototype>
72075ebec6dSmrg    </funcsynopsis>
721af928962Smrg    <para>
722af928962SmrgThis function should be used by most servers. It will try to establish
723af928962Smrga COTS server endpoint for each transport listed in the transport table.
724af928962Smrg<parameter>partial_ret</parameter> will be set to <symbol>True</symbol> if
725af928962Smrgonly a partial network could be created. <parameter>count_ret</parameter> is
726af928962Smrgthe number of transports returned, and <parameter>connections_ret</parameter>
727af928962Smrgis the list of transports.
728af928962Smrg    </para>
729af928962Smrg  </listitem>
730af928962Smrg  <listitem>
73175ebec6dSmrg    <funcsynopsis id='TRANSMakeAllCLTSServerListeners'>
73275ebec6dSmrg      <funcprototype>
73375ebec6dSmrg        <funcdef>int <function>TRANS(MakeAllCLTSServerListeners)</function></funcdef>
73475ebec6dSmrg        <paramdef>char *<parameter>port</parameter></paramdef>
73575ebec6dSmrg        <paramdef>int *<parameter>partial_ret</parameter></paramdef>
73675ebec6dSmrg        <paramdef>int *<parameter>count_ret</parameter></paramdef>
73775ebec6dSmrg        <paramdef>XtransConnInfo **<parameter>connections_ret</parameter></paramdef>
73875ebec6dSmrg      </funcprototype>
73975ebec6dSmrg    </funcsynopsis>
740af928962Smrg    <para>
741af928962SmrgThis function should be used by most servers. It will try to establish a
742af928962SmrgCLTS server endpoint for each transport listed in the transport table.
743af928962Smrg<parameter>partial_ret</parameter> will be set to <symbol>True</symbol> if
744af928962Smrgonly a partial network could be created. <parameter>count_ret</parameter> is
745af928962Smrgthe number of transports returned, and <parameter>connections_ret</parameter>
746af928962Smrgis the list of transports.
747af928962Smrg    </para>
748af928962Smrg  </listitem>
749af928962Smrg</itemizedlist>
750af928962Smrg</sect1>
751af928962Smrg
752fe567363Smrg<sect1 id='Utility_API'>
753af928962Smrg<title>Utility API</title>
754af928962Smrg<para>
755af928962SmrgThis section describes a few useful functions that have been implemented on
756af928962Smrgtop of the Core Interface API.  These functions are being provided as a
757af928962Smrgconvenience.
758af928962Smrg</para>
759af928962Smrg<itemizedlist mark='bullet'>
760af928962Smrg  <listitem>
76175ebec6dSmrg    <funcsynopsis id='TRANSConvertAddress'>
76275ebec6dSmrg      <funcprototype>
76375ebec6dSmrg        <funcdef>int <function>TRANS(ConvertAddress)</function></funcdef>
76475ebec6dSmrg        <paramdef>int *<parameter>familyp</parameter></paramdef>
76575ebec6dSmrg        <paramdef>int *<parameter>addrlenp</parameter></paramdef>
76675ebec6dSmrg        <paramdef>Xtransaddr *<parameter>addrp</parameter></paramdef>
76775ebec6dSmrg      </funcprototype>
76875ebec6dSmrg    </funcsynopsis>
769af928962Smrg    <para>
770af928962SmrgThis function converts a sockaddr based address to an X authorization based
77175ebec6dSmrgaddress (ie <symbol>AF_INET</symbol>, <symbol>AF_UNIX</symbol> to the X
77275ebec6dSmrgprotocol definition (ie <symbol>FamilyInternet</symbol>,
77375ebec6dSmrg<symbol>FamilyLocal</symbol>)).
774af928962Smrg    </para>
775af928962Smrg  </listitem>
776af928962Smrg</itemizedlist>
777af928962Smrg</sect1>
778af928962Smrg</chapter>
779af928962Smrg
780fe567363Smrg<chapter id='Transport_Option_Definition'>
781af928962Smrg<title>Transport Option Definition</title>
782af928962Smrg<para>
783af928962SmrgThe following options are defined for the
78475ebec6dSmrg<link linkend='TRANSSetOption'><function>TRANS(SetOption)()</function></link>
78575ebec6dSmrgfunction. If an OS or transport does not support any of these options,
786af928962Smrgthen it will silently ignore the option.
787af928962Smrg</para>
788af928962Smrg
789af928962Smrg<itemizedlist mark='bullet'>
790af928962Smrg  <listitem>
791af928962Smrg    <para>
792af928962Smrg<symbol>TRANS_NONBLOCKING</symbol>
793af928962Smrg    </para>
794af928962Smrg    <para>
795af928962SmrgThis option controls the blocking mode of the connection. If the argument
796af928962Smrgis set to 1, then the connection will be set to blocking. If the argument
797af928962Smrgis set to 0, then the connection will be set to non- blocking.
798af928962Smrg    </para>
799af928962Smrg  </listitem>
800af928962Smrg  <listitem>
801af928962Smrg    <para>
802af928962Smrg<symbol>TRANS_CLOSEONEXEC</symbol>
803af928962Smrg    </para>
804af928962Smrg    <para>
805af928962SmrgThis option determines what will happen to the connection when an exec is
806af928962Smrgencountered. If the argument is set to 1, then the connection will be
807af928962Smrgclosed when an exec occurs. If the argument is set to 0, then the
808af928962Smrgconnection will not be closed when an exec occurs.
809af928962Smrg    </para>
810af928962Smrg  </listitem>
811af928962Smrg</itemizedlist>
812af928962Smrg</chapter>
813af928962Smrg
814fe567363Smrg<chapter id='Hidden_Transport_Dependent_API'>
815af928962Smrg<title>Hidden Transport Dependent API</title>
816af928962Smrg<para>
817af928962SmrgThe hidden transport dependent functions are placed in the Xtransport record.
818af928962SmrgThese function are similar to the Exposed Transport Independent API, but
819af928962Smrgsome of the parameters and return values are slightly different.  Stuff like
820af928962Smrgthe <code>#ifdef SUNSYSV</code> should be handled inside these functions.
821af928962Smrg</para>
822af928962Smrg
823af928962Smrg<itemizedlist mark='bullet'>
824af928962Smrg  <listitem>
82575ebec6dSmrg    <funcsynopsis id='OpenCOTSClient'>
82675ebec6dSmrg      <funcprototype>
82775ebec6dSmrg        <funcdef>XtransConnInfo *<function>OpenCOTSClient</function></funcdef>
82875ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
82975ebec6dSmrg        <paramdef>char *<parameter>protocol</parameter></paramdef>
83075ebec6dSmrg        <paramdef>char *<parameter>host</parameter></paramdef>
83175ebec6dSmrg        <paramdef>char *<parameter>port</parameter></paramdef>
83275ebec6dSmrg      </funcprototype>
83375ebec6dSmrg    </funcsynopsis>
834af928962Smrg    <para>
835af928962SmrgThis function creates a Connection-Oriented Transport. The parameter
83675ebec6dSmrg<parameter>thistrans</parameter> points to an Xtransport entry in the
83775ebec6dSmrgtransport table. The parameters <parameter>protocol</parameter>,
83875ebec6dSmrg<parameter>host</parameter>, and <parameter>port</parameter>, point to
83975ebec6dSmrgstrings containing the corresponding parts of the address that was passed into
84075ebec6dSmrg<link linkend='TRANSOpenCOTSClient'><function>TRANS(OpenCOTSClient)()</function></link>.
841af928962SmrgThis function must allocate and initialize the contents of the XtransConnInfo
842af928962Smrgstructure that is returned by this function. This function will open the
843af928962Smrgtransport, and bind it into the transport namespace if applicable. The local
844af928962Smrgaddress portion of the XtransConnInfo structure will also be filled in by
845af928962Smrgthis function.
846af928962Smrg    </para>
847af928962Smrg  </listitem>
848af928962Smrg  <listitem>
84975ebec6dSmrg    <funcsynopsis id='OpenCOTSServer'>
85075ebec6dSmrg      <funcprototype>
85175ebec6dSmrg        <funcdef>XtransConnInfo *<function>OpenCOTSServer</function></funcdef>
85275ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
85375ebec6dSmrg        <paramdef>char *<parameter>protocol</parameter></paramdef>
85475ebec6dSmrg        <paramdef>char *<parameter>host</parameter></paramdef>
85575ebec6dSmrg        <paramdef>char *<parameter>port</parameter></paramdef>
85675ebec6dSmrg      </funcprototype>
85775ebec6dSmrg    </funcsynopsis>
858af928962Smrg    <para>
859af928962SmrgThis function creates a Connection-Oriented Transport. The parameter
86075ebec6dSmrg<parameter>thistrans</parameter> points to an Xtransport entry in the
86175ebec6dSmrgtransport table. The parameters <parameter>protocol</parameter>,
86275ebec6dSmrg<parameter>host</parameter>, and <parameter>port</parameter> point to
86375ebec6dSmrgstrings containing the corresponding parts of the address that was passed into
86475ebec6dSmrg<link linkend='TRANSOpenCOTSServer'><function>TRANS(OpenCOTSServer)()</function></link>.
865af928962SmrgThis function must allocate and initialize the contents of the
866af928962SmrgXtransConnInfo structure that is returned by this function. This function
867af928962Smrgwill open the transport.
868af928962Smrg    </para>
869af928962Smrg  </listitem>
870af928962Smrg  <listitem>
87175ebec6dSmrg    <funcsynopsis id='OpenCLTSClient'>
87275ebec6dSmrg      <funcprototype>
87375ebec6dSmrg        <funcdef>XtransConnInfo *<function>OpenCLTSClient</function></funcdef>
87475ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
87575ebec6dSmrg        <paramdef>char *<parameter>protocol</parameter></paramdef>
87675ebec6dSmrg        <paramdef>char *<parameter>host</parameter></paramdef>
87775ebec6dSmrg        <paramdef>char *<parameter>port</parameter></paramdef>
87875ebec6dSmrg      </funcprototype>
87975ebec6dSmrg    </funcsynopsis>
880af928962Smrg    <para>
881af928962SmrgThis function creates a Connection-Less Transport. The parameter
88275ebec6dSmrg<parameter>thistrans</parameter> points to an Xtransport entry in the
88375ebec6dSmrgtransport table. The parameters <parameter>protocol</parameter>,
88475ebec6dSmrg<parameter>host</parameter>, and <parameter>port</parameter> point to strings
88575ebec6dSmrgcontaining the corresponding parts of the address that was passed into
88675ebec6dSmrg<link linkend='TRANSOpenCLTSClient'><function>TRANS(OpenCLTSClient)()</function></link>.
887af928962SmrgThis function must allocate and initialize the contents of the XtransConnInfo
888af928962Smrgstructure that is returned by this function. This function will open the
889af928962Smrgtransport, and bind it into the transport namespace if applicable. The
890af928962Smrglocal address portion of the XtransConnInfo structure will also be filled
891af928962Smrgin by this function.
892af928962Smrg    </para>
893af928962Smrg  </listitem>
894af928962Smrg  <listitem>
89575ebec6dSmrg    <funcsynopsis id='OpenCLTSServer'>
89675ebec6dSmrg      <funcprototype>
89775ebec6dSmrg        <funcdef>XtransConnInfo *<function>OpenCLTSServer</function></funcdef>
89875ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
89975ebec6dSmrg        <paramdef>char *<parameter>protocol</parameter></paramdef>
90075ebec6dSmrg        <paramdef>char *<parameter>host</parameter></paramdef>
90175ebec6dSmrg        <paramdef>char *<parameter>port</parameter></paramdef>
90275ebec6dSmrg      </funcprototype>
90375ebec6dSmrg    </funcsynopsis>
904af928962Smrg    <para>
905af928962SmrgThis function creates a Connection-Less Transport. The parameter
90675ebec6dSmrg<parameter>thistrans</parameter> points to an Xtransport entry in the
90775ebec6dSmrgtransport table. The parameters <parameter>protocol</parameter>,
90875ebec6dSmrg<parameter>host</parameter>, and <parameter>port</parameter> point to strings
90975ebec6dSmrgcontaining the corresponding parts of the address that was passed into
91075ebec6dSmrg<link linkend='TRANSOpenCLTSServer'><function>TRANS(OpenCLTSServer)()</function></link>.
911af928962SmrgThis function must allocate and initialize the contents of the
912af928962SmrgXtransConnInfo structure that is returned by this function. This
913af928962Smrgfunction will open the transport.
914af928962Smrg    </para>
915af928962Smrg  </listitem>
916af928962Smrg  <listitem>
91775ebec6dSmrg    <funcsynopsis id='SetOption'>
91875ebec6dSmrg      <funcprototype>
91975ebec6dSmrg        <funcdef>int <function>SetOption</function></funcdef>
92075ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
92175ebec6dSmrg        <paramdef>int <parameter>option</parameter></paramdef>
92275ebec6dSmrg        <paramdef>int <parameter>arg</parameter></paramdef>
92375ebec6dSmrg      </funcprototype>
92475ebec6dSmrg    </funcsynopsis>
925af928962Smrg    <para>
926af928962SmrgThis function provides a transport dependent way of implementing the
927af928962Smrgoptions defined by the X Transport Interface. In the current prototype,
928af928962Smrgthis function is not being used, because all of the options defined so far
929af928962Smrgare transport independent. This function will have to be used if a radically
930af928962Smrgdifferent transport type is added, or a transport dependent option is defined.
931af928962Smrg    </para>
932af928962Smrg  </listitem>
933af928962Smrg  <listitem>
93475ebec6dSmrg    <funcsynopsis id='CreateListener'>
93575ebec6dSmrg      <funcprototype>
93675ebec6dSmrg        <funcdef>int <function>CreateListener</function></funcdef>
93775ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
93875ebec6dSmrg        <paramdef>char <parameter>*port</parameter></paramdef>
93975ebec6dSmrg        <paramdef>int <parameter>flags</parameter></paramdef>
94075ebec6dSmrg      </funcprototype>
94175ebec6dSmrg    </funcsynopsis>
942af928962Smrg    <para>
943af928962SmrgThis function takes a transport endpoint opened for a server, and sets it
944af928962Smrgup to listen for incoming connection requests. The parameter
945af928962Smrg<parameter>port</parameter>
946af928962Smrgcontains the port portion of the address that was passed to the Open function.
947af928962SmrgThe parameter <parameter>flags</parameter> should be set to
948af928962Smrg<symbol>ADDR_IN_USE_ALLOWED</symbol> if the underlying transport endpoint
949af928962Smrgmay be already bound and this should not be considered
950af928962Smrgas an error. Otherwise flags should be set to 0. This is used by IPv6 code,
951af928962Smrgwhere the same socket can be bound to both an IPv6 address and then to a
952af928962SmrgIPv4 address.  This function will bind the transport into the transport
953af928962Smrgname space if applicable, and fill in the local address portion of the
954af928962SmrgXtransConnInfo structure. The transport endpoint will then be set to
955af928962Smrglisten for incoming connection requests.
956af928962Smrg    </para>
957af928962Smrg  </listitem>
958af928962Smrg  <listitem>
95975ebec6dSmrg    <funcsynopsis id='ResetListener'>
96075ebec6dSmrg      <funcprototype>
96175ebec6dSmrg        <funcdef>int <function>ResetListener</function></funcdef>
96275ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
96375ebec6dSmrg      </funcprototype>
96475ebec6dSmrg    </funcsynopsis>
965af928962Smrg    <para>
966af928962SmrgThis function resets the transport for listening.
967af928962Smrg    </para>
968af928962Smrg  </listitem>
969af928962Smrg  <listitem>
97075ebec6dSmrg    <funcsynopsis id='Accept'>
97175ebec6dSmrg      <funcprototype>
97275ebec6dSmrg        <funcdef> XtransConnInfo <function>Accept</function></funcdef>
97375ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
97475ebec6dSmrg      </funcprototype>
97575ebec6dSmrg    </funcsynopsis>
976af928962Smrg    <para>
977af928962SmrgThis function creates a new transport endpoint as a result of an
978af928962Smrgincoming connection request. The parameter
979af928962Smrg<parameter>thistrans</parameter> is the endpoint
980af928962Smrgthat was opened for listening by the server. The new endpoint is
981af928962Smrgopened and bound into the transport’s namespace. A XtransConnInfo
982af928962Smrgstructure describing the new endpoint is returned from this function
983af928962Smrg    </para>
984af928962Smrg  </listitem>
985af928962Smrg  <listitem>
98675ebec6dSmrg    <funcsynopsis id='Connect'>
98775ebec6dSmrg      <funcprototype>
98875ebec6dSmrg        <funcdef>int <function>Connect</function></funcdef>
98975ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
99075ebec6dSmrg        <paramdef>char *<parameter>host</parameter></paramdef>
99175ebec6dSmrg        <paramdef>char *<parameter>port</parameter></paramdef>
99275ebec6dSmrg      </funcprototype>
99375ebec6dSmrg    </funcsynopsis>
994af928962Smrg    <para>
995af928962SmrgThis function establishes a connection to a server. The parameters
99675ebec6dSmrg<parameter>host</parameter> and <parameter>port</parameter>
997af928962Smrgdescribe the server to which the connection should be
998af928962Smrgestablished. The connection will be established so that
999af928962Smrg<function>Read()</function> and
1000af928962Smrg<function>Write()</function> call can be made.
1001af928962Smrg    </para>
1002af928962Smrg  </listitem>
1003af928962Smrg  <listitem>
100475ebec6dSmrg    <funcsynopsis id='BytesReadable'>
100575ebec6dSmrg      <funcprototype>
100675ebec6dSmrg        <funcdef>int <function>BytesReadable</function></funcdef>
100775ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
100875ebec6dSmrg        <paramdef>BytesReadable_t *<parameter>pend</parameter></paramdef>
100975ebec6dSmrg      </funcprototype>
101075ebec6dSmrg    </funcsynopsis>
101175ebec6dSmrg    <para>
101275ebec6dSmrgThis function replaces the <function>BytesReadable()</function>
101375ebec6dSmrgmacro. This allows each transport to have its own mechanism for determining
1014af928962Smrghow much data is ready to be read.
1015af928962Smrg    </para>
1016af928962Smrg  </listitem>
1017af928962Smrg  <listitem>
101875ebec6dSmrg    <funcsynopsis id='Read'>
101975ebec6dSmrg      <funcprototype>
102075ebec6dSmrg        <funcdef>int <function>Read</function></funcdef>
102175ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
102275ebec6dSmrg        <paramdef>char *<parameter>buf</parameter></paramdef>
102375ebec6dSmrg        <paramdef>int <parameter>size</parameter></paramdef>
102475ebec6dSmrg      </funcprototype>
102575ebec6dSmrg    </funcsynopsis>
102675ebec6dSmrg    <para>
102775ebec6dSmrgThis function reads <parameter>size</parameter> bytes into
102875ebec6dSmrg<parameter>buf</parameter> from the connection.
1029af928962Smrg    </para>
1030af928962Smrg  </listitem>
1031af928962Smrg  <listitem>
103275ebec6dSmrg    <funcsynopsis id='Write'>
103375ebec6dSmrg      <funcprototype>
103475ebec6dSmrg        <funcdef>int <function>Write</function></funcdef>
103575ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
103675ebec6dSmrg        <paramdef>char *<parameter>buf</parameter></paramdef>
103775ebec6dSmrg        <paramdef>int <parameter>size</parameter></paramdef>
103875ebec6dSmrg      </funcprototype>
103975ebec6dSmrg    </funcsynopsis>
104075ebec6dSmrg    <para>
104175ebec6dSmrgThis function writes <parameter>size</parameter> bytes from
104275ebec6dSmrg<parameter>buf</parameter> to the connection.
1043af928962Smrg    </para>
1044af928962Smrg  </listitem>
1045af928962Smrg  <listitem>
104675ebec6dSmrg    <funcsynopsis id='Readv'>
104775ebec6dSmrg      <funcprototype>
104875ebec6dSmrg        <funcdef>int <function>Readv</function></funcdef>
104975ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
105075ebec6dSmrg        <paramdef>struct iovec *<parameter>buf</parameter></paramdef>
105175ebec6dSmrg        <paramdef>int <parameter>size</parameter></paramdef>
105275ebec6dSmrg      </funcprototype>
105375ebec6dSmrg    </funcsynopsis>
1054af928962Smrg    <para>
1055af928962SmrgThis function performs a <function>readv()</function> on the connection.
1056af928962Smrg    </para>
1057af928962Smrg  </listitem>
1058af928962Smrg  <listitem>
105975ebec6dSmrg    <funcsynopsis id='Writev'>
106075ebec6dSmrg      <funcprototype>
106175ebec6dSmrg        <funcdef>int <function>Writev</function></funcdef>
106275ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
106375ebec6dSmrg        <paramdef>struct iovec *<parameter>buf</parameter></paramdef>
106475ebec6dSmrg        <paramdef>int <parameter>size</parameter></paramdef>
106575ebec6dSmrg      </funcprototype>
106675ebec6dSmrg    </funcsynopsis>
1067af928962Smrg    <para>
1068af928962SmrgThis function performs a <function>writev()</function> on the connection.
1069af928962Smrg    </para>
1070af928962Smrg  </listitem>
1071af928962Smrg  <listitem>
107275ebec6dSmrg    <funcsynopsis id='Disconnect'>
107375ebec6dSmrg      <funcprototype>
107475ebec6dSmrg        <funcdef>int <function>Disconnect</function></funcdef>
107575ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
107675ebec6dSmrg      </funcprototype>
107775ebec6dSmrg    </funcsynopsis>
1078af928962Smrg    <para>
1079af928962SmrgThis function initiates an orderly shutdown of a connection. If a
1080af928962Smrgtransport does not distinguish between orderly and disorderly
1081af928962Smrgdisconnects, then a call to this function will have no affect.
1082af928962Smrg    </para>
1083af928962Smrg  </listitem>
1084af928962Smrg  <listitem>
108575ebec6dSmrg    <funcsynopsis id='Close'>
108675ebec6dSmrg      <funcprototype>
108775ebec6dSmrg        <funcdef>int <function>Close</function></funcdef>
108875ebec6dSmrg        <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
108975ebec6dSmrg      </funcprototype>
109075ebec6dSmrg    </funcsynopsis>
1091af928962Smrg    <para>
1092af928962SmrgThis function will break the connection, and close the endpoint.
1093af928962Smrg    </para>
1094af928962Smrg  </listitem>
1095af928962Smrg</itemizedlist>
1096af928962Smrg</chapter>
1097fe567363Smrg<chapter id='Configuration'>
1098af928962Smrg<title>Configuration</title>
1099af928962Smrg
1100af928962Smrg<para>
1101af928962SmrgThe implementation of each transport can be platform specific. It is expected
1102af928962Smrgthat existing connection types such as <symbol>TCPCONN</symbol>,
1103af928962Smrg<symbol>UNIXCONN</symbol>, <symbol>LOCALCONN</symbol>, and
1104af928962Smrg<symbol>STREAMSCONN</symbol> will be replaced with flags for each
1105af928962Smrgpossible transport type.
1106af928962Smrg</para>
1107af928962Smrg<para>
1108af928962SmrgIn X11R6, the below flags to enable transport types were set in
1109af928962Smrg<symbol>ConnectionFlags</symbol> in the <filename>vendor.cf</filename> or
1110af928962Smrg<filename>site.def</filename> config files.
1111af928962Smrg</para>
1112af928962Smrg<para>
1113af928962SmrgIn X11R7 modular releases, these flags are set when running
1114af928962Smrg<filename>configure</filename> scripts which include the
1115af928962Smrg<function>XTRANS_CONNECTION_FLAGS</function> macro from
1116af928962Smrg<filename>xtrans.m4</filename>.
1117af928962Smrg</para>
1118fe567363Smrg
1119fe567363Smrg<informaltable frame='topbot'>
1120fe567363Smrg  <tgroup cols='3' align='left' colsep='0' rowsep='0'>
1121fe567363Smrg    <colspec colname='define' colwidth='1.0*' />
1122fe567363Smrg    <colspec colname='enable' colwidth='2.0*' />
1123fe567363Smrg    <colspec colname='desc'   colwidth='2.0*'/>
1124af928962Smrg    <thead>
1125fe567363Smrg      <row rowsep='1'>
1126af928962Smrg	<entry><code>#define</code></entry>
1127af928962Smrg	<entry>configure flag</entry>
1128af928962Smrg	<entry>Description</entry>
1129af928962Smrg      </row>
1130af928962Smrg    </thead>
1131af928962Smrg    <tbody>
1132af928962Smrg      <row>
1133af928962Smrg	<entry><symbol>TCPCONN</symbol></entry>
1134af928962Smrg	<entry><option>--enable-tcp-transport</option></entry>
1135af928962Smrg	<entry>
1136af928962Smrg	Enables the INET (IPv4) Domain Socket based transport
1137af928962Smrg	</entry>
1138af928962Smrg      </row>
1139af928962Smrg      <row>
1140af928962Smrg	<entry><symbol>IPv6</symbol></entry>
1141af928962Smrg	<entry><option>--enable-ipv6</option></entry>
1142af928962Smrg	<entry>
1143af928962Smrg	Extends <symbol>TCPCONN</symbol> to enable IPv6 Socket based transport
1144af928962Smrg	</entry>
1145af928962Smrg      </row>
1146af928962Smrg      <row>
1147af928962Smrg	<entry><symbol>UNIXCONN</symbol></entry>
1148af928962Smrg	<entry><option>--enable-unix-transport</option></entry>
1149af928962Smrg	<entry>
1150af928962Smrg	Enables the UNIX Domain Socket based transport
1151af928962Smrg	</entry>
1152af928962Smrg      </row>
1153af928962Smrg      <row>
1154af928962Smrg	<entry><symbol>STREAMSCONN</symbol></entry>
1155af928962Smrg	<entry><emphasis>Not available in X11R7</emphasis></entry>
1156af928962Smrg	<entry>
1157af928962Smrg	Enables the TLI based transports
1158af928962Smrg	</entry>
1159af928962Smrg      </row>
1160af928962Smrg      <row>
1161af928962Smrg	<entry><symbol>LOCALCONN</symbol></entry>
1162af928962Smrg	<entry><option>--enable-local-transport</option></entry>
1163af928962Smrg	<entry>
1164af928962Smrg	Enables the SYSV Local connection transports
1165af928962Smrg	</entry>
1166af928962Smrg      </row>
1167af928962Smrg      <row>
1168af928962Smrg	<entry><symbol>DNETCONN</symbol></entry>
1169af928962Smrg	<entry><emphasis>Not available in X11R7</emphasis></entry>
1170af928962Smrg	<entry>
1171af928962Smrg	Enables the DECnet transports
1172af928962Smrg	</entry>
1173af928962Smrg      </row>
1174af928962Smrg    </tbody>
1175af928962Smrg  </tgroup>
1176af928962Smrg</informaltable>
1177af928962Smrg
1178af928962Smrg
1179af928962Smrg</chapter>
1180af928962Smrg
1181fe567363Smrg<chapter id='Transport_Specific_Definitions'>
1182af928962Smrg<title>Transport Specific Definitions</title>
1183af928962Smrg
1184fe567363Smrg<informaltable frame='all' colsep='1' rowsep='1'>
1185af928962Smrg  <tgroup cols='4' align='center'>
1186fe567363Smrg    <colspec colname='c1' colwidth='1.0*'/>
1187fe567363Smrg    <colspec colname='c2' colwidth='1.0*'/>
1188fe567363Smrg    <colspec colname='c3' colwidth='3.0*'/>
1189fe567363Smrg    <colspec colname='c4' colwidth='2.0*'/>
1190af928962Smrg    <thead>
1191af928962Smrg      <row>
1192fe567363Smrg        <entry morerows="1">Protocol Family</entry>
1193af928962Smrg        <entry namest="c2" nameend="c4"  align='center'>Address Component</entry>
1194af928962Smrg      </row>
1195af928962Smrg      <row>
1196af928962Smrg        <entry align='center'>protocol</entry>
1197af928962Smrg        <entry align='center'>host</entry>
1198af928962Smrg        <entry align='center'>port</entry>
1199af928962Smrg      </row>
1200af928962Smrg    </thead>
1201af928962Smrg    <tbody>
1202af928962Smrg      <row>
1203fe567363Smrg        <entry>Internet</entry>
1204fe567363Smrg        <entry>inet inet6 tcp udp</entry>
1205fe567363Smrg        <entry>name of an internet addressable host</entry>
1206fe567363Smrg        <entry>string containing the name of a service or a valid port number.  Example: "xserver0", "7100"</entry>
1207af928962Smrg      </row>
1208af928962Smrg      <row>
1209fe567363Smrg        <entry>DECnet</entry>
1210fe567363Smrg        <entry>decnet</entry>
1211fe567363Smrg        <entry>name of a DECnet addressable host</entry>
1212fe567363Smrg        <entry>string containing the complete name of the object.  Example: "X$X0"</entry>
1213af928962Smrg      </row>
1214af928962Smrg      <row>
1215fe567363Smrg        <entry>NETware</entry>
1216fe567363Smrg        <entry>ipx</entry>
1217fe567363Smrg        <entry>name of a NETware addressable host</entry>
1218fe567363Smrg        <entry>Not sure of the specifics yet.</entry>
1219af928962Smrg      </row>
1220af928962Smrg      <row>
1221fe567363Smrg        <entry>OSI</entry>
1222fe567363Smrg        <entry>osi</entry>
1223fe567363Smrg        <entry>name of an OSI adressable host.</entry>
1224fe567363Smrg        <entry>Not sure of the specifics yet.</entry>
1225af928962Smrg      </row>
1226af928962Smrg      <row>
1227fe567363Smrg        <entry>Local</entry>
1228fe567363Smrg        <entry>local pts named sco isc</entry>
1229fe567363Smrg        <entry>(ignored)</entry>
1230fe567363Smrg        <entry>String containing the port name, ie "xserver0", "fontserver0".</entry>
1231af928962Smrg      </row>
1232af928962Smrg    </tbody>
1233af928962Smrg  </tgroup>
1234af928962Smrg</informaltable>
1235af928962Smrg
1236af928962Smrg</chapter>
1237af928962Smrg
1238fe567363Smrg<chapter id='Implementation_Notes'>
1239af928962Smrg<title>Implementation Notes</title>
1240af928962Smrg<para>
1241af928962SmrgThis section refers to the prototype implementation that is being developed
1242af928962Smrgconcurrently with this document. This prototype has been able to flush out many
1243af928962Smrgdetails and problems as the specification was being developed.
1244af928962Smrg</para>
1245af928962Smrg<para>
1246af928962SmrgIn X11R6, all of the source code for this interface was located in
1247af928962Smrg<filename>xc/lib/xtrans</filename>.
1248af928962Smrg</para>
1249af928962Smrg<para>
1250af928962SmrgIn X11R7, all of the source code for this interface is delivered via
1251af928962Smrgthe <systemitem>lib/libxtrans</systemitem> modular package from X.Org,
1252af928962Smrgand is installed under
1253af928962Smrg<filename><replaceable>${prefix}</replaceable>/X11/Xtrans</filename>
1254af928962Smrgso that other modules may find it when they build.
1255af928962Smrg</para>
1256af928962Smrg<para>
1257af928962SmrgAll functions names in the source are of the format
1258af928962Smrg<function>TRANS(func)()</function>. The
1259af928962Smrg<function>TRANS()</function>
1260af928962Smrgmacro is defined as
1261af928962Smrg<programlisting language="C">
1262af928962Smrg#define TRANS(func) _PROTOCOLTrans##func
1263af928962Smrg</programlisting>
1264af928962Smrg</para>
1265af928962Smrg
1266af928962Smrg<para>
1267af928962Smrg<symbol>PROTOCOL</symbol> will be uniquely defined in each directory
1268af928962Smrgwhere this code is compiled.
1269af928962Smrg<symbol>PROTOCOL</symbol> will be defined to be the name of the protocol
1270af928962Smrgthat is implemented by the library or server, such as X11, FS, and ICE.
1271af928962Smrg</para>
1272af928962Smrg
1273af928962Smrg<para>
1274af928962SmrgAll libraries and servers that use the X Transport Interface should have a new
1275af928962Smrgfile called <filename><replaceable>TRANSPORT</replaceable>trans.c</filename>.
1276af928962SmrgThis file will include the transports based on the configuration flags
1277af928962Smrgprovided by the <filename>configure</filename> script. Below is an
1278af928962Smrgexample <filename>xfstrans.c</filename> for the font server.
1279af928962Smrg</para>
1280af928962Smrg
1281af928962Smrg<programlisting language="C">
1282af928962Smrg#include "config.h"
1283af928962Smrg
1284af928962Smrg#define FONT_t 1
1285af928962Smrg#define TRANS_REOPEN 1
1286af928962Smrg#define TRANS_SERVER 1
1287af928962Smrg
1288af928962Smrg#include &lt;X11/Xtrans/transport.c&gt;
1289af928962Smrg</programlisting>
1290af928962Smrg<para>
1291af928962SmrgThe source files for this interface are listed below.
1292af928962Smrg</para>
1293af928962Smrg
1294af928962Smrg<variablelist>
1295af928962Smrg  <varlistentry>
1296af928962Smrg    <term><filename>Xtrans.h</filename></term>
1297af928962Smrg    <listitem><para>
1298af928962SmrgFunction prototypes and defines for the Transport Independent API.
1299af928962Smrg    </para></listitem>
1300af928962Smrg  </varlistentry>
1301af928962Smrg  <varlistentry>
1302af928962Smrg    <term><filename>Xtransint.h</filename></term>
1303af928962Smrg    <listitem><para>
1304af928962SmrgUsed by the interface implementation only.
1305af928962SmrgContains the internal data structures.
1306af928962Smrg    </para></listitem>
1307af928962Smrg  </varlistentry>
1308af928962Smrg  <varlistentry>
1309af928962Smrg    <term><filename>Xtranssock.c</filename></term>
1310af928962Smrg    <listitem><para>
1311af928962SmrgSocket implementation of the Transport Dependent API.
1312af928962Smrg    </para></listitem>
1313af928962Smrg  </varlistentry>
1314af928962Smrg  <varlistentry>
1315af928962Smrg    <term><filename>Xtranstli.c</filename></term>
1316af928962Smrg    <listitem><para>
1317af928962SmrgTLI implementation of the Transport Dependent API.
1318af928962Smrg    </para></listitem>
1319af928962Smrg  </varlistentry>
1320af928962Smrg  <varlistentry>
1321af928962Smrg    <term><filename>Xtransdnet.c</filename></term>
1322af928962Smrg    <listitem><para>
1323af928962SmrgDECnet implementation of the Transport Dependent API.
1324af928962Smrg    </para></listitem>
1325af928962Smrg  </varlistentry>
1326af928962Smrg  <varlistentry>
1327af928962Smrg    <term><filename>Xtranslocal.c</filename></term>
1328af928962Smrg    <listitem><para>
1329af928962SmrgImplementation of the Transport Dependent API for SYSV Local connections.
1330af928962Smrg    </para></listitem>
1331af928962Smrg  </varlistentry>
1332af928962Smrg  <varlistentry>
1333af928962Smrg    <term><filename>Xtrans.c</filename></term>
1334af928962Smrg    <listitem><para>
1335af928962SmrgExposed Transport Independent API Functions.
1336af928962Smrg    </para></listitem>
1337af928962Smrg  </varlistentry>
1338af928962Smrg  <varlistentry>
1339af928962Smrg    <term><filename>Xtransutil.c</filename></term>
1340af928962Smrg    <listitem><para>
1341af928962SmrgCollection of Utility functions that use the X Transport Interface.
1342af928962Smrg    </para></listitem>
1343af928962Smrg  </varlistentry>
1344af928962Smrg</variablelist>
1345af928962Smrg
1346af928962Smrg
1347af928962Smrg<para>
1348af928962SmrgThe file <filename>Xtransint.h</filename> contains much of the transport
1349af928962Smrgrelated code that was previously in <filename>Xlibint.h</filename> and
1350af928962Smrg<filename>Xlibnet.h</filename>.
1351af928962SmrgThis will make the definitions available for all transport users. This
1352af928962Smrgshould also obsolete the equivalent code in other libraries.
1353af928962Smrg</para>
1354af928962Smrg
1355af928962Smrg</chapter>
1356af928962Smrg</book>
1357