1 /* flags used throughout the code to (hopefully) make it easier to follow */ 2 3 #ifndef FLAGS_H 4 #define FLAGS_H 5 6 #ifndef TRUE 7 #define TRUE 1 8 #define FALSE 0 9 #endif /* TRUE */ 10 11 #ifndef NULL 12 #define NULL ((void *)0) 13 #endif /* NULL */ 14 15 #define XML_TAG 0 16 #define XML_VALUE 1 17 18 #define REDIRECT_REQUEST 0 19 #define REDIRECT_HEADER 1 20 21 #define POLICY_ALLOW 0 22 #define POLICY_DENY 1 23 24 #define NET_UNUSED 0 25 #define NET_LISTEN 1 26 27 #define HTTP_CONNECT 0 28 #define HTTP_RESP 1 29 #define HTTP_PROXY 2 30 #define HTTP_REQUEST 3 31 32 #define HTTP_HTTP09 0 33 #define HTTP_HTTP10 1 34 #define HTTP_HTTP11 2 35 36 #define HEADER_DIRECT 0 37 #define HEADER_FORWARD 1 38 #define HEADER_RESP 2 39 40 #define THREAD_UNUSED 0 /* thread not used */ 41 #define THREAD_IDLE 1 /* thread hasn't filled in it's info yet (avoid race condition) */ 42 #define THREAD_WAITING 2 /* thread is waiting to handle another connection */ 43 #define THREAD_BUSY 3 /* thread is handling a client request */ 44 45 #define FORWARD_HTTP 1 46 #define FORWARD_FTP (1<<1) 47 #define FORWARD_CONNECT (1<<2) 48 49 #define EXTERNAL_PIPE 0 50 #define EXTERNAL_FILE 1 51 52 #define TEMPLATE_FILE 0 53 #define TEMPLATE_EXECUTABLE 1 54 55 #define URL_ENCODE 1 56 #define URL_DECODEBEFORE (1<<1) 57 #define URL_DECODEAFTER (1<<2) 58 59 #define CLIENT 0 60 #define SERVER 1 61 62 #define UP 0 63 #define DOWN 1 64 65 #define TOP 0 66 #define BOTTOM 1 67 68 #define IN 0 69 #define OUT 1 70 71 #define HIT 0 72 #define MISS 1 73 74 #define HTML_NEWLINES 1 75 #define HTML_SPACES (1<<1) 76 77 #define SORT_ASCENDING 0 78 #define SORT_DESCENDING 1 79 80 #define SORT_NONE 0 81 #define SORT_NAME 1 82 #define SORT_SIZE 2 83 #define SORT_DATE 3 84 85 #define HEADER_KEEPALIVE 1 86 87 #define PROXY_DIRECT 0 88 #define PROXY_NORMAL 1 89 #define PROXY_SOCKS4 2 90 #define PROXY_CONNECT 3 91 92 #define REWRITE_CLIENT 1 93 #define REWRITE_SERVER (1<<1) 94 #define REWRITE_BODY (1<<2) 95 #define REWRITE_POST (1<<3) 96 97 #define REDIRECT_LOCATION 1 98 #define REDIRECT_URL 2 99 #define REDIRECT_BOTH 3 100 101 #define ERROR_AUTH -4 102 #define ERROR_DNS -3 103 #define ERROR_CONNECT -2 104 #define ERROR_UNKNOWN -1 105 106 #define SOCKS_GRANTED 90 107 #define SOCKS_FAILED 91 108 #define SOCKS_NOIDENT 92 109 #define SOCKS_BADIDENT 93 110 111 #define COOKIE_IN 0 112 #define COOKIE_OUT 1 113 #define COOKIE_BOTH 2 114 115 #define MMLOG_REQUEST 1 116 #define MMLOG_NETWORK (1 << 1) 117 #define MMLOG_FILTER (1 << 2) 118 #define MMLOG_HEADER (1 << 3) 119 #define MMLOG_MIME (1 << 4) 120 #define MMLOG_COOKIE (1 << 5) 121 #define MMLOG_REDIRECT (1 << 6) 122 #define MMLOG_TEMPLATE (1 << 7) 123 #define MMLOG_KEYWORDS (1 << 8) 124 #define MMLOG_REWRITE (1 << 9) 125 #define MMLOG_LIMITS (1 << 10) 126 #define MMLOG_CACHE (1 << 11) 127 #define MMLOG_PREFETCH (1<<12) 128 #define MMLOG_ICP (1<<13) 129 #define MMLOG_FORWARD (1<<14) 130 #define MMLOG_SECURITY (1 << 15) 131 #define MMLOG_WARN (1 << 16) 132 #define MMLOG_ERROR (1 << 17) 133 #define MMLOG_DEBUG (1 << 18) 134 135 #define FEATURE_FILTER 1 136 #define FEATURE_HEADER (1<<1) 137 #define FEATURE_MIME (1<<2) 138 #define FEATURE_REDIRECT (1<<3) 139 #define FEATURE_COOKIES (1<<4) 140 #define FEATURE_REWRITE (1<<5) 141 #define FEATURE_EXTERNAL (1<<6) 142 #define FEATURE_FORWARD (1<<7) 143 #define FEATURE_KEYWORDS (1<<8) 144 #define FEATURE_DNSBL (1<<9) 145 #define FEATURE_LIMITS (1<<10) 146 147 #define ACCESS_CONFIG 1 148 #define ACCESS_PROXY (1<<1) 149 #define ACCESS_HTTP (1<<2) 150 #define ACCESS_TRANSPARENT (1<<3) 151 #define ACCESS_CONNECT (1<<4) 152 #define ACCESS_BYPASS (1<<5) 153 #define ACCESS_URLCOMMAND (1<<6) 154 155 #define CACHE_WRITING 1 /* cache file is being written */ 156 #define CACHE_INVALID (1<<1) /* cache item is no longer valid */ 157 #define CACHE_EXPIRED (1<<2) /* cache item expired */ 158 #define CACHE_VALIDATE (1<<3) /* cache item needs to be validated */ 159 #define CACHE_PREFETCHED (1<<4) /* cached as a result of a prefetch request */ 160 #define CACHE_VIOLATION (1<<5) /* caching this violates RFC */ 161 #define CACHE_OFFLINE (1<<6) 162 #define CACHE_DISK (1<<7) /* cached on disk */ 163 #define CACHE_MEM (1<<8) /* cached in memory */ 164 165 #define SBALANCE_FILLSIZE 0 166 #define SBALANCE_FILLPERCENT 1 167 168 #define ICP_NONE 0 /* no ICP releationship with this proxy */ 169 #define ICP_PARENT 1 /* proxy is a parent cache */ 170 #define ICP_SIBLING 2 /* proxy is a sibling cache */ 171 172 /* flags which are masked off from journal entries */ 173 #define CACHE_SESSION_FLAGS (CACHE_EXPIRED | CACHE_VALIDATE | CACHE_PREFETCHED | CACHE_MEM | CACHE_VIOLATION) 174 175 #define CONNECTION_BUFFER 1 /* file to be buffered */ 176 #define CONNECTION_VALIDATE (1<<1) /* cached file is being validated using If-Modified-Since header */ 177 #define CONNECTION_VALIDATED (1<<2) /* cached file was successfully validated */ 178 #define CONNECTION_CACHING (1<<3) /* file is being cached */ 179 #define CONNECTION_AUTHENTICATED (1<<4) /* authenticated with forwarding proxy */ 180 #define CONNECTION_OFFLINE (1<<5) /* send only cached files, ignoring expiry date */ 181 #define CONNECTION_PROCESS (1<<6) /* file will be processed */ 182 #define CONNECTION_LOGGEDIN (1<<7) /* already logged in (i.e. ftp connection from pool) */ 183 #define CONNECTION_LIMITCACHE (1<<8) /* limit bytes transfered from cache as well */ 184 #define CONNECTION_PREFETCH (1<<9) /* prefetch connection */ 185 #define CONNECTION_ENCODED (1<<10) /* content is encoded but client doesn't support it */ 186 187 #define HEADER_FILTERED 1 /* header was filtered */ 188 189 #define HEADER_CLIENT 1 /* filter client header */ 190 #define HEADER_SERVER (1 << 1) /* filter server header */ 191 192 #define TIMER_ONCE 0 193 #define TIMER_REPEAT 1 194 195 #define LIMIT_CACHE 1 196 #define LIMIT_ABSOLUTETIME (1<<1) 197 #define LIMIT_ALLRANGETIME (1<<2) 198 199 #define ICP_OP_INVALID 0 200 #define ICP_OP_QUERY 1 201 #define ICP_OP_HIT 2 202 #define ICP_OP_MISS 3 203 #define ICP_OP_ERR 4 204 #define ICP_OP_SECHO 10 205 #define ICP_OP_DECHO 11 206 #define ICP_OP_MISS_NOFETCH 21 207 #define ICP_OP_DENIED 22 208 #define ICP_OP_HIT_OBJ 23 209 210 #define ICP_PACKET_LEN 20 /* the size of an ICP packet (minus payload) */ 211 #define ICP_MESSAGE_MAX 65546 /* maximum length of an ICP packet */ 212 213 #endif /* FLAGS_H */ 214