Added tlspool_configvar() to libtlspool
[tlspool] / lib / swig-tlspool.i
1 /* Generic declarations of libtlspool for swig
2  *
3  * We use swig to generate wrappers for Python.
4  *
5  * We also include the generated result in the Git repository for TLS Pool,
6  * so there is no requirement to install Swig unless you run "make veryclean"
7  * instead of the usual "make clean".
8  *
9  * From: Rick van Rein <rick@openfortress.nl>
10  */
11
12
13 %{
14
15 #include <tlspool/starttls.h>
16 #include <tlspool/commands.h>
17
18 %}
19
20
21 // by default, export nothing (we rename most anyway)
22
23 %ignore "";
24
25
26 // welcome flags and tags
27
28 %rename("%(strip:[TLSPOOL_])s") "";
29 %rename("%s", regexpmatch$name="^PIOC_") "";
30 %rename("%s", regexpmatch$name="^PIOF_") "";
31
32
33 // basic data types -- retyping a few parameters in SWIG-understandable terms
34
35 %apply unsigned char  { uint8_t  }
36 %apply unsigned short { uint16_t }
37 %apply unsigned int   { uint32_t }
38 %apply          short {  int16_t }
39
40 %inline{
41
42         typedef char identity_t [128];
43
44         typedef uint8_t ctlkey_t [16];
45
46         typedef char service_t [16];
47
48         typedef int pool_handle_t;
49
50         typedef struct {
51                 int tlserrno;
52                 char message [128];
53         } error_data;
54
55         typedef struct {
56                 char YYYYMMDD_producer [8+128]; // when & who?
57                 uint32_t facilities;            // PIOF_FACILITY_xxx
58         } ping_data;
59
60         typedef struct {
61                 uint32_t flags;
62                 uint32_t local;
63                 uint8_t ipproto;
64                 uint16_t streamid;
65                 identity_t localid;
66                 identity_t remoteid;
67                 ctlkey_t ctlkey;
68                 service_t service;
69                 uint32_t timeout;
70         } starttls_data;
71
72         typedef struct {
73                 uint32_t flags;
74                 ctlkey_t ctlkey;
75                 identity_t name;
76         } control_data;
77
78         typedef struct {
79                 int16_t in1_len, in2_len, prng_len;
80                 uint8_t buffer [350];
81         } prng_data;
82
83         typedef union {
84                 int unix_socket;
85         } socket_data;
86
87 };
88
89
90 // helper fun
91
92 //IF ANY//
93
94
95 // libtlspool.so
96
97 int tlspool_pid (char *opt_pidfile);
98
99 pool_handle_t tlspool_open_poolhandle (char *path);
100
101 int tlspool_ping (ping_data *pingdata);
102
103 int tlspool_starttls (int cryptfd, starttls_data *tlsdata,
104                         void *privdata,
105                         // int (*namedconnect) (starttls_t *tlsdata,void *privdata));
106                         void *swig_null_callback);
107
108 int tlspool_control_detach (ctlkey_t ctlkey);
109
110 int tlspool_control_reattach (ctlkey_t ctlkey);
111
112 int tlspool_prng (char *label, char *opt_ctxvalue,
113                 uint16_t prng_len, uint8_t *prng_buf,
114                 ctlkey_t ctlkey);
115
116 char *tlspool_configvar (char *cfgfile, char *varname);
117
118
119 // libtlspool_pinentry.c
120 //
121 // NOT MAPPED -- callbacks are not part of SWIG's powers
122
123 //NOTMAPPED// %rename(pin_service) tlspool_pin_service;
124 //NOTMAPPED// // int tlspool_pin_service (char *path, uint32_t regflags, int responsetimeout_usec, void (*cb) (struct pioc_pinentry *entry, void *data), void *data);
125
126
127
128 // libtlspool_lidentry.c
129 //
130 // NOT MAPPED -- callbacks are not part of SWIG's powers
131
132 //NOTMAPPED// %rename(localid_service) tlspool_localid_service;
133 //NOTMAPPED// // int tlspool_localid_service (char *path, uint32_t regflags, int responsetimeout, char * (*cb) (lidentry_t *entry, void *data), void *data);
134
135