Back to index

im-sdk  12.3.91
Classes | Defines | Typedefs | Functions
Xtrans.h File Reference
#include <X11/Xfuncproto.h>
#include <X11/Xos.h>
#include <sys/uio.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Xtransaddr

Defines

#define TRANS(func)   _XTransfunc
#define XTRANS_MAX_ADDR_LEN   128 /* large enough to hold sun_path */
#define TRANS_NONBLOCKING   1
#define TRANS_CLOSEONEXEC   2
#define TRANS_CONNECT_FAILED   -1
#define TRANS_TRY_CONNECT_AGAIN   -2
#define TRANS_CREATE_LISTENER_FAILED   -1
#define TRANS_ADDR_IN_USE   -2
#define TRANS_ACCEPT_BAD_MALLOC   -1
#define TRANS_ACCEPT_FAILED   -2
#define TRANS_ACCEPT_MISC_ERROR   -3
#define TRANS_RESET_NOOP   1
#define TRANS_RESET_NEW_FD   2
#define TRANS_RESET_FAILURE   3

Typedefs

typedef long BytesReadable_t
typedef struct _XtransConnInfoXtransConnInfo

Functions

int TRANS() SetOption (XtransConnInfo, int, int)
int TRANS() BytesReadable (XtransConnInfo, BytesReadable_t *)
int TRANS() Read (XtransConnInfo, char *, int)
int TRANS() Write (XtransConnInfo, char *, int)
int TRANS() Readv (XtransConnInfo, struct iovec *, int)
int TRANS() Writev (XtransConnInfo, struct iovec *, int)
int TRANS() Disconnect (XtransConnInfo)
int TRANS() Close (XtransConnInfo)
int TRANS() CloseForCloning (XtransConnInfo)
int TRANS() IsLocal (XtransConnInfo)
int TRANS() GetMyAddr (XtransConnInfo, int *, int *, Xtransaddr **)
int TRANS() GetPeerAddr (XtransConnInfo, int *, int *, Xtransaddr **)
int TRANS() GetConnectionNumber (XtransConnInfo)

Class Documentation

struct Xtransaddr

Definition at line 143 of file Xtrans.h.

Class Members
unsigned char addr

Define Documentation

#define TRANS (   func)    _XTransfunc

Definition at line 127 of file Xtrans.h.

#define TRANS_ACCEPT_BAD_MALLOC   -1

Definition at line 203 of file Xtrans.h.

#define TRANS_ACCEPT_FAILED   -2

Definition at line 204 of file Xtrans.h.

#define TRANS_ACCEPT_MISC_ERROR   -3

Definition at line 205 of file Xtrans.h.

#define TRANS_ADDR_IN_USE   -2

Definition at line 196 of file Xtrans.h.

#define TRANS_CLOSEONEXEC   2

Definition at line 180 of file Xtrans.h.

#define TRANS_CONNECT_FAILED   -1

Definition at line 187 of file Xtrans.h.

Definition at line 195 of file Xtrans.h.

#define TRANS_NONBLOCKING   1

Definition at line 179 of file Xtrans.h.

#define TRANS_RESET_FAILURE   3

Definition at line 214 of file Xtrans.h.

#define TRANS_RESET_NEW_FD   2

Definition at line 213 of file Xtrans.h.

#define TRANS_RESET_NOOP   1

Definition at line 212 of file Xtrans.h.

#define TRANS_TRY_CONNECT_AGAIN   -2

Definition at line 188 of file Xtrans.h.

#define XTRANS_MAX_ADDR_LEN   128 /* large enough to hold sun_path */

Definition at line 141 of file Xtrans.h.


Typedef Documentation

typedef long BytesReadable_t

Definition at line 151 of file Xtrans.h.

Definition at line 172 of file Xtrans.h.


Function Documentation

Definition at line 848 of file Xtrans.c.

{
    return ciptr->transptr->BytesReadable (ciptr, pend);
}
int TRANS() Close ( XtransConnInfo  )

Definition at line 910 of file Xtrans.c.

{
    int ret;

    PRMSG (2,"TRANS(Close) (%d)\n", ciptr->fd, 0, 0);

    ret = ciptr->transptr->Close (ciptr);

    TRANS(FreeConnInfo) (ciptr);

    return ret;
}

Here is the call graph for this function:

Definition at line 927 of file Xtrans.c.

{
    int ret;

    PRMSG (2,"TRANS(CloseForCloning) (%d)\n", ciptr->fd, 0, 0);

    ret = ciptr->transptr->CloseForCloning (ciptr);

    TRANS(FreeConnInfo) (ciptr);

    return ret;
}

Here is the call graph for this function:

Definition at line 901 of file Xtrans.c.

{
    return ciptr->transptr->Disconnect (ciptr);
}

