00001 /* tclink.h - Header file for TCLink library. 00002 * __LICENSE_HEADER__ */ 00003 00004 #ifndef _TCLINK_H 00005 #define _TCLINK_H 00006 00007 #include "config.h" 00008 00009 /* Handle passed to all TCLink functions. A unique handle must be created 00010 * for each concurrent thread, but the same handle can be shared by transactions 00011 * occurring one after another (such as a for loop). 00012 */ 00013 #define TCLinkHandle void * 00014 00015 /* Parameter names and values cannot exceed this size. 00016 */ 00017 #define PARAM_MAX_LEN 256 00018 00019 /* Create a new TCLinkHandle. 00020 */ 00021 TCLinkHandle TCLinkCreate(); 00022 00023 /* Add a parameter to be sent to the server. 00024 */ 00025 void TCLinkPushParam(TCLinkHandle handle, const char *name, const char *value); 00026 00027 /* Flush the parameters to the server. 00028 */ 00029 void TCLinkSend(TCLinkHandle handle); 00030 00031 /* Look up a response value from the server. 00032 * Returns NULL if no such parameter, or stores the value in 'value' and 00033 * returns a pointer to value. value should be at least PARAM_MAX_LEN in size. 00034 */ 00035 char *TCLinkGetResponse(TCLinkHandle handle, const char *name, char *value); 00036 00037 /* Get all response values from the server in one giant string. 00038 * Stores the string into buf and returns a pointer to it. Size should be 00039 * sizeof(buf), which will limit the string so that no buffer overruns occur. 00040 */ 00041 char *TCLinkGetEntireResponse(TCLinkHandle handle, char *buf, int size); 00042 00043 /* Destory a handle, ending that transaction and freeing the memory associated with it. */ 00044 void TCLinkDestroy(TCLinkHandle handle); 00045 00046 /* Store version string into buf. Returns a pointer to buf. */ 00047 char *TCLinkGetVersion(char *buf); 00048 00049 #endif 00050
1.5.5