blob: 6fd9d35372c753d92bcc333ef80d072a4c525d6c (
plain) (
blame)
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
|
#ifndef _UNIT_WASM_H_
#define _UNIT_WASM_H_
#include <stddef.h>
#include <stdint.h>
typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef uint16_t u16;
typedef int16_t s16;
typedef uint8_t u8;
typedef int8_t s8;
#ifndef __unused
#define __unused __attribute__((unused))
#endif
#ifndef __maybe_unused
#define __maybe_unused __unused
#endif
#ifndef __always_unused
#define __always_unused __unused
#endif
struct hdr_field {
u32 name_offs;
u32 name_len;
u32 value_offs;
u32 value_len;
};
struct req {
u32 method_offs;
u32 method_len;
u32 version_offs;
u32 version_len;
u32 path_offs;
u32 path_len;
u32 query_offs;
u32 query_len;
u32 remote_offs;
u32 remote_len;
u32 local_addr_offs;
u32 local_addr_len;
u32 local_port_offs;
u32 local_port_len;
u32 server_name_offs;
u32 server_name_len;
u32 content_offs;
u32 content_len;
u32 content_sent;
u32 total_content_sent;
u32 request_size;
u32 nr_fields;
u32 tls;
struct hdr_field fields[];
};
struct resp {
u32 size;
u8 data[];
};
struct resp_hdr {
u32 nr_fields;
struct hdr_field fields[];
};
extern void wasm_module_end_handler(void);
extern void wasm_module_init_handler(void);
extern void wasm_response_end_handler(void);
extern void wasm_request_end_handler(void);
extern void wasm_free_handler(u32 addr);
extern u32 wasm_malloc_handler(size_t size);
extern int wasm_request_handler(u8 *addr);
extern void send_headers(u8 *addr, const char *ct, size_t len);
#endif /* _UNIT_WASM_H_ */
|