summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xtrans.c59
-rw-r--r--Xtrans.h25
-rw-r--r--Xtransint.h34
-rw-r--r--Xtranslcl.c74
-rw-r--r--Xtranssock.c35
-rw-r--r--configure.ac2
-rw-r--r--doc/xtrans.xml88
7 files changed, 179 insertions, 138 deletions
diff --git a/Xtrans.c b/Xtrans.c
index 27973ef..c4b7556 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -185,7 +185,8 @@ TRANS(SelectTransport) (const char *protocol)
static
#endif /* TEST_t */
int
-TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
+TRANS(ParseAddress) (const char *address,
+ char **protocol, char **host, char **port)
{
/*
@@ -392,7 +393,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
*/
static XtransConnInfo
-TRANS(Open) (int type, char *address)
+TRANS(Open) (int type, const char *address)
{
char *protocol = NULL, *host = NULL, *port = NULL;
@@ -490,7 +491,7 @@ TRANS(Open) (int type, char *address)
*/
static XtransConnInfo
-TRANS(Reopen) (int type, int trans_id, int fd, char *port)
+TRANS(Reopen) (int type, int trans_id, int fd, const char *port)
{
XtransConnInfo ciptr = NULL;
@@ -565,7 +566,7 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
#ifdef TRANS_CLIENT
XtransConnInfo
-TRANS(OpenCOTSClient) (char *address)
+TRANS(OpenCOTSClient) (const char *address)
{
prmsg (2,"OpenCOTSClient(%s)\n", address);
@@ -578,7 +579,7 @@ TRANS(OpenCOTSClient) (char *address)
#ifdef TRANS_SERVER
XtransConnInfo
-TRANS(OpenCOTSServer) (char *address)
+TRANS(OpenCOTSServer) (const char *address)
{
prmsg (2,"OpenCOTSServer(%s)\n", address);
@@ -591,7 +592,7 @@ TRANS(OpenCOTSServer) (char *address)
#ifdef TRANS_CLIENT
XtransConnInfo
-TRANS(OpenCLTSClient) (char *address)
+TRANS(OpenCLTSClient) (const char *address)
{
prmsg (2,"OpenCLTSClient(%s)\n", address);
@@ -604,7 +605,7 @@ TRANS(OpenCLTSClient) (char *address)
#ifdef TRANS_SERVER
XtransConnInfo
-TRANS(OpenCLTSServer) (char *address)
+TRANS(OpenCLTSServer) (const char *address)
{
prmsg (2,"OpenCLTSServer(%s)\n", address);
@@ -617,7 +618,7 @@ TRANS(OpenCLTSServer) (char *address)
#ifdef TRANS_REOPEN
XtransConnInfo
-TRANS(ReopenCOTSServer) (int trans_id, int fd, char *port)
+TRANS(ReopenCOTSServer) (int trans_id, int fd, const char *port)
{
prmsg (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port);
@@ -625,7 +626,7 @@ TRANS(ReopenCOTSServer) (int trans_id, int fd, char *port)
}
XtransConnInfo
-TRANS(ReopenCLTSServer) (int trans_id, int fd, char *port)
+TRANS(ReopenCLTSServer) (int trans_id, int fd, const char *port)
{
prmsg (2,"ReopenCLTSServer(%d, %d, %s)\n", trans_id, fd, port);
@@ -745,7 +746,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
#ifdef TRANS_SERVER
int
-TRANS(CreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
+TRANS(CreateListener) (XtransConnInfo ciptr, const char *port, unsigned int flags)
{
return ciptr->transptr->CreateListener (ciptr, port, flags);
@@ -806,6 +807,31 @@ TRANS(NoListen) (const char * protocol)
}
int
+TRANS(Listen) (const char * protocol)
+{
+ Xtransport *trans;
+ int i = 0, ret = 0;
+
+ if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
+ {
+ prmsg (1,"TransListen: unable to find transport: %s\n",
+ protocol);
+
+ return -1;
+ }
+ if (trans->flags & TRANS_ALIAS) {
+ if (trans->nolisten)
+ while (trans->nolisten[i]) {
+ ret |= TRANS(Listen)(trans->nolisten[i]);
+ i++;
+ }
+ }
+
+ trans->flags &= ~TRANS_NOLISTEN;
+ return ret;
+}
+
+int
TRANS(IsListening) (const char * protocol)
{
Xtransport *trans;
@@ -854,7 +880,7 @@ TRANS(Accept) (XtransConnInfo ciptr, int *status)
#ifdef TRANS_CLIENT
int
-TRANS(Connect) (XtransConnInfo ciptr, char *address)
+TRANS(Connect) (XtransConnInfo ciptr, const char *address)
{
char *protocol;
@@ -1076,7 +1102,8 @@ complete_network_count (void)
static int
-receive_listening_fds(char* port, XtransConnInfo* temp_ciptrs, int* count_ret)
+receive_listening_fds(const char* port, XtransConnInfo* temp_ciptrs,
+ int* count_ret)
{
#ifdef HAVE_SYSTEMD_DAEMON
@@ -1153,8 +1180,8 @@ extern int xquartz_launchd_fd;
#endif
int
-TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
- XtransConnInfo **ciptrs_ret)
+TRANS(MakeAllCOTSServerListeners) (const char *port, int *partial,
+ int *count_ret, XtransConnInfo **ciptrs_ret)
{
char buffer[256]; /* ??? What size ?? */
@@ -1284,8 +1311,8 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
}
int
-TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
- XtransConnInfo **ciptrs_ret)
+TRANS(MakeAllCLTSServerListeners) (const char *port, int *partial,
+ int *count_ret, XtransConnInfo **ciptrs_ret)
{
char buffer[256]; /* ??? What size ?? */
diff --git a/Xtrans.h b/Xtrans.h
index 5807b67..22e0440 100644
--- a/Xtrans.h
+++ b/Xtrans.h
@@ -52,6 +52,7 @@ from The Open Group.
#include <X11/Xfuncproto.h>
#include <X11/Xos.h>
+#include <X11/Xmd.h>
#ifndef WIN32
#include <sys/socket.h>
@@ -236,7 +237,7 @@ void TRANS(FreeConnInfo) (
#ifdef TRANS_CLIENT
XtransConnInfo TRANS(OpenCOTSClient)(
- char * /* address */
+ const char * /* address */
);
#endif /* TRANS_CLIENT */
@@ -244,7 +245,7 @@ XtransConnInfo TRANS(OpenCOTSClient)(
#ifdef TRANS_SERVER
XtransConnInfo TRANS(OpenCOTSServer)(
- char * /* address */
+ const char * /* address */
);
#endif /* TRANS_SERVER */
@@ -252,7 +253,7 @@ XtransConnInfo TRANS(OpenCOTSServer)(
#ifdef TRANS_CLIENT
XtransConnInfo TRANS(OpenCLTSClient)(
- char * /* address */
+ const char * /* address */
);
#endif /* TRANS_CLIENT */
@@ -260,7 +261,7 @@ XtransConnInfo TRANS(OpenCLTSClient)(
#ifdef TRANS_SERVER
XtransConnInfo TRANS(OpenCLTSServer)(
- char * /* address */
+ const char * /* address */
);
#endif /* TRANS_SERVER */
@@ -270,13 +271,13 @@ XtransConnInfo TRANS(OpenCLTSServer)(
XtransConnInfo TRANS(ReopenCOTSServer)(
int, /* trans_id */
int, /* fd */
- char * /* port */
+ const char * /* port */
);
XtransConnInfo TRANS(ReopenCLTSServer)(
int, /* trans_id */
int, /* fd */
- char * /* port */
+ const char * /* port */
);
int TRANS(GetReopenInfo)(
@@ -299,7 +300,7 @@ int TRANS(SetOption)(
int TRANS(CreateListener)(
XtransConnInfo, /* ciptr */
- char *, /* port */
+ const char *, /* port */
unsigned int /* flags */
);
@@ -311,6 +312,10 @@ int TRANS(NoListen) (
const char* /* protocol*/
);
+int TRANS(Listen) (
+ const char* /* protocol*/
+);
+
int TRANS(IsListening) (
const char* /* protocol*/
);
@@ -330,7 +335,7 @@ XtransConnInfo TRANS(Accept)(
int TRANS(Connect)(
XtransConnInfo, /* ciptr */
- char * /* address */
+ const char * /* address */
);
#endif /* TRANS_CLIENT */
@@ -405,14 +410,14 @@ int TRANS(GetConnectionNumber)(
#ifdef TRANS_SERVER
int TRANS(MakeAllCOTSServerListeners)(
- char *, /* port */
+ const char *, /* port */
int *, /* partial */
int *, /* count_ret */
XtransConnInfo ** /* ciptrs_ret */
);
int TRANS(MakeAllCLTSServerListeners)(
- char *, /* port */
+ const char *, /* port */
int *, /* partial */
int *, /* count_ret */
XtransConnInfo ** /* ciptrs_ret */
diff --git a/Xtransint.h b/Xtransint.h
index 4c670b8..5ff824d 100644
--- a/Xtransint.h
+++ b/Xtransint.h
@@ -163,9 +163,9 @@ typedef struct _Xtransport {
XtransConnInfo (*OpenCOTSClient)(
struct _Xtransport *, /* transport */
- char *, /* protocol */
- char *, /* host */
- char * /* port */
+ const char *, /* protocol */
+ const char *, /* host */
+ const char * /* port */
);
#endif /* TRANS_CLIENT */
@@ -174,9 +174,9 @@ typedef struct _Xtransport {
const char ** nolisten;
XtransConnInfo (*OpenCOTSServer)(
struct _Xtransport *, /* transport */
- char *, /* protocol */
- char *, /* host */
- char * /* port */
+ const char *, /* protocol */
+ const char *, /* host */
+ const char * /* port */
);
#endif /* TRANS_SERVER */
@@ -185,9 +185,9 @@ typedef struct _Xtransport {
XtransConnInfo (*OpenCLTSClient)(
struct _Xtransport *, /* transport */
- char *, /* protocol */
- char *, /* host */
- char * /* port */
+ const char *, /* protocol */
+ const char *, /* host */
+ const char * /* port */
);
#endif /* TRANS_CLIENT */
@@ -196,9 +196,9 @@ typedef struct _Xtransport {
XtransConnInfo (*OpenCLTSServer)(
struct _Xtransport *, /* transport */
- char *, /* protocol */
- char *, /* host */
- char * /* port */
+ const char *, /* protocol */
+ const char *, /* host */
+ const char * /* port */
);
#endif /* TRANS_SERVER */
@@ -209,13 +209,13 @@ typedef struct _Xtransport {
XtransConnInfo (*ReopenCOTSServer)(
struct _Xtransport *, /* transport */
int, /* fd */
- char * /* port */
+ const char * /* port */
);
XtransConnInfo (*ReopenCLTSServer)(
struct _Xtransport *, /* transport */
int, /* fd */
- char * /* port */
+ const char * /* port */
);
#endif /* TRANS_REOPEN */
@@ -233,7 +233,7 @@ typedef struct _Xtransport {
int (*CreateListener)(
XtransConnInfo, /* connection */
- char *, /* port */
+ const char *, /* port */
unsigned int /* flags */
);
@@ -252,8 +252,8 @@ typedef struct _Xtransport {
int (*Connect)(
XtransConnInfo, /* connection */
- char *, /* host */
- char * /* port */
+ const char *, /* host */
+ const char * /* port */
);
#endif /* TRANS_CLIENT */
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 4deb86c..3217506 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -123,7 +123,7 @@ static int TRANS(LocalClose)(XtransConnInfo ciptr);
/* Type Not Supported */
static int
-TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, char *port _X_UNUSED)
+TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, const char *port _X_UNUSED)
{
return -1;
@@ -132,7 +132,8 @@ TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, char *port _X_UNUSED)
#ifdef TRANS_REOPEN
static int
-TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, char *port _X_UNUSED)
+TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED,
+ const char *port _X_UNUSED)
{
return 0;
@@ -158,7 +159,8 @@ TRANS(LocalSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close)
static int
-TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
+TRANS(FillAddrInfo)(XtransConnInfo ciptr,
+ const char *sun_path, const char *peer_sun_path)
{
struct sockaddr_un *sunaddr;
@@ -316,7 +318,7 @@ static void _dummy(int sig _X_UNUSED)
#ifdef TRANS_CLIENT
static int
-TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
+TRANS(PTSOpenClient)(XtransConnInfo ciptr, const char *port)
{
#ifdef PTSNODENAME
@@ -468,7 +470,7 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
#ifdef TRANS_SERVER
static int
-TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
+TRANS(PTSOpenServer)(XtransConnInfo ciptr, const char *port)
{
#ifdef PTSNODENAME
@@ -669,7 +671,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
#ifdef TRANS_CLIENT
static int
-TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
+TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, const char *port)
{
#ifdef NAMEDNODENAME
@@ -806,7 +808,7 @@ TRANS(NAMEDOpenPipe)(const char *server_path)
#endif
static int
-TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port)
+TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, const char *port)
{
#ifdef NAMEDNODENAME
int fd;
@@ -1012,7 +1014,7 @@ named_spipe(int fd, char *path)
#ifdef TRANS_CLIENT
static int
-TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
+TRANS(SCOOpenClient)(XtransConnInfo ciptr, const char *port)
{
#ifdef SCORNODENAME
int fd, server, fl, ret;
@@ -1100,7 +1102,7 @@ TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
#ifdef TRANS_SERVER
static int
-TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
+TRANS(SCOOpenServer)(XtransConnInfo ciptr, const char *port)
{
#ifdef SCORNODENAME
char serverR_path[64];
@@ -1276,7 +1278,7 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
#ifdef LOCAL_TRANS_PTS
static int
-TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
+TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, const char *port)
{
#ifdef PTSNODENAME
@@ -1317,7 +1319,7 @@ TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
#ifdef LOCAL_TRANS_NAMED
static int
-TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, char *port)
+TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, const char *port)
{
#ifdef NAMEDNODENAME
@@ -1358,7 +1360,7 @@ TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, char *port)
#ifdef LOCAL_TRANS_SCO
static int
-TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, char *port)
+TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, const char *port)
{
#ifdef SCORNODENAME
@@ -1407,7 +1409,7 @@ typedef struct _LOCALtrans2dev {
#ifdef TRANS_CLIENT
int (*devcotsopenclient)(
- XtransConnInfo, char * /*port*/
+ XtransConnInfo, const char * /*port*/
);
#endif /* TRANS_CLIENT */
@@ -1415,7 +1417,7 @@ typedef struct _LOCALtrans2dev {
#ifdef TRANS_SERVER
int (*devcotsopenserver)(
- XtransConnInfo, char * /*port*/
+ XtransConnInfo, const char * /*port*/
);
#endif /* TRANS_SERVER */
@@ -1423,7 +1425,7 @@ typedef struct _LOCALtrans2dev {
#ifdef TRANS_CLIENT
int (*devcltsopenclient)(
- XtransConnInfo, char * /*port*/
+ XtransConnInfo, const char * /*port*/
);
#endif /* TRANS_CLIENT */
@@ -1431,7 +1433,7 @@ typedef struct _LOCALtrans2dev {
#ifdef TRANS_SERVER
int (*devcltsopenserver)(
- XtransConnInfo, char * /*port*/
+ XtransConnInfo, const char * /*port*/
);
#endif /* TRANS_SERVER */
@@ -1441,13 +1443,13 @@ typedef struct _LOCALtrans2dev {
int (*devcotsreopenserver)(
XtransConnInfo,
int, /* fd */
- char * /* port */
+ const char * /* port */
);
int (*devcltsreopenserver)(
XtransConnInfo,
int, /* fd */
- char * /* port */
+ const char * /* port */
);
#endif /* TRANS_REOPEN */
@@ -1757,7 +1759,7 @@ TRANS(LocalGetNextTransport)(void)
*/
static int
-HostReallyLocal (char *host)
+HostReallyLocal (const char *host)
{
/*
@@ -1787,7 +1789,8 @@ HostReallyLocal (char *host)
static XtransConnInfo
-TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
+TRANS(LocalOpenClient)(int type, const char *protocol,
+ const char *host, const char *port)
{
LOCALtrans2dev *transptr;
@@ -1882,7 +1885,8 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(LocalOpenServer)(int type, char *protocol, char *host _X_UNUSED, char *port)
+TRANS(LocalOpenServer)(int type, const char *protocol,
+ const char *host _X_UNUSED, const char *port)
{
int i;
@@ -1945,7 +1949,7 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host _X_UNUSED, char *por
#ifdef TRANS_REOPEN
static XtransConnInfo
-TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
+TRANS(LocalReopenServer)(int type, int index, int fd, const char *port)
{
XtransConnInfo ciptr;
@@ -1997,8 +2001,8 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol,
- char *host, char *port)
+TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol,
+ const char *host, const char *port)
{
prmsg(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port);
@@ -2012,8 +2016,8 @@ TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
- char *host, char *port)
+TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const char *protocol,
+ const char *host, const char *port)
{
char *typetocheck = NULL;
@@ -2056,8 +2060,8 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol,
- char *host, char *port)
+TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol,
+ const char *host, const char *port)
{
prmsg(2,"LocalOpenCLTSClient(%s,%s,%s)\n",protocol,host,port);
@@ -2071,8 +2075,8 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(LocalOpenCLTSServer)(Xtransport *thistrans _X_UNUSED, char *protocol,
- char *host, char *port)
+TRANS(LocalOpenCLTSServer)(Xtransport *thistrans _X_UNUSED, const char *protocol,
+ const char *host, const char *port)
{
prmsg(2,"LocalOpenCLTSServer(%s,%s,%s)\n",protocol,host,port);
@@ -2086,7 +2090,7 @@ TRANS(LocalOpenCLTSServer)(Xtransport *thistrans _X_UNUSED, char *protocol,
#ifdef TRANS_REOPEN
static XtransConnInfo
-TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
+TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, const char *port)
{
int index;
@@ -2110,7 +2114,7 @@ TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
}
static XtransConnInfo
-TRANS(LocalReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
+TRANS(LocalReopenCLTSServer)(Xtransport *thistrans, int fd, const char *port)
{
int index;
@@ -2150,7 +2154,8 @@ TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg)
#ifdef TRANS_SERVER
static int
-TRANS(LocalCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags _X_UNUSED)
+TRANS(LocalCreateListener)(XtransConnInfo ciptr, const char *port,
+ unsigned int flags _X_UNUSED)
{
prmsg(2,"LocalCreateListener(%p->%d,%s)\n",ciptr,ciptr->fd,port);
@@ -2215,7 +2220,8 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status)
#ifdef TRANS_CLIENT
static int
-TRANS(LocalConnect)(XtransConnInfo ciptr, char *host _X_UNUSED, char *port)
+TRANS(LocalConnect)(XtransConnInfo ciptr,
+ const char *host _X_UNUSED, const char *port)
{
prmsg(2,"LocalConnect(%p->%d,%s)\n", ciptr, ciptr->fd, port);
diff --git a/Xtranssock.c b/Xtranssock.c
index f122dc8..2c4f9f3 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -473,7 +473,7 @@ TRANS(SocketOpen) (int i, int type)
#ifdef TRANS_REOPEN
static XtransConnInfo
-TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
+TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, const char *port)
{
XtransConnInfo ciptr;
@@ -596,8 +596,8 @@ TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol,
}
static XtransConnInfo
-TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol,
- char *host, char *port)
+TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, const char *protocol,
+ const char *host, const char *port)
{
return TRANS(SocketOpenCOTSClientBase)(
thistrans->TransName, protocol, host, port, -1);
@@ -610,8 +610,8 @@ TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
- char *host, char *port)
+TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, const char *protocol,
+ const char *host, const char *port)
{
XtransConnInfo ciptr;
@@ -677,8 +677,8 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
- char *host, char *port)
+TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, const char *protocol,
+ const char *host, const char *port)
{
XtransConnInfo ciptr;
@@ -716,8 +716,8 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
- char *host, char *port)
+TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, const char *protocol,
+ const char *host, const char *port)
{
XtransConnInfo ciptr;
@@ -762,7 +762,7 @@ TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
#ifdef TRANS_REOPEN
static XtransConnInfo
-TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
+TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, const char *port)
{
XtransConnInfo ciptr;
@@ -796,7 +796,7 @@ TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
}
static XtransConnInfo
-TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
+TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, const char *port)
{
XtransConnInfo ciptr;
@@ -947,7 +947,8 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
#ifdef TCPCONN
static int
-TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
+TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, const char *port,
+ unsigned int flags)
{
#if defined(IPv6) && defined(AF_INET6)
@@ -1075,7 +1076,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
#ifdef UNIXCONN
static int
-TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
+TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, const char *port,
unsigned int flags)
{
@@ -1431,7 +1432,8 @@ static struct addrlist *addrlist = NULL;
static int
-TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
+TRANS(SocketINETConnect) (XtransConnInfo ciptr,
+ const char *host, const char *port)
{
struct sockaddr * socketaddr = NULL;
@@ -1813,7 +1815,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
*/
static int
-UnixHostReallyLocal (char *host)
+UnixHostReallyLocal (const char *host)
{
char hostnamebuf[256];
@@ -1944,7 +1946,8 @@ UnixHostReallyLocal (char *host)
}
static int
-TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
+TRANS(SocketUNIXConnect) (XtransConnInfo ciptr,
+ const char *host, const char *port)
{
struct sockaddr_un sockname;
diff --git a/configure.ac b/configure.ac
index bb8a34c..b43f0f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([xtrans], [1.3.4],
+AC_INIT([xtrans], [1.3.5],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xtrans])
AC_CONFIG_SRCDIR([Makefile.am])
diff --git a/doc/xtrans.xml b/doc/xtrans.xml
index 59daa3f..e3bc1c9 100644
--- a/doc/xtrans.xml
+++ b/doc/xtrans.xml
@@ -187,35 +187,35 @@ points for a single transport. This record is defined as:
<synopsis>
typedef struct _Xtransport {
- char *TransName;
+ const char *TransName;
int flags;
XtransConnInfo (*OpenCOTSClient)(
- struct _Xtransport *, /* transport */
- char *, /* protocol */
- char *, /* host */
- char * /* port */
+ struct _Xtransport *, /* transport */
+ const char *, /* protocol */
+ const char *, /* host */
+ const char * /* port */
);
XtransConnInfo (*OpenCOTSServer)(
- struct _Xtransport *, /* transport */
- char *, /* protocol */
- char *, /* host */
- char * /* port */
+ struct _Xtransport *, /* transport */
+ const char *, /* protocol */
+ const char *, /* host */
+ const char * /* port */
);
XtransConnInfo (*OpenCLTSClient)(
- struct _Xtransport *, /* transport */
- char *, /* protocol */
- char *, /* host */
- char * /* port */
+ struct _Xtransport *, /* transport */
+ const char *, /* protocol */
+ const char *, /* host */
+ const char * /* port */
);
XtransConnInfo (*OpenCLTSServer)(
- struct _Xtransport *, /* transport */
- char *, /* protocol */
- char *, /* host */
- char * /* port */
+ struct _Xtransport *, /* transport */
+ const char *, /* protocol */
+ const char *, /* host */
+ const char * /* port */
);
int (*SetOption)(
@@ -226,8 +226,8 @@ typedef struct _Xtransport {
int (*CreateListener)(
XtransConnInfo, /* connection */
- char *, /* port */
- int /* flags */
+ const char *, /* port */
+ int /* flags */
);
int (*ResetListener)(
@@ -240,8 +240,8 @@ typedef struct _Xtransport {
int (*Connect)(
XtransConnInfo, /* connection */
- char *, /* host */
- char * /* port */
+ const char *, /* host */
+ const char * /* port */
);
int (*BytesReadable)(
@@ -393,7 +393,7 @@ errno will be available for debugging purposes.
<funcsynopsis id='TRANSOpenCOTSClient'>
<funcprototype>
<funcdef>XtransConnInfo <function>TRANS(OpenCOTSClient)</function></funcdef>
- <paramdef>char *<parameter>address</parameter></paramdef>
+ <paramdef>const char *<parameter>address</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -408,7 +408,7 @@ success, or <constant>NULL</constant> on failure.
<funcsynopsis id='TRANSOpenCOTSServer'>
<funcprototype>
<funcdef>XtransConnInfo <function>TRANS(OpenCOTSServer)</function></funcdef>
- <paramdef>char *<parameter>address</parameter></paramdef>
+ <paramdef>const char *<parameter>address</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -423,7 +423,7 @@ on failure.
<funcsynopsis id='TRANSOpenCLTSClient'>
<funcprototype>
<funcdef>XtransConnInfo <function>TRANS(OpenCLTSClient)</function></funcdef>
- <paramdef>char *<parameter>address</parameter></paramdef>
+ <paramdef>const char *<parameter>address</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -438,7 +438,7 @@ function returns an opaque transport connection object on success, or
<funcsynopsis id='TRANSOpenCLTSServer'>
<funcprototype>
<funcdef>XtransConnInfo <function>TRANS(OpenCLTSServer)</function></funcdef>
- <paramdef>char *<parameter>address</parameter></paramdef>
+ <paramdef>const char *<parameter>address</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -480,7 +480,7 @@ Based on current usage, the complimentary function
<funcprototype>
<funcdef>int <function>TRANS(CreateListener)</function></funcdef>
<paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
- <paramdef>char *<parameter>port</parameter></paramdef>
+ <paramdef>const char *<parameter>port</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@@ -542,7 +542,7 @@ new opaque transport connection object upon success,
<funcprototype>
<funcdef>int <function>TRANS(Connect)</function></funcdef>
<paramdef>XtransConnInfo <parameter>connection</parameter></paramdef>
- <paramdef>char *<parameter>address</parameter></paramdef>
+ <paramdef>const char *<parameter>address</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -712,7 +712,7 @@ Returns the file descriptor associated with this transport.
<funcsynopsis id='TRANSMakeAllCOTSServerListeners'>
<funcprototype>
<funcdef>int <function>TRANS(MakeAllCOTSServerListeners)</function></funcdef>
- <paramdef>char *<parameter>port</parameter></paramdef>
+ <paramdef>const char *<parameter>port</parameter></paramdef>
<paramdef>int *<parameter>partial_ret</parameter></paramdef>
<paramdef>int *<parameter>count_ret</parameter></paramdef>
<paramdef>XtransConnInfo **<parameter>connections_ret</parameter></paramdef>
@@ -731,7 +731,7 @@ is the list of transports.
<funcsynopsis id='TRANSMakeAllCLTSServerListeners'>
<funcprototype>
<funcdef>int <function>TRANS(MakeAllCLTSServerListeners)</function></funcdef>
- <paramdef>char *<parameter>port</parameter></paramdef>
+ <paramdef>const char *<parameter>port</parameter></paramdef>
<paramdef>int *<parameter>partial_ret</parameter></paramdef>
<paramdef>int *<parameter>count_ret</parameter></paramdef>
<paramdef>XtransConnInfo **<parameter>connections_ret</parameter></paramdef>
@@ -826,9 +826,9 @@ the <code>#ifdef SUNSYSV</code> should be handled inside these functions.
<funcprototype>
<funcdef>XtransConnInfo *<function>OpenCOTSClient</function></funcdef>
<paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
- <paramdef>char *<parameter>protocol</parameter></paramdef>
- <paramdef>char *<parameter>host</parameter></paramdef>
- <paramdef>char *<parameter>port</parameter></paramdef>
+ <paramdef>const char *<parameter>protocol</parameter></paramdef>
+ <paramdef>const char *<parameter>host</parameter></paramdef>
+ <paramdef>const char *<parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -850,9 +850,9 @@ this function.
<funcprototype>
<funcdef>XtransConnInfo *<function>OpenCOTSServer</function></funcdef>
<paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
- <paramdef>char *<parameter>protocol</parameter></paramdef>
- <paramdef>char *<parameter>host</parameter></paramdef>
- <paramdef>char *<parameter>port</parameter></paramdef>
+ <paramdef>const char *<parameter>protocol</parameter></paramdef>
+ <paramdef>const char *<parameter>host</parameter></paramdef>
+ <paramdef>const char *<parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -872,9 +872,9 @@ will open the transport.
<funcprototype>
<funcdef>XtransConnInfo *<function>OpenCLTSClient</function></funcdef>
<paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
- <paramdef>char *<parameter>protocol</parameter></paramdef>
- <paramdef>char *<parameter>host</parameter></paramdef>
- <paramdef>char *<parameter>port</parameter></paramdef>
+ <paramdef>const char *<parameter>protocol</parameter></paramdef>
+ <paramdef>const char *<parameter>host</parameter></paramdef>
+ <paramdef>const char *<parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -896,9 +896,9 @@ in by this function.
<funcprototype>
<funcdef>XtransConnInfo *<function>OpenCLTSServer</function></funcdef>
<paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
- <paramdef>char *<parameter>protocol</parameter></paramdef>
- <paramdef>char *<parameter>host</parameter></paramdef>
- <paramdef>char *<parameter>port</parameter></paramdef>
+ <paramdef>const char *<parameter>protocol</parameter></paramdef>
+ <paramdef>const char *<parameter>host</parameter></paramdef>
+ <paramdef>const char *<parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
@@ -935,7 +935,7 @@ different transport type is added, or a transport dependent option is defined.
<funcprototype>
<funcdef>int <function>CreateListener</function></funcdef>
<paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
- <paramdef>char <parameter>*port</parameter></paramdef>
+ <paramdef>const char <parameter>*port</parameter></paramdef>
<paramdef>int <parameter>flags</parameter></paramdef>
</funcprototype>
</funcsynopsis>
@@ -987,8 +987,8 @@ structure describing the new endpoint is returned from this function
<funcprototype>
<funcdef>int <function>Connect</function></funcdef>
<paramdef>struct _Xtransport *<parameter>thistrans</parameter></paramdef>
- <paramdef>char *<parameter>host</parameter></paramdef>
- <paramdef>char *<parameter>port</parameter></paramdef>
+ <paramdef>const char *<parameter>host</parameter></paramdef>
+ <paramdef>const char *<parameter>port</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>