annotate include/types.h @ 1599:252e05bf199d

Regenerate proper Autotools files; fix JS stringToTime and add stringToTime_error
author Adam Chlipala <adam@chlipala.net>
date Fri, 18 Nov 2011 17:17:22 -0500
parents 2f5fd248588d
children 438561303d02
rev   line source
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;
adam@1365 12 typedef struct {
adam@1365 13 time_t seconds;
adam@1365 14 unsigned microseconds;
adam@1365 15 } uw_Basis_time;
adamc@737 16 typedef struct {
adamc@737 17 size_t size;
adamc@737 18 char *data;
adamc@737 19 } uw_Basis_blob;
adamc@102 20
adam@1431 21 typedef int 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
adam@1446 38 typedef struct {
adam@1446 39 int context;
adam@1446 40 unsigned long long source;
adam@1446 41 } uw_Basis_source;
adam@1446 42
adamc@737 43 typedef struct uw_Basis_file {
adamc@740 44 uw_Basis_string name, type;
adamc@737 45 uw_Basis_blob data;
adamc@737 46 } uw_Basis_file;
adamc@737 47
adam@1347 48 typedef struct uw_Basis_postBody {
adam@1347 49 uw_Basis_string type, data;
adam@1347 50 } uw_Basis_postBody;
adam@1347 51
adam@1370 52 typedef uw_Basis_string uw_Basis_queryString;
adam@1370 53
adamc@1065 54 typedef enum { SUCCESS, FATAL, BOUNDED_RETRY, UNLIMITED_RETRY, RETURN_INDIRECTLY } failure_kind;
adamc@295 55
adamc@853 56 typedef enum { SERVED, KEEP_OPEN, FAILED } request_result;
adamc@853 57
adamc@756 58 typedef struct input *uw_input;
adamc@295 59
adamc@295 60 #define INTS_MAX 50
adamc@295 61 #define FLOATS_MAX 100
adamc@436 62 #define TIMES_MAX 100
adamc@668 63
adamc@771 64 typedef void (*uw_callback)(void *);
adam@1327 65 typedef void (*uw_callback_with_retry)(void *, int will_retry);
adamc@856 66 typedef void (*uw_logger)(void*, const char *fmt, ...);
adamc@771 67
adamc@1094 68 typedef struct {
adam@1349 69 void (*callback)(uw_context);
adam@1349 70 unsigned int period;
adam@1349 71 } uw_periodic;
adam@1349 72
adam@1349 73 typedef struct {
adamc@1094 74 int inputs_len, timeout;
adamc@1094 75 char *url_prefix;
adamc@1094 76
adamc@1094 77 void (*client_init)();
adamc@1094 78 void (*initializer)(uw_context);
adamc@1094 79 void (*expunger)(uw_context, uw_Basis_client);
adamc@1094 80
adamc@1094 81 void (*db_init)(uw_context);
adamc@1094 82 int (*db_begin)(uw_context);
adamc@1094 83 int (*db_commit)(uw_context);
adamc@1094 84 int (*db_rollback)(uw_context);
adamc@1094 85 void (*db_close)(uw_context);
adamc@1094 86
adamc@1094 87 void (*handle)(uw_context, char *);
adamc@1094 88
adamc@1094 89 int (*input_num)(const char*);
adamc@1094 90 uw_Basis_string (*cookie_sig)(uw_context);
adamc@1094 91 int (*check_url)(const char *);
adamc@1094 92 int (*check_mime)(const char *);
adam@1465 93 int (*check_requestHeader)(const char *);
adam@1465 94 int (*check_responseHeader)(const char *);
adam@1294 95
adam@1294 96 void (*on_error)(uw_context, char *);
adam@1349 97
adam@1349 98 uw_periodic *periodics; // 0-terminated array
adamc@1094 99 } uw_app;
adamc@1094 100
adam@1294 101 #define ERROR_BUF_LEN 1024
adam@1294 102
adam@1369 103 typedef struct {
adam@1369 104 size_t max;
adam@1369 105 char *start, *front, *back;
adam@1369 106 } uw_buffer;
adam@1369 107
adamc@764 108 #endif