Definition at line 1003 of file Xtrans.c.

{
    return ciptr->fd;
}
int TRANS() GetMyAddr ( XtransConnInfo  ,
int *  ,
int *  ,
Xtransaddr **   
)

Definition at line 954 of file Xtrans.c.

{
    PRMSG (2,"TRANS(GetMyAddr) (%d)\n", ciptr->fd, 0, 0);

    *familyp = ciptr->family;
    *addrlenp = ciptr->addrlen;

    if ((*addrp = (Xtransaddr *) malloc (ciptr->addrlen)) == NULL)
    {
       PRMSG (1,"TRANS(GetMyAddr) malloc failed\n", 0, 0, 0);
       return -1;
    }
    memcpy(*addrp, ciptr->addr, ciptr->addrlen);

    return 0;
}
int TRANS() GetPeerAddr ( XtransConnInfo  ,
int *  ,
int *  ,
Xtransaddr **   
)

Definition at line 978 of file Xtrans.c.

{
    PRMSG (2,"TRANS(GetPeerAddr) (%d)\n", ciptr->fd, 0, 0);

    *familyp = ciptr->family;
    *addrlenp = ciptr->peeraddrlen;

    if ((*addrp = (Xtransaddr *) malloc (ciptr->peeraddrlen)) == NULL)
    {
       PRMSG (1,"TRANS(GetPeerAddr) malloc failed\n", 0, 0, 0);
       return -1;
    }
    memcpy(*addrp, ciptr->peeraddr, ciptr->peeraddrlen);

    return 0;
}

Definition at line 944 of file Xtrans.c.

{
    return (ciptr->family == AF_UNIX);
}
int TRANS() Read ( XtransConnInfo  ,
char *  ,
int   
)

Definition at line 858 of file Xtrans.c.

{
    return ciptr->transptr->Read (ciptr, buf, size);
}
int TRANS() Readv ( XtransConnInfo  ,
struct iovec *  ,
int   
)

Definition at line 880 of file Xtrans.c.

{
    return ciptr->transptr->Readv (ciptr, buf, size);
}
int TRANS() SetOption ( XtransConnInfo  ,
int  ,
int   
)

Definition at line 679 of file Xtrans.c.

{
    int       fd = ciptr->fd;
    int       ret = 0;

    PRMSG (2,"TRANS(SetOption) (%d,%d,%d)\n", fd, option, arg);

    /*
     * For now, all transport type use the same stuff for setting options.
     * As long as this is true, we can put the common code here. Once a more
     * complicated transport such as shared memory or an OSI implementation
     * that uses the session and application libraries is implemented, this
     * code may have to move to a transport dependent function.
     *
     * ret = ciptr->transptr->SetOption (ciptr, option, arg);
     */

    switch (option)
    {
    case TRANS_NONBLOCKING:
       switch (arg)
       {
       case 0:
           /* Set to blocking mode */
           break;
       case 1: /* Set to non-blocking mode */
#if defined(O_NONBLOCK) && (!defined(ultrix) && !defined(hpux) && !defined(AIXV3) && !defined(uniosu))
           ret = fcntl (fd, F_SETFL, O_NONBLOCK);
#else
#ifdef FIOSNBIO
       {
           int arg;
           arg = 1;
           ret = ioctl (fd, FIOSNBIO, &arg);
       }
#else
#if (defined(AIXV3) || defined(uniosu) || defined(WIN32)) && defined(FIONBIO)
       {
           int arg;
           arg = 1;
           ret = ioctl (fd, FIONBIO, &arg);
       }
#else
#ifdef FNDELAY
           ret = fcntl (fd, F_SETFL, FNDELAY);
#else
           ret = fcntl (fd, F_SETFL, O_NDELAY);
#endif
#endif /* AIXV3  || uniosu */
#endif /* FIOSNBIO */
#endif /* O_NONBLOCK */
           break;
       default:
           /* Unknown option */
           break;
       }
       break;
    case TRANS_CLOSEONEXEC:
#ifdef F_SETFD
#ifdef FD_CLOEXEC
       ret = fcntl (fd, F_SETFD, FD_CLOEXEC);
#else
       ret = fcntl (fd, F_SETFD, 1);
#endif /* FD_CLOEXEC */
#endif /* F_SETFD */
       break;
    }
    
    return ret;
}
int TRANS() Write ( XtransConnInfo  ,
char *  ,
int   
)

Definition at line 869 of file Xtrans.c.

{
    return ciptr->transptr->Write (ciptr, buf, size);
}
int TRANS() Writev ( XtransConnInfo  ,
struct iovec *  ,
int   
)

Definition at line 890 of file Xtrans.c.

{
    return ciptr->transptr->Writev (ciptr, buf, size);
}