Previous Topic

Next Topic

Improved CTUSERX() Functionality for Custom Server Operations

CTUSERX() provides a means to enable your own custom server side functionality for a client to access. This module is part of the c-treeACE Server SDK.

The original implementation of the CTUSERX() client-side code did not send the first two function parameters (ctlbufptr and ctlbufsiz) to the server, and it assumed the input buffer (inbufptr) to be string data. CTUSERX() was modified to send all parameters to the server and additionally allow binary data in this input buffer.

The ctlbufsiz parameter was removed from the CTUSERX() function definition, as the control buffer data is passed to the c-tree Server as a string, and so the client code computes its string length rather than passing ctlbufsiz to the server.

The function prototypes for both the client CTUSERX() and server-side CT_USERX() functions now become:

extern ctCONV LONG ctDECL CT_USERX( pTEXT ctlbufptr, pTEXT inbufptr, VRLEN inbufsiz, pTEXT outbufptr, pVRLEN outbufsiz);
extern ctCONV LONG ctDECL CTUSERX ( pTEXT ctlbufptr, pTEXT inbufptr, VRLEN inbufsiz, pTEXT outbufptr, pVRLEN outbufsiz);

Further extending behavior, CTUSERX() was modified to support loading a CTUSER() dynamic library and executing a specified function, similar to the existing CTUSER() function loading. The function exported by the CTUSER() shared library must conform to the same prototype as above.

Note that the last parameter of CTUSERX() has been changed to a pointer to the output buffer length (type pVRLEN) The caller passes the address of a VRLEN variable whose value is the size of the output buffer. On return, the value is set to the number of bytes written by c-treeACE to the output buffer.

Note: If a client calls the new version of the CTUSERX() client-side function when connected to c-treeACE that does not support the new CTUSERX() function, the server returns error SFUN_ERR (170, bad function number). c-treeACE continues to support calls by clients that use the original CTUSERX() function.

Backward Compatibility

To restore the original client-side CTUSERX() behavior, add #define NO_ctBEHAV_CTUSERX to ctoptn.h and recompile the c-tree client library.