Skip to content

Chapter 10. Implementation Notes

This section refers to the prototype implementation that is being developed concurrently with this document. This prototype has been able to flush out many details and problems as the specification was being developed.

In X11R6, all of the source code for this interface was located in xc/lib/xtrans.

In X11R7, all of the source code for this interface is delivered via the lib/libxtrans modular package from X.Org, and is installed under ${prefix}/X11/Xtrans so that other modules may find it when they build.

All functions names in the source are of the format TRANS(func)(). The TRANS() macro is defined as

#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
#define TRANS(func) _PROTOCOLTrans##func
#else
#define TRANS(func) _PROTOCOLTrans/**/func
#endif
#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
#define TRANS(func) _PROTOCOLTrans##func
#else
#define TRANS(func) _PROTOCOLTrans/**/func
#endif

PROTOCOL will be uniquely defined in each directory where this code is compiled. PROTOCOL will be defined to be the name of the protocol that is implemented by the library or server, such as X11, FS, and ICE.

All libraries and servers that use the X Transport Interface should have a new file called TRANSPORTtrans.c. This file will include the transports based on the configuration flags provided by the configure script. Below is an example xfstrans.c for the font server.

#include "config.h"

#define FONT_t 1
#define TRANS_REOPEN 1
#define TRANS_SERVER 1

#include <X11/Xtrans/transport.c>
#include "config.h"

#define FONT_t 1
#define TRANS_REOPEN 1
#define TRANS_SERVER 1

#include <X11/Xtrans/transport.c>

The source files for this interface are listed below.

Xtrans.h

Function prototypes and defines for the Transport Independent API.

Xtransint.h

Used by the interface implementation only. Contains the internal data structures.

Xtranssock.c

Socket implementation of the Transport Dependent API.

Xtranstli.c

TLI implementation of the Transport Dependent API.

Xtransdnet.c

DECnet implementation of the Transport Dependent API.

Xtranslocal.c

Implementation of the Transport Dependent API for SYSV Local connections.

Xtrans.c

Exposed Transport Independent API Functions.

Xtransutil.c

Collection of Utility functions that use the X Transport Interface.

The file Xtransint.h contains much of the transport related code that was previously in Xlibint.h and Xlibnet.h. This will make the definitions available for all transport users. This should also obsolete the equivalent code in other libraries.