| Code Coverage: vinyl-cache/lib/libvcc/vcc_fixed_token.c |
| |
| 82217aa4fc7094b3610340078afaf78cd95a8ec9 |
| |
| 0 |
|
/* |
| 1 |
|
* NB: This file is machine generated, DO NOT EDIT! |
| 2 |
|
* |
| 3 |
|
* Edit and run lib/libvcc/generate.py instead. |
| 4 |
|
*/ |
| 5 |
|
|
| 6 |
|
#include "config.h" |
| 7 |
|
|
| 8 |
|
#include "vcc_compile.h" |
| 9 |
1577329 |
#define M1() do {*q = p + 1; return (p[0]); } while (0) |
| 10 |
373437 |
#define M2(c,t) do {if (p[1] == (c)) { *q = p + 2; return (t); }} while (0) |
| 11 |
|
|
| 12 |
|
unsigned |
| 13 |
|
vcl_fixed_token(const char *p, const char **q) |
| 14 |
3134701 |
{ |
| 15 |
3134701 |
switch (p[0]) { |
| 16 |
71599 |
case '!': |
| 17 |
71599 |
M2('=', T_NEQ); |
| 18 |
19611 |
M2('~', T_NOMATCH); |
| 19 |
16354 |
M1(); |
| 20 |
3 |
case '%': |
| 21 |
3 |
M1(); |
| 22 |
55192 |
case '&': |
| 23 |
55192 |
M2('&', T_CAND); |
| 24 |
1 |
M1(); |
| 25 |
199867 |
case '(': |
| 26 |
199867 |
M1(); |
| 27 |
199866 |
case ')': |
| 28 |
199866 |
M1(); |
| 29 |
26 |
case '*': |
| 30 |
26 |
M2('=', T_MUL); |
| 31 |
24 |
M1(); |
| 32 |
78602 |
case '+': |
| 33 |
78602 |
M2('+', T_INC); |
| 34 |
78601 |
M2('=', T_INCR); |
| 35 |
78565 |
M1(); |
| 36 |
14956 |
case ',': |
| 37 |
14956 |
M1(); |
| 38 |
101 |
case '-': |
| 39 |
101 |
M2('-', T_DEC); |
| 40 |
99 |
M2('=', T_DECR); |
| 41 |
98 |
M1(); |
| 42 |
316403 |
case '.': |
| 43 |
316403 |
M1(); |
| 44 |
172 |
case '/': |
| 45 |
172 |
M2('=', T_DIV); |
| 46 |
170 |
M1(); |
| 47 |
260675 |
case ';': |
| 48 |
260675 |
M1(); |
| 49 |
3279 |
case '<': |
| 50 |
3279 |
M2('<', T_SHL); |
| 51 |
3275 |
M2('=', T_LEQ); |
| 52 |
23 |
M1(); |
| 53 |
59530 |
case '=': |
| 54 |
59530 |
M2('=', T_EQ); |
| 55 |
39501 |
M1(); |
| 56 |
47 |
case '>': |
| 57 |
47 |
M2('=', T_GEQ); |
| 58 |
39 |
M2('>', T_SHR); |
| 59 |
37 |
M1(); |
| 60 |
218822 |
case '{': |
| 61 |
218822 |
M1(); |
| 62 |
3264 |
case '|': |
| 63 |
3264 |
M2('|', T_COR); |
| 64 |
2 |
M1(); |
| 65 |
218803 |
case '}': |
| 66 |
218803 |
M1(); |
| 67 |
13159 |
case '~': |
| 68 |
13159 |
M1(); |
| 69 |
1420335 |
default: |
| 70 |
1420335 |
return (0); |
| 71 |
3134701 |
} |
| 72 |
3134701 |
} |
| 73 |
|
|
| 74 |
|
const char * const vcl_tnames[256] = { |
| 75 |
|
['!'] = "'!'", |
| 76 |
|
['%'] = "'%'", |
| 77 |
|
['&'] = "'&'", |
| 78 |
|
['('] = "'('", |
| 79 |
|
[')'] = "')'", |
| 80 |
|
['*'] = "'*'", |
| 81 |
|
['+'] = "'+'", |
| 82 |
|
[','] = "','", |
| 83 |
|
['-'] = "'-'", |
| 84 |
|
['.'] = "'.'", |
| 85 |
|
['/'] = "'/'", |
| 86 |
|
[';'] = "';'", |
| 87 |
|
['<'] = "'<'", |
| 88 |
|
['='] = "'='", |
| 89 |
|
['>'] = "'>'", |
| 90 |
|
['{'] = "'{'", |
| 91 |
|
['|'] = "'|'", |
| 92 |
|
['}'] = "'}'", |
| 93 |
|
['~'] = "'~'", |
| 94 |
|
[CBLOB] = "CBLOB", |
| 95 |
|
[CNUM] = "CNUM", |
| 96 |
|
[CSRC] = "CSRC", |
| 97 |
|
[CSTR] = "CSTR", |
| 98 |
|
[EOI] = "EOI", |
| 99 |
|
[FNUM] = "FNUM", |
| 100 |
|
[ID] = "ID", |
| 101 |
|
[T_CAND] = "&&", |
| 102 |
|
[T_COR] = "||", |
| 103 |
|
[T_DEC] = "--", |
| 104 |
|
[T_DECR] = "-=", |
| 105 |
|
[T_DIV] = "/=", |
| 106 |
|
[T_EQ] = "==", |
| 107 |
|
[T_GEQ] = ">=", |
| 108 |
|
[T_INC] = "++", |
| 109 |
|
[T_INCR] = "+=", |
| 110 |
|
[T_LEQ] = "<=", |
| 111 |
|
[T_MUL] = "*=", |
| 112 |
|
[T_NEQ] = "!=", |
| 113 |
|
[T_NOMATCH] = "!~", |
| 114 |
|
[T_SHL] = "<<", |
| 115 |
|
[T_SHR] = ">>", |
| 116 |
|
}; |
| 117 |
|
|
| 118 |
|
void |
| 119 |
|
vcl_output_lang_h(struct vsb *sb) |
| 120 |
1329 |
{ |
| 121 |
|
|
| 122 |
|
/* ../include/vdef.h */ |
| 123 |
|
|
| 124 |
1329 |
VSB_cat(sb, "/* ---===### include/vdef.h ###===--- */\n\n"); |
| 125 |
1329 |
VSB_cat(sb, |
| 126 |
1329 |
"/*-\n" |
| 127 |
1329 |
" * Copyright (c) 2006 Verdens Gang AS\n" |
| 128 |
1329 |
" * Copyright (c) 2012 Fastly Inc\n" |
| 129 |
1329 |
" * Copyright (c) 2006-2015 Varnish Software AS\n" |
| 130 |
1329 |
" * All rights reserved.\n" |
| 131 |
1329 |
" *\n" |
| 132 |
1329 |
" * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>\n" |
| 133 |
1329 |
" * Author: Rogier 'DocWilco' Mulhuijzen <rogier@fastly.com>\n" |
| 134 |
1329 |
" *\n" |
| 135 |
1329 |
" * Inspired by FreeBSD's <sys/cdefs.h>\n" |
| 136 |
1329 |
" *\n" |
| 137 |
1329 |
" * SPDX-License-Identifier: BSD-2-Clause\n" |
| 138 |
1329 |
" *\n" |
| 139 |
1329 |
" * Redistribution and use in source and binary forms, with or without\n" |
| 140 |
1329 |
" * modification, are permitted provided that the following conditions\n" |
| 141 |
1329 |
" * are met:\n" |
| 142 |
1329 |
" * 1. Redistributions of source code must retain the above copyright\n" |
| 143 |
1329 |
" * notice, this list of conditions and the following disclaimer.\n" |
| 144 |
1329 |
" * 2. Redistributions in binary form must reproduce the above copyright\n" |
| 145 |
1329 |
" * notice, this list of conditions and the following disclaimer in the\n" |
| 146 |
1329 |
" * documentation and/or other materials provided with the distribution.\n" |
| 147 |
1329 |
" *\n" |
| 148 |
1329 |
" * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" |
| 149 |
1329 |
" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" |
| 150 |
1329 |
" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" |
| 151 |
1329 |
" * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n" |
| 152 |
1329 |
" * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" |
| 153 |
1329 |
" * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" |
| 154 |
1329 |
" * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" |
| 155 |
1329 |
" * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" |
| 156 |
1329 |
" * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" |
| 157 |
1329 |
" * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" |
| 158 |
1329 |
" * SUCH DAMAGE.\n" |
| 159 |
1329 |
" *\n" |
| 160 |
1329 |
" * Names of the form \"v_[a-z_]*_\" is reserved for this file.\n" |
| 161 |
1329 |
" *\n" |
| 162 |
1329 |
" * This file should always be the first non <...> include in a .c file.\n" |
| 163 |
1329 |
" */\n" |
| 164 |
1329 |
"\n" |
| 165 |
1329 |
"#include <string.h> // string functions if no builtin\n" |
| 166 |
1329 |
"#include <stddef.h>\n" |
| 167 |
1329 |
"#include <stdint.h>\n" |
| 168 |
1329 |
"\n" |
| 169 |
1329 |
"#ifdef VDEF_H_INCLUDED\n" |
| 170 |
1329 |
"# error \"vdef.h included multiple times\"\n" |
| 171 |
1329 |
"#endif\n" |
| 172 |
1329 |
"#define VDEF_H_INCLUDED\n" |
| 173 |
1329 |
"\n" |
| 174 |
1329 |
"/* Safe printf into a fixed-size buffer */\n" |
| 175 |
1329 |
"#define bprintf(buf, fmt, ...) \\\n" |
| 176 |
1329 |
" do { \\\n" |
| 177 |
1329 |
" int ibprintf; \\\n" |
| 178 |
1329 |
" ibprintf = snprintf(buf, sizeof buf, fmt, __VA_ARGS__); \\\n" |
| 179 |
1329 |
" assert(ibprintf >= 0 && ibprintf < (int)sizeof buf); \\\n" |
| 180 |
1329 |
" } while (0)\n" |
| 181 |
1329 |
"\n" |
| 182 |
1329 |
"/* Safe printf into a fixed-size buffer */\n" |
| 183 |
1329 |
"#define vbprintf(buf, fmt, ap) \\\n" |
| 184 |
1329 |
" do { \\\n" |
| 185 |
1329 |
" int ivbprintf; \\\n" |
| 186 |
1329 |
" ivbprintf = vsnprintf(buf, sizeof buf, fmt, ap); \\\n" |
| 187 |
1329 |
" assert(ivbprintf >= 0 && ivbprintf < (int)sizeof buf); \\\n" |
| 188 |
1329 |
" } while (0)\n" |
| 189 |
1329 |
"\n" |
| 190 |
1329 |
"/* Safe strcpy into a fixed-size buffer */\n" |
| 191 |
1329 |
"#define bstrcpy(dst, src) \\\n" |
| 192 |
1329 |
" do { \\\n" |
| 193 |
1329 |
" assert(vstrlen(src) + 1 <= sizeof (dst)); \\\n" |
| 194 |
1329 |
" strcpy((dst), (src)); \\\n" |
| 195 |
1329 |
" } while (0)\n" |
| 196 |
1329 |
"\n" |
| 197 |
1329 |
"// TODO #define strcpy BANNED\n" |
| 198 |
1329 |
"// TODO then revert 0fa4baead49f0a45f68d3db0b7743c5e4e93ad4d\n" |
| 199 |
1329 |
"// TODO and replace with flexelint exception\n" |
| 200 |
1329 |
"\n" |
| 201 |
1329 |
"/* Close and discard filedescriptor */\n" |
| 202 |
1329 |
"#define closefd(fdp) \\\n" |
| 203 |
1329 |
" do { \\\n" |
| 204 |
1329 |
" assert(*(fdp) >= 0); \\\n" |
| 205 |
1329 |
" AZ(close(*(fdp))); \\\n" |
| 206 |
1329 |
" *(fdp) = -1; \\\n" |
| 207 |
1329 |
" } while (0)\n" |
| 208 |
1329 |
"\n" |
| 209 |
1329 |
"#if !defined(__has_feature)\n" |
| 210 |
1329 |
"# define __has_feature(x) 0\n" |
| 211 |
1329 |
"#endif\n" |
| 212 |
1329 |
"\n" |
| 213 |
1329 |
"#ifndef __GNUC_PREREQ__\n" |
| 214 |
1329 |
"# if defined __GNUC__ && defined __GNUC_MINOR__\n" |
| 215 |
1329 |
"# define __GNUC_PREREQ__(maj, min) \\\n" |
| 216 |
1329 |
" (__GNUC__ > (maj) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min)))\n" |
| 217 |
1329 |
"# else\n" |
| 218 |
1329 |
"# define __GNUC_PREREQ__(maj, min) 0\n" |
| 219 |
1329 |
"# endif\n" |
| 220 |
1329 |
"#endif\n" |
| 221 |
1329 |
"\n" |
| 222 |
1329 |
"#if __GNUC_PREREQ__(2, 95) || defined(__INTEL_COMPILER)\n" |
| 223 |
1329 |
"# define v_printflike_(f,a) __attribute__((format(printf, f, a)))\n" |
| 224 |
1329 |
"#else\n" |
| 225 |
1329 |
"# define v_printflike_(f,a)\n" |
| 226 |
1329 |
"#endif\n" |
| 227 |
1329 |
"\n" |
| 228 |
1329 |
"#define v_noreturn_ __attribute__((__noreturn__))\n" |
| 229 |
1329 |
"\n" |
| 230 |
1329 |
"#ifdef __GNUC__\n" |
| 231 |
1329 |
"# define v_deprecated_ __attribute__((deprecated))\n" |
| 232 |
1329 |
"#else\n" |
| 233 |
1329 |
"# define v_deprecated_\n" |
| 234 |
1329 |
"#endif\n" |
| 235 |
1329 |
"\n" |
| 236 |
1329 |
"#if __GNUC_PREREQ__(4,4) // added 2008-07-23\n" |
| 237 |
1329 |
"# define v_dont_optimize __attribute__((optimize(\"O\")))\n" |
| 238 |
1329 |
"#else\n" |
| 239 |
1329 |
"# define v_dont_optimize\n" |
| 240 |
1329 |
"#endif\n" |
| 241 |
1329 |
"\n" |
| 242 |
1329 |
"#ifdef HAVE___GCOV_FLUSH\n" |
| 243 |
1329 |
"# define v_gcov_flush() __gcov_flush()\n" |
| 244 |
1329 |
"int __gcov_flush(void);\n" |
| 245 |
1329 |
"#elif defined HAVE___GCOV_DUMP\n" |
| 246 |
1329 |
"# define v_gcov_flush() __gcov_dump()\n" |
| 247 |
1329 |
"void __gcov_dump(void);\n" |
| 248 |
1329 |
"#elif defined HAVE___LLVM_GCOV_FLUSH\n" |
| 249 |
1329 |
"# define v_gcov_flush() __llvm_gcov_flush()\n" |
| 250 |
1329 |
"int __llvm_gcov_flush(void);\n" |
| 251 |
1329 |
"#else\n" |
| 252 |
1329 |
"# define v_gcov_flush() do { } while (0)\n" |
| 253 |
1329 |
"#endif\n" |
| 254 |
1329 |
"\n" |
| 255 |
1329 |
"/*********************************************************************\n" |
| 256 |
1329 |
" * Fundamental numerical limits\n" |
| 257 |
1329 |
" * These limits track RFC8941\n" |
| 258 |
1329 |
" * We use hex notation because 999999999999.999 is not perfectly\n" |
| 259 |
1329 |
" * representable in ieee64 doubles.\n" |
| 260 |
1329 |
" */\n" |
| 261 |
1329 |
"\n" |
| 262 |
1329 |
"#define VRT_INTEGER_MAX 999999999999999\n" |
| 263 |
1329 |
"#define VRT_INTEGER_MIN -999999999999999\n" |
| 264 |
1329 |
"#define VRT_DECIMAL_MAX 0x1.d1a94a1fffff8p+39\n" |
| 265 |
1329 |
"#define VRT_DECIMAL_MIN -0x1.d1a94a1fffff8p+39\n" |
| 266 |
1329 |
"\n" |
| 267 |
1329 |
"/*********************************************************************\n" |
| 268 |
1329 |
" * Pointer alignment magic\n" |
| 269 |
1329 |
" */\n" |
| 270 |
1329 |
"\n" |
| 271 |
1329 |
"#if defined(__sparc__)\n" |
| 272 |
1329 |
"/* NB: Overbroad test for 32bit userland on 64bit SPARC cpus. */\n" |
| 273 |
1329 |
"# define PALGN (sizeof(double) - 1) /* size of alignment */\n" |
| 274 |
1329 |
"#else\n" |
| 275 |
1329 |
"# define PALGN (sizeof(void *) - 1) /* size of alignment */\n" |
| 276 |
1329 |
"#endif\n" |
| 277 |
1329 |
"#define PAOK(p) (((uintptr_t)(p) & PALGN) == 0) /* is aligned */\n" |
| 278 |
1329 |
"#define PRNDDN(p) ((uintptr_t)(p) & ~PALGN) /* Round down */\n" |
| 279 |
1329 |
"#define PRNDUP(p) (((uintptr_t)(p) + PALGN) & ~PALGN) /* Round up */\n" |
| 280 |
1329 |
"\n" |
| 281 |
1329 |
"/*********************************************************************\n" |
| 282 |
1329 |
" * To be used as little as possible to wash off const/volatile etc.\n" |
| 283 |
1329 |
" */\n" |
| 284 |
1329 |
"#define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr))\n" |
| 285 |
1329 |
"\n" |
| 286 |
1329 |
"/**********************************************************************\n" |
| 287 |
1329 |
" * Generic power-2 rounding macros\n" |
| 288 |
1329 |
" */\n" |
| 289 |
1329 |
"\n" |
| 290 |
1329 |
"#define PWR2(x) ((((x)-1UL)&(x))==0) /* Is a power of two */\n" |
| 291 |
1329 |
"#define RDN2(x, y) ((x)&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */\n" |
| 292 |
1329 |
"#define RUP2(x, y) (((x)+((y)-1))&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */\n" |
| 293 |
1329 |
"\n" |
| 294 |
1329 |
"/**********************************************************************\n" |
| 295 |
1329 |
" * Find the minimum or maximum values.\n" |
| 296 |
1329 |
" * Only evaluate the expression once and perform type checking.\n" |
| 297 |
1329 |
" */\n" |
| 298 |
1329 |
"\n" |
| 299 |
1329 |
"/* ref: https://stackoverflow.com/a/17624752 */\n" |
| 300 |
1329 |
"\n" |
| 301 |
1329 |
"#define VINDIRECT(a, b, c) a ## b ## c\n" |
| 302 |
1329 |
"#define VCOMBINE(a, b, c) VINDIRECT(a, b, c)\n" |
| 303 |
1329 |
"\n" |
| 304 |
1329 |
"#if defined(__COUNTER__)\n" |
| 305 |
1329 |
"# define VUNIQ_NAME(base) VCOMBINE(base, __LINE__, __COUNTER__)\n" |
| 306 |
1329 |
"#else\n" |
| 307 |
1329 |
"# define VUNIQ_NAME(base) VCOMBINE(base, __LINE__, 0)\n" |
| 308 |
1329 |
"#endif\n" |
| 309 |
1329 |
"\n" |
| 310 |
1329 |
"#ifdef _lint\n" |
| 311 |
1329 |
"#define typeof(x) __typeof__(x)\n" |
| 312 |
1329 |
"#endif\n" |
| 313 |
1329 |
"\n" |
| 314 |
1329 |
"/* ref: https://gcc.gnu.org/onlinedocs/gcc/Typeof.html */\n" |
| 315 |
1329 |
"\n" |
| 316 |
1329 |
"#define _vtake(op, ta, tb, a, b, _va, _vb) \\\n" |
| 317 |
1329 |
" ({ \\\n" |
| 318 |
1329 |
" ta _va = (a); \\\n" |
| 319 |
1329 |
" tb _vb = (b); \\\n" |
| 320 |
1329 |
" (void)(&_va == &_vb); \\\n" |
| 321 |
1329 |
" _va op _vb ? _va : _vb; \\\n" |
| 322 |
1329 |
"})\n" |
| 323 |
1329 |
"\n" |
| 324 |
1329 |
"#define opmin <\n" |
| 325 |
1329 |
"#define opmax >\n" |
| 326 |
1329 |
"#define vtake(n, ta, tb, a, b) _vtake(op ## n, ta, tb, a, b, \\\n" |
| 327 |
1329 |
" VUNIQ_NAME(_v ## n ## A), VUNIQ_NAME(_v ## n ## B))\n" |
| 328 |
1329 |
"\n" |
| 329 |
1329 |
"#define vmin(a, b) vtake(min, typeof(a), typeof(b), a, b)\n" |
| 330 |
1329 |
"#define vmax(a, b) vtake(max, typeof(a), typeof(b), a, b)\n" |
| 331 |
1329 |
"\n" |
| 332 |
1329 |
"#define vmin_t(type, a, b) vtake(min, type, type, a, b)\n" |
| 333 |
1329 |
"#define vmax_t(type, a, b) vtake(max, type, type, a, b)\n" |
| 334 |
1329 |
"\n" |
| 335 |
1329 |
"/**********************************************************************\n" |
| 336 |
1329 |
" * Clamp the value between two limits.\n" |
| 337 |
1329 |
" */\n" |
| 338 |
1329 |
"\n" |
| 339 |
1329 |
"#define vlimit(a, l, u) vmax((l), vmin((a), (u)))\n" |
| 340 |
1329 |
"#define vlimit_t(type, a, l, u) vmax_t(type, (l), vmin_t(type, (a), (u)))\n" |
| 341 |
1329 |
"\n" |
| 342 |
1329 |
"/**********************************************************************\n" |
| 343 |
1329 |
" * Number of elements in an array\n" |
| 344 |
1329 |
" *\n" |
| 345 |
1329 |
" * Data on bikeshedding:\n" |
| 346 |
1329 |
" * https://thephd.dev/the-big-array-size-survey-for-c-results\n" |
| 347 |
1329 |
" */\n" |
| 348 |
1329 |
"#define vcountof(arr) ((sizeof(arr) / sizeof((arr)[0])))\n" |
| 349 |
1329 |
"\n" |
| 350 |
1329 |
"/**********************************************************************\n" |
| 351 |
1329 |
" * FlexeLint and compiler shutuppery\n" |
| 352 |
1329 |
" */\n" |
| 353 |
1329 |
"\n" |
| 354 |
1329 |
"/*\n" |
| 355 |
1329 |
" * In OO-light situations, functions have to match their prototype\n" |
| 356 |
1329 |
" * even if that means not const'ing a const'able argument.\n" |
| 357 |
1329 |
" * The typedef should be specified as argument to the macro.\n" |
| 358 |
1329 |
" */\n" |
| 359 |
1329 |
"#define v_matchproto_(xxx) /*lint --e{818} */\n" |
| 360 |
1329 |
"\n" |
| 361 |
1329 |
"/*\n" |
| 362 |
1329 |
" * State variables may change value before we have considered the\n" |
| 363 |
1329 |
" * previous value\n" |
| 364 |
1329 |
" */\n" |
| 365 |
1329 |
"#define v_statevariable_(varname) varname /*lint -esym(838,varname) */\n" |
| 366 |
1329 |
"\n" |
| 367 |
1329 |
"#ifdef __SUNPRO_C\n" |
| 368 |
1329 |
"# define NEEDLESS(s) {}\n" |
| 369 |
1329 |
"#else\n" |
| 370 |
1329 |
"# define NEEDLESS(s) s\n" |
| 371 |
1329 |
"#endif\n" |
| 372 |
1329 |
"\n" |
| 373 |
1329 |
"#if __GNUC_PREREQ__(2, 7)\n" |
| 374 |
1329 |
"# define v_unused_ __attribute__((__unused__))\n" |
| 375 |
1329 |
"#else\n" |
| 376 |
1329 |
"# define v_unused_\n" |
| 377 |
1329 |
"#endif\n" |
| 378 |
1329 |
"\n" |
| 379 |
1329 |
"#if __GNUC_PREREQ__(4, 3) || defined(__clang__)\n" |
| 380 |
1329 |
"# define v_cold_ __attribute__((cold))\n" |
| 381 |
1329 |
"# define v_used_(x) __attribute__((x, used))\n" |
| 382 |
1329 |
"#else\n" |
| 383 |
1329 |
"# define v_cold_\n" |
| 384 |
1329 |
"# define v_used_(x)\n" |
| 385 |
1329 |
"#endif\n" |
| 386 |
1329 |
"\n" |
| 387 |
1329 |
"#if defined __has_attribute\n" |
| 388 |
1329 |
"# if __has_attribute(counted_by)\n" |
| 389 |
1329 |
"# define v_counted_by_(field) __attribute__((counted_by(field)))\n" |
| 390 |
1329 |
"# endif\n" |
| 391 |
1329 |
"#endif\n" |
| 392 |
1329 |
"\n" |
| 393 |
1329 |
"#ifndef v_counted_by_\n" |
| 394 |
1329 |
"# define v_counted_by_(field)\n" |
| 395 |
1329 |
"#endif\n" |
| 396 |
1329 |
"\n" |
| 397 |
1329 |
"/* VTIM API overhaul WIP */\n" |
| 398 |
1329 |
"typedef double vtim_mono;\n" |
| 399 |
1329 |
"typedef double vtim_real;\n" |
| 400 |
1329 |
"typedef double vtim_dur;\n" |
| 401 |
1329 |
"\n" |
| 402 |
1329 |
"/**********************************************************************\n" |
| 403 |
1329 |
" * txt (vas.h needed for the macros)\n" |
| 404 |
1329 |
" */\n" |
| 405 |
1329 |
"\n" |
| 406 |
1329 |
"typedef struct {\n" |
| 407 |
1329 |
" const char *b;\n" |
| 408 |
1329 |
" const char *e;\n" |
| 409 |
1329 |
"} txt;\n" |
| 410 |
1329 |
"\n" |
| 411 |
1329 |
"#define Tcheck(t) do { (void)pdiff((t).b, (t).e); } while (0)\n" |
| 412 |
1329 |
"#define Tlen(t) (pdiff((t).b, (t).e))\n" |
| 413 |
1329 |
"#define Tstr(s) (/*lint -e(446)*/ (txt){(s), (s) + vstrlen(s)})\n" |
| 414 |
1329 |
"#define Tstreq(t, s) (Tlen(t) == vstrlen(s) && !vmemcmp((t).b, (s), Tlen(t)))\n" |
| 415 |
1329 |
"#define Tforeach(c, t) for ((c) = (t).b; (c) < (t).e; (c)++)\n" |
| 416 |
1329 |
"\n" |
| 417 |
1329 |
"/* #3020 dummy definitions until PR is merged*/\n" |
| 418 |
1329 |
"#define LIKELY(x) (x)\n" |
| 419 |
1329 |
"#define UNLIKELY(x) (x)\n" |
| 420 |
1329 |
"\n" |
| 421 |
1329 |
"#ifndef __DEQUALIFY\n" |
| 422 |
1329 |
"#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var))\n" |
| 423 |
1329 |
"#endif\n" |
| 424 |
1329 |
"\n" |
| 425 |
1329 |
"/**********************************************************************\n" |
| 426 |
1329 |
" * vqueue.h presupposes the __containerof() macro for VSTAILQ_LAST(),\n" |
| 427 |
1329 |
" * which is in FreeBSD cdefs.h.\n" |
| 428 |
1329 |
" *\n" |
| 429 |
1329 |
" * This differs from cdefs.h in that uintptr_t is taken from stdint.h, and\n" |
| 430 |
1329 |
" * offsetof() is taken from stddef.h.\n" |
| 431 |
1329 |
" */\n" |
| 432 |
1329 |
"\n" |
| 433 |
1329 |
"/*\n" |
| 434 |
1329 |
" * Given the pointer x to the member m of the struct s, return\n" |
| 435 |
1329 |
" * a pointer to the containing structure. When using GCC, we first\n" |
| 436 |
1329 |
" * assign pointer x to a local variable, to check that its type is\n" |
| 437 |
1329 |
" * compatible with member m.\n" |
| 438 |
1329 |
" */\n" |
| 439 |
1329 |
"#ifndef __containerof\n" |
| 440 |
1329 |
"#if __GNUC_PREREQ__(3, 1)\n" |
| 441 |
1329 |
"#define __containerof(x, s, m) ({ \\\n" |
| 442 |
1329 |
" const volatile __typeof(((s *)0)->m) *__x = (x); \\\n" |
| 443 |
1329 |
" __DEQUALIFY(s *, (const volatile char *)__x - offsetof(s, m)); \\\n" |
| 444 |
1329 |
"})\n" |
| 445 |
1329 |
"#else\n" |
| 446 |
1329 |
"#define __containerof(x, s, m) \\\n" |
| 447 |
1329 |
" __DEQUALIFY(s *, (const volatile char *)(x) - offsetof(s, m))\n" |
| 448 |
1329 |
"#endif\n" |
| 449 |
1329 |
"#endif\n" |
| 450 |
1329 |
"\n" |
| 451 |
1329 |
"/**********************************************************************\n" |
| 452 |
1329 |
" * various optinal built-ins\n" |
| 453 |
1329 |
" *\n" |
| 454 |
1329 |
" * https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions\n" |
| 455 |
1329 |
" *\n" |
| 456 |
1329 |
" */\n" |
| 457 |
1329 |
"#ifndef __has_builtin\n" |
| 458 |
1329 |
"# define __has_builtin(x) 0\n" |
| 459 |
1329 |
"#endif\n" |
| 460 |
1329 |
"\n" |
| 461 |
1329 |
"// string builtins in order of documentation\n" |
| 462 |
1329 |
"\n" |
| 463 |
1329 |
"#if __has_builtin(__builtin_memchr)\n" |
| 464 |
1329 |
"# define vmemchr(s, c, n) __builtin_memchr(s, c, n)\n" |
| 465 |
1329 |
"#else\n" |
| 466 |
1329 |
"# define vmemchr(s, c, n) memchr(s, c, n)\n" |
| 467 |
1329 |
"#endif\n" |
| 468 |
1329 |
"\n" |
| 469 |
1329 |
"#if __has_builtin(__builtin_memcmp)\n" |
| 470 |
1329 |
"# define vmemcmp(s1, s2, n) __builtin_memcmp(s1, s2, n)\n" |
| 471 |
1329 |
"#else\n" |
| 472 |
1329 |
"# define vmemcmp(s1, s2, n) memcmp(s1, s2, n)\n" |
| 473 |
1329 |
"#endif\n" |
| 474 |
1329 |
"\n" |
| 475 |
1329 |
"#if __has_builtin(__builtin_strchr)\n" |
| 476 |
1329 |
"# define vstrchr(s, c, n) __builtin_strchr(s, c, n)\n" |
| 477 |
1329 |
"#else\n" |
| 478 |
1329 |
"# define vstrchr(s, c, n) strchr(s, c, n)\n" |
| 479 |
1329 |
"#endif\n" |
| 480 |
1329 |
"\n" |
| 481 |
1329 |
"#if __has_builtin(__builtin_strcmp)\n" |
| 482 |
1329 |
"# define vstrcmp(s1, s2) __builtin_strcmp(s1, s2)\n" |
| 483 |
1329 |
"#else\n" |
| 484 |
1329 |
"# define vstrcmp(s1, s2) strcmp(s1, s2)\n" |
| 485 |
1329 |
"#endif\n" |
| 486 |
1329 |
"\n" |
| 487 |
1329 |
"#if __has_builtin(__builtin_strlen)\n" |
| 488 |
1329 |
"# define vstrlen(s) __builtin_strlen(s)\n" |
| 489 |
1329 |
"#else\n" |
| 490 |
1329 |
"# define vstrlen(s) strlen(s)\n" |
| 491 |
1329 |
"#endif\n" |
| 492 |
1329 |
"\n" |
| 493 |
1329 |
"#if __has_builtin(__builtin_strncmp)\n" |
| 494 |
1329 |
"# define vstrncmp(s1, s2, n) __builtin_strncmp(s1, s2, n)\n" |
| 495 |
1329 |
"#else\n" |
| 496 |
1329 |
"# define vstrncmp(s1, s2, n) strncmp(s1, s2, n)\n" |
| 497 |
1329 |
"#endif\n" |
| 498 |
1329 |
"\n" |
| 499 |
1329 |
"\n" |
| 500 |
1329 |
"#if __has_builtin(__builtin_memcpy)\n" |
| 501 |
1329 |
"# define vmemcpy(d, s, n) __builtin_memcpy(d, s, n)\n" |
| 502 |
1329 |
"#else\n" |
| 503 |
1329 |
"# define vmemcpy(d, s, n) memcpy(d, s, n)\n" |
| 504 |
1329 |
"#endif\n" |
| 505 |
1329 |
"\n" |
| 506 |
1329 |
"#if __has_builtin(__builtin_memmove)\n" |
| 507 |
1329 |
"# define vmemmove(d, s, n) __builtin_memmove(d, s, n)\n" |
| 508 |
1329 |
"#else\n" |
| 509 |
1329 |
"# define vmemmove(d, s, n) memmove(d, s, n)\n" |
| 510 |
1329 |
"#endif\n" |
| 511 |
1329 |
"\n" |
| 512 |
1329 |
"// ... to be extended\n" |
| 513 |
1329 |
); |
| 514 |
1329 |
VSB_cat(sb, "\n"); |
| 515 |
|
|
| 516 |
|
/* ../include/vrt.h */ |
| 517 |
|
|
| 518 |
1329 |
VSB_cat(sb, "/* ---===### include/vrt.h ###===--- */\n\n"); |
| 519 |
1329 |
VSB_cat(sb, |
| 520 |
1329 |
"/*-\n" |
| 521 |
1329 |
" * Copyright (c) 2006 Verdens Gang AS\n" |
| 522 |
1329 |
" * Copyright (c) 2006-2021 Varnish Software AS\n" |
| 523 |
1329 |
" * All rights reserved.\n" |
| 524 |
1329 |
" *\n" |
| 525 |
1329 |
" * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>\n" |
| 526 |
1329 |
" *\n" |
| 527 |
1329 |
" * SPDX-License-Identifier: BSD-2-Clause\n" |
| 528 |
1329 |
" *\n" |
| 529 |
1329 |
" * Redistribution and use in source and binary forms, with or without\n" |
| 530 |
1329 |
" * modification, are permitted provided that the following conditions\n" |
| 531 |
1329 |
" * are met:\n" |
| 532 |
1329 |
" * 1. Redistributions of source code must retain the above copyright\n" |
| 533 |
1329 |
" * notice, this list of conditions and the following disclaimer.\n" |
| 534 |
1329 |
" * 2. Redistributions in binary form must reproduce the above copyright\n" |
| 535 |
1329 |
" * notice, this list of conditions and the following disclaimer in the\n" |
| 536 |
1329 |
" * documentation and/or other materials provided with the distribution.\n" |
| 537 |
1329 |
" *\n" |
| 538 |
1329 |
" * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" |
| 539 |
1329 |
" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" |
| 540 |
1329 |
" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" |
| 541 |
1329 |
" * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n" |
| 542 |
1329 |
" * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" |
| 543 |
1329 |
" * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" |
| 544 |
1329 |
" * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" |
| 545 |
1329 |
" * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" |
| 546 |
1329 |
" * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" |
| 547 |
1329 |
" * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" |
| 548 |
1329 |
" * SUCH DAMAGE.\n" |
| 549 |
1329 |
" *\n" |
| 550 |
1329 |
" * Runtime support for compiled VCL programs and VMODs.\n" |
| 551 |
1329 |
" *\n" |
| 552 |
1329 |
" * NB: When this file is changed, lib/libvcc/generate.py *MUST* be rerun.\n" |
| 553 |
1329 |
" */\n" |
| 554 |
1329 |
"\n" |
| 555 |
1329 |
"#ifdef CACHE_H_INCLUDED\n" |
| 556 |
1329 |
"# error \"vrt.h included after cache.h - they are inclusive\"\n" |
| 557 |
1329 |
"#endif\n" |
| 558 |
1329 |
"\n" |
| 559 |
1329 |
"#ifdef VRT_H_INCLUDED\n" |
| 560 |
1329 |
"# error \"vrt.h included multiple times\"\n" |
| 561 |
1329 |
"#endif\n" |
| 562 |
1329 |
"#define VRT_H_INCLUDED\n" |
| 563 |
1329 |
"\n" |
| 564 |
1329 |
"#ifndef VDEF_H_INCLUDED\n" |
| 565 |
1329 |
"# error \"include vdef.h before vrt.h\"\n" |
| 566 |
1329 |
"#endif\n" |
| 567 |
1329 |
"\n" |
| 568 |
1329 |
"#define VRT_MAJOR_VERSION 24U\n" |
| 569 |
1329 |
"\n" |
| 570 |
1329 |
"#define VRT_MINOR_VERSION 3U\n" |
| 571 |
1329 |
"\n" |
| 572 |
1329 |
"/***********************************************************************\n" |
| 573 |
1329 |
" * Major and minor VRT API versions.\n" |
| 574 |
1329 |
" *\n" |
| 575 |
1329 |
" * Whenever something is added, increment MINOR version\n" |
| 576 |
1329 |
" * Whenever something is deleted or changed in a way which is not\n" |
| 577 |
1329 |
" * binary/load-time compatible, increment MAJOR version\n" |
| 578 |
1329 |
" *\n" |
| 579 |
1329 |
" * 24.3\n" |
| 580 |
1329 |
" * // XXX this would be a major bump, but for next release we'll bump\n" |
| 581 |
1329 |
" * // anyway\n" |
| 582 |
1329 |
" * ctx->specific is now an ssize_t * in vcl_synth, -1 is failed\n" |
| 583 |
1329 |
" * 24.2\n" |
| 584 |
1329 |
" * un-const storage_close_f\n" |
| 585 |
1329 |
" * 24.1\n" |
| 586 |
1329 |
" * fixed stevedore ban notification in BAN_Commit()\n" |
| 587 |
1329 |
" * 24.0 (2026-09-16)\n" |
| 588 |
1329 |
" * VRT_Rollback() no longer takes a VCL_HTTP argument\n" |
| 589 |
1329 |
" * struct vmod_data has moved to vmod_abi.h\n" |
| 590 |
1329 |
" * enum gethdr_e gained a new HDR_REQ0 value\n" |
| 591 |
1329 |
" * http_req0 added to struct vrt_ctx\n" |
| 592 |
1329 |
" * struct vmod_data moved to vmod_abi.h\n" |
| 593 |
1329 |
" * stuct VCL_conf declaration removed from vrt.h\n" |
| 594 |
1329 |
" * struct VSC_main declaration removed from vrt.h\n" |
| 595 |
1329 |
" * VRT_r_req0_method() added\n" |
| 596 |
1329 |
" * VRT_r_req0_proto() added\n" |
| 597 |
1329 |
" * VRT_r_req0_url() added\n" |
| 598 |
1329 |
" * VRT_r_beresp_esi_disable_xml_check() added\n" |
| 599 |
1329 |
" * VRT_l_beresp_esi_disable_xml_check() added\n" |
| 600 |
1329 |
" * VRT_r_beresp_esi_ignore_https() added\n" |
| 601 |
1329 |
" * VRT_l_beresp_esi_ignore_https() added\n" |
| 602 |
1329 |
" * VRT_r_beresp_esi_ignore_other_elements() added\n" |
| 603 |
1329 |
" * VRT_l_beresp_esi_ignore_other_elements() added\n" |
| 604 |
1329 |
" * VRT_r_beresp_esi_remove_bom() added\n" |
| 605 |
1329 |
" * VRT_l_beresp_esi_remove_bom() added\n" |
| 606 |
1329 |
" * VRT_r_resp_esi_include_onerror() added\n" |
| 607 |
1329 |
" * VRT_l_resp_esi_include_onerror() added\n" |
| 608 |
1329 |
" * VRT_r_resp_storage() added\n" |
| 609 |
1329 |
" * VRT_l_resp_storage() added\n" |
| 610 |
1329 |
" * VRT_synth_strands() removed\n" |
| 611 |
1329 |
" * VRT_synth_blob() removed\n" |
| 612 |
1329 |
" * VRT_synth_page() removed\n" |
| 613 |
1329 |
" * VRT_Stv() removed\n" |
| 614 |
1329 |
" * 23.0 (2026-03-16)\n" |
| 615 |
1329 |
" * [cache.h] http_method_eq() added\n" |
| 616 |
1329 |
" * [cache.h] http_method_among() added\n" |
| 617 |
1329 |
" * [cache.h] http_SetWellKnownMethod() added\n" |
| 618 |
1329 |
" * VRT_r_req_max_age() added\n" |
| 619 |
1329 |
" * VRT_l_req_max_age() added\n" |
| 620 |
1329 |
" * VRT_u_req_max_age() added\n" |
| 621 |
1329 |
" * VRT_r_bereq_retry_connect() added\n" |
| 622 |
1329 |
" * VRT_l_bereq_retry_connect() added\n" |
| 623 |
1329 |
" * VRT_r_beresp_storage_hint() removed\n" |
| 624 |
1329 |
" * VRT_l_beresp_storage_hint() removed\n" |
| 625 |
1329 |
" * \"vcl_name\" member added to vrt_backend_probe{}\n" |
| 626 |
1329 |
" * VRT_PROBE_string() added\n" |
| 627 |
1329 |
" * 22.0 (2025-09-15)\n" |
| 628 |
1329 |
" * VRT_r_obj_stale_age() added\n" |
| 629 |
1329 |
" * VRT_r_obj_stale_can_esi() added\n" |
| 630 |
1329 |
" * VRT_r_obj_stale_grace() added\n" |
| 631 |
1329 |
" * VRT_r_obj_stale_hits() added\n" |
| 632 |
1329 |
" * VRT_r_obj_stale_keep() added\n" |
| 633 |
1329 |
" * VRT_r_obj_stale_proto() added\n" |
| 634 |
1329 |
" * VRT_r_obj_stale_reason() added\n" |
| 635 |
1329 |
" * VRT_r_obj_stale_status() added\n" |
| 636 |
1329 |
" * VRT_r_obj_stale_storage() added\n" |
| 637 |
1329 |
" * VRT_r_obj_stale_time() added\n" |
| 638 |
1329 |
" * VRT_r_obj_stale_ttl() added\n" |
| 639 |
1329 |
" * VRT_r_obj_stale_uncacheable() added\n" |
| 640 |
1329 |
" * VRT_r_obj_stale_is_valid() added\n" |
| 641 |
1329 |
" * enum gethdr_e has new value HDR_OBJ_STALE\n" |
| 642 |
1329 |
" * typedef hdr_t added\n" |
| 643 |
1329 |
" * struct gethdr_s.what changed to hdr_t\n" |
| 644 |
1329 |
" * VRT_VSC_Alloc() renamed to VRT_VSC_Allocv()\n" |
| 645 |
1329 |
" * new VRT_VSC_Alloc() added\n" |
| 646 |
1329 |
" * VRT_r_param_backend_idle_timeout() added\n" |
| 647 |
1329 |
" * VRT_r_param_backend_wait_limit() added\n" |
| 648 |
1329 |
" * VRT_r_param_backend_wait_timeout() added\n" |
| 649 |
1329 |
" * VRT_r_param_between_bytes_timeout() added\n" |
| 650 |
1329 |
" * VRT_r_param_connect_timeout() added\n" |
| 651 |
1329 |
" * VRT_r_param_default_grace() added\n" |
| 652 |
1329 |
" * VRT_r_param_default_keep() added\n" |
| 653 |
1329 |
" * VRT_r_param_default_ttl() added\n" |
| 654 |
1329 |
" * VRT_r_param_first_byte_timeout() added\n" |
| 655 |
1329 |
" * VRT_r_param_idle_send_timeout() added\n" |
| 656 |
1329 |
" * VRT_r_param_max_esi_depth() added\n" |
| 657 |
1329 |
" * VRT_r_param_max_restarts() added\n" |
| 658 |
1329 |
" * VRT_r_param_max_retries() added\n" |
| 659 |
1329 |
" * VRT_r_param_pipe_task_deadline() added\n" |
| 660 |
1329 |
" * VRT_r_param_pipe_timeout() added\n" |
| 661 |
1329 |
" * VRT_r_param_send_timeout() added\n" |
| 662 |
1329 |
" * VRT_r_param_shortlived() added\n" |
| 663 |
1329 |
" * VRT_r_param_timeout_idle() added\n" |
| 664 |
1329 |
" * VRT_r_param_transit_buffer() added\n" |
| 665 |
1329 |
" * VRT_r_param_uncacheable_ttl() added\n" |
| 666 |
1329 |
" * VRT_AddVFP() removed\n" |
| 667 |
1329 |
" * VRT_AddVDP() removed\n" |
| 668 |
1329 |
" * VRT_RemoveVFP() removed\n" |
| 669 |
1329 |
" * VRT_RemoveVDP() removed\n" |
| 670 |
1329 |
" * struct vrt_blob magic added\n" |
| 671 |
1329 |
" * struct strands magic added;\n" |
| 672 |
1329 |
" * 21.0 (2025-03-17)\n" |
| 673 |
1329 |
" * VRT_u_req_grace() added\n" |
| 674 |
1329 |
" * VRT_u_req_ttl() added\n" |
| 675 |
1329 |
" * VRT_r_req_filters() added\n" |
| 676 |
1329 |
" * VRT_l_req_filters() added\n" |
| 677 |
1329 |
" * VRT_r_bereq_filters() added\n" |
| 678 |
1329 |
" * VRT_l_bereq_filters() added\n" |
| 679 |
1329 |
" * 20.1 (2024-11-08 7.6.1)\n" |
| 680 |
1329 |
" * VDI_EVENT_SICK added to enum vcl_event_e\n" |
| 681 |
1329 |
" * 20.0 (2024-09-13)\n" |
| 682 |
1329 |
" * struct vrt_backend.backend_wait_timeout added\n" |
| 683 |
1329 |
" * struct vrt_backend.backend_wait_limit added\n" |
| 684 |
1329 |
" * 19.1 (2024-05-27)\n" |
| 685 |
1329 |
" * [cache_int.h] ObjWaitExtend() gained statep argument\n" |
| 686 |
1329 |
" * 19.0 (2024-03-18)\n" |
| 687 |
1329 |
" * [cache.h] (struct req).filter_list renamed to vdp_filter_list\n" |
| 688 |
1329 |
" * order of vcl/vmod and director COLD events reversed to directors first\n" |
| 689 |
1329 |
" * VRT_u_sess_idle_send_timeout() added\n" |
| 690 |
1329 |
" * VRT_u_sess_send_timeout() added\n" |
| 691 |
1329 |
" * VRT_u_sess_timeout_idle() added\n" |
| 692 |
1329 |
" * VRT_u_sess_timeout_linger() added\n" |
| 693 |
1329 |
" * (struct vrt_backend).*_timeout must be initialized to a negative value\n" |
| 694 |
1329 |
" * VRT_BACKEND_INIT() helper macro added\n" |
| 695 |
1329 |
" * VRT_l_bereq_task_deadline() added\n" |
| 696 |
1329 |
" * VRT_r_bereq_task_deadline() added\n" |
| 697 |
1329 |
" * VRT_u_bereq_task_deadline() added\n" |
| 698 |
1329 |
" * VRT_u_bereq_between_bytes_timeout() added\n" |
| 699 |
1329 |
" * VRT_u_bereq_connect_timeout() added\n" |
| 700 |
1329 |
" * VRT_u_bereq_first_byte_timeout() added\n" |
| 701 |
1329 |
" * 18.1 (2023-12-05)\n" |
| 702 |
1329 |
" * vbf_objiterate() implementation changed #4013\n" |
| 703 |
1329 |
" * 18.0 (2023-09-15)\n" |
| 704 |
1329 |
" * [cache_filter.h] struct vdp gained priv1 member\n" |
| 705 |
1329 |
" * VRT_trace() added\n" |
| 706 |
1329 |
" * 17.0 (2023-03-15)\n" |
| 707 |
1329 |
" * VXID is 64 bit\n" |
| 708 |
1329 |
" * [cache.h] http_GetRange() changed\n" |
| 709 |
1329 |
" * exp_close added to struct vrt_backend_probe\n" |
| 710 |
1329 |
" * VRT_new_backend() signature changed\n" |
| 711 |
1329 |
" * VRT_new_backend_clustered() signature changed\n" |
| 712 |
1329 |
" * authority field added to struct vrt_backend\n" |
| 713 |
1329 |
" * release field added to struct vdi_methods\n" |
| 714 |
1329 |
" * 16.0 (2022-09-15)\n" |
| 715 |
1329 |
" * VMOD C-prototypes moved into JSON\n" |
| 716 |
1329 |
" * VRT_AddVDP() deprecated\n" |
| 717 |
1329 |
" * VRT_AddVFP() deprecated\n" |
| 718 |
1329 |
" * VRT_RemoveVDP() deprecated\n" |
| 719 |
1329 |
" * VRT_RemoveVFP() deprecated\n" |
| 720 |
1329 |
" * 15.0 (2022-03-15)\n" |
| 721 |
1329 |
" * VRT_r_req_transport() added\n" |
| 722 |
1329 |
" * VRT_Assign_Backend() added\n" |
| 723 |
1329 |
" * VRT_StaticDirector() added\n" |
| 724 |
1329 |
" * enum lbody_e changed\n" |
| 725 |
1329 |
" * - previous enum lbody_e values are defined as macros\n" |
| 726 |
1329 |
" * The following functions changed to take `const char *, BODY`:\n" |
| 727 |
1329 |
" * - VRT_l_beresp_body()\n" |
| 728 |
1329 |
" * - VRT_l_resp_body()\n" |
| 729 |
1329 |
" * BODY can either be a BLOB or a STRANDS, but only a STRANDS\n" |
| 730 |
1329 |
" * can take a non-NULL const char * prefix. The changes to BODY\n" |
| 731 |
1329 |
" * assignments doesn't break the ABI or the API.\n" |
| 732 |
1329 |
" * TOSTRAND() and TOSTRANDS() macros added\n" |
| 733 |
1329 |
" * [cache.h] enum sess_close replaced by struct stream_close\n" |
| 734 |
1329 |
" * [cache.h] http_IsHdr() added\n" |
| 735 |
1329 |
" * [cache_filter.h] vfp_init_f() changed to take a VRT_CTX\n" |
| 736 |
1329 |
" * [cache_filter.h] vdp_init_f() changed to take a VRT_CTX\n" |
| 737 |
1329 |
" * [cache_filter.h] VRT_AddFilter() added\n" |
| 738 |
1329 |
" * [cache_filter.h] VRT_RemoveFilter() added\n" |
| 739 |
1329 |
" * 14.0 (2021-09-15)\n" |
| 740 |
1329 |
" * VIN_n_Arg() no directly returns the directory name.\n" |
| 741 |
1329 |
" * VSB_new() and VSB_delete() removed\n" |
| 742 |
1329 |
" * VCL_STRINGLIST, vrt_magic_string_end removed\n" |
| 743 |
1329 |
" * VRT_String(), VRT_StringList(), VRT_CollectString() removed\n" |
| 744 |
1329 |
" * VRT_CollectStrands() renamed to VRT_STRANDS_string()\n" |
| 745 |
1329 |
" * The following functions changed to take `const char *, STRANDS`:\n" |
| 746 |
1329 |
" * - VRT_l_client_identity()\n" |
| 747 |
1329 |
" * - VRT_l_req_method()\n" |
| 748 |
1329 |
" * - VRT_l_req_url()\n" |
| 749 |
1329 |
" * - VRT_l_req_proto()\n" |
| 750 |
1329 |
" * - VRT_l_bereq_method()\n" |
| 751 |
1329 |
" * - VRT_l_bereq_url()\n" |
| 752 |
1329 |
" * - VRT_l_bereq_proto()\n" |
| 753 |
1329 |
" * - VRT_l_beresp_body()\n" |
| 754 |
1329 |
" * - VRT_l_beresp_proto()\n" |
| 755 |
1329 |
" * - VRT_l_beresp_reason()\n" |
| 756 |
1329 |
" * - VRT_l_beresp_storage_hint()\n" |
| 757 |
1329 |
" * - VRT_l_beresp_filters()\n" |
| 758 |
1329 |
" * - VRT_l_resp_body()\n" |
| 759 |
1329 |
" * - VRT_l_resp_proto()\n" |
| 760 |
1329 |
" * - VRT_l_resp_reason()\n" |
| 761 |
1329 |
" * - VRT_l_resp_filters()\n" |
| 762 |
1329 |
" * - VRT_SetHdr()\n" |
| 763 |
1329 |
" * VRT_UnsetHdr() added\n" |
| 764 |
1329 |
" * vrt_magic_string_unset removed (use VRT_UnsetHdr() instead)\n" |
| 765 |
1329 |
" * VNUMpfx() removed, SF_Parse_{Integer|Decimal|Number} added\n" |
| 766 |
1329 |
" * vrt_null_strands added\n" |
| 767 |
1329 |
" * vrt_null_blob added\n" |
| 768 |
1329 |
" * VRT_NULL_BLOB_TYPE added as the .type of vrt_null_blob\n" |
| 769 |
1329 |
" * VRT_blob() changed to return vrt_null_blob for\n" |
| 770 |
1329 |
" * len == 0 or src == NULL arguments\n" |
| 771 |
1329 |
" * [cache.h] WS_Front() removed\n" |
| 772 |
1329 |
" * [cache.h] WS_Inside() removed\n" |
| 773 |
1329 |
" * [cache.h] WS_Assert_Allocated() removed\n" |
| 774 |
1329 |
" * [cache.h] WS_Allocated() added\n" |
| 775 |
1329 |
" * [cache.h] WS_Dump() added\n" |
| 776 |
1329 |
" * 13.0 (2021-03-15)\n" |
| 777 |
1329 |
" * Move VRT_synth_page() to deprecated status\n" |
| 778 |
1329 |
" * Add VRT_synth_strands() and VRT_synth_blob()\n" |
| 779 |
1329 |
" * struct vrt_type now produced by generate.py\n" |
| 780 |
1329 |
" * VRT_acl_log() moved to VPI_acl_log()\n" |
| 781 |
1329 |
" * VRT_Endpoint_Clone() added.\n" |
| 782 |
1329 |
" * Calling convention for VDP implementation changed\n" |
| 783 |
1329 |
" * VRT_ValidHdr() added.\n" |
| 784 |
1329 |
" * struct vmod_priv_methods added\n" |
| 785 |
1329 |
" * struct vmod_priv free member replaced with methods\n" |
| 786 |
1329 |
" * VRT_CTX_Assert() added\n" |
| 787 |
1329 |
" * VRT_ban_string() signature changed\n" |
| 788 |
1329 |
" * VRT_priv_task_get() added\n" |
| 789 |
1329 |
" * VRT_priv_top_get() added\n" |
| 790 |
1329 |
" * VRT_re_init removed\n" |
| 791 |
1329 |
" * VRT_re_fini removed\n" |
| 792 |
1329 |
" * VRT_re_match signature changed\n" |
| 793 |
1329 |
" * VRT_regsub signature changed\n" |
| 794 |
1329 |
" * VRT_call() added\n" |
| 795 |
1329 |
" * VRT_check_call() added\n" |
| 796 |
1329 |
" * VRT_handled() added\n" |
| 797 |
1329 |
" * 12.0 (2020-09-15)\n" |
| 798 |
1329 |
" * Added VRT_DirectorResolve()\n" |
| 799 |
1329 |
" * Added VCL_STRING VRT_BLOB_string(VRT_CTX, VCL_BLOB)\n" |
| 800 |
1329 |
" * [cache.h] WS_Reserve() removed\n" |
| 801 |
1329 |
" * [cache.h] WS_Printf() changed\n" |
| 802 |
1329 |
" * [cache.h] WS_ReservationSize() added\n" |
| 803 |
1329 |
" * [cache.h] WS_Front() deprecated\n" |
| 804 |
1329 |
" * [cache.h] WS_Reservation() added\n" |
| 805 |
1329 |
" * 11.0 (2020-03-16)\n" |
| 806 |
1329 |
" * Changed type of vsa_suckaddr_len from int to size_t\n" |
| 807 |
1329 |
" * New prefix_{ptr|len} fields in vrt_backend\n" |
| 808 |
1329 |
" * VRT_HashStrands32() added\n" |
| 809 |
1329 |
" * VRT_l_resp_body() changed\n" |
| 810 |
1329 |
" * VRT_l_beresp_body() changed\n" |
| 811 |
1329 |
" * VRT_Format_Proxy() added // transitional interface\n" |
| 812 |
1329 |
" * VRT_AllocStrandsWS() added\n" |
| 813 |
1329 |
" * 10.0 (2019-09-15)\n" |
| 814 |
1329 |
" * VRT_UpperLowerStrands added.\n" |
| 815 |
1329 |
" * VRT_synth_page now takes STRANDS argument\n" |
| 816 |
1329 |
" * VRT_hashdata() now takes STRANDS argument\n" |
| 817 |
1329 |
" * VCL_BOOL VRT_Strands2Bool(VCL_STRANDS) added.\n" |
| 818 |
1329 |
" * VRT_BundleStrands() moved to vcc_interface.h\n" |
| 819 |
1329 |
" * VRT_VCL_{Busy|Unbusy} changed to VRT_VCL_{Prevent|Allow}_Cold\n" |
| 820 |
1329 |
" * VRT_re[fl]_vcl changed to VRT_VCL_{Prevent|Allow}_Discard\n" |
| 821 |
1329 |
" * VRT_Vmod_{Init|Unload} moved to vcc_interface.h\n" |
| 822 |
1329 |
" * VRT_count moved to vcc_interface.h\n" |
| 823 |
1329 |
" * VRT_VCL_Prevent_Cold() and VRT_VCL_Allow_Cold() added.\n" |
| 824 |
1329 |
" * VRT_vcl_get moved to vcc_interface.h\n" |
| 825 |
1329 |
" * VRT_vcl_rel moved to vcc_interface.h\n" |
| 826 |
1329 |
" * VRT_vcl_select moved to vcc_interface.h\n" |
| 827 |
1329 |
" * VRT_VSA_GetPtr() changed\n" |
| 828 |
1329 |
" * VRT_ipcmp() changed\n" |
| 829 |
1329 |
" * VRT_Stv_*() functions renamed to VRT_stevedore_*()\n" |
| 830 |
1329 |
" * [cache.h] WS_ReserveAll() added\n" |
| 831 |
1329 |
" * [cache.h] WS_Reserve(ws, 0) deprecated\n" |
| 832 |
1329 |
" * 9.0 (2019-03-15)\n" |
| 833 |
1329 |
" * Make 'len' in vmod_priv 'long'\n" |
| 834 |
1329 |
" * HTTP_Copy() removed\n" |
| 835 |
1329 |
" * HTTP_Dup() added\n" |
| 836 |
1329 |
" * HTTP_Clone() added\n" |
| 837 |
1329 |
" * VCL_BLOB changed to newly introduced struct vrt_blob *\n" |
| 838 |
1329 |
" * VRT_blob() changed\n" |
| 839 |
1329 |
" * req->req_bodybytes removed\n" |
| 840 |
1329 |
" * use: AZ(ObjGetU64(req->wrk, req->body_oc, OA_LEN, &u));\n" |
| 841 |
1329 |
" * struct vdi_methods .list callback signature changed\n" |
| 842 |
1329 |
" * VRT_LookupDirector() added\n" |
| 843 |
1329 |
" * VRT_SetChanged() added\n" |
| 844 |
1329 |
" * VRT_SetHealth() removed\n" |
| 845 |
1329 |
" * // in cache_filter.h:\n" |
| 846 |
1329 |
" * VRT_AddVDP() added\n" |
| 847 |
1329 |
" * VRT_RemoveVDP() added\n" |
| 848 |
1329 |
" * 8.0 (2018-09-15)\n" |
| 849 |
1329 |
" * VRT_Strands() added\n" |
| 850 |
1329 |
" * VRT_StrandsWS() added\n" |
| 851 |
1329 |
" * VRT_CollectStrands() added\n" |
| 852 |
1329 |
" * VRT_STRANDS_string() removed from vrt.h (never implemented)\n" |
| 853 |
1329 |
" * VRT_Vmod_Init signature changed\n" |
| 854 |
1329 |
" * VRT_Vmod_Fini changed to VRT_Vmod_Unload\n" |
| 855 |
1329 |
" * // directors\n" |
| 856 |
1329 |
" * VRT_backend_healthy() removed\n" |
| 857 |
1329 |
" * VRT_Healthy() changed prototype\n" |
| 858 |
1329 |
" * struct vdi_methods and callback prototypes added\n" |
| 859 |
1329 |
" * struct director added;\n" |
| 860 |
1329 |
" * VRT_AddDirector() added\n" |
| 861 |
1329 |
" * VRT_SetHealth() added\n" |
| 862 |
1329 |
" * VRT_DisableDirector() added\n" |
| 863 |
1329 |
" * VRT_DelDirector() added\n" |
| 864 |
1329 |
" * // in cache_filter.h:\n" |
| 865 |
1329 |
" * VRT_AddVFP() added\n" |
| 866 |
1329 |
" * VRT_RemoveVFP() added\n" |
| 867 |
1329 |
" * 7.0 (2018-03-15)\n" |
| 868 |
1329 |
" * lots of stuff moved from cache.h to cache_int.h\n" |
| 869 |
1329 |
" * (ie: from \"$Abi vrt\" to \"$Abi strict\")\n" |
| 870 |
1329 |
" * VCL_INT and VCL_BYTES are always 64 bits.\n" |
| 871 |
1329 |
" * path field added to struct vrt_backend\n" |
| 872 |
1329 |
" * VRT_Healthy() added\n" |
| 873 |
1329 |
" * VRT_VSC_Alloc() added\n" |
| 874 |
1329 |
" * VRT_VSC_Destroy() added\n" |
| 875 |
1329 |
" * VRT_VSC_Hide() added\n" |
| 876 |
1329 |
" * VRT_VSC_Reveal() added\n" |
| 877 |
1329 |
" * VRT_VSC_Overhead() added\n" |
| 878 |
1329 |
" * struct director.event added\n" |
| 879 |
1329 |
" * struct director.destroy added\n" |
| 880 |
1329 |
" * VRT_r_beresp_storage_hint() VCL <= 4.0 #2509\n" |
| 881 |
1329 |
" * VRT_l_beresp_storage_hint() VCL <= 4.0 #2509\n" |
| 882 |
1329 |
" * VRT_blob() added\n" |
| 883 |
1329 |
" * VCL_STRANDS added\n" |
| 884 |
1329 |
" * 6.1 (2017-09-15 aka 5.2)\n" |
| 885 |
1329 |
" * http_CollectHdrSep added\n" |
| 886 |
1329 |
" * VRT_purge modified (may fail a transaction, signature changed)\n" |
| 887 |
1329 |
" * VRT_r_req_hash() added\n" |
| 888 |
1329 |
" * VRT_r_bereq_hash() added\n" |
| 889 |
1329 |
" * 6.0 (2017-03-15):\n" |
| 890 |
1329 |
" * VRT_hit_for_pass added\n" |
| 891 |
1329 |
" * VRT_ipcmp added\n" |
| 892 |
1329 |
" * VRT_Vmod_Init signature changed\n" |
| 893 |
1329 |
" * VRT_vcl_lookup removed\n" |
| 894 |
1329 |
" * VRT_fail added\n" |
| 895 |
1329 |
" * [cache.h] WS_Reset and WS_Snapshot signatures changed\n" |
| 896 |
1329 |
" * [cache.h] WS_Front added\n" |
| 897 |
1329 |
" * [cache.h] WS_ReserveLumps added\n" |
| 898 |
1329 |
" * [cache.h] WS_Inside added\n" |
| 899 |
1329 |
" * [cache.h] WS_Assert_Allocated added\n" |
| 900 |
1329 |
" * 5.0:\n" |
| 901 |
1329 |
" * Varnish 5.0 release \"better safe than sorry\" bump\n" |
| 902 |
1329 |
" * 4.0:\n" |
| 903 |
1329 |
" * VCL_BYTES changed to long long\n" |
| 904 |
1329 |
" * VRT_CacheReqBody changed signature\n" |
| 905 |
1329 |
" * 3.2:\n" |
| 906 |
1329 |
" * vrt_backend grew .proxy_header field\n" |
| 907 |
1329 |
" * vrt_ctx grew .sp field.\n" |
| 908 |
1329 |
" * vrt_acl type added\n" |
| 909 |
1329 |
" */\n" |
| 910 |
1329 |
"\n" |
| 911 |
1329 |
"/***********************************************************************/\n" |
| 912 |
1329 |
"\n" |
| 913 |
1329 |
"#include <stddef.h> // NULL, size_t\n" |
| 914 |
1329 |
"#include <stdint.h> // [u]int%d_t\n" |
| 915 |
1329 |
"\n" |
| 916 |
1329 |
"struct busyobj;\n" |
| 917 |
1329 |
"struct director;\n" |
| 918 |
1329 |
"struct http;\n" |
| 919 |
1329 |
"struct lock;\n" |
| 920 |
1329 |
"struct req;\n" |
| 921 |
1329 |
"struct stevedore;\n" |
| 922 |
1329 |
"struct stream_close;\n" |
| 923 |
1329 |
"struct suckaddr;\n" |
| 924 |
1329 |
"struct vcl;\n" |
| 925 |
1329 |
"struct vcldir;\n" |
| 926 |
1329 |
"struct vcl_sub;\n" |
| 927 |
1329 |
"struct vmod;\n" |
| 928 |
1329 |
"struct vmod_priv;\n" |
| 929 |
1329 |
"struct vrt_acl;\n" |
| 930 |
1329 |
"struct vsb;\n" |
| 931 |
1329 |
"struct vsc_seg;\n" |
| 932 |
1329 |
"struct vsl_log;\n" |
| 933 |
1329 |
"struct vsmw_cluster;\n" |
| 934 |
1329 |
"struct wrk_vpi;\n" |
| 935 |
1329 |
"struct ws;\n" |
| 936 |
1329 |
"\n" |
| 937 |
1329 |
"typedef const struct stream_close *stream_close_t;\n" |
| 938 |
1329 |
"\n" |
| 939 |
1329 |
"/***********************************************************************\n" |
| 940 |
1329 |
" * VCL_STRANDS:\n" |
| 941 |
1329 |
" *\n" |
| 942 |
1329 |
" * An argc+argv type of data structure where n indicates the number of\n" |
| 943 |
1329 |
" * strings in the p array. Individual components of a strands may be null.\n" |
| 944 |
1329 |
" *\n" |
| 945 |
1329 |
" * A STRANDS allows you to work on a strings concatenation with the\n" |
| 946 |
1329 |
" * option to collect it into a single STRING, or if possible work\n" |
| 947 |
1329 |
" * directly on individual parts.\n" |
| 948 |
1329 |
" *\n" |
| 949 |
1329 |
" * The memory management is very strict: a VMOD function receiving a\n" |
| 950 |
1329 |
" * STRANDS argument should keep no reference after the function returns.\n" |
| 951 |
1329 |
" * Retention of a STRANDS further in the ongoing task is undefined\n" |
| 952 |
1329 |
" * behavior and may result in a panic or data corruption.\n" |
| 953 |
1329 |
" */\n" |
| 954 |
1329 |
"\n" |
| 955 |
1329 |
"struct strands {\n" |
| 956 |
1329 |
" unsigned magic;\n" |
| 957 |
1329 |
"#define STRANDS_MAGIC 0x5d5ab196\n" |
| 958 |
1329 |
" int n;\n" |
| 959 |
1329 |
" const char **p;\n" |
| 960 |
1329 |
"};\n" |
| 961 |
1329 |
"\n" |
| 962 |
1329 |
"/*\n" |
| 963 |
1329 |
" * A VCL_STRANDS return value must never be NULL. Use this instead\n" |
| 964 |
1329 |
" */\n" |
| 965 |
1329 |
"extern const struct strands *const vrt_null_strands;\n" |
| 966 |
1329 |
"\n" |
| 967 |
1329 |
"/*\n" |
| 968 |
1329 |
" * Macros for VCL_STRANDS creation\n" |
| 969 |
1329 |
" */\n" |
| 970 |
1329 |
"#define TOSTRAND(s)(&(struct strands) \\\n" |
| 971 |
1329 |
" {.magic=STRANDS_MAGIC,.n=1,.p=(const char *[1]){(s)}})\n" |
| 972 |
1329 |
"#define TOSTRANDS(x, ...)(&(struct strands) \\\n" |
| 973 |
1329 |
" {.magic=STRANDS_MAGIC,.n=x,.p=(const char *[x]){__VA_ARGS__}})\n" |
| 974 |
1329 |
"\n" |
| 975 |
1329 |
"/*\n" |
| 976 |
1329 |
" * Macros for VCL_STRANDS use\n" |
| 977 |
1329 |
" */\n" |
| 978 |
1329 |
"\n" |
| 979 |
1329 |
"//lint -emacro(506, _strands_foreach) constant value boolean\n" |
| 980 |
1329 |
"#define _strands_foreach(var, s, iter, end) \\\n" |
| 981 |
1329 |
" for (const char * const *iter = (s)->p, \\\n" |
| 982 |
1329 |
" * const *end = iter + (s)->n, \\\n" |
| 983 |
1329 |
" *var = NULL; \\\n" |
| 984 |
1329 |
" iter < end && (var = *iter, 1); \\\n" |
| 985 |
1329 |
" iter++)\n" |
| 986 |
1329 |
"\n" |
| 987 |
1329 |
"#define STRANDS_FOREACH(var, s) \\\n" |
| 988 |
1329 |
" _strands_foreach(var, s, \\\n" |
| 989 |
1329 |
" VUNIQ_NAME(_v_ ## var ## _iter), \\\n" |
| 990 |
1329 |
" VUNIQ_NAME(_v_ ## var ## _end))\n" |
| 991 |
1329 |
"\n" |
| 992 |
1329 |
"/***********************************************************************\n" |
| 993 |
1329 |
" * VCL_BLOB:\n" |
| 994 |
1329 |
" *\n" |
| 995 |
1329 |
" * Opaque, immutable data (pointer + length), minimum lifetime is the\n" |
| 996 |
1329 |
" * VCL task.\n" |
| 997 |
1329 |
" *\n" |
| 998 |
1329 |
" * Type (optional) is owned by the creator of the blob. blob consumers\n" |
| 999 |
1329 |
" * may use it for checks, but should not assert on it.\n" |
| 1000 |
1329 |
" *\n" |
| 1001 |
1329 |
" * The data behind the blob pointer is assumed to be immutable for the\n" |
| 1002 |
1329 |
" * blob's lifetime.\n" |
| 1003 |
1329 |
" *\n" |
| 1004 |
1329 |
" * - memory for shortlived blobs can be put on the tasks workspace\n" |
| 1005 |
1329 |
" *\n" |
| 1006 |
1329 |
" * - management of memory for longer lived blobs is up to the vmod\n" |
| 1007 |
1329 |
" * (in which case the blob will probably be embedded in an object or\n" |
| 1008 |
1329 |
" * referenced by other state with vcl lifetime)\n" |
| 1009 |
1329 |
" */\n" |
| 1010 |
1329 |
"\n" |
| 1011 |
1329 |
"struct vrt_blob {\n" |
| 1012 |
1329 |
" unsigned magic;\n" |
| 1013 |
1329 |
"#define VRT_BLOB_MAGIC 0xe114db9e\n" |
| 1014 |
1329 |
" unsigned type;\n" |
| 1015 |
1329 |
" size_t len;\n" |
| 1016 |
1329 |
" const void *blob;\n" |
| 1017 |
1329 |
"};\n" |
| 1018 |
1329 |
"\n" |
| 1019 |
1329 |
"#define VRT_NULL_BLOB_TYPE 0xfade4fa0\n" |
| 1020 |
1329 |
"extern const struct vrt_blob *const vrt_null_blob;\n" |
| 1021 |
1329 |
"\n" |
| 1022 |
1329 |
"/***********************************************************************\n" |
| 1023 |
1329 |
" * This is the central definition of the mapping from VCL types to\n" |
| 1024 |
1329 |
" * C-types. The python scripts read these from here.\n" |
| 1025 |
1329 |
" * (keep alphabetic order)\n" |
| 1026 |
1329 |
" */\n" |
| 1027 |
1329 |
"\n" |
| 1028 |
1329 |
"typedef const struct vrt_acl * VCL_ACL;\n" |
| 1029 |
1329 |
"typedef const struct director * VCL_BACKEND;\n" |
| 1030 |
1329 |
"typedef const struct vrt_blob * VCL_BLOB;\n" |
| 1031 |
1329 |
"typedef const void * VCL_BODY;\n" |
| 1032 |
1329 |
"typedef unsigned VCL_BOOL;\n" |
| 1033 |
1329 |
"typedef int64_t VCL_BYTES;\n" |
| 1034 |
1329 |
"typedef vtim_dur VCL_DURATION;\n" |
| 1035 |
1329 |
"typedef const char * VCL_ENUM;\n" |
| 1036 |
1329 |
"typedef const struct gethdr_s * VCL_HEADER;\n" |
| 1037 |
1329 |
"typedef struct http * VCL_HTTP;\n" |
| 1038 |
1329 |
"typedef void VCL_INSTANCE;\n" |
| 1039 |
1329 |
"typedef int64_t VCL_INT;\n" |
| 1040 |
1329 |
"typedef const struct suckaddr * VCL_IP;\n" |
| 1041 |
1329 |
"typedef const struct vrt_backend_probe * VCL_PROBE;\n" |
| 1042 |
1329 |
"typedef double VCL_REAL;\n" |
| 1043 |
1329 |
"typedef const struct vre * VCL_REGEX;\n" |
| 1044 |
1329 |
"typedef const struct stevedore * VCL_STEVEDORE;\n" |
| 1045 |
1329 |
"typedef const struct strands * VCL_STRANDS;\n" |
| 1046 |
1329 |
"typedef const char * VCL_STRING;\n" |
| 1047 |
1329 |
"typedef const struct vcl_sub * VCL_SUB;\n" |
| 1048 |
1329 |
"typedef vtim_real VCL_TIME;\n" |
| 1049 |
1329 |
"typedef struct vcl * VCL_VCL;\n" |
| 1050 |
1329 |
"typedef void VCL_VOID;\n" |
| 1051 |
1329 |
"\n" |
| 1052 |
1329 |
"/***********************************************************************\n" |
| 1053 |
1329 |
" * This is the composite \"context\" argument for compiled VCL, VRT and\n" |
| 1054 |
1329 |
" * VMOD functions.\n" |
| 1055 |
1329 |
" */\n" |
| 1056 |
1329 |
"\n" |
| 1057 |
1329 |
"struct vrt_ctx {\n" |
| 1058 |
1329 |
" unsigned magic;\n" |
| 1059 |
1329 |
"#define VRT_CTX_MAGIC 0x6bb8f0db\n" |
| 1060 |
1329 |
"\n" |
| 1061 |
1329 |
" unsigned syntax;\n" |
| 1062 |
1329 |
" unsigned vclver;\n" |
| 1063 |
1329 |
" unsigned method;\n" |
| 1064 |
1329 |
"\n" |
| 1065 |
1329 |
" struct wrk_vpi *vpi;\n" |
| 1066 |
1329 |
"\n" |
| 1067 |
1329 |
" /*\n" |
| 1068 |
1329 |
" * msg is for error messages and exists only for\n" |
| 1069 |
1329 |
" * VCL_EVENT_LOAD\n" |
| 1070 |
1329 |
" * VCL_EVENT_WARM\n" |
| 1071 |
1329 |
" */\n" |
| 1072 |
1329 |
" struct vsb *msg;\n" |
| 1073 |
1329 |
" struct vsl_log *vsl;\n" |
| 1074 |
1329 |
" VCL_VCL vcl;\n" |
| 1075 |
1329 |
" struct ws *ws;\n" |
| 1076 |
1329 |
"\n" |
| 1077 |
1329 |
" struct sess *sp;\n" |
| 1078 |
1329 |
"\n" |
| 1079 |
1329 |
" struct req *req;\n" |
| 1080 |
1329 |
" VCL_HTTP http_req;\n" |
| 1081 |
1329 |
" VCL_HTTP http_req0;\n" |
| 1082 |
1329 |
" VCL_HTTP http_req_top;\n" |
| 1083 |
1329 |
" VCL_HTTP http_resp;\n" |
| 1084 |
1329 |
"\n" |
| 1085 |
1329 |
" struct busyobj *bo;\n" |
| 1086 |
1329 |
" VCL_HTTP http_bereq;\n" |
| 1087 |
1329 |
" VCL_HTTP http_beresp;\n" |
| 1088 |
1329 |
"\n" |
| 1089 |
1329 |
" vtim_real now;\n" |
| 1090 |
1329 |
"\n" |
| 1091 |
1329 |
" /*\n" |
| 1092 |
1329 |
" * method specific argument:\n" |
| 1093 |
1329 |
" * hash: struct VSHA256Context\n" |
| 1094 |
1329 |
" * error: struct vsb *\n" |
| 1095 |
1329 |
" * synth: ssize_t *\n" |
| 1096 |
1329 |
" */\n" |
| 1097 |
1329 |
" void *specific;\n" |
| 1098 |
1329 |
" /* if present, vbitmap of called subs */\n" |
| 1099 |
1329 |
" void *called;\n" |
| 1100 |
1329 |
"};\n" |
| 1101 |
1329 |
"\n" |
| 1102 |
1329 |
"#define VRT_CTX const struct vrt_ctx *ctx\n" |
| 1103 |
1329 |
"void VRT_CTX_Assert(VRT_CTX);\n" |
| 1104 |
1329 |
"\n" |
| 1105 |
1329 |
"enum vcl_func_call_e {\n" |
| 1106 |
1329 |
" VSUB_STATIC, // VCL \"call\" action, only allowed from VCC\n" |
| 1107 |
1329 |
" VSUB_DYNAMIC, // VRT_call()\n" |
| 1108 |
1329 |
" VSUB_CHECK // VRT_check_call()\n" |
| 1109 |
1329 |
"};\n" |
| 1110 |
1329 |
"\n" |
| 1111 |
1329 |
"enum vcl_func_fail_e {\n" |
| 1112 |
1329 |
" VSUB_E_OK,\n" |
| 1113 |
1329 |
" VSUB_E_RECURSE, // call would recurse\n" |
| 1114 |
1329 |
" VSUB_E_METHOD // cannot be called from this method\n" |
| 1115 |
1329 |
"};\n" |
| 1116 |
1329 |
"\n" |
| 1117 |
1329 |
"typedef void vcl_func_f(VRT_CTX, enum vcl_func_call_e, enum vcl_func_fail_e *);\n" |
| 1118 |
1329 |
"\n" |
| 1119 |
1329 |
"/***********************************************************************\n" |
| 1120 |
1329 |
" * Events sent to VMODs and directors:\n" |
| 1121 |
1329 |
" * - VCL: VCL temperature events\n" |
| 1122 |
1329 |
" * - VDI: director events\n" |
| 1123 |
1329 |
" */\n" |
| 1124 |
1329 |
"\n" |
| 1125 |
1329 |
"enum vcl_event_e {\n" |
| 1126 |
1329 |
" VCL_EVENT_LOAD,\n" |
| 1127 |
1329 |
" VCL_EVENT_WARM,\n" |
| 1128 |
1329 |
" VCL_EVENT_COLD,\n" |
| 1129 |
1329 |
" VCL_EVENT_DISCARD,\n" |
| 1130 |
1329 |
"\n" |
| 1131 |
1329 |
" VDI_EVENT_SICK\n" |
| 1132 |
1329 |
"};\n" |
| 1133 |
1329 |
"\n" |
| 1134 |
1329 |
"typedef int vmod_event_f(VRT_CTX, struct vmod_priv *, enum vcl_event_e);\n" |
| 1135 |
1329 |
"\n" |
| 1136 |
1329 |
"/***********************************************************************\n" |
| 1137 |
1329 |
" * Utility functions operating on VCL_types\n" |
| 1138 |
1329 |
" * (alphabetic by type-ish)\n" |
| 1139 |
1329 |
" */\n" |
| 1140 |
1329 |
"\n" |
| 1141 |
1329 |
"/* VCL_ACL */\n" |
| 1142 |
1329 |
"int VRT_acl_match(VRT_CTX, VCL_ACL, VCL_IP);\n" |
| 1143 |
1329 |
"\n" |
| 1144 |
1329 |
"/* VCL_BACKEND */\n" |
| 1145 |
1329 |
"VCL_BACKEND VRT_DirectorResolve(VRT_CTX, VCL_BACKEND);\n" |
| 1146 |
1329 |
"\n" |
| 1147 |
1329 |
"/* VCL_BLOB */\n" |
| 1148 |
1329 |
"VCL_BLOB VRT_blob(VRT_CTX, const char *, const void *, size_t, unsigned);\n" |
| 1149 |
1329 |
"\n" |
| 1150 |
1329 |
"/* VCL_INT */\n" |
| 1151 |
1329 |
"int VRT_INT_is_valid(VCL_INT);\n" |
| 1152 |
1329 |
"\n" |
| 1153 |
1329 |
"/* VCL_IP */\n" |
| 1154 |
1329 |
"int VRT_VSA_GetPtr(VRT_CTX, VCL_IP sua, const unsigned char ** dst);\n" |
| 1155 |
1329 |
"VCL_BOOL VRT_ipcmp(VRT_CTX, VCL_IP, VCL_IP);\n" |
| 1156 |
1329 |
"void VRT_Format_Proxy(struct vsb *, VCL_INT, VCL_IP, VCL_IP, VCL_STRING);\n" |
| 1157 |
1329 |
"\n" |
| 1158 |
1329 |
"/* VCL_REAL */\n" |
| 1159 |
1329 |
"int VRT_REAL_is_valid(VCL_REAL);\n" |
| 1160 |
1329 |
"\n" |
| 1161 |
1329 |
"/* VCL_REGEX */\n" |
| 1162 |
1329 |
"VCL_BOOL VRT_re_match(VRT_CTX, VCL_STRING, VCL_REGEX);\n" |
| 1163 |
1329 |
"VCL_STRING VRT_regsub(VRT_CTX, int all, VCL_STRING, VCL_REGEX, VCL_STRING);\n" |
| 1164 |
1329 |
"\n" |
| 1165 |
1329 |
"/* VCL_STEVEDORE */\n" |
| 1166 |
1329 |
"VCL_STEVEDORE VRT_stevedore(const char *nm);\n" |
| 1167 |
1329 |
"\n" |
| 1168 |
1329 |
"/* VCL_STRANDS */\n" |
| 1169 |
1329 |
"struct strands * VRT_AllocStrandsWS(struct ws *, int);\n" |
| 1170 |
1329 |
"int VRT_CompareStrands(VCL_STRANDS a, VCL_STRANDS b);\n" |
| 1171 |
1329 |
"VCL_BOOL VRT_Strands2Bool(VCL_STRANDS);\n" |
| 1172 |
1329 |
"uint32_t VRT_HashStrands32(VCL_STRANDS);\n" |
| 1173 |
1329 |
"char *VRT_Strands(char *, size_t, VCL_STRANDS);\n" |
| 1174 |
1329 |
"VCL_STRING VRT_StrandsWS(struct ws *, const char *, VCL_STRANDS);\n" |
| 1175 |
1329 |
"VCL_STRING VRT_UpperLowerStrands(VRT_CTX, VCL_STRANDS s, int up);\n" |
| 1176 |
1329 |
"\n" |
| 1177 |
1329 |
"/* VCL_SUB */\n" |
| 1178 |
1329 |
"VCL_STRING VRT_check_call(VRT_CTX, VCL_SUB);\n" |
| 1179 |
1329 |
"VCL_VOID VRT_call(VRT"); |
| 1180 |
1329 |
VSB_cat(sb, |
| 1181 |
1329 |
"_CTX, VCL_SUB);\n" |
| 1182 |
1329 |
"\n" |
| 1183 |
1329 |
"/* Functions to turn types into canonical strings */\n" |
| 1184 |
1329 |
"\n" |
| 1185 |
1329 |
"VCL_STRING VRT_BACKEND_string(VCL_BACKEND);\n" |
| 1186 |
1329 |
"VCL_STRING VRT_BOOL_string(VCL_BOOL);\n" |
| 1187 |
1329 |
"VCL_STRING VRT_BLOB_string(VRT_CTX, VCL_BLOB);\n" |
| 1188 |
1329 |
"VCL_STRING VRT_INT_string(VRT_CTX, VCL_INT);\n" |
| 1189 |
1329 |
"VCL_STRING VRT_IP_string(VRT_CTX, VCL_IP);\n" |
| 1190 |
1329 |
"VCL_STRING VRT_PROBE_string(VCL_PROBE);\n" |
| 1191 |
1329 |
"VCL_STRING VRT_REAL_string(VRT_CTX, VCL_REAL);\n" |
| 1192 |
1329 |
"VCL_STRING VRT_STEVEDORE_string(VCL_STEVEDORE);\n" |
| 1193 |
1329 |
"VCL_STRING VRT_STRANDS_string(VRT_CTX, VCL_STRANDS);\n" |
| 1194 |
1329 |
"VCL_STRING VRT_TIME_string(VRT_CTX, VCL_TIME);\n" |
| 1195 |
1329 |
"\n" |
| 1196 |
1329 |
"/* historical */\n" |
| 1197 |
1329 |
"int VRT_strcmp(const char *s1, const char *s2);\n" |
| 1198 |
1329 |
"void VRT_memmove(void *dst, const void *src, unsigned len);\n" |
| 1199 |
1329 |
"\n" |
| 1200 |
1329 |
"/***********************************************************************\n" |
| 1201 |
1329 |
" * We want the VCC to spit this structs out as const, but when VMODs\n" |
| 1202 |
1329 |
" * come up with them we want to clone them into malloc'ed space which\n" |
| 1203 |
1329 |
" * we can free again.\n" |
| 1204 |
1329 |
" * We collect all the knowledge here by macroizing the fields and make\n" |
| 1205 |
1329 |
" * a macro for handling them all.\n" |
| 1206 |
1329 |
" * See also: cache_backend.h & cache_backend_cfg.c\n" |
| 1207 |
1329 |
" * One of those things...\n" |
| 1208 |
1329 |
" */\n" |
| 1209 |
1329 |
"\n" |
| 1210 |
1329 |
"struct vrt_endpoint {\n" |
| 1211 |
1329 |
" unsigned magic;\n" |
| 1212 |
1329 |
"#define VRT_ENDPOINT_MAGIC 0xcc419347\n" |
| 1213 |
1329 |
" VCL_IP ipv4;\n" |
| 1214 |
1329 |
" VCL_IP ipv6;\n" |
| 1215 |
1329 |
" const char *uds_path;\n" |
| 1216 |
1329 |
" const struct vrt_blob *preamble;\n" |
| 1217 |
1329 |
"};\n" |
| 1218 |
1329 |
"\n" |
| 1219 |
1329 |
"#define VRT_BACKEND_FIELDS(rigid) \\\n" |
| 1220 |
1329 |
" rigid char *vcl_name; \\\n" |
| 1221 |
1329 |
" rigid char *hosthdr; \\\n" |
| 1222 |
1329 |
" rigid char *authority; \\\n" |
| 1223 |
1329 |
" vtim_dur connect_timeout; \\\n" |
| 1224 |
1329 |
" vtim_dur first_byte_timeout; \\\n" |
| 1225 |
1329 |
" vtim_dur between_bytes_timeout; \\\n" |
| 1226 |
1329 |
" vtim_dur backend_wait_timeout; \\\n" |
| 1227 |
1329 |
" unsigned max_connections; \\\n" |
| 1228 |
1329 |
" unsigned proxy_header; \\\n" |
| 1229 |
1329 |
" unsigned backend_wait_limit;\n" |
| 1230 |
1329 |
"\n" |
| 1231 |
1329 |
"#define VRT_BACKEND_INIT(be) \\\n" |
| 1232 |
1329 |
" do { \\\n" |
| 1233 |
1329 |
" INIT_OBJ(be, VRT_BACKEND_MAGIC); \\\n" |
| 1234 |
1329 |
" (be)->connect_timeout = -1.0; \\\n" |
| 1235 |
1329 |
" (be)->first_byte_timeout = -1.0; \\\n" |
| 1236 |
1329 |
" (be)->between_bytes_timeout = -1.0; \\\n" |
| 1237 |
1329 |
" (be)->backend_wait_timeout = -1.0; \\\n" |
| 1238 |
1329 |
" } while(0)\n" |
| 1239 |
1329 |
"\n" |
| 1240 |
1329 |
"#define VRT_BACKEND_HANDLE() \\\n" |
| 1241 |
1329 |
" do { \\\n" |
| 1242 |
1329 |
" DA(vcl_name); \\\n" |
| 1243 |
1329 |
" DA(hosthdr); \\\n" |
| 1244 |
1329 |
" DA(authority); \\\n" |
| 1245 |
1329 |
" DN(connect_timeout); \\\n" |
| 1246 |
1329 |
" DN(first_byte_timeout); \\\n" |
| 1247 |
1329 |
" DN(between_bytes_timeout); \\\n" |
| 1248 |
1329 |
" DN(backend_wait_timeout); \\\n" |
| 1249 |
1329 |
" DN(max_connections); \\\n" |
| 1250 |
1329 |
" DN(proxy_header); \\\n" |
| 1251 |
1329 |
" DN(backend_wait_limit); \\\n" |
| 1252 |
1329 |
" } while(0)\n" |
| 1253 |
1329 |
"\n" |
| 1254 |
1329 |
"struct vrt_backend {\n" |
| 1255 |
1329 |
" unsigned magic;\n" |
| 1256 |
1329 |
"#define VRT_BACKEND_MAGIC 0x4799ce6c\n" |
| 1257 |
1329 |
" const struct vrt_endpoint *endpoint;\n" |
| 1258 |
1329 |
" VRT_BACKEND_FIELDS(const)\n" |
| 1259 |
1329 |
" VCL_PROBE probe;\n" |
| 1260 |
1329 |
"};\n" |
| 1261 |
1329 |
"\n" |
| 1262 |
1329 |
"#define VRT_BACKEND_PROBE_FIELDS(rigid) \\\n" |
| 1263 |
1329 |
" vtim_dur timeout; \\\n" |
| 1264 |
1329 |
" vtim_dur interval; \\\n" |
| 1265 |
1329 |
" unsigned exp_status; \\\n" |
| 1266 |
1329 |
" unsigned window; \\\n" |
| 1267 |
1329 |
" unsigned threshold; \\\n" |
| 1268 |
1329 |
" unsigned initial; \\\n" |
| 1269 |
1329 |
" unsigned exp_close;\n" |
| 1270 |
1329 |
"\n" |
| 1271 |
1329 |
"#define VRT_BACKEND_PROBE_HANDLE() \\\n" |
| 1272 |
1329 |
" do { \\\n" |
| 1273 |
1329 |
" DN(timeout); \\\n" |
| 1274 |
1329 |
" DN(interval); \\\n" |
| 1275 |
1329 |
" DN(exp_status); \\\n" |
| 1276 |
1329 |
" DN(window); \\\n" |
| 1277 |
1329 |
" DN(threshold); \\\n" |
| 1278 |
1329 |
" DN(initial); \\\n" |
| 1279 |
1329 |
" DN(exp_close); \\\n" |
| 1280 |
1329 |
" } while (0)\n" |
| 1281 |
1329 |
"\n" |
| 1282 |
1329 |
"struct vrt_backend_probe {\n" |
| 1283 |
1329 |
" unsigned magic;\n" |
| 1284 |
1329 |
"#define VRT_BACKEND_PROBE_MAGIC 0x84998490\n" |
| 1285 |
1329 |
" const char *url;\n" |
| 1286 |
1329 |
" const char *request;\n" |
| 1287 |
1329 |
" VRT_BACKEND_PROBE_FIELDS(const)\n" |
| 1288 |
1329 |
" const char *vcl_name;\n" |
| 1289 |
1329 |
"};\n" |
| 1290 |
1329 |
"\n" |
| 1291 |
1329 |
"/* Backend related */\n" |
| 1292 |
1329 |
"VCL_BACKEND VRT_new_backend(VRT_CTX, const struct vrt_backend *, VCL_BACKEND);\n" |
| 1293 |
1329 |
"VCL_BACKEND VRT_new_backend_clustered(VRT_CTX,\n" |
| 1294 |
1329 |
" struct vsmw_cluster *, const struct vrt_backend *, VCL_BACKEND);\n" |
| 1295 |
1329 |
"size_t VRT_backend_vsm_need(VRT_CTX);\n" |
| 1296 |
1329 |
"void VRT_delete_backend(VRT_CTX, VCL_BACKEND *);\n" |
| 1297 |
1329 |
"struct vrt_endpoint *VRT_Endpoint_Clone(const struct vrt_endpoint *vep);\n" |
| 1298 |
1329 |
"\n" |
| 1299 |
1329 |
"\n" |
| 1300 |
1329 |
"/***********************************************************************\n" |
| 1301 |
1329 |
" * Getting hold of the various struct http\n" |
| 1302 |
1329 |
" */\n" |
| 1303 |
1329 |
"\n" |
| 1304 |
1329 |
"enum gethdr_e {\n" |
| 1305 |
1329 |
" HDR_REQ,\n" |
| 1306 |
1329 |
" HDR_REQ0,\n" |
| 1307 |
1329 |
" HDR_REQ_TOP,\n" |
| 1308 |
1329 |
" HDR_RESP,\n" |
| 1309 |
1329 |
" HDR_OBJ,\n" |
| 1310 |
1329 |
" HDR_BEREQ,\n" |
| 1311 |
1329 |
" HDR_BERESP,\n" |
| 1312 |
1329 |
" HDR_OBJ_STALE\n" |
| 1313 |
1329 |
"};\n" |
| 1314 |
1329 |
"\n" |
| 1315 |
1329 |
"typedef const struct {\n" |
| 1316 |
1329 |
" unsigned char len;\n" |
| 1317 |
1329 |
" const char str[];\n" |
| 1318 |
1329 |
"} *hdr_t;\n" |
| 1319 |
1329 |
"\n" |
| 1320 |
1329 |
"//lint -esym(754, _hdr_s, _hdr_l) local struct member ... not referenced\n" |
| 1321 |
1329 |
"//lint -emacro(740, HDR) unusual cast\n" |
| 1322 |
1329 |
"#define HDR(name) \\\n" |
| 1323 |
1329 |
" ((hdr_t)&(const struct { \\\n" |
| 1324 |
1329 |
" unsigned char _hdr_l; \\\n" |
| 1325 |
1329 |
" char _hdr_s[sizeof(name \":\")]; \\\n" |
| 1326 |
1329 |
" }){ sizeof(name), name \":\" })\n" |
| 1327 |
1329 |
"\n" |
| 1328 |
1329 |
"#define CHECK_HDR(hdr) \\\n" |
| 1329 |
1329 |
" do { \\\n" |
| 1330 |
1329 |
" AN(hdr); \\\n" |
| 1331 |
1329 |
" assert((hdr)->len > 0); \\\n" |
| 1332 |
1329 |
" assert((hdr)->len == vstrlen((hdr)->str)); \\\n" |
| 1333 |
1329 |
" assert((hdr)->str[(hdr)->len - 1] == ':'); \\\n" |
| 1334 |
1329 |
" } while (0)\n" |
| 1335 |
1329 |
"\n" |
| 1336 |
1329 |
"#define CAST_HDR(hdr, str) \\\n" |
| 1337 |
1329 |
" do { \\\n" |
| 1338 |
1329 |
" hdr = (hdr_t)(str); \\\n" |
| 1339 |
1329 |
" CHECK_HDR(hdr); \\\n" |
| 1340 |
1329 |
" } while (0)\n" |
| 1341 |
1329 |
"\n" |
| 1342 |
1329 |
"struct gethdr_s {\n" |
| 1343 |
1329 |
" enum gethdr_e where;\n" |
| 1344 |
1329 |
" hdr_t what;\n" |
| 1345 |
1329 |
"};\n" |
| 1346 |
1329 |
"\n" |
| 1347 |
1329 |
"VCL_HTTP VRT_selecthttp(VRT_CTX, enum gethdr_e);\n" |
| 1348 |
1329 |
"VCL_STRING VRT_GetHdr(VRT_CTX, VCL_HEADER);\n" |
| 1349 |
1329 |
"\n" |
| 1350 |
1329 |
"/***********************************************************************\n" |
| 1351 |
1329 |
" * req related\n" |
| 1352 |
1329 |
" */\n" |
| 1353 |
1329 |
"\n" |
| 1354 |
1329 |
"enum lbody_e {\n" |
| 1355 |
1329 |
" LBODY_SET_STRING,\n" |
| 1356 |
1329 |
" LBODY_ADD_STRING,\n" |
| 1357 |
1329 |
" LBODY_SET_BLOB,\n" |
| 1358 |
1329 |
" LBODY_ADD_BLOB\n" |
| 1359 |
1329 |
"};\n" |
| 1360 |
1329 |
"\n" |
| 1361 |
1329 |
"VCL_BYTES VRT_CacheReqBody(VRT_CTX, VCL_BYTES maxsize);\n" |
| 1362 |
1329 |
"\n" |
| 1363 |
1329 |
"VCL_STRING VRT_ban_string(VRT_CTX, VCL_STRING);\n" |
| 1364 |
1329 |
"VCL_INT VRT_purge(VRT_CTX, VCL_DURATION, VCL_DURATION, VCL_DURATION);\n" |
| 1365 |
1329 |
"VCL_VOID VRT_synth(VRT_CTX, VCL_INT, VCL_STRING);\n" |
| 1366 |
1329 |
"VCL_VOID VRT_hit_for_pass(VRT_CTX, VCL_DURATION);\n" |
| 1367 |
1329 |
"\n" |
| 1368 |
1329 |
"VCL_BOOL VRT_ValidHdr(VRT_CTX, VCL_STRANDS);\n" |
| 1369 |
1329 |
"VCL_VOID VRT_UnsetHdr(VRT_CTX, VCL_HEADER);\n" |
| 1370 |
1329 |
"VCL_VOID VRT_SetHdr(VRT_CTX, VCL_HEADER, const char *pfx, VCL_STRANDS);\n" |
| 1371 |
1329 |
"VCL_VOID VRT_handling(VRT_CTX, unsigned hand);\n" |
| 1372 |
1329 |
"unsigned VRT_handled(VRT_CTX);\n" |
| 1373 |
1329 |
"VCL_VOID VRT_trace(VRT_CTX, VCL_BOOL);\n" |
| 1374 |
1329 |
"VCL_VOID VRT_fail(VRT_CTX, const char *fmt, ...) v_printflike_(2,3) v_cold_;\n" |
| 1375 |
1329 |
"VCL_VOID VRT_hashdata(VRT_CTX, VCL_STRANDS);\n" |
| 1376 |
1329 |
"\n" |
| 1377 |
1329 |
"VCL_VOID VRT_Rollback(VRT_CTX);\n" |
| 1378 |
1329 |
"\n" |
| 1379 |
1329 |
"/***********************************************************************\n" |
| 1380 |
1329 |
" * VDI - Director API\n" |
| 1381 |
1329 |
" */\n" |
| 1382 |
1329 |
"typedef VCL_BOOL vdi_healthy_f(VRT_CTX, VCL_BACKEND, VCL_TIME *);\n" |
| 1383 |
1329 |
"typedef VCL_BACKEND vdi_resolve_f(VRT_CTX, VCL_BACKEND);\n" |
| 1384 |
1329 |
"typedef int vdi_gethdrs_f(VRT_CTX, VCL_BACKEND);\n" |
| 1385 |
1329 |
"typedef VCL_IP vdi_getip_f(VRT_CTX, VCL_BACKEND);\n" |
| 1386 |
1329 |
"typedef void vdi_finish_f(VRT_CTX, VCL_BACKEND);\n" |
| 1387 |
1329 |
"typedef stream_close_t vdi_http1pipe_f(VRT_CTX, VCL_BACKEND);\n" |
| 1388 |
1329 |
"typedef void vdi_event_f(VCL_BACKEND, enum vcl_event_e);\n" |
| 1389 |
1329 |
"typedef void vdi_release_f(VCL_BACKEND);\n" |
| 1390 |
1329 |
"typedef void vdi_destroy_f(VCL_BACKEND);\n" |
| 1391 |
1329 |
"typedef void vdi_panic_f(VCL_BACKEND, struct vsb *);\n" |
| 1392 |
1329 |
"typedef void vdi_list_f(VRT_CTX, VCL_BACKEND, struct vsb *, int, int);\n" |
| 1393 |
1329 |
"\n" |
| 1394 |
1329 |
"struct vdi_methods {\n" |
| 1395 |
1329 |
" unsigned magic;\n" |
| 1396 |
1329 |
"#define VDI_METHODS_MAGIC 0x4ec0c4bb\n" |
| 1397 |
1329 |
" const char *type;\n" |
| 1398 |
1329 |
" vdi_http1pipe_f *http1pipe;\n" |
| 1399 |
1329 |
" vdi_healthy_f *healthy;\n" |
| 1400 |
1329 |
" vdi_resolve_f *resolve;\n" |
| 1401 |
1329 |
" vdi_gethdrs_f *gethdrs;\n" |
| 1402 |
1329 |
" vdi_getip_f *getip;\n" |
| 1403 |
1329 |
" vdi_finish_f *finish;\n" |
| 1404 |
1329 |
" vdi_event_f *event;\n" |
| 1405 |
1329 |
" // called by VRT_DelDirector: deref all backends\n" |
| 1406 |
1329 |
" vdi_release_f *release;\n" |
| 1407 |
1329 |
" // when refcount goes 0\n" |
| 1408 |
1329 |
" vdi_destroy_f *destroy;\n" |
| 1409 |
1329 |
" vdi_panic_f *panic;\n" |
| 1410 |
1329 |
" vdi_list_f *list;\n" |
| 1411 |
1329 |
"};\n" |
| 1412 |
1329 |
"\n" |
| 1413 |
1329 |
"struct director {\n" |
| 1414 |
1329 |
" unsigned magic;\n" |
| 1415 |
1329 |
"#define DIRECTOR_MAGIC 0x3336351d\n" |
| 1416 |
1329 |
" void *priv;\n" |
| 1417 |
1329 |
" char *vcl_name;\n" |
| 1418 |
1329 |
" struct vcldir *vdir;\n" |
| 1419 |
1329 |
" struct lock *mtx;\n" |
| 1420 |
1329 |
"};\n" |
| 1421 |
1329 |
"\n" |
| 1422 |
1329 |
"VCL_BOOL VRT_Healthy(VRT_CTX, VCL_BACKEND, VCL_TIME *);\n" |
| 1423 |
1329 |
"VCL_VOID VRT_SetChanged(VCL_BACKEND, VCL_TIME);\n" |
| 1424 |
1329 |
"VCL_BACKEND VRT_AddDirector(VRT_CTX, const struct vdi_methods *,\n" |
| 1425 |
1329 |
" void *, const char *, ...) v_printflike_(4, 5);\n" |
| 1426 |
1329 |
"void VRT_DisableDirector(VCL_BACKEND);\n" |
| 1427 |
1329 |
"void VRT_StaticDirector(VCL_BACKEND);\n" |
| 1428 |
1329 |
"VCL_BACKEND VRT_LookupDirector(VRT_CTX, VCL_STRING);\n" |
| 1429 |
1329 |
"void VRT_DelDirector(VCL_BACKEND *);\n" |
| 1430 |
1329 |
"void VRT_Assign_Backend(VCL_BACKEND *dst, VCL_BACKEND src);\n" |
| 1431 |
1329 |
"\n" |
| 1432 |
1329 |
"/***********************************************************************\n" |
| 1433 |
1329 |
" * vmod_priv related\n" |
| 1434 |
1329 |
" */\n" |
| 1435 |
1329 |
"typedef void vmod_priv_fini_f(VRT_CTX, void *);\n" |
| 1436 |
1329 |
"\n" |
| 1437 |
1329 |
"struct vmod_priv_methods {\n" |
| 1438 |
1329 |
" unsigned magic;\n" |
| 1439 |
1329 |
"#define VMOD_PRIV_METHODS_MAGIC 0xcea5ff99\n" |
| 1440 |
1329 |
" const char *type;\n" |
| 1441 |
1329 |
" vmod_priv_fini_f *fini;\n" |
| 1442 |
1329 |
"};\n" |
| 1443 |
1329 |
"\n" |
| 1444 |
1329 |
"struct vmod_priv {\n" |
| 1445 |
1329 |
" void *priv;\n" |
| 1446 |
1329 |
" long len;\n" |
| 1447 |
1329 |
" const struct vmod_priv_methods *methods;\n" |
| 1448 |
1329 |
"};\n" |
| 1449 |
1329 |
"\n" |
| 1450 |
1329 |
"void VRT_priv_fini(VRT_CTX, const struct vmod_priv *p);\n" |
| 1451 |
1329 |
"struct vmod_priv *VRT_priv_task(VRT_CTX, const void *vmod_id);\n" |
| 1452 |
1329 |
"struct vmod_priv *VRT_priv_task_get(VRT_CTX, const void *vmod_id);\n" |
| 1453 |
1329 |
"struct vmod_priv *VRT_priv_top(VRT_CTX, const void *vmod_id);\n" |
| 1454 |
1329 |
"struct vmod_priv *VRT_priv_top_get(VRT_CTX, const void *vmod_id);\n" |
| 1455 |
1329 |
"\n" |
| 1456 |
1329 |
"/***********************************************************************\n" |
| 1457 |
1329 |
" * VSM and VSC\n" |
| 1458 |
1329 |
" */\n" |
| 1459 |
1329 |
"\n" |
| 1460 |
1329 |
"struct vsmw_cluster *VRT_VSM_Cluster_New(VRT_CTX, size_t);\n" |
| 1461 |
1329 |
"void VRT_VSM_Cluster_Destroy(VRT_CTX, struct vsmw_cluster **);\n" |
| 1462 |
1329 |
"\n" |
| 1463 |
1329 |
"#ifdef va_start // XXX: hackish\n" |
| 1464 |
1329 |
"void *VRT_VSC_Allocv(struct vsmw_cluster *, struct vsc_seg **,\n" |
| 1465 |
1329 |
" const char *, size_t, const unsigned char *, size_t, const char *, va_list);\n" |
| 1466 |
1329 |
"void *VRT_VSC_Alloc(struct vsmw_cluster *, struct vsc_seg **,\n" |
| 1467 |
1329 |
" const char *, size_t, const unsigned char *, size_t, const char *, ...);\n" |
| 1468 |
1329 |
"#endif\n" |
| 1469 |
1329 |
"void VRT_VSC_Destroy(const char *, struct vsc_seg *);\n" |
| 1470 |
1329 |
"void VRT_VSC_Hide(const struct vsc_seg *);\n" |
| 1471 |
1329 |
"void VRT_VSC_Reveal(const struct vsc_seg *);\n" |
| 1472 |
1329 |
"size_t VRT_VSC_Overhead(size_t);\n" |
| 1473 |
1329 |
"\n" |
| 1474 |
1329 |
"/***********************************************************************\n" |
| 1475 |
1329 |
" * API to restrict the VCL in various ways\n" |
| 1476 |
1329 |
" */\n" |
| 1477 |
1329 |
"\n" |
| 1478 |
1329 |
"struct vclref;\n" |
| 1479 |
1329 |
"struct vclref * VRT_VCL_Prevent_Cold(VRT_CTX, const char *);\n" |
| 1480 |
1329 |
"void VRT_VCL_Allow_Cold(struct vclref **);\n" |
| 1481 |
1329 |
"\n" |
| 1482 |
1329 |
"struct vclref * VRT_VCL_Prevent_Discard(VRT_CTX, const char *);\n" |
| 1483 |
1329 |
"void VRT_VCL_Allow_Discard(struct vclref **);\n" |
| 1484 |
1329 |
); |
| 1485 |
1329 |
VSB_cat(sb, "\n"); |
| 1486 |
|
|
| 1487 |
|
/* ../include/vcl.h */ |
| 1488 |
|
|
| 1489 |
1329 |
VSB_cat(sb, "/* ---===### include/vcl.h ###===--- */\n\n"); |
| 1490 |
1329 |
VSB_cat(sb, |
| 1491 |
1329 |
"/*\n" |
| 1492 |
1329 |
" * NB: This file is machine generated, DO NOT EDIT!\n" |
| 1493 |
1329 |
" *\n" |
| 1494 |
1329 |
" * Edit and run lib/libvcc/generate.py instead.\n" |
| 1495 |
1329 |
" */\n" |
| 1496 |
1329 |
"\n" |
| 1497 |
1329 |
"#ifdef VCL_H_INCLUDED\n" |
| 1498 |
1329 |
"# error \"vcl.h included multiple times\"\n" |
| 1499 |
1329 |
"#endif\n" |
| 1500 |
1329 |
"#define VCL_H_INCLUDED\n" |
| 1501 |
1329 |
"\n" |
| 1502 |
1329 |
"#ifndef VRT_H_INCLUDED\n" |
| 1503 |
1329 |
"# error \"include vrt.h before vcl.h\"\n" |
| 1504 |
1329 |
"#endif\n" |
| 1505 |
1329 |
"\n" |
| 1506 |
1329 |
"/* VCL Methods */\n" |
| 1507 |
1329 |
"#define VCL_MET_RECV (1U << 1)\n" |
| 1508 |
1329 |
"#define VCL_MET_PIPE (1U << 2)\n" |
| 1509 |
1329 |
"#define VCL_MET_PASS (1U << 3)\n" |
| 1510 |
1329 |
"#define VCL_MET_HASH (1U << 4)\n" |
| 1511 |
1329 |
"#define VCL_MET_PURGE (1U << 5)\n" |
| 1512 |
1329 |
"#define VCL_MET_MISS (1U << 6)\n" |
| 1513 |
1329 |
"#define VCL_MET_HIT (1U << 7)\n" |
| 1514 |
1329 |
"#define VCL_MET_DELIVER (1U << 8)\n" |
| 1515 |
1329 |
"#define VCL_MET_SYNTH (1U << 9)\n" |
| 1516 |
1329 |
"#define VCL_MET_BACKEND_FETCH (1U << 10)\n" |
| 1517 |
1329 |
"#define VCL_MET_BACKEND_REFRESH (1U << 11)\n" |
| 1518 |
1329 |
"#define VCL_MET_BACKEND_RESPONSE (1U << 12)\n" |
| 1519 |
1329 |
"#define VCL_MET_BACKEND_ERROR (1U << 13)\n" |
| 1520 |
1329 |
"#define VCL_MET_INIT (1U << 14)\n" |
| 1521 |
1329 |
"#define VCL_MET_FINI (1U << 15)\n" |
| 1522 |
1329 |
"\n" |
| 1523 |
1329 |
"#define VCL_MET_MAX 16\n" |
| 1524 |
1329 |
"\n" |
| 1525 |
1329 |
"#define VCL_MET_MASK 0xffff\n" |
| 1526 |
1329 |
"\n" |
| 1527 |
1329 |
"#define VCL_MET_TASK_B ( VCL_MET_BACKEND_FETCH | \\\n" |
| 1528 |
1329 |
" VCL_MET_BACKEND_REFRESH | \\\n" |
| 1529 |
1329 |
" VCL_MET_BACKEND_RESPONSE | \\\n" |
| 1530 |
1329 |
" VCL_MET_BACKEND_ERROR )\n" |
| 1531 |
1329 |
"#define VCL_MET_TASK_C ( VCL_MET_RECV | \\\n" |
| 1532 |
1329 |
" VCL_MET_PIPE | \\\n" |
| 1533 |
1329 |
" VCL_MET_PASS | \\\n" |
| 1534 |
1329 |
" VCL_MET_HASH | \\\n" |
| 1535 |
1329 |
" VCL_MET_PURGE | \\\n" |
| 1536 |
1329 |
" VCL_MET_MISS | \\\n" |
| 1537 |
1329 |
" VCL_MET_HIT | \\\n" |
| 1538 |
1329 |
" VCL_MET_DELIVER | \\\n" |
| 1539 |
1329 |
" VCL_MET_SYNTH )\n" |
| 1540 |
1329 |
"#define VCL_MET_TASK_H ( VCL_MET_INIT | \\\n" |
| 1541 |
1329 |
" VCL_MET_FINI )\n" |
| 1542 |
1329 |
"\n" |
| 1543 |
1329 |
"#define VCL_MET_TASK_ALL ( VCL_MET_TASK_C | \\\n" |
| 1544 |
1329 |
" VCL_MET_TASK_B | \\\n" |
| 1545 |
1329 |
" VCL_MET_TASK_H )\n" |
| 1546 |
1329 |
"/* VCL Returns */\n" |
| 1547 |
1329 |
"#define VCL_RET_ABANDON 1\n" |
| 1548 |
1329 |
"#define VCL_RET_BERESP 2\n" |
| 1549 |
1329 |
"#define VCL_RET_DELIVER 3\n" |
| 1550 |
1329 |
"#define VCL_RET_ERROR 4\n" |
| 1551 |
1329 |
"#define VCL_RET_FAIL 5\n" |
| 1552 |
1329 |
"#define VCL_RET_FETCH 6\n" |
| 1553 |
1329 |
"#define VCL_RET_HASH 7\n" |
| 1554 |
1329 |
"#define VCL_RET_LOOKUP 8\n" |
| 1555 |
1329 |
"#define VCL_RET_MERGE 9\n" |
| 1556 |
1329 |
"#define VCL_RET_OBJ_STALE 10\n" |
| 1557 |
1329 |
"#define VCL_RET_OK 11\n" |
| 1558 |
1329 |
"#define VCL_RET_PASS 12\n" |
| 1559 |
1329 |
"#define VCL_RET_PIPE 13\n" |
| 1560 |
1329 |
"#define VCL_RET_PURGE 14\n" |
| 1561 |
1329 |
"#define VCL_RET_RESTART 15\n" |
| 1562 |
1329 |
"#define VCL_RET_RETRY 16\n" |
| 1563 |
1329 |
"#define VCL_RET_SYNTH 17\n" |
| 1564 |
1329 |
"#define VCL_RET_VCL 18\n" |
| 1565 |
1329 |
"\n" |
| 1566 |
1329 |
"#define VCL_RET_MAX 19\n" |
| 1567 |
1329 |
"\n" |
| 1568 |
1329 |
"/* VCL Types */\n" |
| 1569 |
1329 |
"struct vrt_type {\n" |
| 1570 |
1329 |
" unsigned magic;\n" |
| 1571 |
1329 |
"#define VRT_TYPE_MAGIC 0xa943bc32\n" |
| 1572 |
1329 |
" const char *lname;\n" |
| 1573 |
1329 |
" const char *uname;\n" |
| 1574 |
1329 |
" const char *ctype;\n" |
| 1575 |
1329 |
" size_t szof;\n" |
| 1576 |
1329 |
"};\n" |
| 1577 |
1329 |
"\n" |
| 1578 |
1329 |
"extern const struct vrt_type VCL_TYPE_ACL[1];\n" |
| 1579 |
1329 |
"extern const struct vrt_type VCL_TYPE_BACKEND[1];\n" |
| 1580 |
1329 |
"extern const struct vrt_type VCL_TYPE_BLOB[1];\n" |
| 1581 |
1329 |
"extern const struct vrt_type VCL_TYPE_BODY[1];\n" |
| 1582 |
1329 |
"extern const struct vrt_type VCL_TYPE_BOOL[1];\n" |
| 1583 |
1329 |
"extern const struct vrt_type VCL_TYPE_BYTES[1];\n" |
| 1584 |
1329 |
"extern const struct vrt_type VCL_TYPE_DURATION[1];\n" |
| 1585 |
1329 |
"extern const struct vrt_type VCL_TYPE_ENUM[1];\n" |
| 1586 |
1329 |
"extern const struct vrt_type VCL_TYPE_HEADER[1];\n" |
| 1587 |
1329 |
"extern const struct vrt_type VCL_TYPE_HTTP[1];\n" |
| 1588 |
1329 |
"extern const struct vrt_type VCL_TYPE_INSTANCE[1];\n" |
| 1589 |
1329 |
"extern const struct vrt_type VCL_TYPE_INT[1];\n" |
| 1590 |
1329 |
"extern const struct vrt_type VCL_TYPE_IP[1];\n" |
| 1591 |
1329 |
"extern const struct vrt_type VCL_TYPE_PROBE[1];\n" |
| 1592 |
1329 |
"extern const struct vrt_type VCL_TYPE_REAL[1];\n" |
| 1593 |
1329 |
"extern const struct vrt_type VCL_TYPE_REGEX[1];\n" |
| 1594 |
1329 |
"extern const struct vrt_type VCL_TYPE_STEVEDORE[1];\n" |
| 1595 |
1329 |
"extern const struct vrt_type VCL_TYPE_STRANDS[1];\n" |
| 1596 |
1329 |
"extern const struct vrt_type VCL_TYPE_STRING[1];\n" |
| 1597 |
1329 |
"extern const struct vrt_type VCL_TYPE_STRINGS[1];\n" |
| 1598 |
1329 |
"extern const struct vrt_type VCL_TYPE_SUB[1];\n" |
| 1599 |
1329 |
"extern const struct vrt_type VCL_TYPE_TIME[1];\n" |
| 1600 |
1329 |
"extern const struct vrt_type VCL_TYPE_VCL[1];\n" |
| 1601 |
1329 |
"extern const struct vrt_type VCL_TYPE_VOID[1];\n" |
| 1602 |
1329 |
"\n" |
| 1603 |
1329 |
"/* Compiled VCL Interface */\n" |
| 1604 |
1329 |
"typedef int vcl_event_f(VRT_CTX, enum vcl_event_e);\n" |
| 1605 |
1329 |
"typedef int vcl_init_f(VRT_CTX);\n" |
| 1606 |
1329 |
"typedef void vcl_fini_f(VRT_CTX);\n" |
| 1607 |
1329 |
"\n" |
| 1608 |
1329 |
"struct VCL_conf {\n" |
| 1609 |
1329 |
" unsigned magic;\n" |
| 1610 |
1329 |
"#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */\n" |
| 1611 |
1329 |
"\n" |
| 1612 |
1329 |
" unsigned syntax;\n" |
| 1613 |
1329 |
" VCL_BACKEND *default_director;\n" |
| 1614 |
1329 |
" VCL_PROBE default_probe;\n" |
| 1615 |
1329 |
" unsigned nref;\n" |
| 1616 |
1329 |
" const struct vpi_ref *ref;\n" |
| 1617 |
1329 |
"\n" |
| 1618 |
1329 |
" unsigned nsrc;\n" |
| 1619 |
1329 |
" unsigned nsub;\n" |
| 1620 |
1329 |
" const char **srcname;\n" |
| 1621 |
1329 |
" const char **srcbody;\n" |
| 1622 |
1329 |
"\n" |
| 1623 |
1329 |
" int nvmod;\n" |
| 1624 |
1329 |
" const struct vpi_ii *instance_info;\n" |
| 1625 |
1329 |
"\n" |
| 1626 |
1329 |
" vcl_event_f *event_vcl;\n" |
| 1627 |
1329 |
"\n" |
| 1628 |
1329 |
" vcl_func_f *recv_func;\n" |
| 1629 |
1329 |
" vcl_func_f *pipe_func;\n" |
| 1630 |
1329 |
" vcl_func_f *pass_func;\n" |
| 1631 |
1329 |
" vcl_func_f *hash_func;\n" |
| 1632 |
1329 |
" vcl_func_f *purge_func;\n" |
| 1633 |
1329 |
" vcl_func_f *miss_func;\n" |
| 1634 |
1329 |
" vcl_func_f *hit_func;\n" |
| 1635 |
1329 |
" vcl_func_f *deliver_func;\n" |
| 1636 |
1329 |
" vcl_func_f *synth_func;\n" |
| 1637 |
1329 |
" vcl_func_f *backend_fetch_func;\n" |
| 1638 |
1329 |
" vcl_func_f *backend_refresh_func;\n" |
| 1639 |
1329 |
" vcl_func_f *backend_response_func;\n" |
| 1640 |
1329 |
" vcl_func_f *backend_error_func;\n" |
| 1641 |
1329 |
" vcl_func_f *init_func;\n" |
| 1642 |
1329 |
" vcl_func_f *fini_func;\n" |
| 1643 |
1329 |
"\n" |
| 1644 |
1329 |
"};\n" |
| 1645 |
1329 |
); |
| 1646 |
1329 |
VSB_cat(sb, "\n"); |
| 1647 |
|
|
| 1648 |
|
/* ../include/vrt_obj.h */ |
| 1649 |
|
|
| 1650 |
1329 |
VSB_cat(sb, "/* ---===### include/vrt_obj.h ###===--- */\n\n"); |
| 1651 |
1329 |
VSB_cat(sb, |
| 1652 |
1329 |
"/*\n" |
| 1653 |
1329 |
" * NB: This file is machine generated, DO NOT EDIT!\n" |
| 1654 |
1329 |
" *\n" |
| 1655 |
1329 |
" * Edit and run lib/libvcc/generate.py instead.\n" |
| 1656 |
1329 |
" */\n" |
| 1657 |
1329 |
"\n" |
| 1658 |
1329 |
"VCL_STRING VRT_r_client_identity(VRT_CTX);\n" |
| 1659 |
1329 |
"void VRT_l_client_identity(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1660 |
1329 |
"\n" |
| 1661 |
1329 |
"VCL_IP VRT_r_client_ip(VRT_CTX);\n" |
| 1662 |
1329 |
"\n" |
| 1663 |
1329 |
"VCL_STRING VRT_r_server_hostname(VRT_CTX);\n" |
| 1664 |
1329 |
"\n" |
| 1665 |
1329 |
"VCL_STRING VRT_r_server_identity(VRT_CTX);\n" |
| 1666 |
1329 |
"\n" |
| 1667 |
1329 |
"VCL_IP VRT_r_server_ip(VRT_CTX);\n" |
| 1668 |
1329 |
"\n" |
| 1669 |
1329 |
"VCL_IP VRT_r_remote_ip(VRT_CTX);\n" |
| 1670 |
1329 |
"\n" |
| 1671 |
1329 |
"VCL_STRING VRT_r_local_endpoint(VRT_CTX);\n" |
| 1672 |
1329 |
"\n" |
| 1673 |
1329 |
"VCL_IP VRT_r_local_ip(VRT_CTX);\n" |
| 1674 |
1329 |
"\n" |
| 1675 |
1329 |
"VCL_STRING VRT_r_local_socket(VRT_CTX);\n" |
| 1676 |
1329 |
"\n" |
| 1677 |
1329 |
"VCL_HTTP VRT_r_req(VRT_CTX);\n" |
| 1678 |
1329 |
"\n" |
| 1679 |
1329 |
"VCL_BACKEND VRT_r_req_backend_hint(VRT_CTX);\n" |
| 1680 |
1329 |
"void VRT_l_req_backend_hint(VRT_CTX, VCL_BACKEND);\n" |
| 1681 |
1329 |
"\n" |
| 1682 |
1329 |
"VCL_BOOL VRT_r_req_can_gzip(VRT_CTX);\n" |
| 1683 |
1329 |
"\n" |
| 1684 |
1329 |
"VCL_BOOL VRT_r_req_esi(VRT_CTX);\n" |
| 1685 |
1329 |
"void VRT_l_req_esi(VRT_CTX, VCL_BOOL);\n" |
| 1686 |
1329 |
"\n" |
| 1687 |
1329 |
"VCL_INT VRT_r_req_esi_level(VRT_CTX);\n" |
| 1688 |
1329 |
"\n" |
| 1689 |
1329 |
"VCL_STRING VRT_r_req_filters(VRT_CTX);\n" |
| 1690 |
1329 |
"void VRT_l_req_filters(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1691 |
1329 |
"\n" |
| 1692 |
1329 |
"VCL_DURATION VRT_r_req_grace(VRT_CTX);\n" |
| 1693 |
1329 |
"void VRT_l_req_grace(VRT_CTX, VCL_DURATION);\n" |
| 1694 |
1329 |
"void VRT_u_req_grace(VRT_CTX);\n" |
| 1695 |
1329 |
"\n" |
| 1696 |
1329 |
"VCL_BLOB VRT_r_req_hash(VRT_CTX);\n" |
| 1697 |
1329 |
"\n" |
| 1698 |
1329 |
"VCL_BOOL VRT_r_req_hash_always_miss(VRT_CTX);\n" |
| 1699 |
1329 |
"void VRT_l_req_hash_always_miss(VRT_CTX, VCL_BOOL);\n" |
| 1700 |
1329 |
"\n" |
| 1701 |
1329 |
"VCL_BOOL VRT_r_req_hash_ignore_busy(VRT_CTX);\n" |
| 1702 |
1329 |
"void VRT_l_req_hash_ignore_busy(VRT_CTX, VCL_BOOL);\n" |
| 1703 |
1329 |
"\n" |
| 1704 |
1329 |
"VCL_BOOL VRT_r_req_hash_ignore_vary(VRT_CTX);\n" |
| 1705 |
1329 |
"void VRT_l_req_hash_ignore_vary(VRT_CTX, VCL_BOOL);\n" |
| 1706 |
1329 |
"\n" |
| 1707 |
1329 |
"void VRT_u_req_http(VRT_CTX);\n" |
| 1708 |
1329 |
"\n" |
| 1709 |
1329 |
"\n" |
| 1710 |
1329 |
"\n" |
| 1711 |
1329 |
"VCL_BOOL VRT_r_req_is_hitmiss(VRT_CTX);\n" |
| 1712 |
1329 |
"\n" |
| 1713 |
1329 |
"VCL_BOOL VRT_r_req_is_hitpass(VRT_CTX);\n" |
| 1714 |
1329 |
"\n" |
| 1715 |
1329 |
"VCL_STRING VRT_r_req_method(VRT_CTX);\n" |
| 1716 |
1329 |
"void VRT_l_req_method(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1717 |
1329 |
"\n" |
| 1718 |
1329 |
"VCL_STRING VRT_r_req_proto(VRT_CTX);\n" |
| 1719 |
1329 |
"void VRT_l_req_proto(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1720 |
1329 |
"\n" |
| 1721 |
1329 |
"\n" |
| 1722 |
1329 |
"VCL_INT VRT_r_req_restarts(VRT_CTX);\n" |
| 1723 |
1329 |
"\n" |
| 1724 |
1329 |
"VCL_STEVEDORE VRT_r_req_storage(VRT_CTX);\n" |
| 1725 |
1329 |
"void VRT_l_req_storage(VRT_CTX, VCL_STEVEDORE);\n" |
| 1726 |
1329 |
"\n" |
| 1727 |
1329 |
"VCL_TIME VRT_r_req_time(VRT_CTX);\n" |
| 1728 |
1329 |
"\n" |
| 1729 |
1329 |
"VCL_BOOL VRT_r_req_trace(VRT_CTX);\n" |
| 1730 |
1329 |
"void VRT_l_req_trace(VRT_CTX, VCL_BOOL);\n" |
| 1731 |
1329 |
"\n" |
| 1732 |
1329 |
"VCL_STRING VRT_r_req_transport(VRT_CTX);\n" |
| 1733 |
1329 |
"\n" |
| 1734 |
1329 |
"VCL_DURATION VRT_r_req_max_age(VRT_CTX);\n" |
| 1735 |
1329 |
"void VRT_l_req_max_age(VRT_CTX, VCL_DURATION);\n" |
| 1736 |
1329 |
"void VRT_u_req_max_age(VRT_CTX);\n" |
| 1737 |
1329 |
"\n" |
| 1738 |
1329 |
"VCL_DURATION VRT_r_req_ttl(VRT_CTX);\n" |
| 1739 |
1329 |
"void VRT_l_req_ttl(VRT_CTX, VCL_DURATION);\n" |
| 1740 |
1329 |
"void VRT_u_req_ttl(VRT_CTX);\n" |
| 1741 |
1329 |
"\n" |
| 1742 |
1329 |
"VCL_STRING VRT_r_req_url(VRT_CTX);\n" |
| 1743 |
1329 |
"void VRT_l_req_url(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1744 |
1329 |
"\n" |
| 1745 |
1329 |
"VCL_INT VRT_r_req_xid(VRT_CTX);\n" |
| 1746 |
1329 |
"\n" |
| 1747 |
1329 |
"\n" |
| 1748 |
1329 |
"VCL_STRING VRT_r_req0_method(VRT_CTX);\n" |
| 1749 |
1329 |
"\n" |
| 1750 |
1329 |
"VCL_STRING VRT_r_req0_proto(VRT_CTX);\n" |
| 1751 |
1329 |
"\n" |
| 1752 |
1329 |
"VCL_STRING VRT_r_req0_url(VRT_CTX);\n" |
| 1753 |
1329 |
"\n" |
| 1754 |
1329 |
"\n" |
| 1755 |
1329 |
"VCL_STRING VRT_r_req_top_method(VRT_CTX);\n" |
| 1756 |
1329 |
"\n" |
| 1757 |
1329 |
"VCL_STRING VRT_r_req_top_proto(VRT_CTX);\n" |
| 1758 |
1329 |
"\n" |
| 1759 |
1329 |
"VCL_TIME VRT_r_req_top_time(VRT_CTX);\n" |
| 1760 |
1329 |
"\n" |
| 1761 |
1329 |
"VCL_STRING VRT_r_req_top_url(VRT_CTX);\n" |
| 1762 |
1329 |
"\n" |
| 1763 |
1329 |
"VCL_HTTP VRT_r_bereq(VRT_CTX);\n" |
| 1764 |
1329 |
"\n" |
| 1765 |
1329 |
"VCL_BACKEND VRT_r_bereq_backend(VRT_CTX);\n" |
| 1766 |
1329 |
"void VRT_l_bereq_backend(VRT_CTX, VCL_BACKEND);\n" |
| 1767 |
1329 |
"\n" |
| 1768 |
1329 |
"VCL_DURATION VRT_r_bereq_between_bytes_timeout(VRT_CTX);\n" |
| 1769 |
1329 |
"void VRT_l_bereq_between_bytes_timeout(VRT_CTX, VCL_DURATION);\n" |
| 1770 |
1329 |
"void VRT_u_bereq_between_bytes_timeout(VRT_CTX);\n" |
| 1771 |
1329 |
"\n" |
| 1772 |
1329 |
"void VRT_u_bereq_body(VRT_CTX);\n" |
| 1773 |
1329 |
"\n" |
| 1774 |
1329 |
"VCL_DURATION VRT_r_bereq_connect_timeout(VRT_CTX);\n" |
| 1775 |
1329 |
"void VRT_l_bereq_connect_timeout(VRT_CTX, VCL_DURATION);\n" |
| 1776 |
1329 |
"void VRT_u_bereq_connect_timeout(VRT_CTX);\n" |
| 1777 |
1329 |
"\n" |
| 1778 |
1329 |
"VCL_STRING VRT_r_bereq_filters(VRT_CTX);\n" |
| 1779 |
1329 |
"void VRT_l_bereq_filters(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1780 |
1329 |
"\n" |
| 1781 |
1329 |
"VCL_DURATION VRT_r_bereq_first_byte_timeout(VRT_CTX);\n" |
| 1782 |
1329 |
"void VRT_l_bereq_first_byte_timeout(VRT_CTX, VCL_DURATION);\n" |
| 1783 |
1329 |
"void VRT_u_bereq_first_byte_timeout(VRT_CTX);\n" |
| 1784 |
1329 |
"\n" |
| 1785 |
1329 |
"VCL_BLOB VRT_r_bereq_hash(VRT_CTX);\n" |
| 1786 |
1329 |
"\n" |
| 1787 |
1329 |
"void VRT_u_bereq_http(VRT_CTX);\n" |
| 1788 |
1329 |
"\n" |
| 1789 |
1329 |
"\n" |
| 1790 |
1329 |
"\n" |
| 1791 |
1329 |
"VCL_BOOL VRT_r_bereq_is_bgfetch(VRT_CTX);\n" |
| 1792 |
1329 |
"\n" |
| 1793 |
1329 |
"VCL_BOOL VRT_r_bereq_is_hitmiss(VRT_CTX);\n" |
| 1794 |
1329 |
"\n" |
| 1795 |
1329 |
"VCL_BOOL VRT_r_bereq_is_hitpass(VRT_CTX);\n" |
| 1796 |
1329 |
"\n" |
| 1797 |
1329 |
"VCL_STRING VRT_r_bereq_method(VRT_CTX);\n" |
| 1798 |
1329 |
"void VRT_l_bereq_method(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1799 |
1329 |
"\n" |
| 1800 |
1329 |
"VCL_STRING VRT_r_bereq_proto(VRT_CTX);\n" |
| 1801 |
1329 |
"void VRT_l_bereq_proto(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1802 |
1329 |
"\n" |
| 1803 |
1329 |
"\n" |
| 1804 |
1329 |
"VCL_INT VRT_r_bereq_retries(VRT_CTX);\n" |
| 1805 |
1329 |
"\n" |
| 1806 |
1329 |
"VCL_BOOL VRT_r_bereq_retry_connect(VRT_CTX);\n" |
| 1807 |
1329 |
"void VRT_l_bereq_retry_connect(VRT_CTX, VCL_BOOL);\n" |
| 1808 |
1329 |
"\n" |
| 1809 |
1329 |
"VCL_DURATION VRT_r_bereq_task_deadline(VRT_CTX);\n" |
| 1810 |
1329 |
"void VRT_l_bereq_task_deadline(VRT_CTX, VCL_DURATION);\n" |
| 1811 |
1329 |
"void VRT_u_bereq_task_deadline(VRT_CTX);\n" |
| 1812 |
1329 |
"\n" |
| 1813 |
1329 |
"VCL_TIME VRT_r_bereq_time(VRT_CTX);\n" |
| 1814 |
1329 |
"\n" |
| 1815 |
1329 |
"VCL_BOOL VRT_r_bereq_trace(VRT_CTX);\n" |
| 1816 |
1329 |
"void VRT_l_bereq_trace(VRT_CTX, VCL_BOOL);\n" |
| 1817 |
1329 |
"\n" |
| 1818 |
1329 |
"VCL_BOOL VRT_r_bereq_uncacheable(VRT_CTX);\n" |
| 1819 |
1329 |
"\n" |
| 1820 |
1329 |
"VCL_STRING VRT_r_bereq_url(VRT_CTX);\n" |
| 1821 |
1329 |
"void VRT_l_bereq_url(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1822 |
1329 |
"\n" |
| 1823 |
1329 |
"VCL_INT VRT_r_bereq_xid(VRT_CTX);\n" |
| 1824 |
1329 |
"\n" |
| 1825 |
1329 |
"VCL_HTTP VRT_r_beresp(VRT_CTX);\n" |
| 1826 |
1329 |
"\n" |
| 1827 |
1329 |
"VCL_DURATION VRT_r_beresp_age(VRT_CTX);\n" |
| 1828 |
1329 |
"\n" |
| 1829 |
1329 |
"VCL_BACKEND VRT_r_beresp_backend(VRT_CTX);\n" |
| 1830 |
1329 |
"\n" |
| 1831 |
1329 |
"VCL_IP VRT_r_beresp_backend_ip(VRT_CTX);\n" |
| 1832 |
1329 |
"\n" |
| 1833 |
1329 |
"VCL_STRING VRT_r_beresp_backend_name(VRT_CTX);\n" |
| 1834 |
1329 |
"\n" |
| 1835 |
1329 |
"void VRT_l_beresp_body(VRT_CTX, enum lbody_e, const char *, const void *);\n" |
| 1836 |
1329 |
"\n" |
| 1837 |
1329 |
"VCL_BOOL VRT_r_beresp_do_esi(VRT_CTX);\n" |
| 1838 |
1329 |
"void VRT_l_beresp_do_esi(VRT_CTX, VCL_BOOL);\n" |
| 1839 |
1329 |
"\n" |
| 1840 |
1329 |
"VCL_BOOL VRT_r_beresp_do_gunzip(VRT_CTX);\n" |
| 1841 |
1329 |
"void VRT_l_beresp_do_gunzip(VRT_CTX, VCL_BOOL);\n" |
| 1842 |
1329 |
"\n" |
| 1843 |
1329 |
"VCL_BOOL VRT_r_beresp_do_gzip(VRT_CTX);\n" |
| 1844 |
1329 |
"void VRT_l_beresp_do_gzip(VRT_CTX, VCL_BOOL);\n" |
| 1845 |
1329 |
"\n" |
| 1846 |
1329 |
"VCL_BOOL VRT_r_beresp_do_stream(VRT_CTX);\n" |
| 1847 |
1329 |
"void VRT_l_beresp_do_stream(VRT_CTX, VCL_BOOL);\n" |
| 1848 |
1329 |
"\n" |
| 1849 |
1329 |
"VCL_BOOL VRT_r_beresp_esi_disable_xml_check(VRT_CTX);\n" |
| 1850 |
1329 |
"void VRT_l_beresp_esi_disable_xml_check(VRT_CTX, VCL_BOOL);\n" |
| 1851 |
1329 |
"\n" |
| 1852 |
1329 |
"VCL_BOOL VRT_r_beresp_esi_ignore_https(VRT_CTX);\n" |
| 1853 |
1329 |
"void VRT_l_beresp_esi_ignore_https(VRT_CTX, VCL_BOOL);\n" |
| 1854 |
1329 |
"\n" |
| 1855 |
1329 |
"VCL_BOOL VRT_r_beresp_esi_ignore_other_elements(VRT_CTX);\n" |
| 1856 |
1329 |
"void VRT_l_beresp_esi_ignore_other_elements(VRT_CTX, VCL_BOOL);\n" |
| 1857 |
1329 |
"\n" |
| 1858 |
1329 |
"VCL_BOOL VRT_r_beresp_esi_remove_bom(VRT_CTX);\n" |
| 1859 |
1329 |
"void VRT_l_beresp_esi_remove_bom(VRT_CTX, VCL_BOOL);\n" |
| 1860 |
1329 |
"\n" |
| 1861 |
1329 |
"VCL_STRING VRT_r_beresp_filters(VRT_CTX);\n" |
| 1862 |
1329 |
"void VRT_l_beresp_filters(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1863 |
1329 |
"\n" |
| 1864 |
1329 |
"VCL_DURATION VRT_r_beresp_grace(VRT_CTX);\n" |
| 1865 |
1329 |
"void VRT_l_beresp_grace(VRT_CTX, VCL_DURATION);\n" |
| 1866 |
1329 |
"\n" |
| 1867 |
1329 |
"void VRT_u_beresp_http(VRT_CTX);\n" |
| 1868 |
1329 |
"\n" |
| 1869 |
1329 |
"\n" |
| 1870 |
1329 |
"\n" |
| 1871 |
1329 |
"VCL_DURATION VRT_r_beresp_keep(VRT_CTX);\n" |
| 1872 |
1329 |
"void VRT_l_beresp_keep(VRT_CTX, VCL_DURATION);\n" |
| 1873 |
1329 |
"\n" |
| 1874 |
1329 |
"VCL_STRING VRT_r_beresp_proto(VRT_CTX);\n" |
| 1875 |
1329 |
"void VRT_l_beresp_proto(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1876 |
1329 |
"\n" |
| 1877 |
1329 |
"\n" |
| 1878 |
1329 |
"VCL_STRING VRT_r_beresp_reason(VRT_CTX);\n" |
| 1879 |
1329 |
"void VRT_l_beresp_reason(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1880 |
1329 |
"\n" |
| 1881 |
1329 |
"VCL_INT VRT_r_beresp_status(VRT_CTX);\n" |
| 1882 |
1329 |
"void VRT_l_beresp_status(VRT_CTX, VCL_INT);\n" |
| 1883 |
1329 |
"\n" |
| 1884 |
1329 |
"VCL_STEVEDORE VRT_r_beresp_storage(VRT_CTX);\n" |
| 1885 |
1329 |
"void VRT_l_beresp_storage(VRT_CTX, VCL_STEVEDORE);\n" |
| 1886 |
1329 |
"\n" |
| 1887 |
1329 |
"VCL_TIME VRT_r_beresp_time(VRT_CTX);\n" |
| 1888 |
1329 |
"\n" |
| 1889 |
1329 |
"VCL_BYTES VRT_r_beresp_transit_buffer(VRT_CTX);\n" |
| 1890 |
1329 |
"void VRT_l_beresp_transit_buffer(VRT_CTX, VCL_BYTES);\n" |
| 1891 |
1329 |
"\n" |
| 1892 |
1329 |
"VCL_DURATION VRT_r_beresp_ttl(VRT_CTX);\n" |
| 1893 |
1329 |
"void VRT_l_beresp_ttl(VRT_CTX, VCL_DURATION);\n" |
| 1894 |
1329 |
"\n" |
| 1895 |
1329 |
"VCL_BOOL VRT_r_beresp_uncacheable(VRT_CTX);\n" |
| 1896 |
1329 |
"void VRT_l_beresp_uncacheable(VRT_CTX, VCL_BOOL);\n" |
| 1897 |
1329 |
"\n" |
| 1898 |
1329 |
"VCL_BOOL VRT_r_beresp_was_304(VRT_CTX);\n" |
| 1899 |
1329 |
"\n" |
| 1900 |
1329 |
"VCL_DURATION VRT_r_obj_stale_age(VRT_CTX);\n" |
| 1901 |
1329 |
"\n" |
| 1902 |
1329 |
"VCL_BOOL VRT_r_obj_stale_can_esi(VRT_CTX);\n" |
| 1903 |
1329 |
"\n" |
| 1904 |
1329 |
"VCL_DURATION VRT_r_obj_stale_grace(VRT_CTX);\n" |
| 1905 |
1329 |
"\n" |
| 1906 |
1329 |
"VCL_INT VRT_r_obj_stale_hits(VRT_CTX);\n" |
| 1907 |
1329 |
"\n" |
| 1908 |
1329 |
"\n" |
| 1909 |
1329 |
"VCL_DURATION VRT_r_obj_stale_keep(VRT_CTX);\n" |
| 1910 |
1329 |
"\n" |
| 1911 |
1329 |
"VCL_STRING VRT_r_obj_stale_proto(VRT_CTX);\n" |
| 1912 |
1329 |
"\n" |
| 1913 |
1329 |
"VCL_STRING VRT_r_obj_stale_reason(VRT_CTX);\n" |
| 1914 |
1329 |
"\n" |
| 1915 |
1329 |
"VCL_INT VRT_r_obj_stale_status(VRT_CTX);\n" |
| 1916 |
1329 |
"\n" |
| 1917 |
1329 |
"VCL_STEVEDORE VRT_r_obj_stale_storage(VRT_CTX);\n" |
| 1918 |
1329 |
"\n" |
| 1919 |
1329 |
"VCL_TIME VRT_r_obj_stale_time(VRT_CTX);\n" |
| 1920 |
1329 |
"\n" |
| 1921 |
1329 |
"VCL_DURATION VRT_r_obj_stale_ttl(VRT_CTX);\n" |
| 1922 |
1329 |
"\n" |
| 1923 |
1329 |
"VCL_BOOL VRT_r_obj_stale_uncacheable(VRT_CTX);\n" |
| 1924 |
1329 |
"\n" |
| 1925 |
1329 |
"VCL_BOOL VRT_r_obj_stale_is_valid(VRT_CTX);\n" |
| 1926 |
1329 |
"\n" |
| 1927 |
1329 |
"VCL_DURATION VRT_r_obj_age(VRT_CTX);\n" |
| 1928 |
1329 |
"\n" |
| 1929 |
1329 |
"VCL_BOOL VRT_r_obj_can_esi(VRT_CTX);\n" |
| 1930 |
1329 |
"\n" |
| 1931 |
1329 |
"VCL_DURATION VRT_r_obj_grace(VRT_CTX);\n" |
| 1932 |
1329 |
"\n" |
| 1933 |
1329 |
"VCL_INT VRT_r_obj_hits(VRT_CTX);\n" |
| 1934 |
1329 |
"\n" |
| 1935 |
1329 |
"\n" |
| 1936 |
1329 |
"VCL_DURATION VRT_r_obj_keep(VRT_CTX);\n" |
| 1937 |
1329 |
"\n" |
| 1938 |
1329 |
"VCL_STRING VRT_r_obj_proto(VRT_CTX);\n" |
| 1939 |
1329 |
"\n" |
| 1940 |
1329 |
"VCL_STRING VRT_r_obj_reason(VRT_CTX);\n" |
| 1941 |
1329 |
"\n" |
| 1942 |
1329 |
"VCL_INT VRT_r_obj_status(VRT_CTX);\n" |
| 1943 |
1329 |
"\n" |
| 1944 |
1329 |
"VCL_STEVEDORE VRT_r_obj_storage(VRT_CTX);\n" |
| 1945 |
1329 |
"\n" |
| 1946 |
1329 |
"VCL_TIME VRT_r_obj_time(VRT_CTX);\n" |
| 1947 |
1329 |
"\n" |
| 1948 |
1329 |
"VCL_DURATION VRT_r_obj_ttl(VRT_CTX);\n" |
| 1949 |
1329 |
"\n" |
| 1950 |
1329 |
"VCL_BOOL VRT_r_obj_uncacheable(VRT_CTX);\n" |
| 1951 |
1329 |
"\n" |
| 1952 |
1329 |
"VCL_HTTP VRT_r_resp(VRT_CTX);\n" |
| 1953 |
1329 |
"\n" |
| 1954 |
1329 |
"void VRT_l_resp_body(VRT_CTX, enum lbody_e, const char *, const void *);\n" |
| 1955 |
1329 |
"\n" |
| 1956 |
1329 |
"VCL_BOOL VRT_r_resp_do_esi(VRT_CTX);\n" |
| 1957 |
1329 |
"void VRT_l_resp_do_esi(VRT_CTX, VCL_BOOL);\n" |
| 1958 |
1329 |
"\n" |
| 1959 |
1329 |
"VCL_BOOL VRT_r_resp_esi_include_onerror(VRT_CTX);\n" |
| 1960 |
1329 |
"void VRT_l_resp_esi_include_onerror(VRT_CTX, VCL_BOOL);\n" |
| 1961 |
1329 |
"\n" |
| 1962 |
1329 |
"VCL_STRING VRT_r_resp_filters(VRT_CTX);\n" |
| 1963 |
1329 |
"void VRT_l_resp_filters(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1964 |
1329 |
"\n" |
| 1965 |
1329 |
"void VRT_u_resp_http(VRT_CTX);\n" |
| 1966 |
1329 |
"\n" |
| 1967 |
1329 |
"\n" |
| 1968 |
1329 |
"\n" |
| 1969 |
1329 |
"VCL_BOOL VRT_r_resp_is_streaming(VRT_CTX);\n" |
| 1970 |
1329 |
"\n" |
| 1971 |
1329 |
"VCL_STRING VRT_r_resp_proto(VRT_CTX);\n" |
| 1972 |
1329 |
"void VRT_l_resp_proto(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1973 |
1329 |
"\n" |
| 1974 |
1329 |
"\n" |
| 1975 |
1329 |
"VCL_STRING VRT_r_resp_reason(VRT_CTX);\n" |
| 1976 |
1329 |
"void VRT_l_resp_reason(VRT_CTX, const char *, VCL_STRANDS);\n" |
| 1977 |
1329 |
"\n" |
| 1978 |
1329 |
"VCL_INT VRT_r_resp_status(VRT_CTX);\n" |
| 1979 |
1329 |
"void VRT_l_resp_status(VRT_CTX, VCL_INT);\n" |
| 1980 |
1329 |
"\n" |
| 1981 |
1329 |
"VCL_STEVEDORE VRT_r_resp_storage(VRT_CTX);\n" |
| 1982 |
1329 |
"void VRT_l_resp_storage(VRT_CTX, VCL_STEVEDORE);\n" |
| 1983 |
1329 |
"\n" |
| 1984 |
1329 |
"VCL_TIME VRT_r_resp_time(VRT_CTX);\n" |
| 1985 |
1329 |
"\n" |
| 1986 |
1329 |
"VCL_TIME VRT_r_now(VRT_CTX);\n" |
| 1987 |
1329 |
"\n" |
| 1988 |
1329 |
"VCL_DURATION VRT_r_sess_idle_send_timeout(VRT_CTX);\n" |
| 1989 |
1329 |
"void VRT_l_sess_idle_send_timeout(VRT_CTX, VCL_DURATION);\n" |
| 1990 |
1329 |
"void VRT_u_sess_idle_send_timeout(VRT_CTX);\n" |
| 1991 |
1329 |
"\n" |
| 1992 |
1329 |
"VCL_DURATION VRT_r_sess_send_timeout(VRT_CTX);\n" |
| 1993 |
1329 |
"void VRT_l_sess_send_timeout(VRT_CTX, VCL_DURATION);\n" |
| 1994 |
1329 |
"void VRT_u_sess_send_timeout(VRT_CTX);\n" |
| 1995 |
1329 |
"\n" |
| 1996 |
1329 |
"VCL_DURATION VRT_r_sess_timeout_idle(VRT_CTX);\n" |
| 1997 |
1329 |
"void VRT_l_sess_timeout_idle(VRT_CTX, VCL_DURATION);\n" |
| 1998 |
1329 |
"void VRT_u_sess_timeout_idle(VRT_CTX);\n" |
| 1999 |
1329 |
"\n" |
| 2000 |
1329 |
"VCL_DURATION VRT_r_sess_timeout_linger(VRT_CTX);\n" |
| 2001 |
1329 |
"void VRT_l_sess_timeout_linger(VRT_CTX, VCL_DURATION);\n" |
| 2002 |
1329 |
"void VRT_u_sess_timeout_linger(VRT_CTX);\n" |
| 2003 |
1329 |
"\n" |
| 2004 |
1329 |
"VCL_INT VRT_r_sess_xid(VRT_CTX);\n" |
| 2005 |
1329 |
"\n" |
| 2006 |
1329 |
"VCL_DURATION VRT_r_param_backend_idle_timeout(VRT_CTX);\n" |
| 2007 |
1329 |
"\n" |
| 2008 |
1329 |
"VCL_INT VRT_r_param_backend_wait_limit(VRT_CTX);\n" |
| 2009 |
1329 |
"\n" |
| 2010 |
1329 |
"VCL_DURATION VRT_r_param_backend_wait_timeout(VRT_CTX);\n" |
| 2011 |
1329 |
"\n" |
| 2012 |
1329 |
"VCL_DURATION VRT_r_param_between_bytes_timeout(VRT_CTX);\n" |
| 2013 |
1329 |
"\n" |
| 2014 |
1329 |
"VCL_DURATION VRT_r_param_connect_timeout(VRT_CTX);\n" |
| 2015 |
1329 |
"\n" |
| 2016 |
1329 |
"VCL_DURATION VRT_r_param_default_grace(VRT_CTX);\n" |
| 2017 |
1329 |
"\n" |
| 2018 |
1329 |
"VCL_DURATION VRT_r_param_default_keep(VRT_CTX);\n" |
| 2019 |
1329 |
"\n" |
| 2020 |
1329 |
"VCL_DURATION VRT_r_param_default_ttl(VRT_CTX);\n" |
| 2021 |
1329 |
"\n" |
| 2022 |
1329 |
"VCL_DURATION VRT_r_param_first_byte_timeout(VRT_CTX);\n" |
| 2023 |
1329 |
"\n" |
| 2024 |
1329 |
"VCL_DURATION VRT_r_param_idle_send_timeout(VRT_CTX);\n" |
| 2025 |
1329 |
"\n" |
| 2026 |
1329 |
"VCL_INT VRT_r_param_max_esi_depth(VRT_CTX);\n" |
| 2027 |
1329 |
"\n" |
| 2028 |
1329 |
"VCL_INT VRT_r_param_max_restarts(VRT_CTX);\n" |
| 2029 |
1329 |
"\n" |
| 2030 |
1329 |
"VCL_INT VRT_r_param_max_retries(VRT_CTX);\n" |
| 2031 |
1329 |
"\n" |
| 2032 |
1329 |
"VCL_DURATION VRT_r_param_pipe_task_deadline(VRT_CTX);\n" |
| 2033 |
1329 |
"\n" |
| 2034 |
1329 |
"VCL_DURATION VRT_r_param_pipe_timeout(VRT_CTX);\n" |
| 2035 |
1329 |
"\n" |
| 2036 |
1329 |
"VCL_DURATION VRT_r_param_send_timeout(VRT_CTX);\n" |
| 2037 |
1329 |
"\n" |
| 2038 |
1329 |
"VCL_DURATION VRT_r_param_shortlived(VRT_CTX);\n" |
| 2039 |
1329 |
"\n" |
| 2040 |
1329 |
"VCL_DURATION VRT_r_param_timeout_idle(VRT_CTX);\n" |
| 2041 |
1329 |
"\n" |
| 2042 |
1329 |
"VCL_BYTES VRT_r_param_transit_buffer(VRT_CTX);\n" |
| 2043 |
1329 |
"\n" |
| 2044 |
1329 |
"VCL_DURATION VRT_r_param_uncacheable_ttl(VRT_CTX);\n" |
| 2045 |
1329 |
"VCL_BYTES VRT_stevedore_free_space(VCL_STEVEDORE);\n" |
| 2046 |
1329 |
"VCL_BYTES VRT_stevedore_used_space(VCL_STEVEDORE);\n" |
| 2047 |
1329 |
"VCL_BOOL VRT_stevedore_happy(VCL_STEVEDORE);\n" |
| 2048 |
1329 |
); |
| 2049 |
1329 |
VSB_cat(sb, "\n"); |
| 2050 |
|
|
| 2051 |
|
/* ../include/vcc_interface.h */ |
| 2052 |
|
|
| 2053 |
1329 |
VSB_cat(sb, "/* ---===### include/vcc_interface.h ###===--- */\n\n"); |
| 2054 |
1329 |
VSB_cat(sb, |
| 2055 |
1329 |
"/*-\n" |
| 2056 |
1329 |
" * Copyright (c) 2006 Verdens Gang AS\n" |
| 2057 |
1329 |
" * Copyright (c) 2006-2019 Varnish Software AS\n" |
| 2058 |
1329 |
" * All rights reserved.\n" |
| 2059 |
1329 |
" *\n" |
| 2060 |
1329 |
" * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>\n" |
| 2061 |
1329 |
" *\n" |
| 2062 |
1329 |
" * SPDX-License-Identifier: BSD-2-Clause\n" |
| 2063 |
1329 |
" *\n" |
| 2064 |
1329 |
" * Redistribution and use in source and binary forms, with or without\n" |
| 2065 |
1329 |
" * modification, are permitted provided that the following conditions\n" |
| 2066 |
1329 |
" * are met:\n" |
| 2067 |
1329 |
" * 1. Redistributions of source code must retain the above copyright\n" |
| 2068 |
1329 |
" * notice, this list of conditions and the following disclaimer.\n" |
| 2069 |
1329 |
" * 2. Redistributions in binary form must reproduce the above copyright\n" |
| 2070 |
1329 |
" * notice, this list of conditions and the following disclaimer in the\n" |
| 2071 |
1329 |
" * documentation and/or other materials provided with the distribution.\n" |
| 2072 |
1329 |
" *\n" |
| 2073 |
1329 |
" * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" |
| 2074 |
1329 |
" * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" |
| 2075 |
1329 |
" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" |
| 2076 |
1329 |
" * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n" |
| 2077 |
1329 |
" * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" |
| 2078 |
1329 |
" * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" |
| 2079 |
1329 |
" * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" |
| 2080 |
1329 |
" * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" |
| 2081 |
1329 |
" * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" |
| 2082 |
1329 |
" * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" |
| 2083 |
1329 |
" * SUCH DAMAGE.\n" |
| 2084 |
1329 |
" *\n" |
| 2085 |
1329 |
" * Runtime support for compiled VCL programs and VMODs.\n" |
| 2086 |
1329 |
" *\n" |
| 2087 |
1329 |
" * This file contains prototypes for functions nobody but VCC may call.\n" |
| 2088 |
1329 |
" *\n" |
| 2089 |
1329 |
" * NB: When this file is changed, lib/libvcc/generate.py *MUST* be rerun.\n" |
| 2090 |
1329 |
" */\n" |
| 2091 |
1329 |
"\n" |
| 2092 |
1329 |
"VCL_VCL VPI_vcl_get(VRT_CTX, const char *);\n" |
| 2093 |
1329 |
"void VPI_vcl_rel(VRT_CTX, VCL_VCL);\n" |
| 2094 |
1329 |
"void VPI_vcl_select(VRT_CTX, VCL_VCL);\n" |
| 2095 |
1329 |
"void v_noreturn_ VPI_Fail(const char *func, const char *file, int line,\n" |
| 2096 |
1329 |
" const char *cond);\n" |
| 2097 |
1329 |
"\n" |
| 2098 |
1329 |
"/***********************************************************************\n" |
| 2099 |
1329 |
" * VPI_count() refers to this structure for coordinates into the VCL source.\n" |
| 2100 |
1329 |
" */\n" |
| 2101 |
1329 |
"\n" |
| 2102 |
1329 |
"struct vpi_ref {\n" |
| 2103 |
1329 |
" unsigned magic;\n" |
| 2104 |
1329 |
"#define VPI_REF_MAGIC 0xd955f567\n" |
| 2105 |
1329 |
" unsigned source;\n" |
| 2106 |
1329 |
" unsigned offset;\n" |
| 2107 |
1329 |
" unsigned line;\n" |
| 2108 |
1329 |
" unsigned pos;\n" |
| 2109 |
1329 |
" const char *token;\n" |
| 2110 |
1329 |
"};\n" |
| 2111 |
1329 |
"\n" |
| 2112 |
1329 |
"/* VPI's private part of the worker */\n" |
| 2113 |
1329 |
"struct wrk_vpi {\n" |
| 2114 |
1329 |
" unsigned magic;\n" |
| 2115 |
1329 |
"#define WRK_VPI_MAGIC 0xaa3d3df3\n" |
| 2116 |
1329 |
" unsigned handling;\n" |
| 2117 |
1329 |
" unsigned trace; // caches (be)req.trace\n" |
| 2118 |
1329 |
" unsigned ref; // index into (struct vpi_ref)[]\n" |
| 2119 |
1329 |
"};\n" |
| 2120 |
1329 |
"\n" |
| 2121 |
1329 |
"#define VPI_count(ctx, max, u) \\\n" |
| 2122 |
1329 |
" do { \\\n" |
| 2123 |
1329 |
" assert(u < max); \\\n" |
| 2124 |
1329 |
" (ctx)->vpi->ref = u; \\\n" |
| 2125 |
1329 |
" } while(0)\n" |
| 2126 |
1329 |
"void VPI_trace(VRT_CTX, unsigned);\n" |
| 2127 |
1329 |
"void VPI_vcl_fini(VRT_CTX);\n" |
| 2128 |
1329 |
"\n" |
| 2129 |
1329 |
"int VPI_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, size_t len,\n" |
| 2130 |
1329 |
" const char *nm, const char *path, const char *file_id, const char *backup);\n" |
| 2131 |
1329 |
"void VPI_Vmod_Unload(VRT_CTX, struct vmod **hdl);\n" |
| 2132 |
1329 |
"\n" |
| 2133 |
1329 |
"typedef int acl_match_f(VRT_CTX, const VCL_IP);\n" |
| 2134 |
1329 |
"int VPI_acl_table(VRT_CTX, VCL_IP, unsigned n, unsigned m, const uint8_t *tbl,\n" |
| 2135 |
1329 |
" const char * const *str, const char *fin);\n" |
| 2136 |
1329 |
"\n" |
| 2137 |
1329 |
"struct vrt_acl {\n" |
| 2138 |
1329 |
" unsigned magic;\n" |
| 2139 |
1329 |
"#define VRT_ACL_MAGIC 0x78329d96\n" |
| 2140 |
1329 |
" acl_match_f *match;\n" |
| 2141 |
1329 |
" const char *name;\n" |
| 2142 |
1329 |
"};\n" |
| 2143 |
1329 |
"\n" |
| 2144 |
1329 |
"void VPI_acl_log(VRT_CTX, const char *);\n" |
| 2145 |
1329 |
"\n" |
| 2146 |
1329 |
"/* vmod object instance info */\n" |
| 2147 |
1329 |
"struct vpi_ii {\n" |
| 2148 |
1329 |
" uintptr_t * p;\n" |
| 2149 |
1329 |
" const char * const name;\n" |
| 2150 |
1329 |
"};\n" |
| 2151 |
1329 |
"\n" |
| 2152 |
1329 |
"/* Compile time regexp */\n" |
| 2153 |
1329 |
"\n" |
| 2154 |
1329 |
"void VPI_re_init(struct vre **, const char *);\n" |
| 2155 |
1329 |
"void VPI_re_fini(struct vre *);\n" |
| 2156 |
1329 |
"\n" |
| 2157 |
1329 |
"/* VCL_SUB type */\n" |
| 2158 |
1329 |
"\n" |
| 2159 |
1329 |
"struct vcl_sub {\n" |
| 2160 |
1329 |
" unsigned magic;\n" |
| 2161 |
1329 |
"#define VCL_SUB_MAGIC 0x12c1750b\n" |
| 2162 |
1329 |
" const unsigned methods; // ok &= ctx->method\n" |
| 2163 |
1329 |
" const char * const name;\n" |
| 2164 |
1329 |
" const struct VCL_conf *vcl_conf;\n" |
| 2165 |
1329 |
" vcl_func_f *func;\n" |
| 2166 |
1329 |
" unsigned n;\n" |
| 2167 |
1329 |
" unsigned nref;\n" |
| 2168 |
1329 |
" unsigned called;\n" |
| 2169 |
1329 |
"};\n" |
| 2170 |
1329 |
"\n" |
| 2171 |
1329 |
"enum vcl_func_fail_e VPI_Call_Check(VRT_CTX, const struct VCL_conf *conf,\n" |
| 2172 |
1329 |
" unsigned methods, unsigned n);\n" |
| 2173 |
1329 |
"void VPI_Call_Begin(VRT_CTX, unsigned n);\n" |
| 2174 |
1329 |
"void VPI_Call_End(VRT_CTX, unsigned n);\n" |
| 2175 |
1329 |
"VCL_BOOL VPI_PtrCmp(const void *p1, const void *p2);\n" |
| 2176 |
1329 |
); |
| 2177 |
1329 |
VSB_cat(sb, "\n"); |
| 2178 |
1329 |
VSB_cat(sb, "/* ---===### vgc asserts (generate.py) ###===--- */\n\n"); |
| 2179 |
1329 |
VSB_cat(sb, |
| 2180 |
1329 |
"#define assert(e) \\\n" |
| 2181 |
1329 |
" do { \\\n" |
| 2182 |
1329 |
" if (!(e)) { \\\n" |
| 2183 |
1329 |
" VPI_Fail(__func__, __FILE__, __LINE__, #e); \\\n" |
| 2184 |
1329 |
" } \\\n" |
| 2185 |
1329 |
" } while (0)\n" |
| 2186 |
1329 |
); |
| 2187 |
1329 |
VSB_cat(sb, "\n"); |
| 2188 |
|
|
| 2189 |
1329 |
} |