/* begincopyright Copyright (c) 1988 Xerox Corporation. All rights reserved. Use and copying of this software and preparation of derivative works based upon this software are permitted. Any distribution of this software or derivative works must comply with all applicable United States export control laws. This software is made available AS IS, and Xerox Corporation makes no warranty about the software, its performance or its conformity to any specification. Any person obtaining a copy of this software is requested to send their name and post office or electronic mail address to: PCR Coordinator Xerox PARC 3333 Coyote Hill Rd. Palo Alto, CA endcopyright */ /* * CMUXGlue.h * * XR interface to Mentat Courier Multiplexor * * Demers, April 25, 1990 8:35:59 am PDT */ #ifndef _XR_CMUX_GLUE_ #define _XR_CMUX_GLUE_ 1 #ifndef _UIO_ # include "xr/UIO.h" #endif /* * CMUX Descriptors * * Client or Server */ typedef XR_Fildes XR_CMUXDescriptor; # define XR_nullCMUXDesciptor ((XR_CMUXDescriptor)(-1)) /* * Descriptor Create/Destroy * * Client or Server */ extern XR_CMUXDescriptor XR_CMUXCreate (); /* Create a CMUX descriptor and return it. On failure, call XR_SetErrno(why) and return nullCMUXDesciptor. */ extern void XR_CMUXDestroy(/* XR_CMUXDescriptor d */); /* Close a CMUX descriptor. */ /* * Descriptor Binding * * Client Only. */ typedef int XR_CMUXAddrType; # define XR_CMUX_ADDR_TYPE_DFLT_ADDR 0 # define XR_CMUX_ADDR_TYPE_DFLT_NAME 1 # define XR_CMUX_ADDR_TYPE_XNS_ADDR 2 # define XR_CMUX_ADDR_TYPE_XNS_NAME 3 extern int XR_CMUXConnect(/* XR_CMUXDescriptor d, XR_CMUXAddrType type, XR_Pointer addr, int addrLen */); /* Connect client descriptor to server at specified address. Return 0. On failure, call XR_SetErrno(why) and return(-why). */ /* * Courier message I/O * * Client or Server */ typedef XR_Pointer (*XR_CMUXAllocaterFunc)(/* unsigned startIndex, unsigned nBytes, XR_Pointer clientData */); /* Callback type for XR_CMUXReadMsg below. Return pointer to a contiguous buffer area of capacity at least nbytes. XR_CMUXReadMsg will store up to nbytes worth of data there, as message content in range [startIndex .. startIndex+nbytes). The returned pointer is to the startIndex'th byte of message; there is no requirement that the entire message be stored contiguously. Special Case: startIndex = nBytes = 0 may release buffer and return NIL. */ extern int XR_CMUXReadMsg(/* XR_CMUXDescriptor d, bool ignoreAborts, unsigned timeoutMsec, XR_CMUXAllocaterFunc allocaterFunc, XR_Pointer allocaterClientData, */); /* Read a Courier message, including header. Return length. On failure, call XR_SetErrno(why) and return (-why). */ extern int XR_CMUXWriteMsg (/* XR_CMUXDescriptor d, XR_Pointer hdr, unsigned hdrLen, XR_Pointer body, unsigned bodyLen */); /* Write a Courier message with specified header. Return 0. On failure, call XR_SetErrno(why) and return (-why). */ extern int XR_CMUXBDTRead(/* XR_CMUXDescriptor d, XR_Pointer buf, unsigned nBytes */); /* Bulk Data read. Return number of bytes actually read, 0 at end of stream. On failure (include received abort) call XR_SetErrno(why) and return (-why). */ extern int XR_CMUXBDTWrite(/* XR_CMUXDescriptor d, XR_Pointer buf, unsigned nBytes */); /* Bulk Data write. Return number of bytes actually written. On failure (include received abort) call XR_SetErrno(why) and return (-why). */ extern int XR_CMUXFinishBDT (/* XR_CMUXDescriptor d, bool source, bool sendAbort */); /* Bulk Data Transfer abort processing. If source is TRUE this side is the bulk data source. If sendAbort is TRUE this side is initiating an abort. Return 0. On failure, call XR_SetErrno(why) and return (-why). */ extern int XR_CMUXServerAdd(/* XR_CMUXDescriptor d, unsigned pgm, unsigned loVersion, hiVersion */); /* Set descriptor to be server for given pgm and version range. Return 0. On failure, call XR_SetErrno(why) and return (-why). */ extern int XR_CMUXServerQuit(/* XR_CMUXDescriptor d */); /* Set descriptor no longer to be server. Return 0. On failure, call XR_SetErrno(why) and return (-why). */ #endif /* _XR_CMUX_GLUE_ */