Commit | Line | Data |
---|---|---|
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 |
20 | TCLinkHandle |
21 | TCLinkCreate(); | |
d667da5b IK |
22 | |
23 | /* Add a parameter to be sent to the server. | |
24 | */ | |
c235c6ac IK |
25 | void |
26 | TCLinkPushParam(TCLinkHandle handle, const char* name, const char* value); | |
d667da5b IK |
27 | |
28 | /* Flush the parameters to the server. | |
29 | */ | |
c235c6ac IK |
30 | void |
31 | TCLinkSend(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 |
37 | char* |
38 | TCLinkGetResponse(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 |
44 | char* |
45 | TCLinkGetEntireResponse(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. */ | |
49 | void | |
50 | TCLinkDestroy(TCLinkHandle handle); | |
d667da5b IK |
51 | |
52 | /* Store version string into buf. Returns a pointer to buf. */ | |
c235c6ac IK |
53 | char* |
54 | TCLinkGetVersion(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.*/ | |
60 | int | |
61 | TCLinkSetFullClose(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 |
68 | void |
69 | TCLinkSetValidateCallback(TCLinkHandle handle, | |
70 | int (*validate_cert)(int, void*)); | |
d667da5b IK |
71 | |
72 | #endif |