adamc@764
|
1 #ifndef URWEB_TYPES_H
|
adamc@764
|
2 #define URWEB_TYPES_H
|
adamc@764
|
3
|
adamc@436
|
4 #include <time.h>
|
adamc@914
|
5 #include <unistd.h>
|
adamc@436
|
6
|
adamc@311
|
7 typedef long long uw_Basis_int;
|
adamc@311
|
8 typedef double uw_Basis_float;
|
adamc@311
|
9 typedef char* uw_Basis_string;
|
adamc@821
|
10 typedef char uw_Basis_char;
|
adamc@436
|
11 typedef time_t uw_Basis_time;
|
adamc@737
|
12 typedef struct {
|
adamc@737
|
13 size_t size;
|
adamc@737
|
14 char *data;
|
adamc@737
|
15 } uw_Basis_blob;
|
adamc@102
|
16
|
adamc@311
|
17 struct __uws_0 {
|
adamc@102
|
18 };
|
adamc@102
|
19
|
adamc@311
|
20 typedef struct __uws_0 uw_unit;
|
adamc@311
|
21 typedef uw_unit uw_Basis_unit;
|
adamc@117
|
22
|
adamc@311
|
23 typedef enum uw_Basis_bool { uw_Basis_False, uw_Basis_True } uw_Basis_bool;
|
adamc@186
|
24
|
adamc@311
|
25 typedef struct uw_context *uw_context;
|
adamc@117
|
26
|
adamc@311
|
27 typedef uw_Basis_string uw_Basis_xhtml;
|
adamc@311
|
28 typedef uw_Basis_string uw_Basis_page;
|
adamc@757
|
29 typedef uw_Basis_string uw_Basis_xbody;
|
adamc@721
|
30 typedef uw_Basis_string uw_Basis_css_class;
|
adamc@682
|
31
|
adamc@682
|
32 typedef unsigned uw_Basis_client;
|
adamc@682
|
33 typedef struct {
|
adamc@682
|
34 unsigned cli, chn;
|
adamc@682
|
35 } uw_Basis_channel;
|
adamc@167
|
36
|
adamc@737
|
37 typedef struct uw_Basis_file {
|
adamc@740
|
38 uw_Basis_string name, type;
|
adamc@737
|
39 uw_Basis_blob data;
|
adamc@737
|
40 } uw_Basis_file;
|
adamc@737
|
41
|
adamc@1065
|
42 typedef enum { SUCCESS, FATAL, BOUNDED_RETRY, UNLIMITED_RETRY, RETURN_INDIRECTLY } failure_kind;
|
adamc@295
|
43
|
adamc@853
|
44 typedef enum { SERVED, KEEP_OPEN, FAILED } request_result;
|
adamc@853
|
45
|
adamc@756
|
46 typedef struct input *uw_input;
|
adamc@295
|
47
|
adamc@295
|
48 #define INTS_MAX 50
|
adamc@295
|
49 #define FLOATS_MAX 100
|
adamc@436
|
50 #define TIMES_MAX 100
|
adamc@668
|
51
|
adamc@771
|
52 typedef void (*uw_callback)(void *);
|
adamc@856
|
53 typedef void (*uw_logger)(void*, const char *fmt, ...);
|
adamc@771
|
54
|
adamc@1094
|
55 typedef struct {
|
adamc@1094
|
56 int inputs_len, timeout;
|
adamc@1094
|
57 char *url_prefix;
|
adamc@1094
|
58
|
adamc@1094
|
59 void (*client_init)();
|
adamc@1094
|
60 void (*initializer)(uw_context);
|
adamc@1094
|
61 void (*expunger)(uw_context, uw_Basis_client);
|
adamc@1094
|
62
|
adamc@1094
|
63 void (*db_init)(uw_context);
|
adamc@1094
|
64 int (*db_begin)(uw_context);
|
adamc@1094
|
65 int (*db_commit)(uw_context);
|
adamc@1094
|
66 int (*db_rollback)(uw_context);
|
adamc@1094
|
67 void (*db_close)(uw_context);
|
adamc@1094
|
68
|
adamc@1094
|
69 void (*handle)(uw_context, char *);
|
adamc@1094
|
70
|
adamc@1094
|
71 int (*input_num)(const char*);
|
adamc@1094
|
72 uw_Basis_string (*cookie_sig)(uw_context);
|
adamc@1094
|
73 int (*check_url)(const char *);
|
adamc@1094
|
74 int (*check_mime)(const char *);
|
adamc@1094
|
75 } uw_app;
|
adamc@1094
|
76
|
adamc@764
|
77 #endif
|