xtrans.xml revision 6a3641a6
1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 4[ 5<!ENTITY % defs SYSTEM "defs.ent"> %defs; 6]> 7 8<!-- lifted from troff+ms+XMan by doclifter --> 9<book id="xtrans"> 10 11<bookinfo> 12 <title>X Transport Interface</title> 13 <subtitle>X Consortium Standard</subtitle> 14 <authorgroup> 15 <author> 16 <firstname>Stuart</firstname><surname>Anderson</surname> 17 <affiliation><orgname>NCR Corporation</orgname></affiliation> 18 </author> 19 <othercredit><firstname>Ralph</firstname><surname>Mor</surname> 20 <affiliation><orgname>X Consortium</orgname></affiliation> 21 </othercredit> 22 <othercredit><firstname>Alan</firstname><surname>Coopersmith</surname> 23 <affiliation><orgname>Oracle Corp.</orgname></affiliation> 24 </othercredit> 25 </authorgroup> 26 <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 27 <releaseinfo>Version 1.2</releaseinfo> 28 <copyright><year>1993</year><year>1994</year> 29 <holder>NCR Corporation - Dayton, Ohio, USA</holder> 30 </copyright> 31 32<legalnotice> 33<para> 34All Rights Reserved 35</para> 36<para> 37Permission to use, copy, modify, and distribute this software and its 38documentation for any purpose and without fee is hereby granted, provided 39that the above copyright notice appear in all copies and that both that 40copyright notice and this permission notice appear in supporting 41documentation, and that the name NCR not be used in advertising 42or publicity pertaining to distribution of the software without specific, 43written prior permission. NCR makes no representations about the 44suitability of this software for any purpose. It is provided "as is" 45without express or implied warranty. 46</para> 47<para> 48NCR DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 49INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN 50NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR 51CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 52OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 53NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 54CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 55</para> 56</legalnotice> 57 58<legalnotice> 59<para role="multiLicensing"> 60Copyright © 1993, 1994, 2002 The Open Group 61</para> 62<para> 63Permission is hereby granted, free of charge, to any person obtaining a copy 64of this software and associated documentation files (the “Software”), to deal 65in the Software without restriction, including without limitation the rights 66to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 67copies of the Software, and to permit persons to whom the Software is 68furnished to do so, subject to the following conditions: 69</para> 70<para> 71The above copyright notice and this permission notice shall be included in 72all copies or substantial portions of the Software. 73</para> 74<para> 75THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 76IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 77FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 78OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 79AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 80CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 81</para> 82<para> 83Except as contained in this notice, the name of The Open Group shall not be 84used in advertising or otherwise to promote the sale, use or other dealings 85in this Software without prior written authorization from The Open Group. 86</para> 87<para> 88X Window System is a trademark of The Open Group, Inc. 89</para> 90</legalnotice> 91</bookinfo> 92 93<preface><title>The X Transport Interface</title> 94<para> 95Designed by Stuart Anderson (NCR) with help from Ralph Mor (X Consortium) 96</para> 97 98<note><para> 99This documentation does not completely match the implementation in R6 100(as a result of some late changes made in the code). Specifically, support 101was added for font server cloning, and conditional compliation was introduced 102for client vs. server code. 103</para></note> 104</preface> 105 106<chapter id='Purposes_and_Goals'> 107<title>Purposes and Goals</title> 108 109<para>The X Transport Interface is intended to combine all system and 110transport specific code into a single place in the source tree. This API 111should be used by all libraries, clients and servers of the X Window System. 112Use of this API should allow the addition of new types of transports and 113support for new platforms without making any changes to the source except 114in the X Transport Interface code.</para> 115<para>This interface should solve the problem of multiple 116<code>#ifdef TRANSPORT</code> and <code>#ifdef PLATFORM</code> 117statements scattered throughout the source tree.</para> 118<para>This interface should provide enough functionality to support all 119types of protocols, including connection oriented protocols such as X11 and 120FS, and connection-less oriented protocols such as XDMCP.</para> 121 122</chapter> 123 124<chapter id='Overview_of_the_Interface'> 125<title>Overview of the Interface</title> 126 127<para> 128The interface provides an API for use by applications. The functions in 129this API perform work that is common to all transports and systems, such 130as parsing an address into a host and port number. The functions in this 131API call transport specific functions that are contained in a table whose 132contents are defined at compile time. This table contains an entry for each 133type of transport. Each entry is a record containing mostly pointers to 134function that implements the interface for the given transport. 135</para> 136<para> 137This API does not provide an abstraction for <function>select()</function> 138or <function>poll()</function>. 139These functions are themselves transport independent, so an additional 140interface is not needed for these functions. It is also unclear how such 141an interface would affect performance. 142</para> 143</chapter> 144 145<chapter id='Definition_of_Address_Specification_Format'> 146<title>Definition of Address Specification Format</title> 147 148<para> 149Addresses are specified in the following syntax, 150 151<synopsis> 152<replaceable>protocol</replaceable>/<replaceable>host</replaceable>:<replaceable>port</replaceable> 153</synopsis> 154 155where <replaceable>protocol</replaceable> specifies a protocol family 156or an alias for a protocol family. A definition of common protocol 157families is given in a later section. 158</para> 159<para> 160The <replaceable>host</replaceable> part specifies the name of a host or other 161transport dependent entity that could be interpreted as a Network Service Access Point 162(NSAP). 163</para> 164<para> 165The <replaceable>port</replaceable> part specifies the name of a Transport Service 166Access Point (TSAP). The format of the TSAP is defined by the underlying transport 167implementation, but it is represented using a string format when it is 168part of an address. 169</para> 170</chapter> 171 172<chapter id='Internal_Data_Structures'> 173<title>Internal Data Structures</title> 174<para> 175There are two major data structures associated with the transport 176independent portion of this interface. Additional data structures 177may be used internally by each transport. 178</para> 179<sect1 id='Xtransport'> 180<title>Xtransport</title> 181<para> 182Each transport supported has an entry in the transport table. The transport 183table is an array of Xtransport records. Each record contains all the entry 184points for a single transport. This record is defined as: 185</para> 186 187<synopsis> 188typedef struct _Xtransport { 189 190 const char *TransName; 191 int flags; 192 193 XtransConnInfo (*OpenCOTSClient)( 194 struct _Xtransport *, /* transport */ 195 const char *, /* protocol */ 196 const char *, /* host */ 197 const char * /* port */ 198 ); 199 200 XtransConnInfo (*OpenCOTSServer)( 201 struct _Xtransport *, /* transport */ 202 const char *, /* protocol */ 203 const char *, /* host */ 204 const char * /* port */ 205 ); 206 207 XtransConnInfo (*OpenCLTSClient)( 208 struct _Xtransport *, /* transport */ 209 const char *, /* protocol */ 210 const char *, /* host */ 211 const char * /* port */ 212 ); 213 214 XtransConnInfo (*OpenCLTSServer)( 215 struct _Xtransport *, /* transport */ 216 const char *, /* protocol */ 217 const char *, /* host */ 218 const char * /* port */ 219 ); 220 221 int (*SetOption)( 222 XtransConnInfo, /* connection */ 223 int, /* option */ 224 int /* arg */ 225 ); 226 227 int (*CreateListener)( 228 XtransConnInfo, /* connection */ 229 const char *, /* port */ 230 int /* flags */ 231 ); 232 233 int (*ResetListener)( 234 XtransConnInfo /* connection */ 235 ); 236 237 XtransConnInfo (*Accept)( 238 XtransConnInfo /* connection */ 239 ); 240 241 int (*Connect)( 242 XtransConnInfo, /* connection */ 243 const char *, /* host */ 244 const char * /* port */ 245 ); 246 247 int (*BytesReadable)( 248 XtransConnInfo, /* connection */ 249 BytesReadable_t * /* pend */ 250 ); 251 252 int (*Read)( 253 XtransConnInfo, /* connection */ 254 char *, /* buf */ 255 int /* size */ 256 ); 257 258 int (*Write)( 259 XtransConnInfo, /* connection */ 260 char *, /* buf */ 261 int /* size */ 262 ); 263 264 int (*Readv)( 265 XtransConnInfo, /* connection */ 266 struct iovec *, /* buf */ 267 int /* size */ 268 ); 269 270 int (*Writev)( 271 XtransConnInfo, /* connection */ 272 struct iovec *, /* buf */ 273 int /* size */ 274 ); 275 276 int (*Disconnect)( 277 XtransConnInfo /* connection */ 278 ); 279 280 int (*Close)( 281 XtransConnInfo /* connection */ 282 ); 283 284} Xtransport; 285</synopsis> 286 287<para> 288The <structfield>flags</structfield> field can contain an OR of 289the following masks: 290<variablelist> 291 <varlistentry> 292 <term><symbol>TRANS_ALIAS</symbol></term> 293 <listitem><para> 294indicates that this record is providing an alias, and should 295not be used to create a listener. 296 </para></listitem> 297 </varlistentry> 298 <varlistentry> 299 <term><symbol>TRANS_LOCAL</symbol></term> 300 <listitem><para> 301indicates that this is a <symbol>LOCALCONN</symbol> transport. 302 </para></listitem> 303 </varlistentry> 304 <varlistentry> 305 <term><symbol>TRANS_ABSTRACT</symbol></term> 306 <listitem><para> 307indicates that a local connection transport uses the abstract socket namespace. 308 </para></listitem> 309 </varlistentry> 310</variablelist> 311</para> 312 313<para> 314Some additional flags may be set in the <structfield>flags</structfield> 315field by the library while it is running: 316<variablelist> 317 <varlistentry> 318 <term><symbol>TRANS_DISABLED</symbol></term> 319 <listitem><para> 320indicates that this transport has been disabled. 321 </para></listitem> 322 </varlistentry> 323 <varlistentry> 324 <term><symbol>TRANS_NOLISTEN</symbol></term> 325 <listitem><para> 326indicates that servers should not open new listeners using this transport. 327 </para></listitem> 328 </varlistentry> 329 <varlistentry> 330 <term><symbol>TRANS_NOUNLINK</symbol></term> 331 <listitem><para> 332set by a transport backend to indicate that the endpoints for its connection 333should not be unlinked. 334 </para></listitem> 335 </varlistentry> 336</variablelist> 337</para> 338</sect1> 339 340<sect1 id='XtransConnInfo'> 341<title>XtransConnInfo</title> 342<para> 343Each connection will have an opaque <structname>XtransConnInfo</structname> 344transport connection 345object allocated for it. This record contains information specific to the 346connection. The record is defined as: 347 348<synopsis> 349typedef struct _XtransConnInfo *XtransConnInfo; 350 351struct _XtransConnInfo { 352 struct _Xtransport *transptr; 353 char *priv; 354 int flags; 355 int fd; 356 int family; 357 char *addr; 358 int addrlen; 359 char *peeraddr; 360 int peeraddrlen; 361}; 362</synopsis> 363</para> 364</sect1> 365</chapter> 366 367<chapter id='Exposed_Transport_Independent_API'> 368<title>Exposed Transport Independent API</title> 369 370<para> 371This API is included in each library and server that uses it. The API may 372be used by the library, but it is not added to the public API for that 373library. This interface is simply an implementation facilitator. This API 374contains a low level set of core primitives, and a few utility functions 375that are built on top of the primitives. The utility functions exist to 376provide a more familiar interface that can be used to port existing code. 377</para> 378<para> 379A macro is defined in Xtrans.h for TRANS(func) that creates a unique function 380name depending on where the code is compiled. For example, when built for 381Xlib, <function>TRANS(OpenCOTSClient)</function> becomes 382<function>_X11TransOpenCOTSClient</function>. 383</para> 384<para> 385All failures are considered fatal, and the connection should be closed 386and re-established if desired. In most cases, however, the value of 387errno will be available for debugging purposes. 388</para> 389<sect1 id='Core_Interface_API'> 390<title>Core Interface API</title> 391<itemizedlist mark='bullet'> 392 <listitem> 393 <funcsynopsis id='TRANSOpenCOTSClient'> 394 <funcprototype> 395 <funcdef>XtransConnInfo <function>TRANS(OpenCOTSClient)</function></funcdef> 396 <paramdef>const char *<parameter>address</parameter></paramdef> 397 </funcprototype> 398 </funcsynopsis> 399 <para> 400This function creates a Connection-Oriented Transport that is 401suitable for use by a client. The parameter <parameter>address</parameter> 402contains the full address of the server to which this endpoint will be 403connected. This function returns an opaque transport connection object on 404success, or <constant>NULL</constant> on failure. 405 </para> 406 </listitem> 407 <listitem> 408 <funcsynopsis id='TRANSOpenCOTSServer'> 409 <funcprototype> 410 <funcdef>XtransConnInfo <function>TRANS(OpenCOTSServer)</function></funcdef> 411 <paramdef>const char *<parameter>address</parameter></paramdef> 412 </funcprototype> 413 </funcsynopsis> 414 <para> 415This function creates a Connection-Oriented Transport that is suitable 416for use by a server. The parameter <parameter>address</parameter> contains the 417full address to which this server will be bound. This function returns an 418opaque transport connection object on success, or <constant>NULL</constant> 419on failure. 420 </para> 421 </listitem> 422 <listitem> 423 <funcsynopsis id='TRANSOpenCLTSClient'> 424 <funcprototype> 425 <funcdef>XtransConnInfo <function>TRANS(OpenCLTSClient)</function></funcdef> 426 <paramdef>const char *<parameter>address</parameter></paramdef> 427 </funcprototype> 428 </funcsynopsis> 429 <para> 430This function creates a Connection-Less Transport that is suitable for 431use by a client. The parameter <parameter>address</parameter> contains the 432full address of the server to which this endpoint will be connected. This 433function returns an opaque transport connection object on success, or 434<constant>NULL</constant> on failure. 435 </para> 436 </listitem> 437 <listitem> 438 <funcsynopsis id='TRANSOpenCLTSServer'> 439 <funcprototype> 440 <funcdef>XtransConnInfo <function>TRANS(OpenCLTSServer)</function></funcdef> 441 <paramdef>const char *<parameter>address</parameter></paramdef> 442 </funcprototype> 443 </funcsynopsis> 444 <para> 445This function creates a Connection-Less Transport that is suitable for 446use by a server. The parameter <parameter>address</parameter> contains the 447full address to which this server will be bound. This function returns an 448opaque transport connection object on success, or <constant>NULL</constant> 449on failure. 450 </para> 451 </listitem> 452 <listitem> 453 <funcsynopsis id='TRANSSetOption'> 454 <funcprototype> 455 <funcdef>int <function>TRANS(SetOption)</function></funcdef> 456 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 457 <paramdef>int <parameter>option</parameter></paramdef> 458 <paramdef>int <parameter>arg</parameter></paramdef> 459 </funcprototype> 460 </funcsynopsis> 461 <para> 462This function sets transport options, similar to the way 463<function>setsockopt()</function> and <function>ioctl()</function> work. 464The parameter <parameter>connection</parameter> is an endpoint 465that was obtained from <function>_XTransOpen*()</function> functions. 466The parameter <parameter>option</parameter> contains the option that will 467be set. The actual values for <parameter>option</parameter> are defined in a 468<link linkend='Transport_Option_Definition'>later section</link>. 469The parameter <parameter>arg</parameter> can be used to pass 470in an additional value that may be required by some options. 471This function returns 0 on success and -1 on failure. 472 </para> 473 <note><para> 474Based on current usage, the complimentary function 475<function>TRANS(GetOption)</function> is not necessary. 476 </para></note> 477 </listitem> 478 <listitem> 479 <funcsynopsis id='TRANSCreateListener'> 480 <funcprototype> 481 <funcdef>int <function>TRANS(CreateListener)</function></funcdef> 482 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 483 <paramdef>const char *<parameter>port</parameter></paramdef> 484 <paramdef>int <parameter>flags</parameter></paramdef> 485 </funcprototype> 486 </funcsynopsis> 487 <para> 488This function sets up the server endpoint for listening. The parameter 489<parameter>connection</parameter> is an endpoint that was obtained from 490<function>TRANS(OpenCOTSServer)()</function> or 491<function>TRANS(OpenCLTSServer)()</function>. The parameter 492<parameter>port</parameter> specifies the port to which this endpoint 493should be bound for listening. If port is <constant>NULL</constant>, 494then the transport may attempt to allocate any available TSAP for this 495connection. If the transport cannot support this, then this function will 496return a failure. The <parameter>flags</parameter> parameter can be set 497to <symbol>ADDR_IN_USE_ALLOWED</symbol> to allow the call to the underlying 498binding function to fail with a <errorname>EADDRINUSE</errorname> error 499without causing the <function>TRANS(CreateListener)</function> 500function itself to fail. This function return 0 on success and -1 on failure. 501 </para> 502 </listitem> 503 <listitem> 504 <funcsynopsis id='TRANSResetListener'> 505 <funcprototype> 506 <funcdef>int <function>TRANS(ResetListener)</function></funcdef> 507 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 508 </funcprototype> 509 </funcsynopsis> 510 <para> 511When a server is restarted, certain listen ports may need to be reset. 512For example, unix domain needs to check that the file used for 513communication has not been deleted. If it has, it must be recreated. 514The parameter <parameter>connection</parameter> is an opened and bound 515endpoint that was obtained from <function>TRANS(OpenCOTSServer)()</function> 516and passed to <function>TRANS(CreateListener)()</function>. 517This function will return one of the following values: 518<symbol>TRANS_RESET_NOOP</symbol>, 519<symbol>TRANS_RESET_NEW_FD</symbol>, or 520<symbol>TRANS_RESET_FAILURE</symbol>. 521 </para> 522 </listitem> 523 <listitem> 524 <funcsynopsis id='TRANSAccept'> 525 <funcprototype> 526 <funcdef>XtransConnInfo <function>TRANS(Accept)</function></funcdef> 527 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 528 </funcprototype> 529 </funcsynopsis> 530 <para> 531Once a connection indication is received, this function can be called to 532accept the connection. The parameter <parameter>connection</parameter> is 533an opened and bound endpoint that was obtained from 534<function>TRANS(OpenCOTSServer)()</function> and passed to 535<function>TRANS(CreateListener)()</function>. This function will return a 536new opaque transport connection object upon success, 537<constant>NULL</constant> otherwise. 538 </para> 539 </listitem> 540 <listitem> 541 <funcsynopsis id='TRANSConnect'> 542 <funcprototype> 543 <funcdef>int <function>TRANS(Connect)</function></funcdef> 544 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 545 <paramdef>const char *<parameter>address</parameter></paramdef> 546 </funcprototype> 547 </funcsynopsis> 548 <para> 549This function creates a connection to a server. The parameter 550<parameter>connection</parameter> is an endpoint that was obtained 551from <function>TRANS(OpenCOTSClient)()</function>. The parameter 552<parameter>address</parameter> specifies the TSAP to which this endpoint 553should connect. If the protocol is included in the address, it will be 554ignored. This function returns 0 on success and -1 on failure. 555 </para> 556 </listitem> 557 <listitem> 558 <funcsynopsis id='TRANSBytesReadable'> 559 <funcprototype> 560 <funcdef>int <function>TRANS(BytesReadable)</function></funcdef> 561 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 562 <paramdef>BytesReadable_t *<parameter>pend</parameter></paramdef> 563 </funcprototype> 564 </funcsynopsis> 565 <para> 566This function provides the same functionality as the 567<function>BytesReadable</function> macro. 568 </para> 569 </listitem> 570 <listitem> 571 <funcsynopsis id='TRANSRead'> 572 <funcprototype> 573 <funcdef>int <function>TRANS(Read)</function></funcdef> 574 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 575 <paramdef>char *<parameter>buf</parameter></paramdef> 576 <paramdef>int <parameter>size</parameter></paramdef> 577 </funcprototype> 578 </funcsynopsis> 579 <para> 580This function will return the number of bytes requested on a COTS 581connection, and will return the minimum of the number bytes requested or 582the size of the incoming packet on a CLTS connection. 583 </para> 584 </listitem> 585 <listitem> 586 <funcsynopsis id='TRANSWrite'> 587 <funcprototype> 588 <funcdef>int <function>TRANS(Write)</function></funcdef> 589 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 590 <paramdef>char *<parameter>buf</parameter></paramdef> 591 <paramdef>int <parameter>size</parameter></paramdef> 592 </funcprototype> 593 </funcsynopsis> 594 <para> 595This function will write the requested number of bytes on a COTS 596connection, and will send a packet of the requested size on a CLTS connection. 597 </para> 598 </listitem> 599 <listitem> 600 <funcsynopsis id='TRANSReadv'> 601 <funcprototype> 602 <funcdef>int <function>TRANS(Readv)</function></funcdef> 603 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 604 <paramdef>struct iovec *<parameter>buf</parameter></paramdef> 605 <paramdef>int <parameter>size</parameter></paramdef> 606 </funcprototype> 607 </funcsynopsis> 608 <para> 609Similar to <function>TRANS(Read)()</function>. 610 </para> 611 </listitem> 612 <listitem> 613 <funcsynopsis id='TRANSWritev'> 614 <funcprototype> 615 <funcdef> int <function>TRANS(Writev)</function></funcdef> 616 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 617 <paramdef>struct iovec *<parameter>buf</parameter></paramdef> 618 <paramdef>int <parameter>size</parameter></paramdef> 619 </funcprototype> 620 </funcsynopsis> 621 <para> 622Similar to <function>TRANS(Write)()</function>. 623 </para> 624 </listitem> 625 <listitem> 626 <funcsynopsis id='TRANSDisconnect'> 627 <funcprototype> 628 <funcdef>int <function>TRANS(Disconnect)</function></funcdef> 629 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 630 </funcprototype> 631 </funcsynopsis> 632 <para> 633This function is used when an orderly disconnect is desired. This function 634breaks the connection on the transport. It is similar to the socket function 635<function>shutdown()</function>. 636 </para> 637 </listitem> 638 <listitem> 639 <funcsynopsis id='TRANSClose'> 640 <funcprototype> 641 <funcdef>int <function>TRANS(Close)</function></funcdef> 642 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 643 </funcprototype> 644 </funcsynopsis> 645 <para> 646This function closes the transport, unbinds it, and frees all resources that 647was associated with the transport. If a <function>TRANS(Disconnect)</function> 648call was not made on the connection, a disorderly disconnect may occur. 649 </para> 650 </listitem> 651 <listitem> 652 <funcsynopsis id='TRANSIsLocal'> 653 <funcprototype> 654 <funcdef>int <function>TRANS(IsLocal)</function></funcdef> 655 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 656 </funcprototype> 657 </funcsynopsis> 658 <para> 659Returns TRUE if it is a local transport. 660 </para> 661 </listitem> 662 <listitem> 663 <funcsynopsis id='TRANSGetMyAddr'> 664 <funcprototype> 665 <funcdef>int <function>TRANS(GetMyAddr)</function></funcdef> 666 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 667 <paramdef>int *<parameter>familyp</parameter></paramdef> 668 <paramdef>int *<parameter>addrlenp</parameter></paramdef> 669 <paramdef>Xtransaddr **<parameter>addrp</parameter></paramdef> 670 </funcprototype> 671 </funcsynopsis> 672 <para> 673This function is similar to <function>getsockname()</function>. 674This function will allocate space for the address, so it must be freed by 675the caller. Not all transports will have a valid address until a connection 676is established. This function should not be used until the connection is 677established with <function>Connect()</function> or 678<function>Accept()</function>. 679 </para> 680 </listitem> 681 <listitem> 682 <funcsynopsis id='TRANSGetPeerAddr'> 683 <funcprototype> 684 <funcdef>int <function>TRANS(GetPeerAddr)</function></funcdef> 685 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 686 <paramdef>int *<parameter>familyp</parameter></paramdef> 687 <paramdef>int *<parameter>addrlenp</parameter></paramdef> 688 <paramdef>Xtransaddr **<parameter>addrp</parameter></paramdef> 689 </funcprototype> 690 </funcsynopsis> 691 <para> 692This function is similar to <function>getpeername()</function>. 693This function will allocate space for the address, so it must be freed by 694the caller. Not all transports will have a valid address until a connection 695is established. This function should not be used until the connection is 696established with <function>Connect()</function> or 697<function>Accept()</function>. 698 </para> 699 </listitem> 700 <listitem> 701 <funcsynopsis id='TRANSGetConnectionNumber'> 702 <funcprototype> 703 <funcdef>int <function>TRANS(GetConnectionNumber)</function></funcdef> 704 <paramdef>XtransConnInfo <parameter>connection</parameter></paramdef> 705 </funcprototype> 706 </funcsynopsis> 707 <para> 708Returns the file descriptor associated with this transport. 709 </para> 710 </listitem> 711 <listitem> 712 <funcsynopsis id='TRANSMakeAllCOTSServerListeners'> 713 <funcprototype> 714 <funcdef>int <function>TRANS(MakeAllCOTSServerListeners)</function></funcdef> 715 <paramdef>const char *<parameter>port</parameter></paramdef> 716 <paramdef>int *<parameter>partial_ret</parameter></paramdef> 717 <paramdef>int *<parameter>count_ret</parameter></paramdef> 718 <paramdef>XtransConnInfo **<parameter>connections_ret</parameter></paramdef> 719 </funcprototype> 720 </funcsynopsis> 721 <para> 722This function should be used by most servers. It will try to establish 723a COTS server endpoint for each transport listed in the transport table. 724<parameter>partial_ret</parameter> will be set to <symbol>True</symbol> if 725only a partial network could be created. <parameter>count_ret</parameter> is 726the number of transports returned, and <parameter>connections_ret</parameter> 727is the list of transports. 728 </para> 729 </listitem> 730 <listitem> 731 <funcsynopsis id='TRANSMakeAllCLTSServerListeners'> 732 <funcprototype> 733 <funcdef>int <function>TRANS(MakeAllCLTSServerListeners)</function></funcdef> 734 <paramdef>const char *<parameter>port</parameter></paramdef> 735 <paramdef>int *<parameter>partial_ret</parameter></paramdef> 736 <paramdef>int *<parameter>count_ret</parameter></paramdef> 737 <paramdef>XtransConnInfo **<parameter>connections_ret</parameter></paramdef> 738 </funcprototype> 739 </funcsynopsis> 740 <para> 741This function should be used by most servers. It will try to establish a 742CLTS server endpoint for each transport listed in the transport table. 743<parameter>partial_ret</parameter> will be set to <symbol>True</symbol> if 744only a partial network could be created. <parameter>count_ret</parameter> is 745the number of transports returned, and <parameter>connections_ret</parameter> 746is the list of transports. 747 </para> 748 </listitem> 749</itemizedlist> 750</sect1> 751 752<sect1 id='Utility_API'> 753<title>Utility API</title> 754<para> 755This section describes a few useful functions that have been implemented on 756top of the Core Interface API. These functions are being provided as a 757convenience. 758</para> 759<itemizedlist mark='bullet'> 760 <listitem> 761 <funcsynopsis id='TRANSConvertAddress'> 762 <funcprototype> 763 <funcdef>int <function>TRANS(ConvertAddress)</function></funcdef> 764 <paramdef>int *<parameter>familyp</parameter></paramdef> 765 <paramdef>int *<parameter>addrlenp</parameter></paramdef> 766 <paramdef>Xtransaddr *<parameter>addrp</parameter></paramdef> 767 </funcprototype> 768 </funcsynopsis> 769 <para> 770This function converts a sockaddr based address to an X authorization based 771address (ie <symbol>AF_INET</symbol>, <symbol>AF_UNIX</symbol> to the X 772protocol definition (ie <symbol>FamilyInternet</symbol>, 773<symbol>FamilyLocal</symbol>)). 774 </para> 775 </listitem> 776</itemizedlist> 777</sect1> 778</chapter> 779 780<chapter id='Transport_Option_Definition'> 781<title>Transport Option Definition</title> 782<para> 783The following options are defined for the 784<link linkend='TRANSSetOption'><function>TRANS(SetOption)()</function></link> 785function. If an OS or transport does not support any of these options, 786then it will silently ignore the option. 787</para> 788 789<itemizedlist mark='bullet'> 790 <listitem> 791 <para> 792<symbol>TRANS_NONBLOCKING</symbol> 793 </para> 794 <para> 795This option controls the blocking mode of the connection. If the argument 796is set to 1, then the connection will be set to blocking. If the argument 797is set to 0, then the connection will be set to non- blocking. 798 </para> 799 </listitem> 800 <listitem> 801 <para> 802<symbol>TRANS_CLOSEONEXEC</symbol> 803 </para> 804 <para> 805This option determines what will happen to the connection when an exec is 806encountered. If the argument is set to 1, then the connection will be 807closed when an exec occurs. If the argument is set to 0, then the 808connection will not be closed when an exec occurs. 809 </para> 810 </listitem> 811</itemizedlist> 812</chapter> 813 814<chapter id='Hidden_Transport_Dependent_API'> 815<title>Hidden Transport Dependent API</title> 816<para> 817The hidden transport dependent functions are placed in the Xtransport record. 818These function are similar to the Exposed Transport Independent API, but 819some of the parameters and return values are slightly different. Stuff like 820the <code>#ifdef SUNSYSV</code> should be handled inside these functions. 821</para> 822 823<itemizedlist mark='bullet'> 824 <listitem> 825 <funcsynopsis id='OpenCOTSClient'> 826 <funcprototype> 827 <funcdef>XtransConnInfo *<function>OpenCOTSClient</function></funcdef> 828 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 829 <paramdef>const char *<parameter>protocol</parameter></paramdef> 830 <paramdef>const char *<parameter>host</parameter></paramdef> 831 <paramdef>const char *<parameter>port</parameter></paramdef> 832 </funcprototype> 833 </funcsynopsis> 834 <para> 835This function creates a Connection-Oriented Transport. The parameter 836<parameter>thistrans</parameter> points to an Xtransport entry in the 837transport table. The parameters <parameter>protocol</parameter>, 838<parameter>host</parameter>, and <parameter>port</parameter>, point to 839strings containing the corresponding parts of the address that was passed into 840<link linkend='TRANSOpenCOTSClient'><function>TRANS(OpenCOTSClient)()</function></link>. 841This function must allocate and initialize the contents of the XtransConnInfo 842structure that is returned by this function. This function will open the 843transport, and bind it into the transport namespace if applicable. The local 844address portion of the XtransConnInfo structure will also be filled in by 845this function. 846 </para> 847 </listitem> 848 <listitem> 849 <funcsynopsis id='OpenCOTSServer'> 850 <funcprototype> 851 <funcdef>XtransConnInfo *<function>OpenCOTSServer</function></funcdef> 852 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 853 <paramdef>const char *<parameter>protocol</parameter></paramdef> 854 <paramdef>const char *<parameter>host</parameter></paramdef> 855 <paramdef>const char *<parameter>port</parameter></paramdef> 856 </funcprototype> 857 </funcsynopsis> 858 <para> 859This function creates a Connection-Oriented Transport. The parameter 860<parameter>thistrans</parameter> points to an Xtransport entry in the 861transport table. The parameters <parameter>protocol</parameter>, 862<parameter>host</parameter>, and <parameter>port</parameter> point to 863strings containing the corresponding parts of the address that was passed into 864<link linkend='TRANSOpenCOTSServer'><function>TRANS(OpenCOTSServer)()</function></link>. 865This function must allocate and initialize the contents of the 866XtransConnInfo structure that is returned by this function. This function 867will open the transport. 868 </para> 869 </listitem> 870 <listitem> 871 <funcsynopsis id='OpenCLTSClient'> 872 <funcprototype> 873 <funcdef>XtransConnInfo *<function>OpenCLTSClient</function></funcdef> 874 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 875 <paramdef>const char *<parameter>protocol</parameter></paramdef> 876 <paramdef>const char *<parameter>host</parameter></paramdef> 877 <paramdef>const char *<parameter>port</parameter></paramdef> 878 </funcprototype> 879 </funcsynopsis> 880 <para> 881This function creates a Connection-Less Transport. The parameter 882<parameter>thistrans</parameter> points to an Xtransport entry in the 883transport table. The parameters <parameter>protocol</parameter>, 884<parameter>host</parameter>, and <parameter>port</parameter> point to strings 885containing the corresponding parts of the address that was passed into 886<link linkend='TRANSOpenCLTSClient'><function>TRANS(OpenCLTSClient)()</function></link>. 887This function must allocate and initialize the contents of the XtransConnInfo 888structure that is returned by this function. This function will open the 889transport, and bind it into the transport namespace if applicable. The 890local address portion of the XtransConnInfo structure will also be filled 891in by this function. 892 </para> 893 </listitem> 894 <listitem> 895 <funcsynopsis id='OpenCLTSServer'> 896 <funcprototype> 897 <funcdef>XtransConnInfo *<function>OpenCLTSServer</function></funcdef> 898 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 899 <paramdef>const char *<parameter>protocol</parameter></paramdef> 900 <paramdef>const char *<parameter>host</parameter></paramdef> 901 <paramdef>const char *<parameter>port</parameter></paramdef> 902 </funcprototype> 903 </funcsynopsis> 904 <para> 905This function creates a Connection-Less Transport. The parameter 906<parameter>thistrans</parameter> points to an Xtransport entry in the 907transport table. The parameters <parameter>protocol</parameter>, 908<parameter>host</parameter>, and <parameter>port</parameter> point to strings 909containing the corresponding parts of the address that was passed into 910<link linkend='TRANSOpenCLTSServer'><function>TRANS(OpenCLTSServer)()</function></link>. 911This function must allocate and initialize the contents of the 912XtransConnInfo structure that is returned by this function. This 913function will open the transport. 914 </para> 915 </listitem> 916 <listitem> 917 <funcsynopsis id='SetOption'> 918 <funcprototype> 919 <funcdef>int <function>SetOption</function></funcdef> 920 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 921 <paramdef>int <parameter>option</parameter></paramdef> 922 <paramdef>int <parameter>arg</parameter></paramdef> 923 </funcprototype> 924 </funcsynopsis> 925 <para> 926This function provides a transport dependent way of implementing the 927options defined by the X Transport Interface. In the current prototype, 928this function is not being used, because all of the options defined so far 929are transport independent. This function will have to be used if a radically 930different transport type is added, or a transport dependent option is defined. 931 </para> 932 </listitem> 933 <listitem> 934 <funcsynopsis id='CreateListener'> 935 <funcprototype> 936 <funcdef>int <function>CreateListener</function></funcdef> 937 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 938 <paramdef>const char <parameter>*port</parameter></paramdef> 939 <paramdef>int <parameter>flags</parameter></paramdef> 940 </funcprototype> 941 </funcsynopsis> 942 <para> 943This function takes a transport endpoint opened for a server, and sets it 944up to listen for incoming connection requests. The parameter 945<parameter>port</parameter> 946contains the port portion of the address that was passed to the Open function. 947The parameter <parameter>flags</parameter> should be set to 948<symbol>ADDR_IN_USE_ALLOWED</symbol> if the underlying transport endpoint 949may be already bound and this should not be considered 950as an error. Otherwise flags should be set to 0. This is used by IPv6 code, 951where the same socket can be bound to both an IPv6 address and then to a 952IPv4 address. This function will bind the transport into the transport 953name space if applicable, and fill in the local address portion of the 954XtransConnInfo structure. The transport endpoint will then be set to 955listen for incoming connection requests. 956 </para> 957 </listitem> 958 <listitem> 959 <funcsynopsis id='ResetListener'> 960 <funcprototype> 961 <funcdef>int <function>ResetListener</function></funcdef> 962 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 963 </funcprototype> 964 </funcsynopsis> 965 <para> 966This function resets the transport for listening. 967 </para> 968 </listitem> 969 <listitem> 970 <funcsynopsis id='Accept'> 971 <funcprototype> 972 <funcdef> XtransConnInfo <function>Accept</function></funcdef> 973 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 974 </funcprototype> 975 </funcsynopsis> 976 <para> 977This function creates a new transport endpoint as a result of an 978incoming connection request. The parameter 979<parameter>thistrans</parameter> is the endpoint 980that was opened for listening by the server. The new endpoint is 981opened and bound into the transport’s namespace. A XtransConnInfo 982structure describing the new endpoint is returned from this function 983 </para> 984 </listitem> 985 <listitem> 986 <funcsynopsis id='Connect'> 987 <funcprototype> 988 <funcdef>int <function>Connect</function></funcdef> 989 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 990 <paramdef>const char *<parameter>host</parameter></paramdef> 991 <paramdef>const char *<parameter>port</parameter></paramdef> 992 </funcprototype> 993 </funcsynopsis> 994 <para> 995This function establishes a connection to a server. The parameters 996<parameter>host</parameter> and <parameter>port</parameter> 997describe the server to which the connection should be 998established. The connection will be established so that 999<function>Read()</function> and 1000<function>Write()</function> call can be made. 1001 </para> 1002 </listitem> 1003 <listitem> 1004 <funcsynopsis id='BytesReadable'> 1005 <funcprototype> 1006 <funcdef>int <function>BytesReadable</function></funcdef> 1007 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 1008 <paramdef>BytesReadable_t *<parameter>pend</parameter></paramdef> 1009 </funcprototype> 1010 </funcsynopsis> 1011 <para> 1012This function replaces the <function>BytesReadable()</function> 1013macro. This allows each transport to have its own mechanism for determining 1014how much data is ready to be read. 1015 </para> 1016 </listitem> 1017 <listitem> 1018 <funcsynopsis id='Read'> 1019 <funcprototype> 1020 <funcdef>int <function>Read</function></funcdef> 1021 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 1022 <paramdef>char *<parameter>buf</parameter></paramdef> 1023 <paramdef>int <parameter>size</parameter></paramdef> 1024 </funcprototype> 1025 </funcsynopsis> 1026 <para> 1027This function reads <parameter>size</parameter> bytes into 1028<parameter>buf</parameter> from the connection. 1029 </para> 1030 </listitem> 1031 <listitem> 1032 <funcsynopsis id='Write'> 1033 <funcprototype> 1034 <funcdef>int <function>Write</function></funcdef> 1035 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 1036 <paramdef>char *<parameter>buf</parameter></paramdef> 1037 <paramdef>int <parameter>size</parameter></paramdef> 1038 </funcprototype> 1039 </funcsynopsis> 1040 <para> 1041This function writes <parameter>size</parameter> bytes from 1042<parameter>buf</parameter> to the connection. 1043 </para> 1044 </listitem> 1045 <listitem> 1046 <funcsynopsis id='Readv'> 1047 <funcprototype> 1048 <funcdef>int <function>Readv</function></funcdef> 1049 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 1050 <paramdef>struct iovec *<parameter>buf</parameter></paramdef> 1051 <paramdef>int <parameter>size</parameter></paramdef> 1052 </funcprototype> 1053 </funcsynopsis> 1054 <para> 1055This function performs a <function>readv()</function> on the connection. 1056 </para> 1057 </listitem> 1058 <listitem> 1059 <funcsynopsis id='Writev'> 1060 <funcprototype> 1061 <funcdef>int <function>Writev</function></funcdef> 1062 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 1063 <paramdef>struct iovec *<parameter>buf</parameter></paramdef> 1064 <paramdef>int <parameter>size</parameter></paramdef> 1065 </funcprototype> 1066 </funcsynopsis> 1067 <para> 1068This function performs a <function>writev()</function> on the connection. 1069 </para> 1070 </listitem> 1071 <listitem> 1072 <funcsynopsis id='Disconnect'> 1073 <funcprototype> 1074 <funcdef>int <function>Disconnect</function></funcdef> 1075 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 1076 </funcprototype> 1077 </funcsynopsis> 1078 <para> 1079This function initiates an orderly shutdown of a connection. If a 1080transport does not distinguish between orderly and disorderly 1081disconnects, then a call to this function will have no affect. 1082 </para> 1083 </listitem> 1084 <listitem> 1085 <funcsynopsis id='Close'> 1086 <funcprototype> 1087 <funcdef>int <function>Close</function></funcdef> 1088 <paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef> 1089 </funcprototype> 1090 </funcsynopsis> 1091 <para> 1092This function will break the connection, and close the endpoint. 1093 </para> 1094 </listitem> 1095</itemizedlist> 1096</chapter> 1097<chapter id='Configuration'> 1098<title>Configuration</title> 1099 1100<para> 1101The implementation of each transport can be platform specific. It is expected 1102that existing connection types such as <symbol>TCPCONN</symbol>, 1103<symbol>UNIXCONN</symbol>, <symbol>LOCALCONN</symbol>, and 1104<symbol>STREAMSCONN</symbol> will be replaced with flags for each 1105possible transport type. 1106</para> 1107<para> 1108In X11R6, the below flags to enable transport types were set in 1109<symbol>ConnectionFlags</symbol> in the <filename>vendor.cf</filename> or 1110<filename>site.def</filename> config files. 1111</para> 1112<para> 1113In X11R7 modular releases, these flags are set when running 1114<filename>configure</filename> scripts which include the 1115<function>XTRANS_CONNECTION_FLAGS</function> macro from 1116<filename>xtrans.m4</filename>. 1117</para> 1118 1119<informaltable frame='topbot'> 1120 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 1121 <colspec colname='define' colwidth='1.0*' /> 1122 <colspec colname='enable' colwidth='2.0*' /> 1123 <colspec colname='desc' colwidth='2.0*'/> 1124 <thead> 1125 <row rowsep='1'> 1126 <entry><code>#define</code></entry> 1127 <entry>configure flag</entry> 1128 <entry>Description</entry> 1129 </row> 1130 </thead> 1131 <tbody> 1132 <row> 1133 <entry><symbol>TCPCONN</symbol></entry> 1134 <entry><option>--enable-tcp-transport</option></entry> 1135 <entry> 1136 Enables the INET (IPv4) Domain Socket based transport 1137 </entry> 1138 </row> 1139 <row> 1140 <entry><symbol>IPv6</symbol></entry> 1141 <entry><option>--enable-ipv6</option></entry> 1142 <entry> 1143 Extends <symbol>TCPCONN</symbol> to enable IPv6 Socket based transport 1144 </entry> 1145 </row> 1146 <row> 1147 <entry><symbol>UNIXCONN</symbol></entry> 1148 <entry><option>--enable-unix-transport</option></entry> 1149 <entry> 1150 Enables the UNIX Domain Socket based transport 1151 </entry> 1152 </row> 1153 <row> 1154 <entry><symbol>STREAMSCONN</symbol></entry> 1155 <entry><emphasis>Not available in X11R7</emphasis></entry> 1156 <entry> 1157 Enables the TLI based transports 1158 </entry> 1159 </row> 1160 <row> 1161 <entry><symbol>LOCALCONN</symbol></entry> 1162 <entry><option>--enable-local-transport</option></entry> 1163 <entry> 1164 Enables the SYSV Local connection transports 1165 </entry> 1166 </row> 1167 <row> 1168 <entry><symbol>DNETCONN</symbol></entry> 1169 <entry><emphasis>Not available in X11R7</emphasis></entry> 1170 <entry> 1171 Enables the DECnet transports 1172 </entry> 1173 </row> 1174 </tbody> 1175 </tgroup> 1176</informaltable> 1177 1178 1179</chapter> 1180 1181<chapter id='Transport_Specific_Definitions'> 1182<title>Transport Specific Definitions</title> 1183 1184<informaltable frame='all' colsep='1' rowsep='1'> 1185 <tgroup cols='4' align='center'> 1186 <colspec colname='c1' colwidth='1.0*'/> 1187 <colspec colname='c2' colwidth='1.0*'/> 1188 <colspec colname='c3' colwidth='3.0*'/> 1189 <colspec colname='c4' colwidth='2.0*'/> 1190 <thead> 1191 <row> 1192 <entry morerows="1">Protocol Family</entry> 1193 <entry namest="c2" nameend="c4" align='center'>Address Component</entry> 1194 </row> 1195 <row> 1196 <entry align='center'>protocol</entry> 1197 <entry align='center'>host</entry> 1198 <entry align='center'>port</entry> 1199 </row> 1200 </thead> 1201 <tbody> 1202 <row> 1203 <entry>Internet</entry> 1204 <entry>inet inet6 tcp udp</entry> 1205 <entry>name of an internet addressable host</entry> 1206 <entry>string containing the name of a service or a valid port number. Example: "xserver0", "7100"</entry> 1207 </row> 1208 <row> 1209 <entry>DECnet</entry> 1210 <entry>decnet</entry> 1211 <entry>name of a DECnet addressable host</entry> 1212 <entry>string containing the complete name of the object. Example: "X$X0"</entry> 1213 </row> 1214 <row> 1215 <entry>NETware</entry> 1216 <entry>ipx</entry> 1217 <entry>name of a NETware addressable host</entry> 1218 <entry>Not sure of the specifics yet.</entry> 1219 </row> 1220 <row> 1221 <entry>OSI</entry> 1222 <entry>osi</entry> 1223 <entry>name of an OSI adressable host.</entry> 1224 <entry>Not sure of the specifics yet.</entry> 1225 </row> 1226 <row> 1227 <entry>Local</entry> 1228 <entry>local pts named sco isc</entry> 1229 <entry>(ignored)</entry> 1230 <entry>String containing the port name, ie "xserver0", "fontserver0".</entry> 1231 </row> 1232 </tbody> 1233 </tgroup> 1234</informaltable> 1235 1236</chapter> 1237 1238<chapter id='Implementation_Notes'> 1239<title>Implementation Notes</title> 1240<para> 1241This section refers to the prototype implementation that is being developed 1242concurrently with this document. This prototype has been able to flush out many 1243details and problems as the specification was being developed. 1244</para> 1245<para> 1246In X11R6, all of the source code for this interface was located in 1247<filename>xc/lib/xtrans</filename>. 1248</para> 1249<para> 1250In X11R7, all of the source code for this interface is delivered via 1251the <systemitem>lib/libxtrans</systemitem> modular package from X.Org, 1252and is installed under 1253<filename><replaceable>${prefix}</replaceable>/X11/Xtrans</filename> 1254so that other modules may find it when they build. 1255</para> 1256<para> 1257All functions names in the source are of the format 1258<function>TRANS(func)()</function>. The 1259<function>TRANS()</function> 1260macro is defined as 1261<programlisting language="C"> 1262#define TRANS(func) _PROTOCOLTrans##func 1263</programlisting> 1264</para> 1265 1266<para> 1267<symbol>PROTOCOL</symbol> will be uniquely defined in each directory 1268where this code is compiled. 1269<symbol>PROTOCOL</symbol> will be defined to be the name of the protocol 1270that is implemented by the library or server, such as X11, FS, and ICE. 1271</para> 1272 1273<para> 1274All libraries and servers that use the X Transport Interface should have a new 1275file called <filename><replaceable>TRANSPORT</replaceable>trans.c</filename>. 1276This file will include the transports based on the configuration flags 1277provided by the <filename>configure</filename> script. Below is an 1278example <filename>xfstrans.c</filename> for the font server. 1279</para> 1280 1281<programlisting language="C"> 1282#include "config.h" 1283 1284#define FONT_t 1 1285#define TRANS_REOPEN 1 1286#define TRANS_SERVER 1 1287 1288#include <X11/Xtrans/transport.c> 1289</programlisting> 1290<para> 1291The source files for this interface are listed below. 1292</para> 1293 1294<variablelist> 1295 <varlistentry> 1296 <term><filename>Xtrans.h</filename></term> 1297 <listitem><para> 1298Function prototypes and defines for the Transport Independent API. 1299 </para></listitem> 1300 </varlistentry> 1301 <varlistentry> 1302 <term><filename>Xtransint.h</filename></term> 1303 <listitem><para> 1304Used by the interface implementation only. 1305Contains the internal data structures. 1306 </para></listitem> 1307 </varlistentry> 1308 <varlistentry> 1309 <term><filename>Xtranssock.c</filename></term> 1310 <listitem><para> 1311Socket implementation of the Transport Dependent API. 1312 </para></listitem> 1313 </varlistentry> 1314 <varlistentry> 1315 <term><filename>Xtranstli.c</filename></term> 1316 <listitem><para> 1317TLI implementation of the Transport Dependent API. 1318 </para></listitem> 1319 </varlistentry> 1320 <varlistentry> 1321 <term><filename>Xtransdnet.c</filename></term> 1322 <listitem><para> 1323DECnet implementation of the Transport Dependent API. 1324 </para></listitem> 1325 </varlistentry> 1326 <varlistentry> 1327 <term><filename>Xtranslocal.c</filename></term> 1328 <listitem><para> 1329Implementation of the Transport Dependent API for SYSV Local connections. 1330 </para></listitem> 1331 </varlistentry> 1332 <varlistentry> 1333 <term><filename>Xtrans.c</filename></term> 1334 <listitem><para> 1335Exposed Transport Independent API Functions. 1336 </para></listitem> 1337 </varlistentry> 1338 <varlistentry> 1339 <term><filename>Xtransutil.c</filename></term> 1340 <listitem><para> 1341Collection of Utility functions that use the X Transport Interface. 1342 </para></listitem> 1343 </varlistentry> 1344</variablelist> 1345 1346 1347<para> 1348The file <filename>Xtransint.h</filename> contains much of the transport 1349related code that was previously in <filename>Xlibint.h</filename> and 1350<filename>Xlibnet.h</filename>. 1351This will make the definitions available for all transport users. This 1352should also obsolete the equivalent code in other libraries. 1353</para> 1354 1355</chapter> 1356</book> 1357