From 1858516e9f0f3e65cc3d1f6cedfe8bfa614c8082 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 6 Nov 2010 11:22:15 -0700 Subject: doc: Markup & typo cleanups Signed-off-by: Alan Coopersmith --- doc/xtrans.xml | 376 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 238 insertions(+), 138 deletions(-) diff --git a/doc/xtrans.xml b/doc/xtrans.xml index d3e10d9..208a438 100644 --- a/doc/xtrans.xml +++ b/doc/xtrans.xml @@ -1,6 +1,6 @@ - + @@ -117,8 +117,9 @@ should be used by all libraries, clients and servers of the X Window System. Use of this API should allow the addition of new types of transports and support for new platforms without making any changes to the source except in the X Transport Interface code. -This interface should solve the problem of multiple #ifdef TRANSPORT -and #ifdef PLATFORM statements scattered throughout the source tree. +This interface should solve the problem of multiple +#ifdef TRANSPORT and #ifdef PLATFORM +statements scattered throughout the source tree. This interface should provide enough functionality to support all types of protocols, including connection oriented protocols such as X11 and FS, and connection-less oriented protocols such as XDMCP. @@ -138,8 +139,9 @@ type of transport. Each entry is a record containing mostly pointers to function that implements the interface for the given transport. -This API does not provide an abstraction for select() or poll(). -These function are themselves transport independent, so an additional +This API does not provide an abstraction for select() +or poll(). +These functions are themselves transport independent, so an additional interface is not needed for these functions. It is also unclear how such an interface would affect performance. @@ -150,22 +152,22 @@ an interface would affect performance. Addresses are specified in the following syntax, - - -protocol/host:port - - -where protocol specifies a protocol family or an alias for -a protocol family. A definition of common protocol families is given in a later section. + +protocol/host:port + + +where protocol specifies a protocol family +or an alias for a protocol family. A definition of common protocol +families is given in a later section. -The host part specifies the name of a host or other +The host part specifies the name of a host or other transport dependent entity that could be interpreted as a Network Service Access Point (NSAP). -The port part specifies the name of a Transport Service +The port part specifies the name of a Transport Service Access Point (TSAP). The format of the TSAP is defined by the underlying transport implementation, but it is represented using a string format when it is part of an address. @@ -187,7 +189,7 @@ table is an array of Xtransport records. Each record contains all the entry points for a single transport. This record is defined as: - + typedef struct _Xtransport { char *TransName; @@ -285,29 +287,38 @@ typedef struct _Xtransport { ); } Xtransport; - + -The flags field can contain an OR of the following masks: - - -TRANS_ALIAS: indicates that this record is providing an alias, and should +The flags field can contain an OR of +the following masks: + + + TRANS_ALIAS + +indicates that this record is providing an alias, and should not be used to create a listener. - - -TRANS_LOCAL: indicates that this is a LOCALCONN transport. + + + + TRANS_LOCAL + +indicates that this is a LOCALCONN transport. + + + XtransConnInfo -Each connection will have an opaque XtransConnInfo transport connection +Each connection will have an opaque XtransConnInfo +transport connection object allocated for it. This record contains information specific to the connection. The record is defined as: - - + typedef struct _XtransConnInfo *XtransConnInfo; struct _XtransConnInfo { @@ -321,7 +332,8 @@ struct _XtransConnInfo { char *peeraddr; int peeraddrlen; }; - + + @@ -355,7 +367,7 @@ XtransConnInfo TRANS(OpenCOTSClient)(char *address) This function creates a Connection-Oriented Transport that is -suitable for use by a client. The parameter address +suitable for use by a client. The parameter address contains the full address of the server to which this endpoint will be connected. This functions returns an opaque transport connection object on success, or NULL on failure. @@ -367,7 +379,7 @@ XtransConnInfo TRANS(OpenCOTSServer)(char *address) This function creates a Connection-Oriented Transport that is suitable -for use by a server. The parameter address contains the +for use by a server. The parameter address contains the full address to which this server will be bound. This functions returns an opaque transport connection object on success, or NULL on failure. @@ -378,7 +390,7 @@ XtransConnInfo TRANS(OpenCLTSClient)(char *address) This function creates a Connection-Less Transport that is suitable for -use by a client. The parameter address contains the +use by a client. The parameter address contains the full address of the server to which this endpoint will be connected. This functions returns an opaque transport connection object on success, or NULL on failure. @@ -389,7 +401,7 @@ XtransConnInfo TRANS(OpenCLTSServer)(char *address) This function creates a Connection-Less Transport that is suitable for -use by a server. The parameter address contains the +use by a server. The parameter address contains the full address to which this server will be bound. This functions returns an opaque transport connection object on success, or NULL on failure. @@ -399,12 +411,14 @@ transport connection object on success, or NULL on failure. int TRANS(SetOption)(XtransConnInfo connection, int option, int arg) -This function sets transport options, similar to the way setsockopt() -and ioctl() work. The parameter connection is an endpoint +This function sets transport options, similar to the way +setsockopt() and ioctl() work. +The parameter connection is an endpoint that was obtained from _XTransOpen*() functions. The parameter -option contains the option that will be set. The actual -values for option are defined in a later section. The parameter arg can be used to pass -in an additional value that may be required by some options. This function return 0 on +option contains the option that will be set. The actual +values for option are defined in a later section. The parameter +arg can be used to pass in an additional value that may +be required by some options. This function return 0 on success and -1 on failure. @@ -418,16 +432,17 @@ int TRANS(CreateListener)(XtransConnInfo connection, char *port, int flags) This function sets up the server endpoint for listening. The parameter -connection is an endpoint that was obtained from -TRANS(OpenCOTSServer)() or TRANS(OpenCLTSServer)(). The parameter -port specifies the +connection is an endpoint that was obtained from +TRANS(OpenCOTSServer)() or +TRANS(OpenCLTSServer)(). The parameter +port specifies the port to which this endpoint should be bound for listening. If port is NULL, then the transport may attempt to allocate any available TSAP for this connection. If the transport cannot support this, then this function will -return a failure. The flags parameter can be set -to ADDR_IN_USE_ALLOWED to allow the call to the underlying binding function to -fail with a EADDRINUSE error without causing the -TRANS(CreateListener) +return a failure. The flags parameter can be set +to ADDR_IN_USE_ALLOWED to allow the call to the underlying +binding function to fail with a EADDRINUSE error +without causing the TRANS(CreateListener) function itself to fail. This function return 0 on success and -1 on failure. @@ -439,13 +454,13 @@ int TRANS(ResetListener)(XtransConnInfo connection) When a server is restarted, certain listen ports may need to be reset. For example, unix domain needs to check that the file used for communication has not been deleted. If it has, it must be recreated. -The parameter connection is an opened and bound -endpoint that was obtained from TRANS(OpenCOTSServer)() and passed to -TRANS(CreateListener)(). +The parameter connection is an opened and bound +endpoint that was obtained from TRANS(OpenCOTSServer)() +and passed to TRANS(CreateListener)(). This function will return one of the following values: -TRANS_RESET_NOOP, -TRANS_RESET_NEW_FD, or -TRANS_RESET_FAILURE. +TRANS_RESET_NOOP, +TRANS_RESET_NEW_FD, or +TRANS_RESET_FAILURE. @@ -454,10 +469,11 @@ XtransConnInfo TRANS(Accept)(XtransConnInfo connection) Once a connection indication is received, this function can be called to -accept the connection. The parameter connection is -an opened and bound endpoint that was obtained from TRANS(OpenCOTSServer)() and passed to -TRANS(CreateListener)(). This function will return a new opaque transport -connection object upon success, NULL otherwise. +accept the connection. The parameter connection is +an opened and bound endpoint that was obtained from +TRANS(OpenCOTSServer)() and passed to +TRANS(CreateListener)(). This function will return a +new opaque transport connection object upon success, NULL otherwise. @@ -466,9 +482,10 @@ int TRANS(Connect)(XtransConnInfo connection, char *address) This function creates a connection to a server. The parameter -connection is -an endpoint that was obtained from TRANS(OpenCOTSClient)(). The parameters -address specify the TSAP to which this endpoint should connect. If the +connection is an endpoint that was obtained +from TRANS(OpenCOTSClient)(). The parameter +address specifies the TSAP to which this endpoint +should connect. If the protocol is included in the address, it will be ignored. This function return 0 on success and -1 on failure. @@ -505,7 +522,7 @@ connection, and will send a packet of the requested size on a CLTS connection. int TRANS(Readv)(XtransConnInfo connection, struct iovec *buf, int size) -Similar to TRANS(Read)(). +Similar to TRANS(Read)(). @@ -513,7 +530,7 @@ Similar to TRANS(Read)(). int TRANS(Writev)(XtransConnInfo connection, struct iovec *buf, int size) -Similar to TRANS(Write)(). +Similar to TRANS(Write)(). @@ -532,8 +549,8 @@ int TRANS(Close)(XtransConnInfo connection) This function closes the transport, unbinds it, and frees all resources that -was associated with the transport. If a TRANS(Disconnect) call was not -made on the connection, a disorderly disconnect may occur. +was associated with the transport. If a TRANS(Disconnect) +call was not made on the connection, a disorderly disconnect may occur. @@ -592,8 +609,9 @@ int *count_ret, XtransConnInfo **connections_ret) This function should be used by most servers. It will try to establish a COTS server endpoint for each transport listed in the transport table. -partial_ret will be set to True if only a partial network could be -created. count_ret is the number of transports returns, and connections_ret +partial_ret will be set to True if +only a partial network could be created. count_ret is +the number of transports returned, and connections_ret is the list of transports. @@ -605,8 +623,9 @@ int *count_ret, XtransConnInfo **connections_ret) This function should be used by most servers. It will try to establish a CLTS server endpoint for each transport listed in the transport table. -partial_ret will be set to True if only a partial network could be -created. count_ret is the number of transports returns, and connections_ret +partial_ret will be set to True if +only a partial network could be created. count_ret is +the number of transports returned, and connections_ret is the list of transports. @@ -647,7 +666,7 @@ then it will silently ignore the option. -TRANS_NONBLOCKING +TRANS_NONBLOCKING This option controls the blocking mode of the connection. If the argument @@ -657,7 +676,7 @@ is set to 0, then the connection will be set to non- blocking. -TRANS_CLOSEONEXEC +TRANS_CLOSEONEXEC This option determines what will happen to the connection when an exec is @@ -675,7 +694,7 @@ connection will not be closed when an exec occurs. The hidden transport dependent functions are placed in the Xtransport record. These function are similar to the Exposed Transport Independent API, but some of the parameters and return values are slightly different. Stuff like -the #ifdef SUNSYSV should be handled inside these functions. +the #ifdef SUNSYSV should be handled inside these functions. @@ -686,11 +705,11 @@ struct _Xtransport *thistrans, char *protocol, char *host, char *port) This function creates a Connection-Oriented Transport. The parameter -thistrans +thistrans points to an Xtransport entry in the transport table. The parameters -protocol, -host, and -port, point to strings containing the corresponding +protocol, +host, and +port, point to strings containing the corresponding parts of the address that was passed into TRANS(OpenCOTSClient)(). This function must allocate and initialize the contents of the XtransConnInfo structure that is returned by this function. This function will open the @@ -706,12 +725,12 @@ struct _Xtransport *thistrans, char *protocol, char *host, char *port) This function creates a Connection-Oriented Transport. The parameter -thistrans +thistrans points to an Xtransport entry in the transport table. The parameters -protocol, -host, and -port point to strings containing the +protocol, +host, and +port point to strings containing the corresponding parts of the address that was passed into TRANS(OpenCOTSClient)(). This function must allocate and initialize the contents of the @@ -726,11 +745,11 @@ struct _Xtransport *thistrans, char *protocol, char *host, char *port) This function creates a Connection-Less Transport. The parameter -thistrans +thistrans points to an Xtransport entry in the transport table. The parameters -protocol, -host, and -port point to strings containing the +protocol, +host, and +port point to strings containing the corresponding parts of the address that was passed into TRANS(OpenCOTSClient)(). This function must allocate and initialize the contents of the XtransConnInfo @@ -747,11 +766,11 @@ struct _Xtransport *thistrans, char *protocol, char *host, char *port) This function creates a Connection-Less Transport. The parameter -thistrans +thistrans points to an Xtransport entry in the transport table. The parameters -protocol, -host, and -port point to strings containing the +protocol, +host, and +port point to strings containing the corresponding parts of the address that was passed into TRANS(OpenCOTSClient)(). This function must allocate and initialize the contents of the @@ -766,7 +785,7 @@ int SetOption (struct _Xtransport *thistrans, int option, int arg) This function provides a transport dependent way of implementing the options defined by the X Transport Interface. In the current prototype, -this function is not being used, because all of the option defined so far, +this function is not being used, because all of the options defined so far are transport independent. This function will have to be used if a radically different transport type is added, or a transport dependent option is defined. @@ -777,13 +796,13 @@ int CreateListener (struct _Xtransport *thistrans, char *port, int flags ) This function takes a transport endpoint opened for a server, and sets it -Jup to listen for incoming connection requests. The parameter port -port -contain the port portion of the address that was passed to the Open function. -The parameter -flags should be set to ADDR_IN_USE_ALLOWED if the -underlying transport endpoint may be already bound and this should not be considered -as an error. Otherwise flags sould be set to 0. This is used by IPv6 code, +up to listen for incoming connection requests. The parameter +port +contains the port portion of the address that was passed to the Open function. +The parameter flags should be set to +ADDR_IN_USE_ALLOWED if the underlying transport endpoint +may be already bound and this should not be considered +as an error. Otherwise flags should be set to 0. This is used by IPv6 code, where the same socket can be bound to both an IPv6 address and then to a IPv4 address. This function will bind the transport into the transport name space if applicable, and fill in the local address portion of the @@ -806,7 +825,7 @@ This function resets the transport for listening. This function creates a new transport endpoint as a result of an incoming connection request. The parameter -thistrans is the endpoint +thistrans is the endpoint that was opened for listening by the server. The new endpoint is opened and bound into the transport’s namespace. A XtransConnInfo structure describing the new endpoint is returned from this function @@ -818,8 +837,8 @@ int Connect(struct _Xtransport *thistrans, char *host, char *port ) This function establishes a connection to a server. The parameters -host and -port +host and +port describe the server to which the connection should be established. The connection will be established so that Read() and @@ -894,21 +913,60 @@ This function will break the connection, and close the endpoint. The implementation of each transport can be platform specific. It is expected -that existing connection types such as TCPCONN, UNIXCONN, LOCALCONN and -STREAMSCONN will be replaced with flags for each possible transport type. +that existing connection types such as TCPCONN, +UNIXCONN, LOCALCONN, and +STREAMSCONN will be replaced with flags for each +possible transport type. -Below are the flags that can be set in ConnectionFlags in the vendor.cf or -site.def config files. +Below are the flags that can be set in ConnectionFlags +in the vendor.cf or +site.def config files. - - TCPCONN Enables the INET (IPv4) Domain Socket based transport - IPv6 Extends TCPCONN to enable IPv6 Socket based transport - UNIXCONN Enables the UNIX Domain Socket based transport - STREAMSCONN Enables the TLI based transports - LOCALCONN Enables the SYSV Local connection transports - DNETCONN Enables the DECnet transports - + + + + + + + TCPCONN + + Enables the INET (IPv4) Domain Socket based transport + + + + IPv6 + + Extends TCPCONN to enable IPv6 Socket based transport + + + + UNIXCONN + + Enables the UNIX Domain Socket based transport + + + + STREAMSCONN + + Enables the TLI based transports + + + + LOCALCONN + + Enables the SYSV Local connection transports + + + + DNETCONN + + Enables the DECnet transports + + + + + @@ -978,34 +1036,38 @@ concurrently with this document. This prototype has been able to flush out many details and problems as the specification was being developed. -All of the source code for this interface is located in xc/lib/xtrans. +All of the source code for this interface is located in +xc/lib/xtrans. -All functions names in the source are of the format TRANS(func)(). The +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 - + + -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. +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 transport.c. This file will include the transports based on the configuration -flags ConnectionFlags. Below is an example transport.c. +All libraries and servers that use the X Transport Interface should have a new +file called transport.c. This file will include the +transports based on the configuration flags ConnectionFlags. Below is an +example transport.c. - + #include "Xtransint.h" #ifdef DNETCONN #include "Xtransdnet.c" @@ -1021,32 +1083,70 @@ flags ConnectionFlags. Below is an example transport.c. #endif #include "Xtrans.c" #include "Xtransutil.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. - + + + 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 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. +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. -- cgit v1.2.3