summaryrefslogtreecommitdiff
path: root/src/libdisfluid/main.c
blob: 6b21295cc217ed1b1c95bfcef761c29e81843bf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#include <config.h>

#define STREQ(a, b) (strcmp ((a), (b)) == 0)
#define STRNEQ(a, b) (! (STREQ (a, b)))

#include <errno.h>
#include <fcntl.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "gettext.h"
#include "relocatable.h"
#include "attribute.h"
#include <disfluid.h>

#define _(String) dgettext (PACKAGE, (String))
#define N_(String) (String)

#include "disfluid-authors.h"
#include "disfluid-cache-entry.h"
#include "disfluid-cache-entry-key.h"
#include "disfluid-cache-entry-hash.h"
#include "disfluid-tests.h"
#include "disfluid-version.h"

const char *
disfluid_version (void)
{
  return version ();
}

int
disfluid_is_nightly (void)
{
  return is_nightly ();
}

const char *
disfluid_website (void)
{
  return website ();
}

const char *
disfluid_whats_new (void)
{
  return whats_new ();
}

const char *
disfluid_major_version (void)
{
  return major_version ();
}

char *
disfluid_run_tests (size_t *n_tests, size_t *n_errors)
{
  return run_tests (n_tests, n_errors);
}

size_t
disfluid_count_authors (void)
{
  return count_authors ();
}

const char *
disfluid_author_name (size_t i)
{
  return author_name (i);
}

const char *
disfluid_author_email (size_t i)
{
  return author_email (i);
}

const char *
disfluid_author_uri (size_t i)
{
  return author_uri (i);
}

int
disfluid_author_is_developer (size_t i)
{
  return author_is_developer (i);
}

int
disfluid_author_is_designer (size_t i)
{
  return author_is_designer (i);
}

int
disfluid_author_is_artist (size_t i)
{
  return author_is_artist (i);
}

int
disfluid_author_is_documenter (size_t i)
{
  return author_is_documenter (i);
}

const char *
disfluid_translation_credits (void)
{
  return translation_credits ();
}

size_t
disfluid_cache_entry_size (size_t max_key, size_t max_header, size_t max_body)
{
  return cache_entry_size (max_key, max_header, max_body);
}

size_t
disfluid_cache_entry_alignment (void)
{
  return cache_entry_alignment ();
}

void
disfluid_cache_entry_init (struct disfluid_cache_entry *entry,
			   size_t max_key, size_t max_header, size_t max_body)
{
  cache_entry_init (entry, max_key, max_header, max_body);
}

void
disfluid_cache_entry_minimum_size (const struct disfluid_cache_entry *entry,
				   size_t *min_key, size_t *min_header,
				   size_t *min_body)
{
  cache_entry_minimum_size (entry, min_key, min_header, min_body);
}

int
disfluid_cache_entry_copy (struct disfluid_cache_entry *restrict dest,
			   const struct disfluid_cache_entry *restrict src)
{
  return cache_entry_copy (dest, src);
}

struct disfluid_cache_entry *
disfluid_cache_entry_alloc (size_t max_key, size_t max_header,
			    size_t max_body)
{
  return cache_entry_alloc (max_key, max_header, max_body);
}

struct disfluid_cache_entry *
disfluid_cache_entry_dup (const struct disfluid_cache_entry *entry)
{
  return cache_entry_dup (entry);
}

void
disfluid_cache_entry_free (struct disfluid_cache_entry *entry)
{
  return cache_entry_free (entry);
}

void
disfluid_cache_entry_set_request_date (struct disfluid_cache_entry *entry,
				       const struct timespec *date)
{
  cache_entry_set_request_date (entry, date);
}

void
disfluid_cache_entry_set_response_date (struct disfluid_cache_entry *entry,
					const struct timespec *date)
{
  cache_entry_set_response_date (entry, date);
}

void
disfluid_cache_entry_invalidate (struct disfluid_cache_entry *entry)
{
  cache_entry_invalidate (entry);
}

void
disfluid_cache_entry_set_invalidated (struct disfluid_cache_entry *entry,
				      int invalidated)
{
  cache_entry_set_invalidated (entry, invalidated);
}

int
disfluid_cache_entry_set_key (struct disfluid_cache_entry *entry,
			      const char *key)
{
  return cache_entry_set_key (entry, key);
}

int
disfluid_cache_entry_set_response_header (struct disfluid_cache_entry *entry,
					  const char *header)
{
  return cache_entry_set_response_header (entry, header);
}

int
disfluid_cache_entry_set_response_body (struct disfluid_cache_entry *entry,
					size_t body_length, const char *body)
{
  return cache_entry_set_response_body (entry, body_length, body);
}

void
disfluid_cache_entry_get_request_date (const struct disfluid_cache_entry
				       *entry, struct timespec *date)
{
  cache_entry_get_request_date (entry, date);
}

void
disfluid_cache_entry_get_response_date (const struct disfluid_cache_entry
					*entry, struct timespec *date)
{
  cache_entry_get_response_date (entry, date);
}

int
disfluid_cache_entry_is_invalidated (const struct disfluid_cache_entry *entry)
{
  return cache_entry_is_invalidated (entry);
}

int
disfluid_cache_entry_load (struct disfluid_cache_entry *entry,
			   int load_key,
			   int load_header,
			   int load_body,
			   ssize_t (*read_impl) (void *, void *, size_t),
			   int (*skip) (void *, size_t), void *context)
{
  return cache_entry_load (entry, load_key, load_header, load_body, read_impl,
			   skip, context);
}

int
disfluid_cache_entry_save (const struct disfluid_cache_entry *entry,
			   ssize_t (*write_impl) (void *, const void *,
						  size_t), void *context)
{
  return cache_entry_save (entry, write_impl, context);
}

int
disfluid_cache_entry_read (struct disfluid_cache_entry *entry,
			   int read_key,
			   int read_header, int read_body, int fd)
{
  return cache_entry_read (entry, read_key, read_header, read_body, fd);
}

int
disfluid_cache_entry_fread (struct disfluid_cache_entry *entry,
			    int read_key,
			    int read_header, int read_body, FILE * f)
{
  return cache_entry_fread (entry, read_key, read_header, read_body, f);
}

int
disfluid_cache_entry_write (const struct disfluid_cache_entry *entry, int fd)
{
  return cache_entry_write (entry, fd);
}

int
disfluid_cache_entry_fwrite (const struct disfluid_cache_entry *entry,
			     FILE * f)
{
  return cache_entry_fwrite (entry, f);
}

int
disfluid_compute_cache_key (const char *request_scheme,
			    const char *request_header,
			    const char *response_header,
			    size_t max_key, char *key)
{
  return compute_cache_key (request_scheme, request_header, response_header,
			    max_key, key);
}

int
disfluid_hash_primary_cache_key (const char *method,
				 const char *uri,
				 const char *password,
				 size_t password_length,
				 size_t max_hash, char *hash)
{
  return hash_primary_cache_key (method, uri, password, password_length,
				 max_hash, hash);
}