/usr/include/lighttpd/array.h is in lighttpd-dev 1.4.33-1+nmu2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | #ifndef ARRAY_H
#define ARRAY_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_PCRE_H
# include <pcre.h>
#endif
#include "buffer.h"
#include <stdlib.h>
#define DATA_IS_STRING(x) (x->type == TYPE_STRING)
typedef enum { TYPE_UNSET, TYPE_STRING, TYPE_COUNT, TYPE_ARRAY, TYPE_INTEGER, TYPE_FASTCGI, TYPE_CONFIG } data_type_t;
#define DATA_UNSET \
data_type_t type; \
buffer *key; \
int is_index_key; /* 1 if key is a array index (autogenerated keys) */ \
struct data_unset *(*copy)(const struct data_unset *src); \
void (* free)(struct data_unset *p); \
void (* reset)(struct data_unset *p); \
int (*insert_dup)(struct data_unset *dst, struct data_unset *src); \
void (*print)(const struct data_unset *p, int depth)
typedef struct data_unset {
DATA_UNSET;
} data_unset;
typedef struct {
data_unset **data;
size_t *sorted;
size_t used;
size_t size;
size_t unique_ndx;
size_t next_power_of_2;
int is_weakref; /* data is weakref, don't bother the data */
} array;
typedef struct {
DATA_UNSET;
int count;
} data_count;
data_count *data_count_init(void);
typedef struct {
DATA_UNSET;
buffer *value;
} data_string;
data_string *data_string_init(void);
data_string *data_response_init(void);
typedef struct {
DATA_UNSET;
array *value;
} data_array;
data_array *data_array_init(void);
/**
* possible compare ops in the configfile parser
*/
typedef enum {
CONFIG_COND_UNSET,
CONFIG_COND_EQ, /** == */
CONFIG_COND_MATCH, /** =~ */
CONFIG_COND_NE, /** != */
CONFIG_COND_NOMATCH /** !~ */
} config_cond_t;
/**
* possible fields to match against
*/
typedef enum {
COMP_UNSET,
COMP_SERVER_SOCKET,
COMP_HTTP_URL,
COMP_HTTP_HOST,
COMP_HTTP_REFERER,
COMP_HTTP_USER_AGENT,
COMP_HTTP_LANGUAGE,
COMP_HTTP_COOKIE,
COMP_HTTP_REMOTE_IP,
COMP_HTTP_QUERY_STRING,
COMP_HTTP_SCHEME,
COMP_HTTP_REQUEST_METHOD,
COMP_LAST_ELEMENT
} comp_key_t;
/* $HTTP["host"] == "incremental.home.kneschke.de" { ... }
* for print: comp_key op string
* for compare: comp cond string/regex
*/
typedef struct _data_config data_config;
struct _data_config {
DATA_UNSET;
array *value;
buffer *comp_key;
comp_key_t comp;
config_cond_t cond;
buffer *op;
int context_ndx; /* more or less like an id */
array *childs;
/* nested */
data_config *parent;
/* for chaining only */
data_config *prev;
data_config *next;
buffer *string;
#ifdef HAVE_PCRE_H
pcre *regex;
pcre_extra *regex_study;
#endif
};
data_config *data_config_init(void);
typedef struct {
DATA_UNSET;
int value;
} data_integer;
data_integer *data_integer_init(void);
typedef struct {
DATA_UNSET;
buffer *host;
unsigned short port;
time_t disable_ts;
int is_disabled;
size_t balance;
int usage; /* fair-balancing needs the no. of connections active on this host */
int last_used_ndx; /* round robin */
} data_fastcgi;
data_fastcgi *data_fastcgi_init(void);
array *array_init(void);
array *array_init_array(array *a);
void array_free(array *a);
void array_reset(array *a);
int array_insert_unique(array *a, data_unset *str);
data_unset *array_pop(array *a);
int array_print(array *a, int depth);
data_unset *array_get_unused_element(array *a, data_type_t t);
data_unset *array_get_element(array *a, const char *key);
void array_set_key_value(array *hdrs, const char *key, size_t key_len, const char *value, size_t val_len);
data_unset *array_replace(array *a, data_unset *du);
int array_strcasecmp(const char *a, size_t a_len, const char *b, size_t b_len);
void array_print_indent(int depth);
size_t array_get_max_key_length(array *a);
#endif
|