5.0 from trustcommerce
[tclink.git] / tclink.h
CommitLineData
c235c6ac 1/* tclink.h - Header file for TCLink library. */
d667da5b
IK
2
3#ifndef _TCLINK_H
4#define _TCLINK_H
5
6#include "config.h"
7
8/* Handle passed to all TCLink functions. A unique handle must be created
9 * for each concurrent thread, but the same handle can be shared by transactions
10 * occurring one after another (such as a for loop).
11 */
c235c6ac 12#define TCLinkHandle void*
d667da5b
IK
13
14/* Parameter names and values cannot exceed this size.
15 */
c235c6ac 16#define PARAM_MAX_LEN 768
d667da5b
IK
17
18/* Create a new TCLinkHandle.
19 */
c235c6ac
IK
20TCLinkHandle
21TCLinkCreate();
d667da5b
IK
22
23/* Add a parameter to be sent to the server.
24 */
c235c6ac
IK
25void
26TCLinkPushParam(TCLinkHandle handle, const char* name, const char* value);
d667da5b
IK
27
28/* Flush the parameters to the server.
29 */
c235c6ac
IK
30void
31TCLinkSend(TCLinkHandle handle);
d667da5b
IK
32
33/* Look up a response value from the server.
34 * Returns NULL if no such parameter, or stores the value in 'value' and
35 * returns a pointer to value. value should be at least PARAM_MAX_LEN in size.
36 */
c235c6ac
IK
37char*
38TCLinkGetResponse(TCLinkHandle handle, const char* name, char* value);
d667da5b
IK
39
40/* Get all response values from the server in one giant string.
41 * Stores the string into buf and returns a pointer to it. Size should be
42 * sizeof(buf), which will limit the string so that no buffer overruns occur.
43 */
c235c6ac
IK
44char*
45TCLinkGetEntireResponse(TCLinkHandle handle, char* buf, int size);
d667da5b 46
c235c6ac
IK
47/* Destory a handle, ending that transaction and freeing the memory associated
48 * with it. */
49void
50TCLinkDestroy(TCLinkHandle handle);
d667da5b
IK
51
52/* Store version string into buf. Returns a pointer to buf. */
c235c6ac
IK
53char*
54TCLinkGetVersion(char* buf);
d667da5b
IK
55
56/* The API methods below are subject to change. */
57
c235c6ac
IK
58/* Enables (1) or Disables (0) the full SSL close_notify sequence. By default,
59 * this is set to 1.*/
60int
61TCLinkSetFullClose(TCLinkHandle handle, int full_ssl_close);
d667da5b 62
c235c6ac
IK
63/* Provides a method, once the handshake is completed, a means to verify the
64 * contents of that certificate independently. Note that the certificate may not
65 * be set depending on the negotation type (in which case the pointer would be
66 * NULL)
d667da5b 67 */
c235c6ac
IK
68void
69TCLinkSetValidateCallback(TCLinkHandle handle,
70 int (*validate_cert)(int, void*));
d667da5b
IK
71
72#endif