Skip to content

Chapter 7. Hidden Transport Dependent API

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.

  • XtransConnInfo *OpenCOTSClient ( struct _Xtransport *thistrans, char *protocol, char *host, char *port)

    This function creates a Connection-Oriented Transport. The parameter thistrans points to an Xtransport entry in the transport table. The parameters 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 transport, and bind it into the transport namespace if applicable. The local address portion of the XtransConnInfo structure will also be filled in by this function.

  • XtransConnInfo *OpenCOTSServer ( struct _Xtransport *thistrans, char *protocol, char *host, char *port)

    This function creates a Connection-Oriented Transport. The parameter thistrans points to an Xtransport entry in the transport table. The parameters 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 transport.

  • XtransConnInfo *OpenCLTSClient ( struct _Xtransport *thistrans, char *protocol, char *host, char *port)

    This function creates a Connection-Less Transport. The parameter thistrans points to an Xtransport entry in the transport table. The parameters 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 transport, and bind it into the transport namespace if applicable. The local address portion of the XtransConnInfo structure will also be filled in by this function.

  • XtransConnInfo *OpenCLTSServer ( struct _Xtransport *thistrans, char *protocol, char *host, char *port)

    This function creates a Connection-Less Transport. The parameter thistrans points to an Xtransport entry in the transport table. The parameters 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 transport.

  • 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 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.

  • int CreateListener (struct _Xtransport *thistrans, char *port, int flags )

    This function takes a transport endpoint opened for a server, and sets it 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 XtransConnInfo structure. The transport endpoint will then be set to listen for incoming connection requests.

  • int ResetListener (struct _Xtransport *thistrans)

    This function resets the transport for listening.

  • XtransConnInfo Accept(struct _Xtransport *thistrans)

    This function creates a new transport endpoint as a result of an incoming connection request. The parameter 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

  • int Connect(struct _Xtransport *thistrans, char *host, char *port )

    This function establishes a connection to a server. The parameters host and port describe the server to which the connection should be established. The connection will be established so that Read() and Write() call can be made.

  • int BytesReadable(struct _Xtransport *thistrans, BytesReadable_t *pend )

    This function replaces the BytesReadable() macro. This allows each transport to have it’s own mechanism for determining how much data is ready to be read.

  • int Read(struct _Xtransport *thistrans, char *buf, int size )

    This function reads size bytes into buf from the connection.

  • int Write(struct _Xtransport *thistrans, char *buf, int size )

    This function writes size bytes from buf to the connection.

  • int Readv(struct _Xtransport *thistrans, struct iovec *buf, int size )

    This function performs a readv() on the connection.

  • int Writev(struct _Xtransport *thistrans, struct iovec *buf, int size )

    This function performs a writev() on the connection.

  • int Disconnect(struct _Xtransport *thistrans)

    This function initiates an orderly shutdown of a connection. If a transport does not distinguish between orderly and disorderly disconnects, then a call to this function will have no affect.

  • int Close(struct _Xtransport *thistrans)

    This function will break the connection, and close the endpoint.