-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathacme_xgh.h
More file actions
51 lines (38 loc) · 1.51 KB
/
acme_xgh.h
File metadata and controls
51 lines (38 loc) · 1.51 KB
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
#ifndef ACME_XGH
#define ACME_XGH
#include <stddef.h>
// Only source-compatibility supported for now. Enum may change order.
// No test harness to detect enum changes.
// TODO Inside this ACME library, there is a HTTP client library that
// wants to get out. Most likely prefixed `http_xgh_*`
// TODO I completely forgot about when the TLS tunnel breaks and needs
// new reconnection.
// HTTP 1.1 only for now, nothing fancy.
// This library is currently singleton (lots of global variables).
// This library has several fixed-size internal buffers, so no dynamic
// memory allocation: it will crash (yeah, crash) the entire process
// if a limit is reached.
// TODO Differentiate "okay" from "finished"
// TODO It's already X macros, make it m4 to generate Ragel actions
#define HTTP_XGH_ERROR_XS \
HTTP_XGH_X(NONE ), \
HTTP_XGH_X(SKILL_ISSUE ), \
HTTP_XGH_X(SOME ), \
HTTP_XGH_X(UNRECOVERABLE), \
HTTP_XGH_X(REJECT )
enum acme_xgh_error
{
#define HTTP_XGH_X(ID) ACME_XGH_ERROR_##ID
HTTP_XGH_ERROR_XS,
#undef HTTP_XGH_X
};
// TODO WIP Just thinking how it will look like.
// This part will handle what the Web server must serve.
// It returns an int to discern several challenges.
// Something else that confirms, haven't got around this part
// yet.
extern int (*acme_xgh_challenge)(unsigned char *);
void acme_xgh_init(void);
enum acme_xgh_error acme_xgh_recv(unsigned char *, size_t len);
// Call `acme_xgh_recv(NULL, 0)` when EOF reached.
#endif