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