PK wFZulQ� � vdef.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2012 Fastly Inc
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
* Author: Rogier 'DocWilco' Mulhuijzen <rogier@fastly.com>
*
* Inspired by FreeBSD's <sys/cdefs.h>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Names of the form "v_[a-z_]*_" is reserved for this file.
*
* This file should always be the first non <...> include in a .c file.
*/
#ifdef VDEF_H_INCLUDED
# error "vdef.h included multiple times"
#endif
#define VDEF_H_INCLUDED
/* Safe printf into a fixed-size buffer */
#define bprintf(buf, fmt, ...) \
do { \
int ibprintf; \
ibprintf = snprintf(buf, sizeof buf, fmt, __VA_ARGS__); \
assert(ibprintf >= 0 && ibprintf < (int)sizeof buf); \
} while (0)
/* Safe printf into a fixed-size buffer */
#define vbprintf(buf, fmt, ap) \
do { \
int ivbprintf; \
ivbprintf = vsnprintf(buf, sizeof buf, fmt, ap); \
assert(ivbprintf >= 0 && ivbprintf < (int)sizeof buf); \
} while (0)
/* Close and discard filedescriptor */
#define closefd(fdp) \
do { \
assert(*(fdp) >= 0); \
AZ(close(*(fdp))); \
*(fdp) = -1; \
} while (0)
#if !defined(__has_feature)
# define __has_feature(x) 0
#endif
#ifndef __GNUC_PREREQ__
# if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ__(maj, min) \
(__GNUC__ > (maj) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min)))
# else
# define __GNUC_PREREQ__(maj, min) 0
# endif
#endif
#ifdef __printflike
# define v_printflike_(f,a) __printflike(f,a)
#elif __GNUC_PREREQ__(2, 95) || defined(__INTEL_COMPILER)
# define v_printflike_(f,a) __attribute__((format(printf, f, a)))
#else
# define v_printflike_(f,a)
#endif
#define v_noreturn_ __attribute__((__noreturn__))
#ifdef __GNUC__
# define v_deprecated_ __attribute__((deprecated))
#else
# define v_deprecated_
#endif
/*********************************************************************
* Pointer alignment magic
*/
#if defined(__sparc__)
/* NB: Overbroad test for 32bit userland on 64bit SPARC cpus. */
# define PALGN (sizeof(double) - 1) /* size of alignment */
#else
# define PALGN (sizeof(void *) - 1) /* size of alignment */
#endif
#define PAOK(p) (((uintptr_t)(p) & PALGN) == 0) /* is aligned */
#define PRNDDN(p) ((uintptr_t)(p) & ~PALGN) /* Round down */
#define PRNDUP(p) (((uintptr_t)(p) + PALGN) & ~PALGN) /* Round up */
/*********************************************************************
* To be used as little as possible to wash off const/volatile etc.
*/
#define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr))
/**********************************************************************
* Generic power-2 rounding macros
*/
#define PWR2(x) ((((x)-1UL)&(x))==0) /* Is a power of two */
#define RDN2(x, y) ((x)&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */
#define RUP2(x, y) (((x)+((y)-1))&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */
/**********************************************************************
* Find the minimum or maximum values.
* Only evaluate the expression once and perform type checking.
*/
/* ref: https://stackoverflow.com/a/17624752 */
#define VINDIRECT(a, b, c) a ## b ## c
#define VCOMBINE(a, b, c) VINDIRECT(a, b, c)
#if defined(__COUNTER__)
# define VUNIQ_NAME(base) VCOMBINE(base, __LINE__, __COUNTER__)
#else
# define VUNIQ_NAME(base) VCOMBINE(base, __LINE__, 0)
#endif
/* ref: https://gcc.gnu.org/onlinedocs/gcc/Typeof.html */
#define _vmin(a, b, _va, _vb) \
({ \
typeof (a) _va = (a); \
typeof (b) _vb = (b); \
(void)(&_va == &_vb); \
_va < _vb ? _va : _vb; \
})
#define _vmax(a, b, _va, _vb) \
({ \
typeof (a) _va = (a); \
typeof (b) _vb = (b); \
(void)(&_va == &_vb); \
_va > _vb ? _va : _vb; \
})
#define vmin(a, b) _vmin((a), (b), VUNIQ_NAME(_vmina), \
VUNIQ_NAME(_vminb))
#define vmax(a, b) _vmax((a), (b), VUNIQ_NAME(_vmaxa), \
VUNIQ_NAME(_vmaxb))
#define vmin_t(type, a, b) vmin((type)(a), (type)(b))
#define vmax_t(type, a, b) vmax((type)(a), (type)(b))
/**********************************************************************
* Clamp the value between two limits.
*/
#define vlimit(a, l, u) vmax((l), vmin((a), (u)))
#define vlimit_t(type, a, l, u) vmax_t(type, (l), vmin_t(type, (a), (u)))
/**********************************************************************
* FlexeLint and compiler shutuppery
*/
/*
* In OO-light situations, functions have to match their prototype
* even if that means not const'ing a const'able argument.
* The typedef should be specified as argument to the macro.
*/
#define v_matchproto_(xxx) /*lint --e{818} */
/*
* State variables may change value before we have considered the
* previous value
*/
#define v_statevariable_(varname) varname /*lint -esym(838,varname) */
#ifdef __SUNPRO_C
#define NEEDLESS(s) {}
#else
#define NEEDLESS(s) s
#endif
#if __GNUC_PREREQ__(2, 7)
# define v_unused_ __attribute__((__unused__))
#else
# define v_unused_
#endif
/*
* Most of this nightmare is stolen from FreeBSD's <cdefs.h>
*/
#ifndef __has_extension
# define __has_extension(x) 0
#endif
#if defined(_Static_assert)
/* Nothing, somebody already did this for us */
#elif __has_extension(c_static_assert)
/* Nothing, we should be fine */
#elif (defined(__cplusplus) && __cplusplus >= 201103L) || \
__has_extension(cxx_static_assert)
# define _Static_assert(x, y) static_assert(x, y)
#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
#else
# if defined(__COUNTER__)
# define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
# else
# define _Static_assert(x, y) __Static_assert(x, __LINE__)
# endif
# define __Static_assert(x, y) ___Static_assert(x, y)
# define ___Static_assert(x, y) \
typedef char __assert_## y[(x) ? 1 : -1] v_unused_
#endif
/* VTIM API overhaul WIP */
typedef double vtim_mono;
typedef double vtim_real;
typedef double vtim_dur;
PK wFZx����
�
common/common_param.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file contains the heritage passed when mgt forks cache
*/
#ifdef COMMON_COMMON_PARAM_H
#error "Multiple includes of common/common_param.h"
#endif
#define COMMON_COMMON_PARAM_H
#include "vre.h"
#define VSM_CLASS_PARAM "Params"
enum debug_bits {
#define DEBUG_BIT(U, l, d) DBG_##U,
#include "tbl/debug_bits.h"
DBG_Reserved
};
static inline int
COM_DO_DEBUG(const volatile uint8_t *p, enum debug_bits x)
{
return (p[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7)));
}
enum feature_bits {
#define FEATURE_BIT(U, l, d, ld) FEATURE_##U,
#include "tbl/feature_bits.h"
FEATURE_Reserved
};
static inline int
COM_FEATURE(const volatile uint8_t *p, enum feature_bits x)
{
return (p[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7)));
}
struct poolparam {
unsigned min_pool;
unsigned max_pool;
double max_age;
};
struct params {
#define ptyp_bool unsigned
#define ptyp_bytes ssize_t
#define ptyp_bytes_u unsigned
#define ptyp_double double
#define ptyp_poolparam struct poolparam
#define ptyp_timeout double
#define ptyp_uint unsigned
#define ptyp_vsl_buffer unsigned
#define ptyp_vsl_reclen unsigned
#define PARAM(nm, ty, mi, ma, de, un, fl, st, lt, fn) ptyp_##ty nm;
#include <tbl/params.h>
#undef ptyp_bool
#undef ptyp_bytes
#undef ptyp_bytes_u
#undef ptyp_double
#undef ptyp_poolparam
#undef ptyp_timeout
#undef ptyp_uint
#undef ptyp_vsl_buffer
#undef ptyp_vsl_reclen
/* Unprivileged user / group */
uid_t uid;
gid_t gid;
/* Worker threads and pool */
unsigned wthread_min;
unsigned wthread_max;
unsigned wthread_reserve;
double wthread_timeout;
unsigned wthread_pools;
double wthread_add_delay;
double wthread_fail_delay;
double wthread_destroy_delay;
double wthread_watchdog;
unsigned wthread_stats_rate;
ssize_t wthread_stacksize;
unsigned wthread_queue_limit;
struct vre_limits vre_limits;
struct poolparam req_pool;
struct poolparam sess_pool;
struct poolparam vbo_pool;
uint8_t vsl_mask[256>>3];
uint8_t debug_bits[(DBG_Reserved+7)>>3];
uint8_t feature_bits[(FEATURE_Reserved+7)>>3];
};
PK wFZ�e��� � vtim.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/* from libvarnish/vtim.c */
extern unsigned VTIM_postel;
#define VTIM_FORMAT_SIZE 30
void VTIM_format(vtim_real t, char *p);
vtim_real VTIM_parse(const char *p);
vtim_mono VTIM_mono(void);
vtim_real VTIM_real(void);
void VTIM_sleep(vtim_dur t);
struct timespec VTIM_timespec(vtim_real t);
struct timeval VTIM_timeval(vtim_real t);
PK wFZ��
vcli.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Public definition of the CLI protocol, part of the published Varnish-API.
*
* The overall structure of the protocol is a command-line like
* "command+arguments" request and a IETF style "number + string" response.
*
* Arguments can contain arbitrary sequences of bytes which are encoded
* in back-slash notation in double-quoted, if necessary.
*/
/*
* Status/return codes in the CLI protocol
*/
enum VCLI_status_e {
CLIS_SYNTAX = 100,
CLIS_UNKNOWN = 101,
CLIS_UNIMPL = 102,
CLIS_TOOFEW = 104,
CLIS_TOOMANY = 105,
CLIS_PARAM = 106,
CLIS_AUTH = 107,
CLIS_OK = 200,
CLIS_TRUNCATED = 201,
CLIS_CANT = 300,
CLIS_COMMS = 400,
CLIS_CLOSE = 500
};
/* Length of first line of response */
#define CLI_LINE0_LEN 13
#define CLI_AUTH_RESPONSE_LEN 64 /* 64 hex + NUL */
#if !defined(VCLI_PROTOCOL_ONLY)
/* Convenience functions exported in libvarnishapi */
int VCLI_WriteResult(int fd, unsigned status, const char *result);
int VCLI_ReadResult(int fd, unsigned *status, char **ptr, double tmo);
void VCLI_AuthResponse(int S_fd, const char *challenge,
char reponse[CLI_AUTH_RESPONSE_LEN + 1]);
#endif
PK wFZ w�i
i
vsb.hnu �[��� /*-
* Copyright (c) 2000-2011 Poul-Henning Kamp
* Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/sys/sys/vsb.h 221993 2011-05-16 16:18:40Z phk $
*/
#ifndef VSB_H_INCLUDED
#define VSB_H_INCLUDED
/*
* Structure definition
*/
struct vsb {
unsigned magic;
#define VSB_MAGIC 0x4a82dd8a
int s_error; /* current error code */
char *s_buf; /* storage buffer */
ssize_t s_size; /* size of storage buffer */
ssize_t s_len; /* current length of string */
#define VSB_FIXEDLEN 0x00000000 /* fixed length buffer (default) */
#define VSB_AUTOEXTEND 0x00000001 /* automatically extend buffer */
#define VSB_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */
#define VSB_DYNAMIC 0x00010000 /* s_buf must be freed */
#define VSB_FINISHED 0x00020000 /* set by VSB_finish() */
#define VSB_DYNSTRUCT 0x00080000 /* vsb must be freed */
int s_flags; /* flags */
int s_indent; /* Ident level */
};
#ifdef __cplusplus
extern "C" {
#endif
/*
* API functions
*/
struct vsb *VSB_new(struct vsb *, char *, int, int);
#define VSB_new_auto() \
VSB_new(NULL, NULL, 0, VSB_AUTOEXTEND)
void VSB_clear(struct vsb *);
int VSB_bcat(struct vsb *, const void *, ssize_t);
int VSB_cat(struct vsb *, const char *);
int VSB_printf(struct vsb *, const char *, ...)
v_printflike_(2, 3);
#ifdef va_start
int VSB_vprintf(struct vsb *, const char *, va_list)
v_printflike_(2, 0);
#endif
int VSB_putc(struct vsb *, int);
int VSB_error(const struct vsb *);
int VSB_finish(struct vsb *);
char *VSB_data(const struct vsb *);
ssize_t VSB_len(const struct vsb *);
void VSB_delete(struct vsb *);
void VSB_destroy(struct vsb **);
#define VSB_QUOTE_NONL 1
#define VSB_QUOTE_JSON 2
#define VSB_QUOTE_HEX 4
#define VSB_QUOTE_CSTR 8
#define VSB_QUOTE_UNSAFE 16
void VSB_quote_pfx(struct vsb *, const char*, const void *,
int len, int how);
void VSB_quote(struct vsb *, const void *, int len, int how);
void VSB_indent(struct vsb *, int);
int VSB_tofile(const struct vsb *, int fd);
#ifdef __cplusplus
};
#endif
#endif
PK wFZ��;�n
n
vut.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Common functions for the utilities
*/
struct VUT;
struct vopt_spec;
typedef void VUT_sighandler_f(int);
typedef int VUT_cb_f(struct VUT *);
typedef void VUT_error_f(struct VUT *, int, const char *, va_list);
struct VUT {
unsigned magic;
#define VUT_MAGIC 0xdf3b3de8
const char *progname;
/* Options */
int d_opt;
int D_opt;
int g_arg;
int k_arg;
char *n_arg;
char *P_arg;
char *q_arg;
char *r_arg;
char *t_arg;
/* State */
struct VSL_data *vsl;
struct vsm *vsm;
struct VSLQ *vslq;
int sighup;
int sigint;
int sigusr1;
/* Callback functions */
VUT_cb_f *idle_f;
VUT_cb_f *sighup_f;
VUT_error_f *error_f;
VSLQ_dispatch_f *dispatch_f;
void *dispatch_priv;
};
void VUT_Error(struct VUT *, int status, const char *fmt, ...)
v_noreturn_ v_printflike_(3, 4);
int VUT_Arg(struct VUT *, int opt, const char *arg);
#define VUT_InitProg(argc, argv, spec) VUT_Init(argv[0], argc, argv, spec)
struct VUT * VUT_Init(const char *progname, int argc, char * const *argv,
const struct vopt_spec *);
void VUT_Signal(VUT_sighandler_f);
void VUT_Signaled(struct VUT *, int);
void VUT_Setup(struct VUT *);
int VUT_Main(struct VUT *);
void VUT_Fini(struct VUT **);
PK wFZY`<� � vrnd.hnu �[��� /*-
* Copyright (c) 2013 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Random functions
*/
typedef void vrnd_lock_f(void);
extern vrnd_lock_f *VRND_Lock;
extern vrnd_lock_f *VRND_Unlock;
int VRND_RandomCrypto(void *, size_t);
long VRND_RandomTestable(void);
double VRND_RandomTestableDouble(void);
void VRND_SeedTestable(unsigned int);
void VRND_SeedAll(void); /* Seed random(3) properly */
PK wFZ;F � �
vcs_version.hnu �[��� /* a395739fa63cddec305142eabefec0a4fd5339e7 */
/*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run include/generate.py instead.
*/
#define VCS_Version "a395739fa63cddec305142eabefec0a4fd5339e7"
PK wFZ�o��
vut_options.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* VUT options */
#define VUT_GLOBAL_OPT_D \
VOPT("D", "[-D]", "Daemonize", \
"Daemonize." \
)
#define VUT_GLOBAL_OPT_P \
VOPT("P:", "[-P <file>]", "PID file", \
"Write the process' PID to the specified file." \
)
#define VUT_GLOBAL_OPT_V \
VOPT("V", "[-V]", "Version", \
"Print version information and exit." \
)
#define VUT_OPT_d \
VOPT("d", "[-d]", "Process old log entries and exit", \
"Process log records at the head of the log and exit." \
)
#define VUT_OPT_g \
VOPT("g:", "[-g <session|request|vxid|raw>]", "Grouping mode (default: vxid)", \
"The grouping of the log records. The default is to group" \
" by vxid." \
)
#define VUT_OPT_h \
VOPT("h", "[-h]", "Usage help", \
"Print program usage and exit" \
)
#define VUT_OPT_k \
VOPT("k:", "[-k <num>]", "Limit transactions", \
"Process this number of matching log transactions before" \
" exiting." \
)
#define VUT_OPT_n \
VOPT("n:", "[-n <dir>]", "varnishd working directory", \
"Specify the varnishd working directory (also known as" \
" instance name) to get logs from. If -n is not specified," \
" the host name is used." \
)
#define VUT_OPT_q \
VOPT("q:", "[-q <query>]", "VSL query", \
"Specifies the VSL query to use." \
)
#define VUT_OPT_r \
VOPT("r:", "[-r <filename>]", "Binary file input", \
"Read log in binary file format from this file. The file" \
" can be created with ``varnishlog -w filename``." \
)
#define VUT_OPT_t \
VOPT("t:", "[-t <seconds|off>]", "VSM connection timeout", \
"Timeout before returning error on initial VSM connection." \
" If set the VSM connection is retried every 0.5 seconds" \
" for this many seconds. If zero the connection is" \
" attempted only once and will fail immediately if" \
" unsuccessful. If set to \"off\", the connection will not" \
" fail, allowing the utility to start and wait" \
" indefinetely for the Varnish instance to appear. " \
" Defaults to 5 seconds." \
)
PK wFZar˖� � miniobj.hnu �[��� /*
* Written by Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* This file is in the public domain.
*
*/
#ifdef HAVE_EXPLICIT_BZERO
# define ZERO_OBJ(to, sz) explicit_bzero(to, sz)
#else
# define ZERO_OBJ(to, sz) (void)memset(to, 0, sz)
#endif
#define INIT_OBJ(to, type_magic) \
do { \
(void)memset(to, 0, sizeof *(to)); \
(to)->magic = (type_magic); \
} while (0)
#define ALLOC_OBJ(to, type_magic) \
do { \
(to) = calloc(1, sizeof *(to)); \
if ((to) != NULL) \
(to)->magic = (type_magic); \
} while (0)
#define FREE_OBJ(to) \
do { \
ZERO_OBJ(&(to)->magic, sizeof (to)->magic); \
free(to); \
to = NULL; \
} while (0)
#define VALID_OBJ(ptr, type_magic) \
((ptr) != NULL && (ptr)->magic == (type_magic))
#define CHECK_OBJ(ptr, type_magic) \
do { \
assert((ptr)->magic == type_magic); \
} while (0)
#define CHECK_OBJ_NOTNULL(ptr, type_magic) \
do { \
assert((ptr) != NULL); \
assert((ptr)->magic == type_magic); \
} while (0)
#define CHECK_OBJ_ORNULL(ptr, type_magic) \
do { \
if ((ptr) != NULL) \
assert((ptr)->magic == type_magic); \
} while (0)
#define CAST_OBJ(to, from, type_magic) \
do { \
(to) = (from); \
if ((to) != NULL) \
CHECK_OBJ((to), (type_magic)); \
} while (0)
#define CAST_OBJ_NOTNULL(to, from, type_magic) \
do { \
(to) = (from); \
AN((to)); \
CHECK_OBJ((to), (type_magic)); \
} while (0)
#define TAKE_OBJ_NOTNULL(to, pfrom, type_magic) \
do { \
AN((pfrom)); \
(to) = *(pfrom); \
*(pfrom) = NULL; \
CHECK_OBJ_NOTNULL((to), (type_magic)); \
} while (0)
#define REPLACE(ptr, val) \
do { \
const char *_vreplace = (val); \
free(ptr); \
if (_vreplace != NULL) { \
ptr = strdup(_vreplace); \
AN((ptr)); \
} else { \
ptr = NULL; \
} \
} while (0)
PK wFZ���� � vsa.hnu �[��� /*-
* Copyright (c) 2013-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifndef VSA_H_INCLUDED
#define VSA_H_INCLUDED
struct suckaddr;
extern const int vsa_suckaddr_len;
extern const struct suckaddr *bogo_ip;
void VSA_Init(void);
int VSA_Sane(const struct suckaddr *);
unsigned VSA_Port(const struct suckaddr *);
int VSA_Compare(const struct suckaddr *, const struct suckaddr *);
int VSA_Compare_IP(const struct suckaddr *, const struct suckaddr *);
struct suckaddr *VSA_Clone(const struct suckaddr *sua);
const void *VSA_Get_Sockaddr(const struct suckaddr *, socklen_t *sl);
int VSA_Get_Proto(const struct suckaddr *);
/*
* 's' is a sockaddr of some kind, 'sal' is its length
*/
struct suckaddr *VSA_Malloc(const void *s, unsigned sal);
/*
* 'd' SHALL point to vsa_suckaddr_len aligned bytes of storage,
* 's' is a sockaddr of some kind, 'sal' is its length.
*/
struct suckaddr *VSA_Build(void *d, const void *s, unsigned sal);
/*
* This VRT interface is for the VCC generated ACL code, which needs
* to know the address family and a pointer to the actual address.
*/
int VSA_GetPtr(const struct suckaddr *sua, const unsigned char ** dst);
#endif
PK wFZWX��5 �5 vrt.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Runtime support for compiled VCL programs and VMODs.
*
* NB: When this file is changed, lib/libvcc/generate.py *MUST* be rerun.
*/
#ifdef CACHE_H_INCLUDED
# error "vrt.h included after cache.h - they are inclusive"
#endif
#ifdef VRT_H_INCLUDED
# error "vrt.h included multiple times"
#endif
#define VRT_H_INCLUDED
#ifndef VDEF_H_INCLUDED
# error "include vdef.h before vrt.h"
#endif
/***********************************************************************
* Major and minor VRT API versions.
*
* Whenever something is added, increment MINOR version
* Whenever something is deleted or changed in a way which is not
* binary/load-time compatible, increment MAJOR version
*
*
* 7.1 (unreleased)
* VRT_Strands() added
* VRT_StrandsWS() added
* VRT_CollectStrands() added
* VRT_STRANDS_string() removed from vrt.h (never implemented)
* 7.0 (2018-03-15)
* lots of stuff moved from cache.h to cache_varnishd.h
* (ie: from "$Abi vrt" to "$Abi strict")
* VCL_INT and VCL_BYTES are always 64 bits.
* path field added to struct vrt_backend
* VRT_Healthy() added
* VRT_VSC_Alloc() added
* VRT_VSC_Destroy() added
* VRT_VSC_Hide() added
* VRT_VSC_Reveal() added
* VRT_VSC_Overhead() added
* struct director.event added
* struct director.destroy added
* VRT_r_beresp_storage_hint() VCL <= 4.0 #2509
* VRT_l_beresp_storage_hint() VCL <= 4.0 #2509
* VRT_blob() added
* VCL_STRANDS added
* 6.1 (2017-09-15 aka 5.2)
* http_CollectHdrSep added
* VRT_purge modified (may fail a transaction, signature changed)
* VRT_r_req_hash() added
* VRT_r_bereq_hash() added
* 6.0 (2017-03-15):
* VRT_hit_for_pass added
* VRT_ipcmp added
* VRT_Vmod_Init signature changed
* VRT_vcl_lookup removed
* VRT_vcl_get added
* VRT_vcl_rel added
* VRT_fail added
* WS_Reset and WS_Snapshot signatures changed
* WS_Front added
* WS_ReserveLumps added
* WS_Inside added
* WS_Assert_Allocated added
* 5.0:
* Varnish 5.0 release "better safe than sorry" bump
* 4.0:
* VCL_BYTES changed to long long
* VRT_CacheReqBody changed signature
* 3.2:
* vrt_backend grew .proxy_header field
* vrt_ctx grew .sp field.
* vrt_acl type added
*/
#define VRT_MAJOR_VERSION 7U
#define VRT_MINOR_VERSION 1U
/***********************************************************************/
#include <stddef.h> // NULL, size_t
#include <stdint.h> // [u]int%d_t
struct VCL_conf;
struct busyobj;
struct director;
struct http;
struct req;
struct stevedore;
struct suckaddr;
struct vcl;
struct vmod;
struct vmod_priv;
struct vrt_acl;
struct vsb;
struct vsc_seg;
struct vsmw_cluster;
struct vsl_log;
struct ws;
struct VSC_main;
struct strands {
int n;
const char **p;
};
/***********************************************************************
* This is the central definition of the mapping from VCL types to
* C-types. The python scripts read these from here.
* (alphabetic order)
*/
typedef const struct vrt_acl * VCL_ACL;
typedef const struct director * VCL_BACKEND;
typedef const struct vmod_priv * VCL_BLOB;
typedef const char * VCL_BODY;
typedef unsigned VCL_BOOL;
typedef int64_t VCL_BYTES;
typedef vtim_dur VCL_DURATION;
typedef const char * VCL_ENUM;
typedef const struct gethdr_s * VCL_HEADER;
typedef struct http * VCL_HTTP;
typedef void VCL_INSTANCE;
typedef int64_t VCL_INT;
typedef const struct suckaddr * VCL_IP;
typedef const struct vrt_backend_probe * VCL_PROBE;
typedef double VCL_REAL;
typedef const struct stevedore * VCL_STEVEDORE;
typedef const struct strands * VCL_STRANDS;
typedef const char * VCL_STRING;
typedef vtim_real VCL_TIME;
typedef struct vcl * VCL_VCL;
typedef void VCL_VOID;
struct vrt_type {
unsigned magic;
#define VRT_TYPE_MAGIC 0xa943bc32
const char *lname;
const char *uname;
const char *ctype;
size_t szof;
};
/***********************************************************************
* This is the composite argument we pass to compiled VCL and VRT
* functions.
*/
struct vrt_ctx {
unsigned magic;
#define VRT_CTX_MAGIC 0x6bb8f0db
unsigned syntax;
unsigned method;
unsigned *handling; // not in director context
unsigned vclver;
struct vsb *msg; // Only in ...init()
struct vsl_log *vsl;
struct vcl *vcl;
struct ws *ws;
struct sess *sp;
struct req *req;
struct http *http_req;
struct http *http_req_top;
struct http *http_resp;
struct busyobj *bo;
struct http *http_bereq;
struct http *http_beresp;
vtim_real now;
/*
* method specific argument:
* hash: struct VSHA256Context
* synth+error: struct vsb *
*/
void *specific;
};
#define VRT_CTX const struct vrt_ctx *ctx
/***********************************************************************
* This is the interface structure to a compiled VMOD
*/
struct vmod_data {
/* The version/id fields must be first, they protect the rest */
unsigned vrt_major;
unsigned vrt_minor;
const char *file_id;
const char *name;
const void *func;
int func_len;
const char *proto;
const char *json;
const char *abi;
};
/***********************************************************************
* Enum for events sent to compiled VCL and from there to Vmods
*/
enum vcl_event_e {
VCL_EVENT_LOAD,
VCL_EVENT_WARM,
VCL_EVENT_COLD,
VCL_EVENT_DISCARD,
};
/***********************************************************************/
extern const void * const vrt_magic_string_end;
extern const void * const vrt_magic_string_unset;
/***********************************************************************
* We want the VCC to spit this structs out as const, but when VMODs
* come up with them we want to clone them into malloc'ed space which
* we can free again.
* We collect all the knowledge here by macroizing the fields and make
* a macro for handling them all.
* See also: cache_backend.h & cache_backend_cfg.c
* One of those things...
*/
#define VRT_BACKEND_FIELDS(rigid) \
rigid char *vcl_name; \
rigid char *ipv4_addr; \
rigid char *ipv6_addr; \
rigid char *port; \
rigid char *path; \
rigid char *hosthdr; \
vtim_dur connect_timeout; \
vtim_dur first_byte_timeout; \
vtim_dur between_bytes_timeout; \
unsigned max_connections; \
unsigned proxy_header;
#define VRT_BACKEND_HANDLE() \
do { \
DA(vcl_name); \
DA(ipv4_addr); \
DA(ipv6_addr); \
DA(port); \
DA(path); \
DA(hosthdr); \
DN(connect_timeout); \
DN(first_byte_timeout); \
DN(between_bytes_timeout); \
DN(max_connections); \
DN(proxy_header); \
} while(0)
struct vrt_backend {
unsigned magic;
#define VRT_BACKEND_MAGIC 0x4799ce6b
VRT_BACKEND_FIELDS(const)
const struct suckaddr *ipv4_suckaddr;
const struct suckaddr *ipv6_suckaddr;
const struct vrt_backend_probe *probe;
};
#define VRT_BACKEND_PROBE_FIELDS(rigid) \
vtim_dur timeout; \
vtim_dur interval; \
unsigned exp_status; \
unsigned window; \
unsigned threshold; \
unsigned initial;
#define VRT_BACKEND_PROBE_HANDLE() \
do { \
DN(timeout); \
DN(interval); \
DN(exp_status); \
DN(window); \
DN(threshold); \
DN(initial); \
} while (0)
struct vrt_backend_probe {
unsigned magic;
#define VRT_BACKEND_PROBE_MAGIC 0x84998490
const char *url;
const char *request;
VRT_BACKEND_PROBE_FIELDS(const)
};
/***********************************************************************
* VRT_count() refers to this structure for coordinates into the VCL source.
*/
struct vrt_ref {
unsigned source;
unsigned offset;
unsigned line;
unsigned pos;
const char *token;
};
void VRT_count(VRT_CTX, unsigned);
/***********************************************************************
* Implementation details of ACLs
*/
typedef int acl_match_f(VRT_CTX, const VCL_IP);
struct vrt_acl {
unsigned magic;
#define VRT_ACL_MAGIC 0x78329d96
acl_match_f *match;
};
void VRT_acl_log(VRT_CTX, const char *);
int VRT_acl_match(VRT_CTX, VCL_ACL, VCL_IP);
/***********************************************************************
* Compile time regexp
*/
void VRT_re_init(void **, const char *);
void VRT_re_fini(void *);
int VRT_re_match(VRT_CTX, const char *, void *);
/***********************************************************************
* Getting hold of the various struct http
*/
enum gethdr_e {
HDR_REQ,
HDR_REQ_TOP,
HDR_RESP,
HDR_OBJ,
HDR_BEREQ,
HDR_BERESP
};
struct gethdr_s {
enum gethdr_e where;
const char *what;
};
VCL_HTTP VRT_selecthttp(VRT_CTX, enum gethdr_e);
VCL_STRING VRT_GetHdr(VRT_CTX, const struct gethdr_s *);
/***********************************************************************
* req related
*/
VCL_BYTES VRT_CacheReqBody(VRT_CTX, VCL_BYTES maxsize);
/* Regexp related */
const char *VRT_regsub(VRT_CTX, int all, const char *, void *, const char *);
VCL_VOID VRT_ban_string(VRT_CTX, VCL_STRING);
VCL_INT VRT_purge(VRT_CTX, VCL_DURATION, VCL_DURATION, VCL_DURATION);
VCL_VOID VRT_synth(VRT_CTX, VCL_INT, VCL_STRING);
VCL_VOID VRT_hit_for_pass(VRT_CTX, VCL_DURATION);
VCL_VOID VRT_SetHdr(VRT_CTX, const struct gethdr_s *, const char *, ...);
VCL_VOID VRT_handling(VRT_CTX, unsigned hand);
VCL_VOID VRT_fail(VRT_CTX, const char *fmt, ...) v_printflike_(2,3);
VCL_VOID VRT_hashdata(VRT_CTX, const char *str, ...);
/* Simple stuff */
int VRT_strcmp(const char *s1, const char *s2);
void VRT_memmove(void *dst, const void *src, unsigned len);
VCL_BOOL VRT_ipcmp(VCL_IP, VCL_IP);
VCL_BLOB VRT_blob(VRT_CTX, const char *, const void *, size_t);
VCL_VOID VRT_Rollback(VRT_CTX, VCL_HTTP);
/* Synthetic pages */
VCL_VOID VRT_synth_page(VRT_CTX, const char *, ...);
/* Backend related */
struct director *VRT_new_backend(VRT_CTX, const struct vrt_backend *);
struct director *VRT_new_backend_clustered(VRT_CTX,
struct vsmw_cluster *, const struct vrt_backend *);
size_t VRT_backend_vsm_need(VRT_CTX);
void VRT_delete_backend(VRT_CTX, struct director **);
int VRT_backend_healthy(VRT_CTX, struct director *);
/* VSM related */
struct vsmw_cluster *VRT_VSM_Cluster_New(VRT_CTX, size_t);
void VRT_VSM_Cluster_Destroy(VRT_CTX, struct vsmw_cluster **);
/* cache_director.c */
int VRT_Healthy(VRT_CTX, VCL_BACKEND);
/* Suckaddr related */
int VRT_VSA_GetPtr(const struct suckaddr *sua, const unsigned char ** dst);
/* VMOD/Modules related */
int VRT_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
const char *nm, const char *path, const char *file_id, const char *backup);
void VRT_Vmod_Unload(VRT_CTX, struct vmod **hdl);
/* VCL program related */
VCL_VCL VRT_vcl_get(VRT_CTX, const char *);
void VRT_vcl_rel(VRT_CTX, VCL_VCL);
void VRT_vcl_select(VRT_CTX, VCL_VCL);
typedef int vmod_event_f(VRT_CTX, struct vmod_priv *, enum vcl_event_e);
typedef void vmod_priv_free_f(void *);
struct vmod_priv {
void *priv;
int len;
vmod_priv_free_f *free;
};
struct vclref;
struct vclref * VRT_ref_vcl(VRT_CTX, const char *);
void VRT_rel_vcl(VRT_CTX, struct vclref **);
void VRT_priv_fini(const struct vmod_priv *p);
struct vmod_priv *VRT_priv_task(VRT_CTX, const void *vmod_id);
struct vmod_priv *VRT_priv_top(VRT_CTX, const void *vmod_id);
/* Stevedore related functions */
int VRT_Stv(const char *nm);
VCL_STEVEDORE VRT_stevedore(const char *nm);
/* Convert things to string */
VCL_STRANDS VRT_BundleStrands(int, struct strands *, char const **,
const char *f, ...);
int VRT_CompareStrands(VCL_STRANDS a, VCL_STRANDS b);
char *VRT_Strands(char *, size_t, VCL_STRANDS);
VCL_STRING VRT_StrandsWS(struct ws *, const char *, VCL_STRANDS);
VCL_STRING VRT_CollectStrands(VRT_CTX, VCL_STRANDS);
VCL_STRING VRT_BACKEND_string(VCL_BACKEND);
VCL_STRING VRT_BOOL_string(VCL_BOOL);
VCL_STRING VRT_CollectString(VRT_CTX, const char *p, ...);
VCL_STRING VRT_INT_string(VRT_CTX, VCL_INT);
VCL_STRING VRT_IP_string(VRT_CTX, VCL_IP);
VCL_STRING VRT_REAL_string(VRT_CTX, VCL_REAL);
VCL_STRING VRT_STEVEDORE_string(VCL_STEVEDORE);
VCL_STRING VRT_TIME_string(VRT_CTX, VCL_TIME);
#ifdef va_start // XXX: hackish
void *VRT_VSC_Alloc(struct vsmw_cluster *, struct vsc_seg **,
const char *, size_t, const unsigned char *, size_t, const char *, va_list);
#endif
void VRT_VSC_Destroy(const char *, struct vsc_seg *);
void VRT_VSC_Hide(const struct vsc_seg *);
void VRT_VSC_Reveal(const struct vsc_seg *);
size_t VRT_VSC_Overhead(size_t);
PK wFZ�v-u� � vrt_obj.hnu �[��� /*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run lib/libvcc/generate.py instead.
*/
VCL_IP VRT_r_local_ip(VRT_CTX);
VCL_STRING VRT_r_local_endpoint(VRT_CTX);
VCL_STRING VRT_r_local_socket(VRT_CTX);
VCL_IP VRT_r_remote_ip(VRT_CTX);
VCL_IP VRT_r_client_ip(VRT_CTX);
VCL_STRING VRT_r_client_identity(VRT_CTX);
void VRT_l_client_identity(VRT_CTX, const char *, ...);
VCL_IP VRT_r_server_ip(VRT_CTX);
VCL_STRING VRT_r_server_hostname(VRT_CTX);
VCL_STRING VRT_r_server_identity(VRT_CTX);
VCL_HTTP VRT_r_req(VRT_CTX);
VCL_STRING VRT_r_req_method(VRT_CTX);
void VRT_l_req_method(VRT_CTX, const char *, ...);
VCL_BLOB VRT_r_req_hash(VRT_CTX);
VCL_STRING VRT_r_req_url(VRT_CTX);
void VRT_l_req_url(VRT_CTX, const char *, ...);
VCL_STRING VRT_r_req_proto(VRT_CTX);
void VRT_l_req_proto(VRT_CTX, const char *, ...);
void VRT_u_req_http_(VRT_CTX);
VCL_INT VRT_r_req_restarts(VRT_CTX);
VCL_STEVEDORE VRT_r_req_storage(VRT_CTX);
void VRT_l_req_storage(VRT_CTX, VCL_STEVEDORE);
VCL_INT VRT_r_req_esi_level(VRT_CTX);
VCL_DURATION VRT_r_req_ttl(VRT_CTX);
void VRT_l_req_ttl(VRT_CTX, VCL_DURATION);
VCL_DURATION VRT_r_req_grace(VRT_CTX);
void VRT_l_req_grace(VRT_CTX, VCL_DURATION);
VCL_STRING VRT_r_req_xid(VRT_CTX);
VCL_BOOL VRT_r_req_esi(VRT_CTX);
void VRT_l_req_esi(VRT_CTX, VCL_BOOL);
VCL_BOOL VRT_r_req_can_gzip(VRT_CTX);
VCL_BACKEND VRT_r_req_backend_hint(VRT_CTX);
void VRT_l_req_backend_hint(VRT_CTX, VCL_BACKEND);
VCL_BOOL VRT_r_req_hash_ignore_busy(VRT_CTX);
void VRT_l_req_hash_ignore_busy(VRT_CTX, VCL_BOOL);
VCL_BOOL VRT_r_req_hash_always_miss(VRT_CTX);
void VRT_l_req_hash_always_miss(VRT_CTX, VCL_BOOL);
VCL_BOOL VRT_r_req_is_hitmiss(VRT_CTX);
VCL_BOOL VRT_r_req_is_hitpass(VRT_CTX);
VCL_STRING VRT_r_req_top_method(VRT_CTX);
VCL_STRING VRT_r_req_top_url(VRT_CTX);
VCL_STRING VRT_r_req_top_proto(VRT_CTX);
VCL_HTTP VRT_r_bereq(VRT_CTX);
VCL_STRING VRT_r_bereq_xid(VRT_CTX);
VCL_INT VRT_r_bereq_retries(VRT_CTX);
VCL_BACKEND VRT_r_bereq_backend(VRT_CTX);
void VRT_l_bereq_backend(VRT_CTX, VCL_BACKEND);
void VRT_u_bereq_body(VRT_CTX);
VCL_BLOB VRT_r_bereq_hash(VRT_CTX);
VCL_STRING VRT_r_bereq_method(VRT_CTX);
void VRT_l_bereq_method(VRT_CTX, const char *, ...);
VCL_STRING VRT_r_bereq_url(VRT_CTX);
void VRT_l_bereq_url(VRT_CTX, const char *, ...);
VCL_STRING VRT_r_bereq_proto(VRT_CTX);
void VRT_l_bereq_proto(VRT_CTX, const char *, ...);
void VRT_u_bereq_http_(VRT_CTX);
VCL_BOOL VRT_r_bereq_uncacheable(VRT_CTX);
VCL_DURATION VRT_r_bereq_connect_timeout(VRT_CTX);
void VRT_l_bereq_connect_timeout(VRT_CTX, VCL_DURATION);
VCL_DURATION VRT_r_bereq_first_byte_timeout(VRT_CTX);
void VRT_l_bereq_first_byte_timeout(VRT_CTX, VCL_DURATION);
VCL_DURATION VRT_r_bereq_between_bytes_timeout(VRT_CTX);
void VRT_l_bereq_between_bytes_timeout(VRT_CTX, VCL_DURATION);
VCL_BOOL VRT_r_bereq_is_bgfetch(VRT_CTX);
VCL_HTTP VRT_r_beresp(VRT_CTX);
void VRT_l_beresp_body(VRT_CTX, const char *, ...);
VCL_STRING VRT_r_beresp_proto(VRT_CTX);
void VRT_l_beresp_proto(VRT_CTX, const char *, ...);
VCL_INT VRT_r_beresp_status(VRT_CTX);
void VRT_l_beresp_status(VRT_CTX, VCL_INT);
VCL_STRING VRT_r_beresp_reason(VRT_CTX);
void VRT_l_beresp_reason(VRT_CTX, const char *, ...);
void VRT_u_beresp_http_(VRT_CTX);
VCL_BOOL VRT_r_beresp_do_esi(VRT_CTX);
void VRT_l_beresp_do_esi(VRT_CTX, VCL_BOOL);
VCL_BOOL VRT_r_beresp_do_stream(VRT_CTX);
void VRT_l_beresp_do_stream(VRT_CTX, VCL_BOOL);
VCL_BOOL VRT_r_beresp_do_gzip(VRT_CTX);
void VRT_l_beresp_do_gzip(VRT_CTX, VCL_BOOL);
VCL_BOOL VRT_r_beresp_do_gunzip(VRT_CTX);
void VRT_l_beresp_do_gunzip(VRT_CTX, VCL_BOOL);
VCL_BOOL VRT_r_beresp_was_304(VRT_CTX);
VCL_BOOL VRT_r_beresp_uncacheable(VRT_CTX);
void VRT_l_beresp_uncacheable(VRT_CTX, VCL_BOOL);
VCL_DURATION VRT_r_beresp_ttl(VRT_CTX);
void VRT_l_beresp_ttl(VRT_CTX, VCL_DURATION);
VCL_DURATION VRT_r_beresp_age(VRT_CTX);
VCL_DURATION VRT_r_beresp_grace(VRT_CTX);
void VRT_l_beresp_grace(VRT_CTX, VCL_DURATION);
VCL_DURATION VRT_r_beresp_keep(VRT_CTX);
void VRT_l_beresp_keep(VRT_CTX, VCL_DURATION);
VCL_BACKEND VRT_r_beresp_backend(VRT_CTX);
VCL_STRING VRT_r_beresp_backend_name(VRT_CTX);
VCL_IP VRT_r_beresp_backend_ip(VRT_CTX);
VCL_STEVEDORE VRT_r_beresp_storage(VRT_CTX);
void VRT_l_beresp_storage(VRT_CTX, VCL_STEVEDORE);
VCL_STRING VRT_r_beresp_storage_hint(VRT_CTX);
void VRT_l_beresp_storage_hint(VRT_CTX, const char *, ...);
VCL_STRING VRT_r_obj_proto(VRT_CTX);
VCL_INT VRT_r_obj_status(VRT_CTX);
VCL_STRING VRT_r_obj_reason(VRT_CTX);
VCL_INT VRT_r_obj_hits(VRT_CTX);
VCL_DURATION VRT_r_obj_ttl(VRT_CTX);
VCL_DURATION VRT_r_obj_age(VRT_CTX);
VCL_DURATION VRT_r_obj_grace(VRT_CTX);
VCL_DURATION VRT_r_obj_keep(VRT_CTX);
VCL_BOOL VRT_r_obj_uncacheable(VRT_CTX);
VCL_STEVEDORE VRT_r_obj_storage(VRT_CTX);
VCL_HTTP VRT_r_resp(VRT_CTX);
void VRT_l_resp_body(VRT_CTX, const char *, ...);
VCL_STRING VRT_r_resp_proto(VRT_CTX);
void VRT_l_resp_proto(VRT_CTX, const char *, ...);
VCL_INT VRT_r_resp_status(VRT_CTX);
void VRT_l_resp_status(VRT_CTX, VCL_INT);
VCL_STRING VRT_r_resp_reason(VRT_CTX);
void VRT_l_resp_reason(VRT_CTX, const char *, ...);
void VRT_u_resp_http_(VRT_CTX);
VCL_BOOL VRT_r_resp_do_esi(VRT_CTX);
void VRT_l_resp_do_esi(VRT_CTX, VCL_BOOL);
VCL_BOOL VRT_r_resp_is_streaming(VRT_CTX);
VCL_TIME VRT_r_now(VRT_CTX);
VCL_DURATION VRT_r_sess_timeout_idle(VRT_CTX);
void VRT_l_sess_timeout_idle(VRT_CTX, VCL_DURATION);
VCL_STRING VRT_r_sess_xid(VRT_CTX);
int64_t VRT_Stv_free_space(const char *);
int64_t VRT_Stv_used_space(const char *);
unsigned VRT_Stv_happy(const char *);
PK wFZ"sݬ�M �M vqueue.hnu �[��� /*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
* $FreeBSD: head/sys/sys/queue.h 251887 2013-06-18 02:57:56Z lstewart $
*/
#ifndef VARNISH_QUEUE_H
#define VARNISH_QUEUE_H
/*
* This file defines four types of data structures: singly-linked lists,
* singly-linked tail queues, lists and tail queues.
*
* A singly-linked list is headed by a single forward pointer. The elements
* are singly linked for minimum space and pointer manipulation overhead at
* the expense of O(n) removal for arbitrary elements. New elements can be
* added to the list after an existing element or at the head of the list.
* Elements being removed from the head of the list should use the explicit
* macro for this purpose for optimum efficiency. A singly-linked list may
* only be traversed in the forward direction. Singly-linked lists are ideal
* for applications with large datasets and few or no removals or for
* implementing a LIFO queue.
*
* A singly-linked tail queue is headed by a pair of pointers, one to the
* head of the list and the other to the tail of the list. The elements are
* singly linked for minimum space and pointer manipulation overhead at the
* expense of O(n) removal for arbitrary elements. New elements can be added
* to the list after an existing element, at the head of the list, or at the
* end of the list. Elements being removed from the head of the tail queue
* should use the explicit macro for this purpose for optimum efficiency.
* A singly-linked tail queue may only be traversed in the forward direction.
* Singly-linked tail queues are ideal for applications with large datasets
* and few or no removals or for implementing a FIFO queue.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
* so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before
* or after an existing element or at the head of the list. A list
* may be traversed in either direction.
*
* A tail queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or
* after an existing element, at the head of the list, or at the end of
* the list. A tail queue may be traversed in either direction.
*
* For details on the use of these macros, see the queue(3) manual page.
*
*
* VSLIST VLIST VSTAILQ VTAILQ
* _HEAD + + + +
* _HEAD_INITIALIZER + + + +
* _ENTRY + + + +
* _INIT + + + +
* _EMPTY + + + +
* _FIRST + + + +
* _NEXT + + + +
* _PREV - + - +
* _LAST - - + +
* _FOREACH + + + +
* _FOREACH_FROM + + + +
* _FOREACH_SAFE + + + +
* _FOREACH_FROM_SAFE + + + +
* _FOREACH_REVERSE - - - +
* _FOREACH_REVERSE_FROM - - - +
* _FOREACH_REVERSE_SAFE - - - +
* _FOREACH_REVERSE_FROM_SAFE - - - +
* _INSERT_HEAD + + + +
* _INSERT_BEFORE - + - +
* _INSERT_AFTER + + + +
* _INSERT_TAIL - - + +
* _CONCAT - - + +
* _REMOVE_AFTER + - + -
* _REMOVE_HEAD + - + -
* _REMOVE + + + +
* _SWAP + + + +
*
*/
#define TRACEBUF
#define TRACEBUF_INITIALIZER
#define TRASHIT(x)
/*
* Singly-linked List declarations.
*/
#define VSLIST_HEAD(name, type) \
struct name { \
struct type *vslh_first; /* first element */ \
}
#define VSLIST_HEAD_INITIALIZER(head) \
{ NULL }
#define VSLIST_ENTRY(type) \
struct { \
struct type *vsle_next; /* next element */ \
}
/*
* Singly-linked List functions.
*/
#define VSLIST_EMPTY(head) ((head)->vslh_first == NULL)
#define VSLIST_FIRST(head) ((head)->vslh_first)
#define VSLIST_FOREACH(var, head, field) \
for ((var) = VSLIST_FIRST((head)); \
(var); \
(var) = VSLIST_NEXT((var), field))
#define VSLIST_FOREACH_FROM(var, head, field) \
for ((var) = ((var) ? (var) : VSLIST_FIRST((head))); \
(var); \
(var) = VSLIST_NEXT((var), field))
#define VSLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = VSLIST_FIRST((head)); \
(var) && ((tvar) = VSLIST_NEXT((var), field), 1); \
(var) = (tvar))
#define VSLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
for ((var) = ((var) ? (var) : VSLIST_FIRST((head))); \
(var) && ((tvar) = VSLIST_NEXT((var), field), 1); \
(var) = (tvar))
#define VSLIST_FOREACH_PREVPTR(var, varp, head, field) \
for ((varp) = &VSLIST_FIRST((head)); \
((var) = *(varp)) != NULL; \
(varp) = &VSLIST_NEXT((var), field))
#define VSLIST_INIT(head) do { \
VSLIST_FIRST((head)) = NULL; \
} while (0)
#define VSLIST_INSERT_AFTER(slistelm, elm, field) do { \
VSLIST_NEXT((elm), field) = VSLIST_NEXT((slistelm), field); \
VSLIST_NEXT((slistelm), field) = (elm); \
} while (0)
#define VSLIST_INSERT_HEAD(head, elm, field) do { \
VSLIST_NEXT((elm), field) = VSLIST_FIRST((head)); \
VSLIST_FIRST((head)) = (elm); \
} while (0)
#define VSLIST_NEXT(elm, field) ((elm)->field.vsle_next)
#define VSLIST_REMOVE(head, elm, type, field) do { \
if (VSLIST_FIRST((head)) == (elm)) { \
VSLIST_REMOVE_HEAD((head), field); \
} \
else { \
struct type *curelm = VSLIST_FIRST((head)); \
while (VSLIST_NEXT(curelm, field) != (elm)) \
curelm = VSLIST_NEXT(curelm, field); \
VSLIST_REMOVE_AFTER(curelm, field); \
} \
TRASHIT(*oldnext); \
} while (0)
#define VSLIST_REMOVE_AFTER(elm, field) do { \
VSLIST_NEXT(elm, field) = \
VSLIST_NEXT(VSLIST_NEXT(elm, field), field); \
} while (0)
#define VSLIST_REMOVE_HEAD(head, field) do { \
VSLIST_FIRST((head)) = VSLIST_NEXT(VSLIST_FIRST((head)), field);\
} while (0)
#define VSLIST_SWAP(head1, head2, type) do { \
struct type *swap_first = VSLIST_FIRST(head1); \
VSLIST_FIRST(head1) = VSLIST_FIRST(head2); \
VSLIST_FIRST(head2) = swap_first; \
} while (0)
/*
* Singly-linked Tail queue declarations.
*/
#define VSTAILQ_HEAD(name, type) \
struct name { \
struct type *vstqh_first;/* first element */ \
struct type **vstqh_last;/* addr of last next element */ \
}
#define VSTAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).vstqh_first }
#define VSTAILQ_ENTRY(type) \
struct { \
struct type *vstqe_next; /* next element */ \
}
/*
* Singly-linked Tail queue functions.
*/
#define VSTAILQ_CONCAT(head1, head2) do { \
if (!VSTAILQ_EMPTY((head2))) { \
*(head1)->vstqh_last = (head2)->vstqh_first; \
(head1)->vstqh_last = (head2)->vstqh_last; \
VSTAILQ_INIT((head2)); \
} \
} while (0)
#define VSTAILQ_EMPTY(head) ((head)->vstqh_first == NULL)
#define VSTAILQ_FIRST(head) ((head)->vstqh_first)
#define VSTAILQ_FOREACH(var, head, field) \
for ((var) = VSTAILQ_FIRST((head)); \
(var); \
(var) = VSTAILQ_NEXT((var), field))
#define VSTAILQ_FOREACH_FROM(var, head, field) \
for ((var) = ((var) ? (var) : VSTAILQ_FIRST((head))); \
(var); \
(var) = VSTAILQ_NEXT((var), field))
#define VSTAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = VSTAILQ_FIRST((head)); \
(var) && ((tvar) = VSTAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#define VSTAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
for ((var) = ((var) ? (var) : VSTAILQ_FIRST((head))); \
(var) && ((tvar) = VSTAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#define VSTAILQ_INIT(head) do { \
VSTAILQ_FIRST((head)) = NULL; \
(head)->vstqh_last = &VSTAILQ_FIRST((head)); \
} while (0)
#define VSTAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
if ((VSTAILQ_NEXT((elm), field) = VSTAILQ_NEXT((tqelm), field)) == NULL)\
(head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \
VSTAILQ_NEXT((tqelm), field) = (elm); \
} while (0)
#define VSTAILQ_INSERT_HEAD(head, elm, field) do { \
if ((VSTAILQ_NEXT((elm), field) = VSTAILQ_FIRST((head))) == NULL)\
(head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \
VSTAILQ_FIRST((head)) = (elm); \
} while (0)
#define VSTAILQ_INSERT_TAIL(head, elm, field) do { \
VSTAILQ_NEXT((elm), field) = NULL; \
*(head)->vstqh_last = (elm); \
(head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \
} while (0)
#define VSTAILQ_LAST(head, type, field) \
(VSTAILQ_EMPTY((head)) ? NULL : \
__containerof((head)->vstqh_last, struct type, field.vstqe_next))
#define VSTAILQ_NEXT(elm, field) ((elm)->field.vstqe_next)
#define VSTAILQ_REMOVE(head, elm, type, field) do { \
if (VSTAILQ_FIRST((head)) == (elm)) { \
VSTAILQ_REMOVE_HEAD((head), field); \
} \
else { \
struct type *curelm = VSTAILQ_FIRST((head)); \
while (VSTAILQ_NEXT(curelm, field) != (elm)) \
curelm = VSTAILQ_NEXT(curelm, field); \
VSTAILQ_REMOVE_AFTER(head, curelm, field); \
} \
TRASHIT(*oldnext); \
} while (0)
#define VSTAILQ_REMOVE_AFTER(head, elm, field) do { \
if ((VSTAILQ_NEXT(elm, field) = \
VSTAILQ_NEXT(VSTAILQ_NEXT(elm, field), field)) == NULL) \
(head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \
} while (0)
#define VSTAILQ_REMOVE_HEAD(head, field) do { \
if ((VSTAILQ_FIRST((head)) = \
VSTAILQ_NEXT(VSTAILQ_FIRST((head)), field)) == NULL) \
(head)->vstqh_last = &VSTAILQ_FIRST((head)); \
} while (0)
#define VSTAILQ_SWAP(head1, head2, type) do { \
struct type *swap_first = VSTAILQ_FIRST(head1); \
struct type **swap_last = (head1)->vstqh_last; \
VSTAILQ_FIRST(head1) = VSTAILQ_FIRST(head2); \
(head1)->vstqh_last = (head2)->vstqh_last; \
VSTAILQ_FIRST(head2) = swap_first; \
(head2)->vstqh_last = swap_last; \
if (VSTAILQ_EMPTY(head1)) \
(head1)->vstqh_last = &VSTAILQ_FIRST(head1); \
if (VSTAILQ_EMPTY(head2)) \
(head2)->vstqh_last = &VSTAILQ_FIRST(head2); \
} while (0)
/*
* List declarations.
*/
#define VLIST_HEAD(name, type) \
struct name { \
struct type *vlh_first; /* first element */ \
}
#define VLIST_HEAD_INITIALIZER(head) \
{ NULL }
#define VLIST_ENTRY(type) \
struct { \
struct type *vle_next; /* next element */ \
struct type **vle_prev; /* address of previous next element */ \
}
/*
* List functions.
*/
#define VLIST_EMPTY(head) ((head)->vlh_first == NULL)
#define VLIST_FIRST(head) ((head)->vlh_first)
#define VLIST_FOREACH(var, head, field) \
for ((var) = VLIST_FIRST((head)); \
(var); \
(var) = VLIST_NEXT((var), field))
#define VLIST_FOREACH_FROM(var, head, field) \
for ((var) = ((var) ? (var) : VLIST_FIRST((head))); \
(var); \
(var) = VLIST_NEXT((var), field))
#define VLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = VLIST_FIRST((head)); \
(var) && ((tvar) = VLIST_NEXT((var), field), 1); \
(var) = (tvar))
#define VLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
for ((var) = ((var) ? (var) : VLIST_FIRST((head))); \
(var) && ((tvar) = VLIST_NEXT((var), field), 1); \
(var) = (tvar))
#define VLIST_INIT(head) do { \
VLIST_FIRST((head)) = NULL; \
} while (0)
#define VLIST_INSERT_AFTER(listelm, elm, field) do { \
if ((VLIST_NEXT((elm), field) = VLIST_NEXT((listelm), field)) != NULL)\
VLIST_NEXT((listelm), field)->field.vle_prev = \
&VLIST_NEXT((elm), field); \
VLIST_NEXT((listelm), field) = (elm); \
(elm)->field.vle_prev = &VLIST_NEXT((listelm), field); \
} while (0)
#define VLIST_INSERT_BEFORE(listelm, elm, field) do { \
(elm)->field.vle_prev = (listelm)->field.vle_prev; \
VLIST_NEXT((elm), field) = (listelm); \
*(listelm)->field.vle_prev = (elm); \
(listelm)->field.vle_prev = &VLIST_NEXT((elm), field); \
} while (0)
#define VLIST_INSERT_HEAD(head, elm, field) do { \
if ((VLIST_NEXT((elm), field) = VLIST_FIRST((head))) != NULL) \
VLIST_FIRST((head))->field.vle_prev = &VLIST_NEXT((elm), field);\
VLIST_FIRST((head)) = (elm); \
(elm)->field.vle_prev = &VLIST_FIRST((head)); \
} while (0)
#define VLIST_NEXT(elm, field) ((elm)->field.vle_next)
#define VLIST_PREV(elm, head, type, field) \
((elm)->field.vle_prev == &VLIST_FIRST((head)) ? NULL : \
__containerof((elm)->field.vle_prev, struct type, field.vle_next))
#define VLIST_REMOVE(elm, field) do { \
if (VLIST_NEXT((elm), field) != NULL) \
VLIST_NEXT((elm), field)->field.vle_prev = \
(elm)->field.vle_prev; \
*(elm)->field.vle_prev = VLIST_NEXT((elm), field); \
TRASHIT(*oldnext); \
TRASHIT(*oldprev); \
} while (0)
#define VLIST_SWAP(head1, head2, type, field) do { \
struct type *swap_tmp = VLIST_FIRST((head1)); \
VLIST_FIRST((head1)) = VLIST_FIRST((head2)); \
VLIST_FIRST((head2)) = swap_tmp; \
if ((swap_tmp = VLIST_FIRST((head1))) != NULL) \
swap_tmp->field.vle_prev = &VLIST_FIRST((head1)); \
if ((swap_tmp = VLIST_FIRST((head2))) != NULL) \
swap_tmp->field.vle_prev = &VLIST_FIRST((head2)); \
} while (0)
/*
* Tail queue declarations.
*/
#define VTAILQ_HEAD(name, type) \
struct name { \
struct type *vtqh_first; /* first element */ \
struct type **vtqh_last; /* addr of last next element */ \
TRACEBUF \
}
#define VTAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).vtqh_first, TRACEBUF_INITIALIZER }
#define VTAILQ_ENTRY(type) \
struct { \
struct type *vtqe_next; /* next element */ \
struct type **vtqe_prev; /* address of previous next element */\
TRACEBUF \
}
/*
* Tail queue functions.
*/
#define VTAILQ_CONCAT(head1, head2, field) do { \
if (!VTAILQ_EMPTY(head2)) { \
*(head1)->vtqh_last = (head2)->vtqh_first; \
(head2)->vtqh_first->field.vtqe_prev = (head1)->vtqh_last;\
(head1)->vtqh_last = (head2)->vtqh_last; \
VTAILQ_INIT((head2)); \
} \
} while (0)
#define VTAILQ_EMPTY(head) ((head)->vtqh_first == NULL)
#define VTAILQ_FIRST(head) ((head)->vtqh_first)
#define VTAILQ_FOREACH(var, head, field) \
for ((var) = VTAILQ_FIRST((head)); \
(var); \
(var) = VTAILQ_NEXT((var), field))
#define VTAILQ_FOREACH_FROM(var, head, field) \
for ((var) = ((var) ? (var) : VTAILQ_FIRST((head))); \
(var); \
(var) = VTAILQ_NEXT((var), field))
#define VTAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = VTAILQ_FIRST((head)); \
(var) && ((tvar) = VTAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#define VTAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
for ((var) = ((var) ? (var) : VTAILQ_FIRST((head))); \
(var) && ((tvar) = VTAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#define VTAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = VTAILQ_LAST((head), headname); \
(var); \
(var) = VTAILQ_PREV((var), headname, field))
#define VTAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \
for ((var) = ((var) ? (var) : VTAILQ_LAST((head), headname)); \
(var); \
(var) = VTAILQ_PREV((var), headname, field))
#define VTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
for ((var) = VTAILQ_LAST((head), headname); \
(var) && ((tvar) = VTAILQ_PREV((var), headname, field), 1); \
(var) = (tvar))
#define VTAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
for ((var) = ((var) ? (var) : VTAILQ_LAST((head), headname)); \
(var) && ((tvar) = VTAILQ_PREV((var), headname, field), 1); \
(var) = (tvar))
#define VTAILQ_INIT(head) do { \
VTAILQ_FIRST((head)) = NULL; \
(head)->vtqh_last = &VTAILQ_FIRST((head)); \
} while (0)
#define VTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
if ((VTAILQ_NEXT((elm), field) = VTAILQ_NEXT((listelm), field)) != NULL)\
VTAILQ_NEXT((elm), field)->field.vtqe_prev = \
&VTAILQ_NEXT((elm), field); \
else { \
(head)->vtqh_last = &VTAILQ_NEXT((elm), field); \
} \
VTAILQ_NEXT((listelm), field) = (elm); \
(elm)->field.vtqe_prev = &VTAILQ_NEXT((listelm), field); \
} while (0)
#define VTAILQ_INSERT_BEFORE(listelm, elm, field) do { \
(elm)->field.vtqe_prev = (listelm)->field.vtqe_prev; \
VTAILQ_NEXT((elm), field) = (listelm); \
*(listelm)->field.vtqe_prev = (elm); \
(listelm)->field.vtqe_prev = &VTAILQ_NEXT((elm), field); \
} while (0)
#define VTAILQ_INSERT_HEAD(head, elm, field) do { \
if ((VTAILQ_NEXT((elm), field) = VTAILQ_FIRST((head))) != NULL) \
VTAILQ_FIRST((head))->field.vtqe_prev = \
&VTAILQ_NEXT((elm), field); \
else \
(head)->vtqh_last = &VTAILQ_NEXT((elm), field); \
VTAILQ_FIRST((head)) = (elm); \
(elm)->field.vtqe_prev = &VTAILQ_FIRST((head)); \
} while (0)
#define VTAILQ_INSERT_TAIL(head, elm, field) do { \
VTAILQ_NEXT((elm), field) = NULL; \
(elm)->field.vtqe_prev = (head)->vtqh_last; \
*(head)->vtqh_last = (elm); \
(head)->vtqh_last = &VTAILQ_NEXT((elm), field); \
} while (0)
#define VTAILQ_LAST(head, headname) \
(*(((struct headname *)((head)->vtqh_last))->vtqh_last))
#define VTAILQ_NEXT(elm, field) ((elm)->field.vtqe_next)
#define VTAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.vtqe_prev))->vtqh_last))
#define VTAILQ_REMOVE(head, elm, field) do { \
if ((VTAILQ_NEXT((elm), field)) != NULL) \
VTAILQ_NEXT((elm), field)->field.vtqe_prev = \
(elm)->field.vtqe_prev; \
else { \
(head)->vtqh_last = (elm)->field.vtqe_prev; \
} \
*(elm)->field.vtqe_prev = VTAILQ_NEXT((elm), field); \
TRASHIT(*oldnext); \
TRASHIT(*oldprev); \
} while (0)
#define VTAILQ_SWAP(head1, head2, type, field) do { \
struct type *swap_first = (head1)->vtqh_first; \
struct type **swap_last = (head1)->vtqh_last; \
(head1)->vtqh_first = (head2)->vtqh_first; \
(head1)->vtqh_last = (head2)->vtqh_last; \
(head2)->vtqh_first = swap_first; \
(head2)->vtqh_last = swap_last; \
if ((swap_first = (head1)->vtqh_first) != NULL) \
swap_first->field.vtqe_prev = &(head1)->vtqh_first; \
else \
(head1)->vtqh_last = &(head1)->vtqh_first; \
if ((swap_first = (head2)->vtqh_first) != NULL) \
swap_first->field.vtqe_prev = &(head2)->vtqh_first; \
else \
(head2)->vtqh_last = &(head2)->vtqh_first; \
} while (0)
#endif /* !VARNISH_QUEUE_H */
PK wFZ�r��� � vav.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
void VAV_Free(char **argv);
char **VAV_Parse(const char *s, int *argc, int flag);
char *VAV_BackSlashDecode(const char *s, const char *e);
int VAV_BackSlash(const char *s, char *res);
#define ARGV_COMMENT (1 << 0)
#define ARGV_COMMA (1 << 1)
#define ARGV_NOESC (1 << 2)
PK wFZ�H vcs.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/* from libvarnish/version.c */
extern const char *VCS_version;
void VCS_Message(const char *);
PK wFZ���R� � vcl.hnu �[��� /*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run lib/libvcc/generate.py instead.
*/
#ifdef VCL_H_INCLUDED
# error "vcl.h included multiple times"
#endif
#define VCL_H_INCLUDED
#ifndef VRT_H_INCLUDED
# error "include vrt.h before vcl.h"
#endif
/* VCL Methods */
#define VCL_MET_RECV (1U << 1)
#define VCL_MET_PIPE (1U << 2)
#define VCL_MET_PASS (1U << 3)
#define VCL_MET_HASH (1U << 4)
#define VCL_MET_PURGE (1U << 5)
#define VCL_MET_MISS (1U << 6)
#define VCL_MET_HIT (1U << 7)
#define VCL_MET_DELIVER (1U << 8)
#define VCL_MET_SYNTH (1U << 9)
#define VCL_MET_BACKEND_FETCH (1U << 10)
#define VCL_MET_BACKEND_RESPONSE (1U << 11)
#define VCL_MET_BACKEND_ERROR (1U << 12)
#define VCL_MET_INIT (1U << 13)
#define VCL_MET_FINI (1U << 14)
#define VCL_MET_MAX 15
#define VCL_MET_MASK 0x7fff
#define VCL_MET_TASK_B ( VCL_MET_BACKEND_FETCH | \
VCL_MET_BACKEND_RESPONSE | \
VCL_MET_BACKEND_ERROR )
#define VCL_MET_TASK_C ( VCL_MET_RECV | \
VCL_MET_PIPE | \
VCL_MET_PASS | \
VCL_MET_HASH | \
VCL_MET_PURGE | \
VCL_MET_MISS | \
VCL_MET_HIT | \
VCL_MET_DELIVER | \
VCL_MET_SYNTH )
#define VCL_MET_TASK_H ( VCL_MET_INIT | \
VCL_MET_FINI )
/* VCL Returns */
#define VCL_RET_ABANDON 1
#define VCL_RET_DELIVER 2
#define VCL_RET_ERROR 3
#define VCL_RET_FAIL 4
#define VCL_RET_FETCH 5
#define VCL_RET_HASH 6
#define VCL_RET_LOOKUP 7
#define VCL_RET_MISS 8
#define VCL_RET_OK 9
#define VCL_RET_PASS 10
#define VCL_RET_PIPE 11
#define VCL_RET_PURGE 12
#define VCL_RET_RESTART 13
#define VCL_RET_RETRY 14
#define VCL_RET_SYNTH 15
#define VCL_RET_VCL 16
#define VCL_RET_MAX 17
/* VCL Types */
extern const struct vrt_type VCL_TYPE_ACL[1];
extern const struct vrt_type VCL_TYPE_BACKEND[1];
extern const struct vrt_type VCL_TYPE_BLOB[1];
extern const struct vrt_type VCL_TYPE_BODY[1];
extern const struct vrt_type VCL_TYPE_BOOL[1];
extern const struct vrt_type VCL_TYPE_BYTES[1];
extern const struct vrt_type VCL_TYPE_DURATION[1];
extern const struct vrt_type VCL_TYPE_ENUM[1];
extern const struct vrt_type VCL_TYPE_HEADER[1];
extern const struct vrt_type VCL_TYPE_HTTP[1];
extern const struct vrt_type VCL_TYPE_INSTANCE[1];
extern const struct vrt_type VCL_TYPE_INT[1];
extern const struct vrt_type VCL_TYPE_IP[1];
extern const struct vrt_type VCL_TYPE_PROBE[1];
extern const struct vrt_type VCL_TYPE_REAL[1];
extern const struct vrt_type VCL_TYPE_STEVEDORE[1];
extern const struct vrt_type VCL_TYPE_STRANDS[1];
extern const struct vrt_type VCL_TYPE_STRING[1];
extern const struct vrt_type VCL_TYPE_STRINGS[1];
extern const struct vrt_type VCL_TYPE_STRING_LIST[1];
extern const struct vrt_type VCL_TYPE_SUB[1];
extern const struct vrt_type VCL_TYPE_TIME[1];
extern const struct vrt_type VCL_TYPE_VCL[1];
extern const struct vrt_type VCL_TYPE_VOID[1];
/* Compiled VCL Interface */
typedef int vcl_event_f(VRT_CTX, enum vcl_event_e);
typedef int vcl_init_f(VRT_CTX);
typedef void vcl_fini_f(VRT_CTX);
typedef void vcl_func_f(VRT_CTX);
struct VCL_conf {
unsigned magic;
#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */
unsigned syntax;
struct director **default_director;
const struct vrt_backend_probe *default_probe;
unsigned nref;
const struct vrt_ref *ref;
unsigned nsrc;
const char **srcname;
const char **srcbody;
unsigned nvmod;
vcl_event_f *event_vcl;
vcl_func_f *recv_func;
vcl_func_f *pipe_func;
vcl_func_f *pass_func;
vcl_func_f *hash_func;
vcl_func_f *purge_func;
vcl_func_f *miss_func;
vcl_func_f *hit_func;
vcl_func_f *deliver_func;
vcl_func_f *synth_func;
vcl_func_f *backend_fetch_func;
vcl_func_f *backend_response_func;
vcl_func_f *backend_error_func;
vcl_func_f *init_func;
vcl_func_f *fini_func;
};
PK wFZ(���� � vre.hnu �[��� /*-
* Copyright (c) 2009 Varnish Software AS
* All rights reserved.
*
* Author: Tollef Fog Heen <tfheen@redpill-linpro.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Regular expression support
*
* We wrap PCRE in VRE to make to make it feasible to use something else
* without hunting down stuff through out the Varnish source code.
*
*/
#ifndef VRE_H_INCLUDED
#define VRE_H_INCLUDED
struct vre;
struct vre_limits {
unsigned match;
unsigned match_recursion;
};
typedef struct vre vre_t;
/* This maps to PCRE error codes */
#define VRE_ERROR_NOMATCH (-1)
/* And those to PCRE options */
extern const unsigned VRE_has_jit;
extern const unsigned VRE_CASELESS;
extern const unsigned VRE_NOTEMPTY;
vre_t *VRE_compile(const char *, unsigned, const char **, int *);
int VRE_exec(const vre_t *code, const char *subject, int length,
int startoffset, int options, int *ovector, int ovecsize,
const volatile struct vre_limits *lim);
void VRE_free(vre_t **);
#endif /* VRE_H_INCLUDED */
PK wFZS�X� � vbm.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2010 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Self-sizeing bitmap operations
*/
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
/**********************************************************************
* Generic bitmap functions
*/
#define VBITMAP_TYPE unsigned /* Our preferred wordsize */
#define VBITMAP_LUMP (1024) /* How many bits we alloc at a time */
#define VBITMAP_WORD (sizeof(VBITMAP_TYPE) * 8)
#define VBITMAP_IDX(n) ((n) / VBITMAP_WORD)
#define VBITMAP_BIT(n) (1U << ((n) % VBITMAP_WORD))
static inline unsigned
vbit_rndup(unsigned bit, unsigned to)
{
bit += to - 1;
bit -= (bit % to);
return (bit);
}
struct vbitmap {
unsigned flags;
#define VBITMAP_FL_MALLOC 1 /* struct vbitmap is malloced */
#define VBITMAP_FL_MALLOC_BITS (1<<1) /* bits space is malloced */
VBITMAP_TYPE *bits;
unsigned nbits;
};
static inline void
vbit_expand(struct vbitmap *vb, unsigned bit)
{
unsigned char *p;
bit = vbit_rndup(bit, VBITMAP_LUMP);
assert(bit > vb->nbits);
if (vb->flags & VBITMAP_FL_MALLOC_BITS) {
p = realloc(vb->bits, bit / 8);
assert(p != NULL);
} else {
p = malloc(bit / 8);
assert(p != NULL);
if (vb->nbits > 0)
memcpy(p, vb->bits, vb->nbits / 8);
}
memset(p + vb->nbits / 8, 0, (bit - vb->nbits) / 8);
vb->flags |= VBITMAP_FL_MALLOC_BITS;
vb->bits = (void*)p;
vb->nbits = bit;
}
#define VBITMAP_SZ(b) (sizeof(struct vbitmap) + \
vbit_rndup(b, VBITMAP_WORD))
/*
* init from some extent of memory (e.g. workspace) which the caller must
* manage. Returns a vbitmap with as many bits as fit into sz in VBITMAP_WORD
* chunks.
*
* use VBITMAP_SZ to calculate sz
*/
static inline struct vbitmap *
vbit_init(void *p, size_t sz)
{
struct vbitmap *vb;
if (sz < sizeof(*vb))
return NULL;
memset(p, 0, sz);
vb = p;
p = (char *)p + sizeof(*vb);
sz -= sizeof(*vb);
vb->nbits = (sz / VBITMAP_WORD) * VBITMAP_WORD;
if (vb->nbits)
vb->bits = p;
return (vb);
}
/* init using malloc */
static inline struct vbitmap *
vbit_new(unsigned initial)
{
struct vbitmap *vb;
vb = calloc(1, sizeof *vb);
assert(vb != NULL);
vb->flags |= VBITMAP_FL_MALLOC;
if (initial == 0)
initial = VBITMAP_LUMP;
vbit_expand(vb, initial);
return (vb);
}
static inline void
vbit_destroy(struct vbitmap *vb)
{
if (vb == NULL)
return;
if (vb->flags & VBITMAP_FL_MALLOC_BITS) {
free(vb->bits);
vb->bits = NULL;
vb->nbits = 0;
}
if (vb->flags & VBITMAP_FL_MALLOC)
free(vb);
}
static inline void
vbit_set(struct vbitmap *vb, unsigned bit)
{
if (bit >= vb->nbits)
vbit_expand(vb, bit + 1);
vb->bits[VBITMAP_IDX(bit)] |= VBITMAP_BIT(bit);
}
static inline void
vbit_clr(const struct vbitmap *vb, unsigned bit)
{
if (bit < vb->nbits)
vb->bits[VBITMAP_IDX(bit)] &= ~VBITMAP_BIT(bit);
}
static inline int
vbit_test(const struct vbitmap *vb, unsigned bit)
{
if (bit >= vb->nbits)
return (0);
return (vb->bits[VBITMAP_IDX(bit)] & VBITMAP_BIT(bit));
}
PK wFZ��u�� �
vmod_abi.hnu �[��� /*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run include/generate.py instead.
*/
#define VMOD_ABI_Version "Varnish 6.0.13 a395739fa63cddec305142eabefec0a4fd5339e7"
PK wFZ�=�M�Y �Y
cache/cache.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2019 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifdef VRT_H_INCLUDED
# error "vrt.h included before cache.h - they are exclusive"
#endif
#ifdef CACHE_H_INCLUDED
# error "cache.h included multiple times"
#endif
#include <math.h>
#include <pthread.h>
#include <stdarg.h>
#include <sys/types.h>
#include "vdef.h"
#include "vrt.h"
#define CACHE_H_INCLUDED
#include "miniobj.h"
#include "vas.h"
#include "vqueue.h"
#include "vapi/vsl_int.h"
/*--------------------------------------------------------------------*/
enum body_status {
#define BODYSTATUS(U,l) BS_##U,
#include "tbl/body_status.h"
};
/*--------------------------------------------------------------------*/
enum req_body_state_e {
#define REQ_BODY(U) REQ_BODY_##U,
#include "tbl/req_body.h"
};
/*--------------------------------------------------------------------*/
enum sess_close {
SC_NULL = 0,
#define SESS_CLOSE(nm, stat, err, desc) SC_##nm,
#include "tbl/sess_close.h"
};
/*--------------------------------------------------------------------
* Indices into http->hd[]
*/
enum {
#define SLTH(tag, ind, req, resp, sdesc, ldesc) ind,
#include "tbl/vsl_tags_http.h"
};
/*--------------------------------------------------------------------*/
struct VSC_lck;
struct VSC_main;
struct VSC_main_wrk;
struct backend;
struct ban;
struct ban_proto;
struct cli;
struct http_conn;
struct mempool;
struct objcore;
struct objhead;
struct pool;
struct sess;
struct transport;
struct worker;
struct listen_sock;
#define DIGEST_LEN 32
/*--------------------------------------------------------------------*/
typedef struct {
const char *b;
const char *e;
} txt;
/*--------------------------------------------------------------------*/
enum req_step {
R_STP_NONE = 0,
#define REQ_STEP(l, u, arg) R_STP_##u,
#include "tbl/steps.h"
};
enum fetch_step {
F_STP_NONE = 0,
#define FETCH_STEP(l, U, arg) F_STP_##U,
#include "tbl/steps.h"
};
/*--------------------------------------------------------------------*/
struct lock { void *priv; }; // Opaque
/*--------------------------------------------------------------------
* Workspace structure for quick memory allocation.
*/
struct ws {
unsigned magic;
#define WS_MAGIC 0x35fac554
char id[4]; /* identity */
char *s; /* (S)tart of buffer */
char *f; /* (F)ree/front pointer */
char *r; /* (R)eserved length */
char *e; /* (E)nd of buffer */
};
/*--------------------------------------------------------------------
*
*/
struct http {
unsigned magic;
#define HTTP_MAGIC 0x6428b5c9
uint16_t shd; /* Size of hd space */
txt *hd;
unsigned char *hdf;
#define HDF_FILTER (1 << 0) /* Filtered by Connection */
/* NB: ->nhd and below zeroed/initialized by http_Teardown */
uint16_t nhd; /* Next free hd */
enum VSL_tag_e logtag; /* Must be SLT_*Method */
struct vsl_log *vsl;
struct ws *ws;
uint16_t status;
uint8_t protover;
uint8_t conds; /* If-* headers present */
};
/*--------------------------------------------------------------------*/
struct acct_req {
#define ACCT(foo) uint64_t foo;
#include "tbl/acct_fields_req.h"
};
/*--------------------------------------------------------------------*/
struct acct_bereq {
#define ACCT(foo) uint64_t foo;
#include "tbl/acct_fields_bereq.h"
};
/*--------------------------------------------------------------------*/
struct vsl_log {
uint32_t *wlb, *wlp, *wle;
unsigned wlr;
unsigned wid;
};
/*--------------------------------------------------------------------*/
struct vxid_pool {
uint32_t next;
uint32_t count;
};
/*--------------------------------------------------------------------*/
struct vrt_privs {
unsigned magic;
#define VRT_PRIVS_MAGIC 0x03ba7501
VTAILQ_HEAD(,vrt_priv) privs;
};
/* Worker pool stuff -------------------------------------------------*/
typedef void task_func_t(struct worker *wrk, void *priv);
struct pool_task {
VTAILQ_ENTRY(pool_task) list;
task_func_t *func;
void *priv;
};
/*
* tasks are taken off the queues in this order
*
* TASK_QUEUE_{REQ|STR} are new req's (H1/H2), and subject to queue limit.
*
* TASK_QUEUE_RUSH is req's returning from waiting list
*
* NOTE: When changing the number of classes, update places marked with
* TASK_QUEUE__END in mgt_pool.c
*/
enum task_prio {
TASK_QUEUE_BO,
TASK_QUEUE_RUSH,
TASK_QUEUE_REQ,
TASK_QUEUE_STR,
TASK_QUEUE_VCA,
TASK_QUEUE__END
};
#define TASK_QUEUE_HIGHEST_PRIORITY TASK_QUEUE_BO
#define TASK_QUEUE_CLIENT(prio) \
(prio == TASK_QUEUE_REQ || prio == TASK_QUEUE_STR)
/*--------------------------------------------------------------------*/
struct worker {
unsigned magic;
#define WORKER_MAGIC 0x6391adcf
struct pool *pool;
struct objhead *nobjhead;
struct objcore *nobjcore;
void *nhashpriv;
struct VSC_main_wrk *stats;
struct vsl_log *vsl; // borrowed from req/bo
struct pool_task task;
vtim_real lastused;
int strangelove;
struct v1l *v1l;
pthread_cond_t cond;
struct vcl *vcl;
struct ws aws[1];
struct vxid_pool vxid_pool;
unsigned cur_method;
unsigned seen_methods;
unsigned handling;
};
/* Stored object -----------------------------------------------------
* This is just to encapsulate the fields owned by the stevedore
*/
struct storeobj {
const struct stevedore *stevedore;
void *priv;
uintptr_t priv2;
};
/* Busy Objcore structure --------------------------------------------
*
*/
/*
* The macro-states we expose outside the fetch code
*/
enum boc_state_e {
#define BOC_STATE(U, l) BOS_##U,
#include "tbl/boc_state.h"
};
struct boc {
unsigned magic;
#define BOC_MAGIC 0x70c98476
unsigned refcount;
struct lock mtx;
pthread_cond_t cond;
void *stevedore_priv;
enum boc_state_e state;
uint8_t *vary;
uint64_t len_so_far;
};
/* Object core structure ---------------------------------------------
* Objects have sideways references in the binary heap and the LRU list
* and we want to avoid paging in a lot of objects just to move them up
* or down the binheap or to move a unrelated object on the LRU list.
* To avoid this we use a proxy object, objcore, to hold the relevant
* housekeeping fields parts of an object.
*/
enum obj_attr {
#define OBJ_FIXATTR(U, l, s) OA_##U,
#define OBJ_VARATTR(U, l) OA_##U,
#define OBJ_AUXATTR(U, l) OA_##U,
#include "tbl/obj_attr.h"
OA__MAX,
};
enum obj_flags {
#define OBJ_FLAG(U, l, v) OF_##U = v,
#include "tbl/obj_attr.h"
};
enum oc_flags {
#define OC_FLAG(U, l, v) OC_F_##U = v,
#include "tbl/oc_flags.h"
};
enum oc_exp_flags {
#define OC_EXP_FLAG(U, l, v) OC_EF_##U = v,
#include "tbl/oc_exp_flags.h"
};
struct objcore {
unsigned magic;
#define OBJCORE_MAGIC 0x4d301302
int refcnt;
struct storeobj stobj[1];
struct objhead *objhead;
struct boc *boc;
double timer_when;
long hits;
double t_origin;
float ttl;
float grace;
float keep;
uint8_t flags;
uint8_t exp_flags;
uint16_t oa_present;
unsigned timer_idx; // XXX 4Gobj limit
double last_lru;
VTAILQ_ENTRY(objcore) hsh_list;
VTAILQ_ENTRY(objcore) lru_list;
VTAILQ_ENTRY(objcore) ban_list;
VSTAILQ_ENTRY(objcore) exp_list;
struct ban *ban;
};
/* Busy Object structure ---------------------------------------------
*
* The busyobj structure captures the aspects of an object related to,
* and while it is being fetched from the backend.
*
* One of these aspects will be how much has been fetched, which
* streaming delivery will make use of.
*/
enum director_state_e {
DIR_S_NULL = 0,
DIR_S_HDRS = 1,
DIR_S_BODY = 2,
};
struct busyobj {
unsigned magic;
#define BUSYOBJ_MAGIC 0x23b95567
char *end;
/*
* All fields from retries and down are zeroed when the busyobj
* is recycled.
*/
int retries;
struct req *req;
struct sess *sp;
struct worker *wrk;
struct vfp_ctx *vfc;
struct ws ws[1];
uintptr_t ws_bo;
struct http *bereq0;
struct http *bereq;
struct http *beresp;
struct objcore *stale_oc;
struct objcore *fetch_objcore;
struct http_conn *htc;
struct pool_task fetch_task;
#define BO_FLAG(l, r, w, d) unsigned l:1;
#include "tbl/bo_flags.h"
/* Timeouts */
vtim_dur connect_timeout;
vtim_dur first_byte_timeout;
vtim_dur between_bytes_timeout;
/* Timers */
double t_first; /* First timestamp logged */
double t_prev; /* Previous timestamp logged */
/* Acct */
struct acct_bereq acct;
const struct stevedore *storage;
const struct director *director_req;
const struct director *director_resp;
enum director_state_e director_state;
struct vcl *vcl;
struct vsl_log vsl[1];
uint8_t digest[DIGEST_LEN];
struct vrt_privs privs[1];
uint16_t err_code;
const char *err_reason;
enum req_body_state_e initial_req_body_status;
struct objcore *bereq_body;
};
/*--------------------------------------------------------------------*/
struct req {
unsigned magic;
#define REQ_MAGIC 0x2751aaa1
enum req_step req_step;
volatile enum req_body_state_e req_body_status;
enum sess_close doclose;
int restarts;
int esi_level;
struct req *top; /* esi_level == 0 request */
#define REQ_FLAG(l, r, w, d) unsigned l:1;
#include "tbl/req_flags.h"
uint16_t err_code;
const char *err_reason;
struct sess *sp;
struct worker *wrk;
struct pool_task task;
const struct transport *transport;
void *transport_priv;
VTAILQ_ENTRY(req) w_list;
struct objcore *body_oc;
/* The busy objhead we sleep on */
struct objhead *hash_objhead;
/* Built Vary string */
uint8_t *vary_b;
uint8_t *vary_l;
uint8_t *vary_e;
uint8_t digest[DIGEST_LEN];
double d_ttl;
double d_grace;
ssize_t req_bodybytes; /* Parsed req bodybytes */
const struct stevedore *storage;
const struct director *director_hint;
struct vcl *vcl;
uintptr_t ws_req; /* WS above request data */
/* Timestamps */
double t_first; /* First timestamp logged */
double t_prev; /* Previous timestamp logged */
double t_req; /* Headers complete */
struct http_conn *htc;
struct vfp_ctx *vfc;
const char *client_identity;
/* HTTP request */
struct http *http;
struct http *http0;
/* HTTP response */
struct http *resp;
intmax_t resp_len;
struct ws ws[1];
struct objcore *objcore;
struct objcore *stale_oc;
/* Deliver pipeline */
struct vdp_ctx *vdc;
/* Delivery mode */
unsigned res_mode;
#define RES_LEN (1<<1)
#define RES_EOF (1<<2)
#define RES_CHUNKED (1<<3)
#define RES_ESI (1<<4)
#define RES_ESI_CHILD (1<<5)
#define RES_GUNZIP (1<<6)
#define RES_PIPE (1<<7)
/* Transaction VSL buffer */
struct vsl_log vsl[1];
/* Temporary accounting */
struct acct_req acct;
struct vrt_privs privs[1];
};
/*--------------------------------------------------------------------
* Struct sess is a high memory-load structure because sessions typically
* hang around the waiter for relatively long time.
*
* The size goal for struct sess + struct memitem is <512 bytes
*
* Getting down to the next relevant size (<256 bytes because of how malloc
* works, is not realistic without a lot of code changes.
*/
enum sess_attr {
#define SESS_ATTR(UP, low, typ, len) SA_##UP,
SA_TRANSPORT,
#include "tbl/sess_attr.h"
SA_LAST
};
struct sess {
unsigned magic;
#define SESS_MAGIC 0x2c2f9c5a
uint16_t sattr[SA_LAST];
struct listen_sock *listen_sock;
int refcnt;
int fd;
uint32_t vxid;
struct lock mtx;
struct pool *pool;
struct ws ws[1];
vtim_real t_open; /* fd accepted */
vtim_real t_idle; /* fd accepted or resp sent */
vtim_dur timeout_idle;
};
#define SESS_TMO(sp, tmo) \
(isnan((sp)->tmo) ? cache_param->tmo : (sp)->tmo)
/* Prototypes etc ----------------------------------------------------*/
/* cache_ban.c */
/* for constructing bans */
struct ban_proto *BAN_Build(void);
const char *BAN_AddTest(struct ban_proto *,
const char *, const char *, const char *);
const char *BAN_Commit(struct ban_proto *b);
void BAN_Abandon(struct ban_proto *b);
/* cache_cli.c [CLI] */
extern pthread_t cli_thread;
#define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0)
/* cache_http.c */
unsigned HTTP_estimate(unsigned nhttp);
void HTTP_Copy(struct http *to, const struct http * const fm);
struct http *HTTP_create(void *p, uint16_t nhttp, unsigned);
const char *http_Status2Reason(unsigned, const char **);
unsigned http_EstimateWS(const struct http *fm, unsigned how);
void http_PutResponse(struct http *to, const char *proto, uint16_t status,
const char *response);
void http_FilterReq(struct http *to, const struct http *fm, unsigned how);
void HTTP_Encode(const struct http *fm, uint8_t *, unsigned len, unsigned how);
int HTTP_Decode(struct http *to, const uint8_t *fm);
void http_ForceHeader(struct http *to, const char *hdr, const char *val);
void http_PrintfHeader(struct http *to, const char *fmt, ...)
v_printflike_(2, 3);
void http_TimeHeader(struct http *to, const char *fmt, double now);
void http_Proto(struct http *to);
void http_SetHeader(struct http *to, const char *hdr);
void http_SetH(struct http *to, unsigned n, const char *fm);
void http_ForceField(struct http *to, unsigned n, const char *t);
void HTTP_Setup(struct http *, struct ws *, struct vsl_log *, enum VSL_tag_e);
void http_Teardown(struct http *ht);
int http_GetHdr(const struct http *hp, const char *hdr, const char **ptr);
int http_GetHdrToken(const struct http *hp, const char *hdr,
const char *token, const char **pb, const char **pe);
int http_GetHdrField(const struct http *hp, const char *hdr,
const char *field, const char **ptr);
double http_GetHdrQ(const struct http *hp, const char *hdr, const char *field);
ssize_t http_GetContentLength(const struct http *hp);
uint16_t http_GetStatus(const struct http *hp);
int http_IsStatus(const struct http *hp, int);
void http_SetStatus(struct http *to, uint16_t status);
const char *http_GetMethod(const struct http *hp);
int http_HdrIs(const struct http *hp, const char *hdr, const char *val);
void http_CopyHome(const struct http *hp);
void http_Unset(struct http *hp, const char *hdr);
unsigned http_CountHdr(const struct http *hp, const char *hdr);
void http_CollectHdr(struct http *hp, const char *hdr);
void http_CollectHdrSep(struct http *hp, const char *hdr, const char *sep);
void http_VSL_log(const struct http *hp);
void HTTP_Merge(struct worker *, struct objcore *, struct http *to);
uint16_t HTTP_GetStatusPack(struct worker *, struct objcore *oc);
int HTTP_IterHdrPack(struct worker *, struct objcore *, const char **);
#define HTTP_FOREACH_PACK(wrk, oc, ptr) \
for ((ptr) = NULL; HTTP_IterHdrPack(wrk, oc, &(ptr));)
const char *HTTP_GetHdrPack(struct worker *, struct objcore *, const char *hdr);
enum sess_close http_DoConnection(struct http *hp);
int http_IsFiltered(const struct http *hp, unsigned u, unsigned how);
#define HTTPH_R_PASS (1 << 0) /* Request (c->b) in pass mode */
#define HTTPH_R_FETCH (1 << 1) /* Request (c->b) for fetch */
#define HTTPH_A_INS (1 << 2) /* Response (b->o) for insert */
#define HTTPH_A_PASS (1 << 3) /* Response (b->o) for pass */
#define HTTPH_C_SPECIFIC (1 << 4) /* Connection-specific */
#define HTTPH(a, b, c) extern char b[];
#include "tbl/http_headers.h"
extern const char H__Status[];
extern const char H__Proto[];
extern const char H__Reason[];
/* cache_main.c */
#define VXID(u) ((u) & VSL_IDENTMASK)
uint32_t VXID_Get(struct worker *, uint32_t marker);
extern pthread_key_t witness_key;
/* cache_lck.c */
/* Internal functions, call only through macros below */
void Lck__Lock(struct lock *lck, const char *p, int l);
void Lck__Unlock(struct lock *lck, const char *p, int l);
int Lck__Trylock(struct lock *lck, const char *p, int l);
void Lck__New(struct lock *lck, struct VSC_lck *, const char *);
int Lck__Held(const struct lock *lck);
int Lck__Owned(const struct lock *lck);
/* public interface: */
void Lck_Delete(struct lock *lck);
int Lck_CondWait(pthread_cond_t *cond, struct lock *lck, vtim_real);
#define Lck_New(a, b) Lck__New(a, b, #b)
#define Lck_Lock(a) Lck__Lock(a, __func__, __LINE__)
#define Lck_Unlock(a) Lck__Unlock(a, __func__, __LINE__)
#define Lck_Trylock(a) Lck__Trylock(a, __func__, __LINE__)
#define Lck_AssertHeld(a) \
do { \
assert(Lck__Held(a)); \
assert(Lck__Owned(a)); \
} while (0)
struct VSC_lck *Lck_CreateClass(struct vsc_seg **, const char *);
void Lck_DestroyClass(struct vsc_seg **);
#define LOCK(nam) extern struct VSC_lck *lck_##nam;
#include "tbl/locks.h"
/* cache_obj.c */
int ObjHasAttr(struct worker *, struct objcore *, enum obj_attr);
const void *ObjGetAttr(struct worker *, struct objcore *, enum obj_attr,
ssize_t *len);
typedef int objiterate_f(void *priv, int flush, const void *ptr, ssize_t len);
int ObjIterate(struct worker *, struct objcore *,
void *priv, objiterate_f *func, int final);
unsigned ObjGetXID(struct worker *, struct objcore *);
uint64_t ObjGetLen(struct worker *, struct objcore *);
int ObjGetDouble(struct worker *, struct objcore *, enum obj_attr, double *);
int ObjGetU32(struct worker *, struct objcore *, enum obj_attr, uint32_t *);
int ObjGetU64(struct worker *, struct objcore *, enum obj_attr, uint64_t *);
int ObjCheckFlag(struct worker *, struct objcore *, enum obj_flags of);
/* cache_session.c [SES] */
#define SESS_ATTR(UP, low, typ, len) \
int SES_Get_##low(const struct sess *sp, typ **dst);
#include "tbl/sess_attr.h"
const char *SES_Get_String_Attr(const struct sess *sp, enum sess_attr a);
/* cache_shmlog.c */
void VSLv(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, va_list va);
void VSL(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, ...)
v_printflike_(3, 4);
void VSLbv(struct vsl_log *, enum VSL_tag_e tag, const char *fmt, va_list va);
void VSLb(struct vsl_log *, enum VSL_tag_e tag, const char *fmt, ...)
v_printflike_(3, 4);
void VSLbt(struct vsl_log *, enum VSL_tag_e tag, txt t);
void VSLb_ts(struct vsl_log *, const char *event, double first, double *pprev,
double now);
void VSLb_bin(struct vsl_log *, enum VSL_tag_e, ssize_t, const void*);
static inline void
VSLb_ts_req(struct req *req, const char *event, double now)
{
if (isnan(req->t_first) || req->t_first == 0.)
req->t_first = req->t_prev = now;
VSLb_ts(req->vsl, event, req->t_first, &req->t_prev, now);
}
static inline void
VSLb_ts_busyobj(struct busyobj *bo, const char *event, double now)
{
if (isnan(bo->t_first) || bo->t_first == 0.)
bo->t_first = bo->t_prev = now;
VSLb_ts(bo->vsl, event, bo->t_first, &bo->t_prev, now);
}
/* cache_vcl.c */
const char *VCL_Name(const struct vcl *);
/* cache_vrt.c */
/*
* These prototypes go here, because we do not want to pollute vrt.h
* with va_list. VCC never generates direct calls to them.
* XXX: We should deprecate these (ref: STRANDS)
*/
const char *VRT_String(struct ws *ws, const char *h, const char *p, va_list ap);
char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap);
/* cache_wrk.c */
typedef void *bgthread_t(struct worker *, void *priv);
void WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func,
void *priv);
/* cache_ws.c */
void WS_Init(struct ws *ws, const char *id, void *space, unsigned len);
/* WS_Reserve(): Use WS_ReserveSize() or WS_ReserveAll() */
unsigned WS_Reserve(struct ws *ws, unsigned bytes);
unsigned WS_ReserveSize(struct ws *, unsigned);
unsigned WS_ReserveAll(struct ws *);
unsigned WS_ReserveLumps(struct ws *ws, size_t sz);
void WS_MarkOverflow(struct ws *ws);
void WS_Release(struct ws *ws, unsigned bytes);
void WS_ReleaseP(struct ws *ws, const char *ptr);
void WS_Assert(const struct ws *ws);
void WS_Reset(struct ws *ws, uintptr_t);
void *WS_Alloc(struct ws *ws, unsigned bytes);
void *WS_Copy(struct ws *ws, const void *str, int len);
uintptr_t WS_Snapshot(struct ws *ws);
int WS_Overflowed(const struct ws *ws);
void *WS_Printf(struct ws *ws, const char *fmt, ...) v_printflike_(2, 3);
int WS_Inside(const struct ws *, const void *, const void *);
void WS_Assert_Allocated(const struct ws *ws, const void *ptr, ssize_t len);
static inline char*
WS_Front(const struct ws *ws)
{
return ws->f;
}
/* cache_rfc2616.c */
void RFC2616_Ttl(struct busyobj *, double now, double *t_origin,
float *ttl, float *grace, float *keep);
unsigned RFC2616_Req_Gzip(const struct http *);
int RFC2616_Do_Cond(const struct req *sp);
void RFC2616_Weaken_Etag(struct http *hp);
void RFC2616_Vary_AE(struct http *hp);
void RFC2616_Response_Body(const struct worker *, const struct busyobj *);
/*
* A normal pointer difference is signed, but we never want a negative value
* so this little tool will make sure we don't get that.
*/
static inline unsigned
pdiff(const void *b, const void *e)
{
assert(b <= e);
return
((unsigned)((const unsigned char *)e - (const unsigned char *)b));
}
#define Tcheck(t) do { \
AN((t).b); \
AN((t).e); \
assert((t).b <= (t).e); \
} while(0)
/*
* unsigned length of a txt
*/
static inline unsigned
Tlen(const txt t)
{
Tcheck(t);
return ((unsigned)(t.e - t.b));
}
/*
* We want to cache the most recent timestamp in wrk->lastused to avoid
* extra timestamps in cache_pool.c. Hide this detail with a macro
*/
#define W_TIM_real(w) ((w)->lastused = VTIM_real())
#define PAN_CheckMagic(vsb, ptr, exp) \
do { \
if ((ptr)->magic != (exp)) \
VSB_printf((vsb), \
"MAGIC at %p is 0x%08x (Should be: %s/0x%08x)\n", \
ptr, (ptr)->magic, #exp, exp); \
} while(0)
PK wFZH�cW W cache/cache_filter.hnu �[��� /*-
* Copyright (c) 2013-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
struct req;
struct vfp_entry;
struct vfp_ctx;
/* Fetch processors --------------------------------------------------*/
enum vfp_status {
VFP_ERROR = -1,
VFP_OK = 0,
VFP_END = 1,
VFP_NULL = 2,
};
typedef enum vfp_status vfp_init_f(struct vfp_ctx *, struct vfp_entry *);
typedef enum vfp_status
vfp_pull_f(struct vfp_ctx *, struct vfp_entry *, void *ptr, ssize_t *len);
typedef void vfp_fini_f(struct vfp_ctx *, struct vfp_entry *);
struct vfp {
const char *name;
vfp_init_f *init;
vfp_pull_f *pull;
vfp_fini_f *fini;
const void *priv1;
};
struct vfp_entry {
unsigned magic;
#define VFP_ENTRY_MAGIC 0xbe32a027
const struct vfp *vfp;
void *priv1;
intptr_t priv2;
enum vfp_status closed;
VTAILQ_ENTRY(vfp_entry) list;
uint64_t calls;
uint64_t bytes_out;
};
/*--------------------------------------------------------------------
* VFP filter state
*/
VTAILQ_HEAD(vfp_entry_s, vfp_entry);
struct vfp_ctx {
unsigned magic;
#define VFP_CTX_MAGIC 0x61d9d3e5
int failed;
struct http *req;
struct http *resp;
struct worker *wrk;
struct objcore *oc;
struct vfp_entry_s vfp;
struct vfp_entry *vfp_nxt;
unsigned obj_flags;
};
enum vfp_status VFP_Suck(struct vfp_ctx *, void *p, ssize_t *lp);
enum vfp_status VFP_Error(struct vfp_ctx *, const char *fmt, ...)
v_printflike_(2, 3);
/* Deliver processors ------------------------------------------------*/
enum vdp_action {
VDP_NULL, /* Input buffer valid after call */
VDP_FLUSH, /* Input buffer will be invalidated */
};
typedef int vdp_init_f(struct req *, void **priv);
/*
* Return value:
* negative: Error - abandon delivery
* zero: OK
* positive: Don't push this VDP anyway
*/
typedef int vdp_fini_f(struct req *, void **priv);
typedef int vdp_bytes_f(struct req *, enum vdp_action, void **priv,
const void *ptr, ssize_t len);
struct vdp {
const char *name;
vdp_init_f *init;
vdp_bytes_f *bytes;
vdp_fini_f *fini;
};
struct vdp_entry {
unsigned magic;
#define VDP_ENTRY_MAGIC 0x353eb781
const struct vdp *vdp;
void *priv;
VTAILQ_ENTRY(vdp_entry) list;
};
VTAILQ_HEAD(vdp_entry_s, vdp_entry);
struct vdp_ctx {
unsigned magic;
#define VDP_CTX_MAGIC 0xee501df7
struct vdp_entry_s vdp;
struct vdp_entry *nxt;
int retval;
};
int VDP_bytes(struct req *, enum vdp_action act, const void *ptr, ssize_t len);
int VDP_Push(struct req *, const struct vdp *, void *priv);
void VRT_AddVDP(VRT_CTX, const struct vdp *);
void VRT_RemoveVDP(VRT_CTX, const struct vdp *);
PK wFZʥ�I�7 �7 cache/cache_varnishd.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2019 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Stuff that should *never* be exposed to a VMOD
*/
#include "cache.h"
#include "vsb.h"
#include <sys/socket.h>
#include <string.h>
#include <limits.h>
#include <unistd.h>
#include "common/common_param.h"
#ifdef NOT_IN_A_VMOD
# include "VSC_main.h"
#endif
/* -------------------------------------------------------------------*/
struct vfp;
struct cli_proto;
struct poolparam;
/*--------------------------------------------------------------------
* HTTP Protocol connection structure
*
* This is the protocol independent object for a HTTP connection, used
* both for backend and client sides.
*
*/
struct http_conn {
unsigned magic;
#define HTTP_CONN_MAGIC 0x3e19edd1
int *rfd;
enum sess_close doclose;
enum body_status body_status;
struct ws *ws;
char *rxbuf_b;
char *rxbuf_e;
char *pipeline_b;
char *pipeline_e;
ssize_t content_length;
void *priv;
/* Timeouts */
vtim_dur first_byte_timeout;
vtim_dur between_bytes_timeout;
};
typedef enum htc_status_e htc_complete_f(struct http_conn *);
/* -------------------------------------------------------------------*/
extern volatile struct params * cache_param;
/* Prototypes etc ----------------------------------------------------*/
/* cache_acceptor.c */
void VCA_Init(void);
void VCA_Shutdown(void);
/* cache_backend_cfg.c */
void VBE_InitCfg(void);
void VBE_Poll(void);
/* cache_backend_tcp.c */
void VTP_Init(void);
/* cache_backend_poll.c */
void VBP_Init(void);
/* cache_ban.c */
/* for stevedoes resurrecting bans */
void BAN_Hold(void);
void BAN_Release(void);
void BAN_Reload(const uint8_t *ban, unsigned len);
struct ban *BAN_FindBan(double t0);
void BAN_RefBan(struct objcore *oc, struct ban *);
double BAN_Time(const struct ban *ban);
/* cache_busyobj.c */
struct busyobj *VBO_GetBusyObj(struct worker *, const struct req *);
void VBO_ReleaseBusyObj(struct worker *wrk, struct busyobj **busyobj);
/* cache_director.c */
int VDI_GetHdr(struct worker *, struct busyobj *);
int VDI_GetBody(struct worker *, struct busyobj *);
const struct suckaddr *VDI_GetIP(struct worker *, struct busyobj *);
void VDI_Finish(struct worker *wrk, struct busyobj *bo);
enum sess_close VDI_Http1Pipe(struct req *, struct busyobj *);
void VDI_Panic(const struct director *, struct vsb *, const char *nm);
void VDI_Event(const struct director *d, enum vcl_event_e ev);
void VDI_Init(void);
/* cache_exp.c */
double EXP_Ttl(const struct req *, const struct objcore *);
double EXP_Ttl_grace(const struct req *, const struct objcore *oc);
void EXP_RefNewObjcore(struct objcore *);
void EXP_Insert(struct worker *wrk, struct objcore *oc);
void EXP_Remove(struct objcore *);
#define EXP_Dttl(req, oc) (oc->ttl - (req->t_req - oc->t_origin))
/* cache_expire.c */
/*
* The set of variables which control object expiry are inconveniently
* 24 bytes long (double+3*float) and this causes alignment waste if
* we put then in a struct.
* These three macros operate on the struct we don't use.
*/
#define EXP_ZERO(xx) \
do { \
(xx)->t_origin = 0.0; \
(xx)->ttl = 0.0; \
(xx)->grace = 0.0; \
(xx)->keep = 0.0; \
} while (0)
#define EXP_COPY(to,fm) \
do { \
(to)->t_origin = (fm)->t_origin; \
(to)->ttl = (fm)->ttl; \
(to)->grace = (fm)->grace; \
(to)->keep = (fm)->keep; \
} while (0)
#define EXP_WHEN(to) \
((to)->t_origin + (to)->ttl + (to)->grace + (to)->keep)
/* cache_exp.c */
void EXP_Rearm(struct objcore *, double now, double ttl, double grace,
double keep);
/* From cache_main.c */
void BAN_Init(void);
void BAN_Compile(void);
void BAN_Shutdown(void);
/* From cache_hash.c */
void BAN_NewObjCore(struct objcore *oc);
void BAN_DestroyObj(struct objcore *oc);
int BAN_CheckObject(struct worker *, struct objcore *, struct req *);
/* cache_busyobj.c */
void VBO_Init(void);
/* cache_cli.c [CLI] */
void CLI_Init(void);
void CLI_Run(void);
void CLI_AddFuncs(struct cli_proto *p);
/* cache_deliver_proc.c */
void VDP_close(struct req *req);
int VDP_DeliverObj(struct req *req);
extern const struct vdp VDP_gunzip;
extern const struct vdp VDP_esi;
/* cache_expire.c */
void EXP_Init(void);
/* cache_fetch.c */
enum vbf_fetch_mode_e {
VBF_NORMAL = 0,
VBF_PASS = 1,
VBF_BACKGROUND = 2,
};
void VBF_Fetch(struct worker *wrk, struct req *req,
struct objcore *oc, struct objcore *oldoc, enum vbf_fetch_mode_e);
void Bereq_Rollback(struct busyobj *);
/* cache_fetch_proc.c */
void VFP_Init(void);
enum vfp_status VFP_GetStorage(struct vfp_ctx *, ssize_t *sz, uint8_t **ptr);
void VFP_Extend(const struct vfp_ctx *, ssize_t sz);
struct vfp_entry *VFP_Push(struct vfp_ctx *, const struct vfp *);
void VFP_Setup(struct vfp_ctx *vc, struct worker *wrk);
int VFP_Open(struct vfp_ctx *bo);
void VFP_Close(struct vfp_ctx *bo);
extern const struct vfp VFP_gunzip;
extern const struct vfp VFP_gzip;
extern const struct vfp VFP_testgunzip;
extern const struct vfp VFP_esi;
extern const struct vfp VFP_esi_gzip;
/* cache_http.c */
void HTTP_Init(void);
/* cache_http1_proto.c */
htc_complete_f HTTP1_Complete;
uint16_t HTTP1_DissectRequest(struct http_conn *, struct http *);
uint16_t HTTP1_DissectResponse(struct http_conn *, struct http *resp,
const struct http *req);
unsigned HTTP1_Write(const struct worker *w, const struct http *hp, const int*);
/* cache_main.c */
void THR_SetName(const char *name);
const char* THR_GetName(void);
void THR_SetBusyobj(const struct busyobj *);
struct busyobj * THR_GetBusyobj(void);
void THR_SetRequest(const struct req *);
struct req * THR_GetRequest(void);
void THR_Init(void);
/* cache_lck.c */
void LCK_Init(void);
/* cache_mempool.c */
void MPL_AssertSane(const void *item);
struct mempool * MPL_New(const char *name, volatile struct poolparam *pp,
volatile unsigned *cur_size);
void MPL_Destroy(struct mempool **mpp);
void *MPL_Get(struct mempool *mpl, unsigned *size);
void MPL_Free(struct mempool *mpl, void *item);
/* cache_obj.c */
void ObjInit(void);
struct objcore * ObjNew(const struct worker *);
void ObjDestroy(const struct worker *, struct objcore **);
int ObjGetSpace(struct worker *, struct objcore *, ssize_t *sz, uint8_t **ptr);
void ObjExtend(struct worker *, struct objcore *, ssize_t l);
uint64_t ObjWaitExtend(const struct worker *, const struct objcore *,
uint64_t l);
void ObjSetState(struct worker *, const struct objcore *,
enum boc_state_e next);
void ObjWaitState(const struct objcore *, enum boc_state_e want);
void ObjTrimStore(struct worker *, struct objcore *);
void ObjTouch(struct worker *, struct objcore *, vtim_real now);
void ObjFreeObj(struct worker *, struct objcore *);
void ObjSlim(struct worker *, struct objcore *);
void *ObjSetAttr(struct worker *, struct objcore *, enum obj_attr,
ssize_t len, const void *);
int ObjCopyAttr(struct worker *, struct objcore *, struct objcore *,
enum obj_attr attr);
void ObjBocDone(struct worker *, struct objcore *, struct boc **);
int ObjSetDouble(struct worker *, struct objcore *, enum obj_attr, double);
int ObjSetU32(struct worker *, struct objcore *, enum obj_attr, uint32_t);
int ObjSetU64(struct worker *, struct objcore *, enum obj_attr, uint64_t);
void ObjSetFlag(struct worker *, struct objcore *, enum obj_flags of, int val);
void ObjSendEvent(struct worker *, struct objcore *oc, unsigned event);
#define OEV_INSERT (1U<<1)
#define OEV_BANCHG (1U<<2)
#define OEV_TTLCHG (1U<<3)
#define OEV_EXPIRE (1U<<4)
#define OEV_MASK (OEV_INSERT|OEV_BANCHG|OEV_TTLCHG|OEV_EXPIRE)
typedef void obj_event_f(struct worker *, void *priv, struct objcore *,
unsigned);
uintptr_t ObjSubscribeEvents(obj_event_f *, void *, unsigned mask);
void ObjUnsubscribeEvents(uintptr_t *);
/* cache_panic.c */
void PAN_Init(void);
int PAN_already(struct vsb *, const void *);
const char *body_status_2str(enum body_status e);
const char *sess_close_2str(enum sess_close sc, int want_desc);
/* cache_pool.c */
void Pool_Init(void);
int Pool_Task(struct pool *pp, struct pool_task *task, enum task_prio prio);
int Pool_Task_Arg(struct worker *, enum task_prio, task_func_t *,
const void *arg, size_t arg_len);
void Pool_Sumstat(const struct worker *w);
int Pool_TrySumstat(const struct worker *wrk);
void Pool_PurgeStat(unsigned nobj);
int Pool_Task_Any(struct pool_task *task, enum task_prio prio);
/* cache_range.c [VRG] */
void VRG_dorange(struct req *req, const char *r);
/* cache_req.c */
struct req *Req_New(const struct worker *, struct sess *);
void Req_Release(struct req *);
void Req_Rollback(struct req *req);
void Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req);
void Req_Fail(struct req *req, enum sess_close reason);
/* cache_req_body.c */
int VRB_Ignore(struct req *);
ssize_t VRB_Cache(struct req *, ssize_t maxsize);
ssize_t VRB_Iterate(struct req *, objiterate_f *func, void *priv);
void VRB_Free(struct req *);
/* cache_req_fsm.c [CNT] */
int Resp_Setup(struct req *, unsigned);
enum req_fsm_nxt {
REQ_FSM_MORE,
REQ_FSM_DONE,
REQ_FSM_DISEMBARK,
};
enum req_fsm_nxt CNT_Request(struct worker *, struct req *);
/* cache_session.c */
void SES_NewPool(struct pool *, unsigned pool_no);
void SES_DestroyPool(struct pool *);
void SES_Wait(struct sess *, const struct transport *);
void SES_Ref(struct sess *sp);
void SES_Rel(struct sess *sp);
const char * HTC_Status(enum htc_status_e);
void HTC_RxInit(struct http_conn *htc, struct ws *ws);
void HTC_RxPipeline(struct http_conn *htc, void *);
enum htc_status_e HTC_RxStuff(struct http_conn *, htc_complete_f *,
vtim_real *t1, vtim_real *t2, vtim_real ti, vtim_real tn, vtim_dur td,
int maxbytes);
#define SESS_ATTR(UP, low, typ, len) \
int SES_Set_##low(const struct sess *sp, const typ *src); \
int SES_Reserve_##low(struct sess *sp, typ **dst);
#include "tbl/sess_attr.h"
int SES_Set_String_Attr(struct sess *sp, enum sess_attr a, const char *src);
enum htc_status_e {
#define HTC_STATUS(e, n, s, l) HTC_S_ ## e = n,
#include "tbl/htc.h"
};
/* cache_shmlog.c */
extern struct VSC_main *VSC_C_main;
void VSM_Init(void);
void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len);
void VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why,
uint32_t vxid);
void VSL_End(struct vsl_log *vsl);
void VSL_Flush(struct vsl_log *, int overflow);
/* cache_vary.c */
int VRY_Create(struct busyobj *bo, struct vsb **psb);
int VRY_Match(struct req *, const uint8_t *vary);
void VRY_Prep(struct req *);
void VRY_Clear(struct req *);
enum vry_finish_flag { KEEP, DISCARD };
void VRY_Finish(struct req *req, enum vry_finish_flag);
/* cache_vcl.c */
struct director *VCL_DefaultDirector(const struct vcl *);
const struct vrt_backend_probe *VCL_DefaultProbe(const struct vcl *);
void VCL_Init(void);
void VCL_Panic(struct vsb *, const struct vcl *);
void VCL_Poll(void);
void VCL_Ref(struct vcl *);
void VCL_Refresh(struct vcl **);
void VCL_Rel(struct vcl **);
void VCL_TaskEnter(const struct vcl *, struct vrt_privs *);
void VCL_TaskLeave(const struct vcl *, struct vrt_privs *);
const char *VCL_Return_Name(unsigned);
const char *VCL_Method_Name(unsigned);
void VCL_Bo2Ctx(struct vrt_ctx *, struct busyobj *);
void VCL_Req2Ctx(struct vrt_ctx *, struct req *);
#define VCL_MET_MAC(l,u,t,b) \
void VCL_##l##_method(struct vcl *, struct worker *, struct req *, \
struct busyobj *bo, void *specific);
#include "tbl/vcl_returns.h"
typedef int vcl_be_func(struct cli *, struct director *, void *);
int VCL_IterDirector(struct cli *, const char *, vcl_be_func *, void *);
/* cache_vrt.c */
void pan_privs(struct vsb *, const struct vrt_privs *);
/* cache_vrt_priv.c */
extern struct vrt_privs cli_task_privs[1];
/* cache_vrt_vmod.c */
void VMOD_Init(void);
void VMOD_Panic(struct vsb *);
/* cache_wrk.c */
void WRK_Init(void);
/* http1/cache_http1_pipe.c */
void V1P_Init(void);
/* cache_http2_deliver.c */
void V2D_Init(void);
/* stevedore.c */
void STV_open(void);
void STV_close(void);
const struct stevedore *STV_next(void);
int STV_BanInfoDrop(const uint8_t *ban, unsigned len);
int STV_BanInfoNew(const uint8_t *ban, unsigned len);
void STV_BanExport(const uint8_t *banlist, unsigned len);
int STV_NewObject(struct worker *, struct objcore *,
const struct stevedore *, unsigned len);
struct stv_buffer;
struct stv_buffer *STV_AllocBuf(struct worker *wrk, const struct stevedore *stv,
size_t size);
void STV_FreeBuf(struct worker *wrk, struct stv_buffer **pstvbuf);
void *STV_GetBufPtr(struct stv_buffer *stvbuf, size_t *psize);
#if WITH_PERSISTENT_STORAGE
/* storage_persistent.c */
void SMP_Ready(void);
#endif
#define FEATURE(x) COM_FEATURE(cache_param->feature_bits, x)
#define DO_DEBUG(x) COM_DO_DEBUG(cache_param->debug_bits, x)
#define DSL(debug_bit, id, ...) \
do { \
if (DO_DEBUG(debug_bit)) \
VSL(SLT_Debug, (id), __VA_ARGS__); \
} while (0)
PK wFZ���A cache/cache_director.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Director APIs
*
* A director ("VDI") is an abstract entity which can either satisfy a
* backend fetch request or select another director for the job.
*
* In theory a director does not have to talk HTTP over TCP, it can satisfy
* the backend request using any means it wants, although this is presently
* not implemented.
*
*/
typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *,
double *changed);
/* XXX need a VRT_CTX argument */
typedef const struct director *vdi_resolve_f(const struct director *,
struct worker *, struct busyobj *);
typedef int vdi_gethdrs_f(const struct director *, struct worker *,
struct busyobj *);
typedef int vdi_getbody_f(const struct director *, struct worker *,
struct busyobj *);
typedef const struct suckaddr *vdi_getip_f(const struct director *,
struct worker *, struct busyobj *);
typedef void vdi_finish_f(const struct director *, struct worker *,
struct busyobj *);
typedef enum sess_close vdi_http1pipe_f(const struct director *, struct req *,
struct busyobj *);
typedef void vdi_event_f(const struct director *, enum vcl_event_e);
typedef void vdi_destroy_f(const struct director *);
typedef void vdi_panic_f(const struct director *, struct vsb *);
struct director {
unsigned magic;
#define DIRECTOR_MAGIC 0x3336351d
const char *name;
char *vcl_name;
vdi_http1pipe_f *http1pipe;
vdi_healthy_f *healthy;
vdi_resolve_f *resolve;
vdi_gethdrs_f *gethdrs;
vdi_getbody_f *getbody;
vdi_getip_f *getip;
vdi_finish_f *finish;
vdi_event_f *event;
vdi_destroy_f *destroy;
vdi_panic_f *panic;
void *priv;
const void *priv2;
/* Internal Housekeeping fields */
char *display_name;
VTAILQ_ENTRY(director) vcl_list;
struct vcl *vcl;
unsigned health;
const struct vdi_ahealth *admin_health;
double health_changed;
};
unsigned VDI_Healthy(const struct director *, double *);
/* cache_vcl.c */
int VCL_AddDirector(struct vcl *, struct director *, const char *);
void VCL_DelDirector(struct director *);
/* cache_director.c */
#define VBE_AHEALTH_LIST \
VBE_AHEALTH(healthy, HEALTHY) \
VBE_AHEALTH(sick, SICK) \
VBE_AHEALTH(probe, PROBE) \
VBE_AHEALTH(deleted, DELETED)
#define VBE_AHEALTH(l,u) extern const struct vdi_ahealth * const VDI_AH_##u;
VBE_AHEALTH_LIST
#undef VBE_AHEALTH
const char *VDI_Ahealth(const struct director *d);
PK wFZ�n�+ cache/cache_backend.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Backend and APIs
*
* A backend ("VBE") is a director which talks HTTP over TCP.
*
* As you'll notice the terminology is a bit muddled here, but we try to
* keep it clean on the user-facing side, where a "director" is always
* a "pick a backend/director" functionality, and a "backend" is whatever
* satisfies the actual request in the end.
*
*/
struct vbp_target;
struct vrt_ctx;
struct vrt_backend_probe;
struct tcp_pool;
/*--------------------------------------------------------------------
* An instance of a backend from a VCL program.
*/
struct backend {
unsigned magic;
#define BACKEND_MAGIC 0x64c4c7c6
unsigned n_conn;
VTAILQ_ENTRY(backend) list;
struct lock mtx;
VRT_BACKEND_FIELDS()
struct vbp_target *probe;
struct vsc_seg *vsc_seg;
struct VSC_vbe *vsc;
struct tcp_pool *tcp_pool;
struct director director[1];
vtim_real cooled;
};
/*---------------------------------------------------------------------
* Prototypes
*/
/* cache_backend_cfg.c */
void VBE_SetHappy(const struct backend *, uint64_t);
/* cache_backend_probe.c */
void VBP_Insert(struct backend *b, struct vrt_backend_probe const *p,
struct tcp_pool *);
void VBP_Remove(struct backend *b);
void VBP_Control(const struct backend *b, int stop);
void VBP_Status(struct cli *cli, const struct backend *, int details);
void VBE_Connect_Error(struct VSC_vbe *, int err);
PK wFZ���f�f �f vtree.hnu �[��� /* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $ */
/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */
/* $FreeBSD: release/9.0.0/sys/sys/tree.h 189204 2009-03-01 04:57:23Z bms $ */
/*-
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _VTREE_H_
#define _VTREE_H_
/*
* This file defines data structures for different types of trees:
* splay trees and red-black trees.
*
* A splay tree is a self-organizing data structure. Every operation
* on the tree causes a splay to happen. The splay moves the requested
* node to the root of the tree and partly rebalances it.
*
* This has the benefit that request locality causes faster lookups as
* the requested nodes move to the top of the tree. On the other hand,
* every lookup causes memory writes.
*
* The Balance Theorem bounds the total access time for m operations
* and n inserts on an initially empty tree as O((m + n)lg n). The
* amortized cost for a sequence of m accesses to a splay tree is O(lg n);
*
* A red-black tree is a binary search tree with the node color as an
* extra attribute. It fulfills a set of conditions:
* - every search path from the root to a leaf consists of the
* same number of black nodes,
* - each red node (except for the root) has a black parent,
* - each leaf node is black.
*
* Every operation on a red-black tree is bounded as O(lg n).
* The maximum height of a red-black tree is 2lg (n+1).
*/
#define VSPLAY_HEAD(name, type) \
struct name { \
struct type *sph_root; /* root of the tree */ \
}
#define VSPLAY_INITIALIZER(root) \
{ NULL }
#define VSPLAY_INIT(root) do { \
(root)->sph_root = NULL; \
} while (/*CONSTCOND*/ 0)
#define VSPLAY_ENTRY(type) \
struct { \
struct type *spe_left; /* left element */ \
struct type *spe_right; /* right element */ \
}
#define VSPLAY_LEFT(elm, field) (elm)->field.spe_left
#define VSPLAY_RIGHT(elm, field) (elm)->field.spe_right
#define VSPLAY_ROOT(head) (head)->sph_root
#define VSPLAY_EMPTY(head) (VSPLAY_ROOT(head) == NULL)
/* VSPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold VSPLAY_{RIGHT,LEFT} */
#define VSPLAY_ROTATE_RIGHT(head, tmp, field) do { \
VSPLAY_LEFT((head)->sph_root, field) = VSPLAY_RIGHT(tmp, field);\
VSPLAY_RIGHT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
} while (/*CONSTCOND*/ 0)
#define VSPLAY_ROTATE_LEFT(head, tmp, field) do { \
VSPLAY_RIGHT((head)->sph_root, field) = VSPLAY_LEFT(tmp, field);\
VSPLAY_LEFT(tmp, field) = (head)->sph_root; \
(head)->sph_root = tmp; \
} while (/*CONSTCOND*/ 0)
#define VSPLAY_LINKLEFT(head, tmp, field) do { \
VSPLAY_LEFT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = VSPLAY_LEFT((head)->sph_root, field); \
} while (/*CONSTCOND*/ 0)
#define VSPLAY_LINKRIGHT(head, tmp, field) do { \
VSPLAY_RIGHT(tmp, field) = (head)->sph_root; \
tmp = (head)->sph_root; \
(head)->sph_root = VSPLAY_RIGHT((head)->sph_root, field); \
} while (/*CONSTCOND*/ 0)
#define VSPLAY_ASSEMBLE(head, node, left, right, field) do { \
VSPLAY_RIGHT(left, field) = VSPLAY_LEFT((head)->sph_root, field);\
VSPLAY_LEFT(right, field) = VSPLAY_RIGHT((head)->sph_root, field);\
VSPLAY_LEFT((head)->sph_root, field) = VSPLAY_RIGHT(node, field);\
VSPLAY_RIGHT((head)->sph_root, field) = VSPLAY_LEFT(node, field);\
} while (/*CONSTCOND*/ 0)
/* Generates prototypes and inline functions */
#define VSPLAY_PROTOTYPE(name, type, field, cmp) \
void name##_VSPLAY(struct name *, struct type *); \
void name##_VSPLAY_MINMAX(struct name *, int); \
struct type *name##_VSPLAY_INSERT(struct name *, struct type *); \
struct type *name##_VSPLAY_REMOVE(struct name *, struct type *); \
\
/* Finds the node with the same key as elm */ \
static __inline struct type * \
name##_VSPLAY_FIND(struct name *head, struct type *elm) \
{ \
if (VSPLAY_EMPTY(head)) \
return(NULL); \
name##_VSPLAY(head, elm); \
if ((cmp)(elm, (head)->sph_root) == 0) \
return (head->sph_root); \
return (NULL); \
} \
\
static __inline struct type * \
name##_VSPLAY_NEXT(struct name *head, struct type *elm) \
{ \
name##_VSPLAY(head, elm); \
if (VSPLAY_RIGHT(elm, field) != NULL) { \
elm = VSPLAY_RIGHT(elm, field); \
while (VSPLAY_LEFT(elm, field) != NULL) { \
elm = VSPLAY_LEFT(elm, field); \
} \
} else \
elm = NULL; \
return (elm); \
} \
\
static __inline struct type * \
name##_VSPLAY_MIN_MAX(struct name *head, int val) \
{ \
name##_VSPLAY_MINMAX(head, val); \
return (VSPLAY_ROOT(head)); \
}
/* Main splay operation.
* Moves node close to the key of elm to top
*/
#define VSPLAY_GENERATE(name, type, field, cmp) \
struct type * \
name##_VSPLAY_INSERT(struct name *head, struct type *elm) \
{ \
if (VSPLAY_EMPTY(head)) { \
VSPLAY_LEFT(elm, field) = VSPLAY_RIGHT(elm, field) = NULL; \
} else { \
int __comp; \
name##_VSPLAY(head, elm); \
__comp = (cmp)(elm, (head)->sph_root); \
if (__comp < 0) { \
VSPLAY_LEFT(elm, field) = VSPLAY_LEFT((head)->sph_root, field);\
VSPLAY_RIGHT(elm, field) = (head)->sph_root; \
VSPLAY_LEFT((head)->sph_root, field) = NULL; \
} else if (__comp > 0) { \
VSPLAY_RIGHT(elm, field) = VSPLAY_RIGHT((head)->sph_root, field);\
VSPLAY_LEFT(elm, field) = (head)->sph_root; \
VSPLAY_RIGHT((head)->sph_root, field) = NULL; \
} else \
return ((head)->sph_root); \
} \
(head)->sph_root = (elm); \
return (NULL); \
} \
\
struct type * \
name##_VSPLAY_REMOVE(struct name *head, struct type *elm) \
{ \
struct type *__tmp; \
if (VSPLAY_EMPTY(head)) \
return (NULL); \
name##_VSPLAY(head, elm); \
if ((cmp)(elm, (head)->sph_root) == 0) { \
if (VSPLAY_LEFT((head)->sph_root, field) == NULL) { \
(head)->sph_root = VSPLAY_RIGHT((head)->sph_root, field);\
} else { \
__tmp = VSPLAY_RIGHT((head)->sph_root, field); \
(head)->sph_root = VSPLAY_LEFT((head)->sph_root, field);\
name##_VSPLAY(head, elm); \
VSPLAY_RIGHT((head)->sph_root, field) = __tmp; \
} \
return (elm); \
} \
return (NULL); \
} \
\
void \
name##_VSPLAY(struct name *head, struct type *elm) \
{ \
struct type __node, *__left, *__right, *__tmp; \
int __comp; \
\
VSPLAY_LEFT(&__node, field) = VSPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
\
while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \
if (__comp < 0) { \
__tmp = VSPLAY_LEFT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if ((cmp)(elm, __tmp) < 0){ \
VSPLAY_ROTATE_RIGHT(head, __tmp, field);\
if (VSPLAY_LEFT((head)->sph_root, field) == NULL)\
break; \
} \
VSPLAY_LINKLEFT(head, __right, field); \
} else if (__comp > 0) { \
__tmp = VSPLAY_RIGHT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if ((cmp)(elm, __tmp) > 0){ \
VSPLAY_ROTATE_LEFT(head, __tmp, field); \
if (VSPLAY_RIGHT((head)->sph_root, field) == NULL)\
break; \
} \
VSPLAY_LINKRIGHT(head, __left, field); \
} \
} \
VSPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
} \
\
/* Splay with either the minimum or the maximum element \
* Used to find minimum or maximum element in tree. \
*/ \
void name##_VSPLAY_MINMAX(struct name *head, int __comp) \
{ \
struct type __node, *__left, *__right, *__tmp; \
\
VSPLAY_LEFT(&__node, field) = VSPLAY_RIGHT(&__node, field) = NULL;\
__left = __right = &__node; \
\
while (1) { \
if (__comp < 0) { \
__tmp = VSPLAY_LEFT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if (__comp < 0){ \
VSPLAY_ROTATE_RIGHT(head, __tmp, field);\
if (VSPLAY_LEFT((head)->sph_root, field) == NULL)\
break; \
} \
VSPLAY_LINKLEFT(head, __right, field); \
} else if (__comp > 0) { \
__tmp = VSPLAY_RIGHT((head)->sph_root, field); \
if (__tmp == NULL) \
break; \
if (__comp > 0) { \
VSPLAY_ROTATE_LEFT(head, __tmp, field); \
if (VSPLAY_RIGHT((head)->sph_root, field) == NULL)\
break; \
} \
VSPLAY_LINKRIGHT(head, __left, field); \
} \
} \
VSPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
}
#define VSPLAY_NEGINF -1
#define VSPLAY_INF 1
#define VSPLAY_INSERT(name, x, y) name##_VSPLAY_INSERT(x, y)
#define VSPLAY_REMOVE(name, x, y) name##_VSPLAY_REMOVE(x, y)
#define VSPLAY_FIND(name, x, y) name##_VSPLAY_FIND(x, y)
#define VSPLAY_NEXT(name, x, y) name##_VSPLAY_NEXT(x, y)
#define VSPLAY_MIN(name, x) (VSPLAY_EMPTY(x) ? NULL \
: name##_VSPLAY_MIN_MAX(x, VSPLAY_NEGINF))
#define VSPLAY_MAX(name, x) (VSPLAY_EMPTY(x) ? NULL \
: name##_VSPLAY_MIN_MAX(x, VSPLAY_INF))
#define VSPLAY_FOREACH(x, name, head) \
for ((x) = VSPLAY_MIN(name, head); \
(x) != NULL; \
(x) = VSPLAY_NEXT(name, head, x))
/* Macros that define a red-black tree */
#define VRB_HEAD(name, type) \
struct name { \
struct type *rbh_root; /* root of the tree */ \
}
#define VRB_INITIALIZER(root) \
{ NULL }
#define VRB_INIT(root) do { \
(root)->rbh_root = NULL; \
} while (/*CONSTCOND*/ 0)
#define VRB_BLACK 0
#define VRB_RED 1
#define VRB_ENTRY(type) \
struct { \
struct type *rbe_left; /* left element */ \
struct type *rbe_right; /* right element */ \
struct type *rbe_parent; /* parent element */ \
int rbe_color; /* node color */ \
}
#define VRB_LEFT(elm, field) (elm)->field.rbe_left
#define VRB_RIGHT(elm, field) (elm)->field.rbe_right
#define VRB_PARENT(elm, field) (elm)->field.rbe_parent
#define VRB_COLOR(elm, field) (elm)->field.rbe_color
#define VRB_ROOT(head) (head)->rbh_root
#define VRB_EMPTY(head) (VRB_ROOT(head) == NULL)
#define VRB_SET(elm, parent, field) do { \
VRB_PARENT(elm, field) = parent; \
VRB_LEFT(elm, field) = VRB_RIGHT(elm, field) = NULL; \
VRB_COLOR(elm, field) = VRB_RED; \
} while (/*CONSTCOND*/ 0)
#define VRB_SET_BLACKRED(black, red, field) do { \
VRB_COLOR(black, field) = VRB_BLACK; \
VRB_COLOR(red, field) = VRB_RED; \
} while (/*CONSTCOND*/ 0)
#ifndef VRB_AUGMENT
#define VRB_AUGMENT(x) do {} while (0)
#endif
#define VRB_ROTATE_LEFT(head, elm, tmp, field) do { \
(tmp) = VRB_RIGHT(elm, field); \
if ((VRB_RIGHT(elm, field) = VRB_LEFT(tmp, field)) != NULL) { \
VRB_PARENT(VRB_LEFT(tmp, field), field) = (elm); \
} \
VRB_AUGMENT(elm); \
if ((VRB_PARENT(tmp, field) = VRB_PARENT(elm, field)) != NULL) {\
if ((elm) == VRB_LEFT(VRB_PARENT(elm, field), field)) \
VRB_LEFT(VRB_PARENT(elm, field), field) = (tmp);\
else \
VRB_RIGHT(VRB_PARENT(elm, field), field) = (tmp);\
} else \
(head)->rbh_root = (tmp); \
VRB_LEFT(tmp, field) = (elm); \
VRB_PARENT(elm, field) = (tmp); \
VRB_AUGMENT(tmp); \
if ((VRB_PARENT(tmp, field))) \
VRB_AUGMENT(VRB_PARENT(tmp, field)); \
} while (/*CONSTCOND*/ 0)
#define VRB_ROTATE_RIGHT(head, elm, tmp, field) do { \
(tmp) = VRB_LEFT(elm, field); \
if ((VRB_LEFT(elm, field) = VRB_RIGHT(tmp, field)) != NULL) { \
VRB_PARENT(VRB_RIGHT(tmp, field), field) = (elm); \
} \
VRB_AUGMENT(elm); \
if ((VRB_PARENT(tmp, field) = VRB_PARENT(elm, field)) != NULL) {\
if ((elm) == VRB_LEFT(VRB_PARENT(elm, field), field)) \
VRB_LEFT(VRB_PARENT(elm, field), field) = (tmp);\
else \
VRB_RIGHT(VRB_PARENT(elm, field), field) = (tmp);\
} else \
(head)->rbh_root = (tmp); \
VRB_RIGHT(tmp, field) = (elm); \
VRB_PARENT(elm, field) = (tmp); \
VRB_AUGMENT(tmp); \
if ((VRB_PARENT(tmp, field))) \
VRB_AUGMENT(VRB_PARENT(tmp, field)); \
} while (/*CONSTCOND*/ 0)
/* Generates prototypes and inline functions */
#define VRB_PROTOTYPE(name, type, field, cmp) \
VRB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
#define VRB_PROTOTYPE_STATIC(name, type, field, cmp) \
VRB_PROTOTYPE_INTERNAL(name, type, field, cmp, v_unused_ static)
#define VRB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
/*lint -esym(528, name##_VRB_*) */ \
attr void name##_VRB_INSERT_COLOR(struct name *, struct type *); \
attr void name##_VRB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
attr struct type *name##_VRB_REMOVE(struct name *, struct type *); \
attr struct type *name##_VRB_INSERT(struct name *, struct type *); \
attr struct type *name##_VRB_FIND(const struct name *, const struct type *); \
attr struct type *name##_VRB_NFIND(const struct name *, const struct type *); \
attr struct type *name##_VRB_NEXT(struct type *); \
attr struct type *name##_VRB_PREV(struct type *); \
attr struct type *name##_VRB_MINMAX(const struct name *, int); \
\
/* Main rb operation.
* Moves node close to the key of elm to top
*/
#define VRB_GENERATE(name, type, field, cmp) \
VRB_GENERATE_INTERNAL(name, type, field, cmp,)
#define VRB_GENERATE_STATIC(name, type, field, cmp) \
VRB_GENERATE_INTERNAL(name, type, field, cmp, v_unused_ static)
#define VRB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
attr void \
name##_VRB_INSERT_COLOR(struct name *head, struct type *elm) \
{ \
struct type *parent, *gparent, *tmp; \
while ((parent = VRB_PARENT(elm, field)) != NULL && \
VRB_COLOR(parent, field) == VRB_RED) { \
gparent = VRB_PARENT(parent, field); \
if (parent == VRB_LEFT(gparent, field)) { \
tmp = VRB_RIGHT(gparent, field); \
if (tmp && VRB_COLOR(tmp, field) == VRB_RED) { \
VRB_COLOR(tmp, field) = VRB_BLACK; \
VRB_SET_BLACKRED(parent, gparent, field);\
elm = gparent; \
continue; \
} \
if (VRB_RIGHT(parent, field) == elm) { \
VRB_ROTATE_LEFT(head, parent, tmp, field);\
tmp = parent; \
parent = elm; \
elm = tmp; \
} \
VRB_SET_BLACKRED(parent, gparent, field); \
VRB_ROTATE_RIGHT(head, gparent, tmp, field); \
} else { \
tmp = VRB_LEFT(gparent, field); \
if (tmp && VRB_COLOR(tmp, field) == VRB_RED) { \
VRB_COLOR(tmp, field) = VRB_BLACK; \
VRB_SET_BLACKRED(parent, gparent, field);\
elm = gparent; \
continue; \
} \
if (VRB_LEFT(parent, field) == elm) { \
VRB_ROTATE_RIGHT(head, parent, tmp, field);\
tmp = parent; \
parent = elm; \
elm = tmp; \
} \
VRB_SET_BLACKRED(parent, gparent, field); \
VRB_ROTATE_LEFT(head, gparent, tmp, field); \
} \
} \
VRB_COLOR(head->rbh_root, field) = VRB_BLACK; \
} \
\
attr void \
name##_VRB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
{ \
struct type *tmp; \
while ((elm == NULL || VRB_COLOR(elm, field) == VRB_BLACK) && \
elm != VRB_ROOT(head)) { \
AN(parent); \
if (VRB_LEFT(parent, field) == elm) { \
tmp = VRB_RIGHT(parent, field); \
if (VRB_COLOR(tmp, field) == VRB_RED) { \
VRB_SET_BLACKRED(tmp, parent, field); \
VRB_ROTATE_LEFT(head, parent, tmp, field);\
tmp = VRB_RIGHT(parent, field); \
} \
if ((VRB_LEFT(tmp, field) == NULL || \
VRB_COLOR(VRB_LEFT(tmp, field), field) == VRB_BLACK) &&\
(VRB_RIGHT(tmp, field) == NULL || \
VRB_COLOR(VRB_RIGHT(tmp, field), field) == VRB_BLACK)) {\
VRB_COLOR(tmp, field) = VRB_RED; \
elm = parent; \
parent = VRB_PARENT(elm, field); \
} else { \
if (VRB_RIGHT(tmp, field) == NULL || \
VRB_COLOR(VRB_RIGHT(tmp, field), field) == VRB_BLACK) {\
struct type *oleft; \
if ((oleft = VRB_LEFT(tmp, field)) \
!= NULL) \
VRB_COLOR(oleft, field) = VRB_BLACK;\
VRB_COLOR(tmp, field) = VRB_RED;\
VRB_ROTATE_RIGHT(head, tmp, oleft, field);\
tmp = VRB_RIGHT(parent, field); \
} \
VRB_COLOR(tmp, field) = VRB_COLOR(parent, field);\
VRB_COLOR(parent, field) = VRB_BLACK; \
if (VRB_RIGHT(tmp, field)) \
VRB_COLOR(VRB_RIGHT(tmp, field), field) = VRB_BLACK;\
VRB_ROTATE_LEFT(head, parent, tmp, field);\
elm = VRB_ROOT(head); \
break; \
} \
} else { \
tmp = VRB_LEFT(parent, field); \
if (VRB_COLOR(tmp, field) == VRB_RED) { \
VRB_SET_BLACKRED(tmp, parent, field); \
VRB_ROTATE_RIGHT(head, parent, tmp, field);\
tmp = VRB_LEFT(parent, field); \
} \
if ((VRB_LEFT(tmp, field) == NULL || \
VRB_COLOR(VRB_LEFT(tmp, field), field) == VRB_BLACK) &&\
(VRB_RIGHT(tmp, field) == NULL || \
VRB_COLOR(VRB_RIGHT(tmp, field), field) == VRB_BLACK)) {\
VRB_COLOR(tmp, field) = VRB_RED; \
elm = parent; \
parent = VRB_PARENT(elm, field); \
} else { \
if (VRB_LEFT(tmp, field) == NULL || \
VRB_COLOR(VRB_LEFT(tmp, field), field) == VRB_BLACK) {\
struct type *oright; \
if ((oright = VRB_RIGHT(tmp, field)) \
!= NULL) \
VRB_COLOR(oright, field) = VRB_BLACK;\
VRB_COLOR(tmp, field) = VRB_RED;\
VRB_ROTATE_LEFT(head, tmp, oright, field);\
tmp = VRB_LEFT(parent, field); \
} \
VRB_COLOR(tmp, field) = VRB_COLOR(parent, field);\
VRB_COLOR(parent, field) = VRB_BLACK; \
if (VRB_LEFT(tmp, field)) \
VRB_COLOR(VRB_LEFT(tmp, field), field) = VRB_BLACK;\
VRB_ROTATE_RIGHT(head, parent, tmp, field);\
elm = VRB_ROOT(head); \
break; \
} \
} \
} \
if (elm) \
VRB_COLOR(elm, field) = VRB_BLACK; \
} \
\
attr struct type * \
name##_VRB_REMOVE(struct name *head, struct type *elm) \
{ \
struct type *child, *parent, *old = elm; \
int color; \
if (VRB_LEFT(elm, field) == NULL) \
child = VRB_RIGHT(elm, field); \
else if (VRB_RIGHT(elm, field) == NULL) \
child = VRB_LEFT(elm, field); \
else { \
struct type *left; \
elm = VRB_RIGHT(elm, field); \
while ((left = VRB_LEFT(elm, field)) != NULL) \
elm = left; \
child = VRB_RIGHT(elm, field); \
parent = VRB_PARENT(elm, field); \
color = VRB_COLOR(elm, field); \
if (child) \
VRB_PARENT(child, field) = parent; \
if (parent) { \
if (VRB_LEFT(parent, field) == elm) \
VRB_LEFT(parent, field) = child; \
else \
VRB_RIGHT(parent, field) = child; \
VRB_AUGMENT(parent); \
} else \
VRB_ROOT(head) = child; \
if (VRB_PARENT(elm, field) == old) \
parent = elm; \
(elm)->field = (old)->field; \
if (VRB_PARENT(old, field)) { \
if (VRB_LEFT(VRB_PARENT(old, field), field) == old)\
VRB_LEFT(VRB_PARENT(old, field), field) = elm;\
else \
VRB_RIGHT(VRB_PARENT(old, field), field) = elm;\
VRB_AUGMENT(VRB_PARENT(old, field)); \
} else \
VRB_ROOT(head) = elm; \
VRB_PARENT(VRB_LEFT(old, field), field) = elm; \
if (VRB_RIGHT(old, field)) \
VRB_PARENT(VRB_RIGHT(old, field), field) = elm; \
if (parent) { \
left = parent; \
do { \
VRB_AUGMENT(left); \
} while ((left = VRB_PARENT(left, field)) != NULL); \
} \
goto color; \
} \
parent = VRB_PARENT(elm, field); \
color = VRB_COLOR(elm, field); \
if (child) \
VRB_PARENT(child, field) = parent; \
if (parent) { \
if (VRB_LEFT(parent, field) == elm) \
VRB_LEFT(parent, field) = child; \
else \
VRB_RIGHT(parent, field) = child; \
VRB_AUGMENT(parent); \
} else \
VRB_ROOT(head) = child; \
color: \
if (color == VRB_BLACK) { \
name##_VRB_REMOVE_COLOR(head, parent, child); \
} \
return (old); \
} \
\
/* Inserts a node into the RB tree */ \
attr struct type * \
name##_VRB_INSERT(struct name *head, struct type *elm) \
{ \
struct type *tmp; \
struct type *parent = NULL; \
int comp = 0; \
tmp = VRB_ROOT(head); \
while (tmp) { \
parent = tmp; \
comp = (cmp)(elm, parent); \
if (comp < 0) \
tmp = VRB_LEFT(tmp, field); \
else if (comp > 0) \
tmp = VRB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
VRB_SET(elm, parent, field); \
if (parent != NULL) { \
if (comp < 0) \
VRB_LEFT(parent, field) = elm; \
else \
VRB_RIGHT(parent, field) = elm; \
VRB_AUGMENT(parent); \
} else \
VRB_ROOT(head) = elm; \
name##_VRB_INSERT_COLOR(head, elm); \
return (NULL); \
} \
\
/* Finds the node with the same key as elm */ \
attr struct type * \
name##_VRB_FIND(const struct name *head, const struct type *elm) \
{ \
struct type *tmp = VRB_ROOT(head); \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) \
tmp = VRB_LEFT(tmp, field); \
else if (comp > 0) \
tmp = VRB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (NULL); \
} \
\
/* Finds the first node greater than or equal to the search key */ \
attr struct type * \
name##_VRB_NFIND(const struct name *head, const struct type *elm) \
{ \
struct type *tmp = VRB_ROOT(head); \
struct type *res = NULL; \
int comp; \
while (tmp) { \
comp = cmp(elm, tmp); \
if (comp < 0) { \
res = tmp; \
tmp = VRB_LEFT(tmp, field); \
} \
else if (comp > 0) \
tmp = VRB_RIGHT(tmp, field); \
else \
return (tmp); \
} \
return (res); \
} \
\
/* ARGSUSED */ \
attr struct type * \
name##_VRB_NEXT(struct type *elm) \
{ \
if (VRB_RIGHT(elm, field)) { \
elm = VRB_RIGHT(elm, field); \
while (VRB_LEFT(elm, field)) \
elm = VRB_LEFT(elm, field); \
} else { \
if (VRB_PARENT(elm, field) && \
(elm == VRB_LEFT(VRB_PARENT(elm, field), field))) \
elm = VRB_PARENT(elm, field); \
else { \
while (VRB_PARENT(elm, field) && \
(elm == VRB_RIGHT(VRB_PARENT(elm, field), field)))\
elm = VRB_PARENT(elm, field); \
elm = VRB_PARENT(elm, field); \
} \
} \
return (elm); \
} \
\
/* ARGSUSED */ \
attr struct type * \
name##_VRB_PREV(struct type *elm) \
{ \
if (VRB_LEFT(elm, field)) { \
elm = VRB_LEFT(elm, field); \
while (VRB_RIGHT(elm, field)) \
elm = VRB_RIGHT(elm, field); \
} else { \
if (VRB_PARENT(elm, field) && \
(elm == VRB_RIGHT(VRB_PARENT(elm, field), field))) \
elm = VRB_PARENT(elm, field); \
else { \
while (VRB_PARENT(elm, field) && \
(elm == VRB_LEFT(VRB_PARENT(elm, field), field)))\
elm = VRB_PARENT(elm, field); \
elm = VRB_PARENT(elm, field); \
} \
} \
return (elm); \
} \
\
attr struct type * \
name##_VRB_MINMAX(const struct name *head, int val) \
{ \
struct type *tmp = VRB_ROOT(head); \
struct type *parent = NULL; \
while (tmp) { \
parent = tmp; \
if (val < 0) \
tmp = VRB_LEFT(tmp, field); \
else \
tmp = VRB_RIGHT(tmp, field); \
} \
return (parent); \
}
#define VRB_NEGINF -1
#define VRB_INF 1
#define VRB_INSERT(name, x, y) name##_VRB_INSERT(x, y)
#define VRB_REMOVE(name, x, y) name##_VRB_REMOVE(x, y)
#define VRB_FIND(name, x, y) name##_VRB_FIND(x, y)
#define VRB_NFIND(name, x, y) name##_VRB_NFIND(x, y)
#define VRB_NEXT(name, x, y) name##_VRB_NEXT(y)
#define VRB_PREV(name, x, y) name##_VRB_PREV(y)
#define VRB_MIN(name, x) name##_VRB_MINMAX(x, VRB_NEGINF)
#define VRB_MAX(name, x) name##_VRB_MINMAX(x, VRB_INF)
#define VRB_FOREACH(x, name, head) \
for ((x) = VRB_MIN(name, head); \
(x) != NULL; \
(x) = name##_VRB_NEXT(x))
#define VRB_FOREACH_FROM(x, name, y) \
for ((x) = (y); \
((x) != NULL) && ((y) = name##_VRB_NEXT(x), (x) != NULL); \
(x) = (y))
#define VRB_FOREACH_SAFE(x, name, head, y) \
for ((x) = VRB_MIN(name, head); \
((x) != NULL) && ((y) = name##_VRB_NEXT(x), (x) != NULL); \
(x) = (y))
#define VRB_FOREACH_REVERSE(x, name, head) \
for ((x) = VRB_MAX(name, head); \
(x) != NULL; \
(x) = name##_VRB_PREV(x))
#define VRB_FOREACH_REVERSE_FROM(x, name, y) \
for ((x) = (y); \
((x) != NULL) && ((y) = name##_VRB_PREV(x), (x) != NULL); \
(x) = (y))
#define VRB_FOREACH_REVERSE_SAFE(x, name, head, y) \
for ((x) = VRB_MAX(name, head); \
((x) != NULL) && ((y) = name##_VRB_PREV(x), (x) != NULL); \
(x) = (y))
#endif /* _VTREE_H_ */
PK wFZ0�&
�
�
vtcp.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
struct suckaddr;
/* from libvarnish/tcp.c */
/* NI_MAXHOST and NI_MAXSERV are ridiculously long for numeric format */
#define VTCP_ADDRBUFSIZE 64
#define VTCP_PORTBUFSIZE 16
int VTCP_Check(ssize_t a);
#define VTCP_Assert(a) assert(VTCP_Check(a))
struct suckaddr *VTCP_my_suckaddr(int sock);
void VTCP_myname(int sock, char *abuf, unsigned alen,
char *pbuf, unsigned plen);
void VTCP_hisname(int sock, char *abuf, unsigned alen,
char *pbuf, unsigned plen);
int VTCP_filter_http(int sock);
int VTCP_fastopen(int sock, int depth);
void VTCP_blocking(int sock);
void VTCP_nonblocking(int sock);
int VTCP_linger(int sock, int linger);
int VTCP_check_hup(int sock);
// #ifdef SOL_SOCKET
void VTCP_name(const struct suckaddr *addr, char *abuf, unsigned alen,
char *pbuf, unsigned plen);
int VTCP_connected(int s);
int VTCP_connect(const struct suckaddr *name, int msec);
int VTCP_open(const char *addr, const char *def_port, vtim_dur timeout,
const char **err);
void VTCP_close(int *s);
int VTCP_bind(const struct suckaddr *addr, const char **errp);
int VTCP_listen(const struct suckaddr *addr, int depth, const char **errp);
int VTCP_listen_on(const char *addr, const char *def_port, int depth,
const char **errp);
void VTCP_set_read_timeout(int s, vtim_dur seconds);
int VTCP_read(int fd, void *ptr, size_t len, vtim_dur tmo);
// #endif
PK wFZ��VS vas.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* assert(), AN() and AZ() are static checks that should not happen.
* In general asserts should be cheap, such as checking return
* values and similar.
* diagnostic() are asserts which are so expensive that we may want
* to compile them out for performance at a later date.
* xxxassert(), XXXAN() and XXXAZ() marks conditions we ought to
* handle gracefully, such as malloc failure.
*/
#ifndef VAS_H_INCLUDED
#define VAS_H_INCLUDED
enum vas_e {
VAS_WRONG,
VAS_MISSING,
VAS_ASSERT,
VAS_INCOMPLETE,
VAS_VCL,
};
typedef void vas_f(const char *, const char *, int, const char *, enum vas_e);
extern vas_f *VAS_Fail_Func v_noreturn_;
extern vas_f VAS_Fail v_noreturn_;
#ifdef WITHOUT_ASSERTS
#define assert(e) ((void)(e))
#else /* WITH_ASSERTS */
#define assert(e) \
do { \
if (!(e)) { \
VAS_Fail(__func__, __FILE__, __LINE__, \
#e, VAS_ASSERT); \
} \
} while (0)
#endif
#define xxxassert(e) \
do { \
if (!(e)) { \
VAS_Fail(__func__, __FILE__, __LINE__, \
#e, VAS_MISSING); \
} \
} while (0)
/* Assert zero return value */
#define AZ(foo) do { assert((foo) == 0); } while (0)
#define AN(foo) do { assert((foo) != 0); } while (0)
#define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0)
#define XXXAN(foo) do { xxxassert((foo) != 0); } while (0)
#define diagnostic(foo) assert(foo)
#define WRONG(expl) \
do { \
VAS_Fail(__func__, __FILE__, __LINE__, expl, VAS_WRONG); \
} while (0)
#define INCOMPL() \
do { \
VAS_Fail(__func__, __FILE__, __LINE__, \
"", VAS_INCOMPLETE); \
} while (0)
#endif
PK wFZ��P�M9 M9
vapi/vsl.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This is the public API for the VSL access.
*
*/
#ifndef VAPI_VSL_H_INCLUDED
#define VAPI_VSL_H_INCLUDED
#include <stdint.h>
#include "vapi/vsl_int.h"
struct vsm;
/*
* enum VSL_tag_e enumerates the SHM log tags, where the identifiers are
* "SLT_" + XML tag, as defined in tbl/vsl_tags.h. Use the macro SLT__MAX
* for the highest possible value of the enum.
* (VSL_tag_e and SLT__MAX included from vsl_int.h)
*/
struct VSL_data;
struct VSLQ;
struct VSLC_ptr {
const uint32_t *ptr; /* Record pointer */
unsigned priv;
};
/*
* Use these macros to access fields of a VSLC_ptr record
* (included from vsl_int.h):
*
* VSL_TAG(ptr)
* SLT tag (enum VSL_tag_e)
*
* VSL_ID(ptr)
* VXID
*
* VSL_CDATA(ptr)
* Payload (as const char *)
*
* VSL_LEN(ptr)
* Length of the payload in bytes
*
* VSL_CLIENT(ptr)
* Non-zero if this is a client transaction
*
* VSL_BACKEND(ptr)
* Non-zero if this is a backend transaction
*/
struct VSL_cursor {
/* The record this cursor points to */
struct VSLC_ptr rec;
/* Private data */
const void *priv_tbl;
void *priv_data;
};
enum VSL_transaction_e {
VSL_t_unknown,
VSL_t_sess,
VSL_t_req,
VSL_t_bereq,
VSL_t_raw,
VSL_t__MAX,
};
enum VSL_reason_e {
VSL_r_unknown,
VSL_r_http_1,
VSL_r_rxreq,
VSL_r_esi,
VSL_r_restart,
VSL_r_pass,
VSL_r_fetch,
VSL_r_bgfetch,
VSL_r_pipe,
VSL_r__MAX,
};
struct VSL_transaction {
unsigned level;
uint32_t vxid;
uint32_t vxid_parent;
enum VSL_transaction_e type;
enum VSL_reason_e reason;
struct VSL_cursor *c;
};
enum VSL_grouping_e {
VSL_g_raw,
VSL_g_vxid,
VSL_g_request,
VSL_g_session,
VSL_g__MAX,
};
typedef int VSLQ_dispatch_f(struct VSL_data *vsl,
struct VSL_transaction * const trans[], void *priv);
/*
* The callback function type for use with VSLQ_Dispatch.
*
* Arguments:
* vsl: The VSL_data context
* trans[]: A NULL terminated array of pointers to VSL_transaction.
* priv: The priv argument from VSL_Dispatch
*
* Return value:
* 0: OK - continue
* !=0: Makes VSLQ_Dispatch return with this return value immediatly
*
* Return values of the callback function should be distinct from the
* values of enum vsl_status except for 0
*/
typedef void VSL_tagfind_f(int tag, void *priv);
/*
* The callback function type for use with VSL_Glob2Tags and
* VSL_List2Tags..
*
* Arguments:
* tag: Tag number (= enum VSL_tag_e)
* priv: The priv argument
*/
extern const char * const VSL_tags[SLT__MAX];
/*
* Tag to string array. Contains NULL for invalid tags.
*/
extern const unsigned VSL_tagflags[SLT__MAX];
/*
* Tag flags array.
* Use these macros with VSL_tagflags (included from vsl_int.h):
*
* VSL_tagflags[tag] & SLT_F_BINARY
* Non-zero if the payload is binary data
*
* VSL_tagflags[tag] & SLT_F_UNSAFE
* Non-zero if the payload with this tag may include
* non-printable characters
*
* VSL_tagflags[tag] & SLT_F_UNUSED
* Non-zero if this tag is reserved for future use
*/
int VSL_Name2Tag(const char *name, int l);
/*
* Convert string to tag number (= enum VSL_tag_e). Name can be a
* substring from the beginning of a tag when that substring is
* unique. Matching is case insensitive.
*
* Arguments:
* name: A tag name (or substring) to match against
* l: The length of name, or -1 to use strlen.
*
* Return values:
* >=0: Tag number
* -1: No tag matches
* -2: Multiple tags match substring
*/
int VSL_Glob2Tags(const char *glob, int l, VSL_tagfind_f *func, void *priv);
/*
* Convert a string to multiple tag matches. The string can have
* either a prefix or postfix wildcard (*) character. For each
* matching tag func is called. Matching is done case insensitive.
*
* Arguments:
* glob: The string to match
* l: The length of glob. -1 to use strlen.
* func: The function to call (can be NULL)
* priv: An argument that will be passed to func.
*
* Return values:
* >0: Number of times func was called for matching tags.
* -1: No tag matches
* -2: Multiple tags match non-glob input
* -3: Syntax error
*/
int VSL_List2Tags(const char *list, int l, VSL_tagfind_f *func, void *priv);
/*
* Convert a comma-separated list of tag globs to tag
* matches. Calls VSL_Glob2Tags for each comma-separated part of
* list.
*
* Arguments:
* list: The list of globs
* l: The length of list. -1 to use strlen
* func: The function to call (can be NULL)
* priv: An argument that will be passed to func.
*
* Return values:
* >0: Number of times func was called for matching tags.
* -1: No tag matches for list element
* -2: Multiple tags match non-glob list element
* -3: Syntax error
*/
extern const char *VSLQ_grouping[VSL_g__MAX];
/*
* Grouping mode to string array.
*/
int VSLQ_Name2Grouping(const char *name, int l);
/*
* Convert string to grouping (= enum VSL_grouping_e)
*
* Return values:
* >=0: Grouping value
* -1: No grouping type matches
* -2: Multiple grouping types match substring
*/
struct VSL_data *VSL_New(void);
int VSL_Arg(struct VSL_data *vsl, int opt, const char *arg);
/*
* Handle standard log-presenter arguments
* Return:
* -1 error, VSL_Error() returns diagnostic string
* 0 not handled
* 1 Handled.
*/
void VSL_Delete(struct VSL_data *vsl);
/*
* Delete a VSL context, freeing up the resources
*/
const char *VSL_Error(const struct VSL_data *vsl);
/*
* Return the latest error message.
*/
void VSL_ResetError(struct VSL_data *vsl);
/*
* Reset any error message.
*/
#define VSL_COPT_TAIL (1 << 0)
#define VSL_COPT_BATCH (1 << 1)
#define VSL_COPT_TAILSTOP (1 << 2)
struct VSL_cursor *VSL_CursorVSM(struct VSL_data *vsl, struct vsm *vsm,
unsigned options);
/*
* Set the cursor pointed to by cursor up as a raw cursor in the
* log. Cursor points at the current log head.
*
* Options:
* VSL_COPT_TAIL Start cursor at log tail
* VSL_COPT_BATCH Return batch records
* VSL_COPT_TAILSTOP Return EOF when reaching the log tail
*
* Return values:
* non-NULL: Pointer to cursor
* NULL: Error, see VSL_Error
*/
struct VSL_cursor *VSL_CursorFile(struct VSL_data *vsl, const char *name,
unsigned options);
/*
* Create a cursor pointing to the beginning of the binary VSL log
* in file name. If name is '-' reads from stdin.
*
* Options:
* NONE
*
* Return values:
* non-NULL: Pointer to cursor
* NULL: Error, see VSL_Error
*/
void VSL_DeleteCursor(const struct VSL_cursor *c);
/*
* Delete the cursor pointed to by c
*/
enum vsl_status
VSL_ResetCursor(const struct VSL_cursor *c);
/*
* Reset the cursor position to the head, so that the next call to
* VSL_Next returns the first record. For VSM cursor, it will
* point close to the head of the log, but at least 2 segments away
* from the tail.
*
* Return values:
* - vsl_end == success
* - and see enum vsl_status
*
*/
enum vsl_check {
vsl_check_e_notsupp = -1,
vsl_check_e_inval = 0,
vsl_check_warn = 1,
vsl_check_valid = 2
};
enum vsl_check
VSL_Check(const struct VSL_cursor *c, const struct VSLC_ptr *ptr);
/*
* Check if the VSLC_ptr structure points to a value that is still
* valid:
*
* Return values:
* -1: Operation not supported
* 0: Not valid
* 1: Valid - warning level
* 2: Valid
*/
enum vsl_status {
vsl_e_write = -5, // Error from VSL_Write etc.
vsl_e_io = -4, // I/O read error - see errno
vsl_e_overrun = -3, // Overrun
vsl_e_abandon = -2, // Remote abandoned or closed
vsl_e_eof = -1, // End of file
vsl_end = 0, // End of log/cursor
vsl_more = 1 // Cursor points to next log record
};
enum vsl_status
VSL_Next(const struct VSL_cursor *c);
/*
* Return raw pointer to next VSL record.
*
* Return values: see enum vsl_status
*/
int VSL_Match(struct VSL_data *vsl, const struct VSL_cursor *c);
/*
* Returns true if the record pointed to by cursor matches the
* record current record selectors
*
* Return value:
* 1: Match
* 0: No match
*/
int VSL_Print(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
/*
* Print the log record pointed to by cursor to stream.
*
* Format: (t=type)
* 1234567890 12345678901234 1 ...
* vxid tag t content
*
* Arguments:
* vsl: The VSL_data context
* c: A VSL_cursor
* fo: A FILE* pointer
*
* Return values:
* 0: OK
* -5: I/O write error - see errno
*/
int VSL_PrintTerse(const struct VSL_data *vsl, const struct VSL_cursor *c,
void *fo);
/*
* Print the log record pointed to by cursor to stream.
*
* Format:
* 12345678901234 ...
* tag content
*
* Arguments:
* vsl: The VSL_data context
* c: A VSL_cursor
* fo: A FILE* pointer
*
* Return values:
* 0: OK
* -5: I/O write error - see errno
*/
int VSL_PrintAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
/*
* Calls VSL_Next on c until c is exhausted. In turn calls
* VSL_Print on all records where VSL_Match returns true.
*
* Arguments:
* vsl: The VSL_data context
* c: A VSL_cursor
* fo: A FILE* pointer, stdout if NULL
*
* Return values:
* 0: OK
* !=0: Return value from either VSL_Next or VSL_Print
*/
VSLQ_dispatch_f VSL_PrintTransactions;
/*
* Prints out each transaction in the array ptrans. For
* transactions of level > 0 it will print a header before the log
* records. The records will for level == 0 (single records) or if
* v_opt is set, be printed by VSL_Print. Else VSL_PrintTerse is
* used.
*
* Arguments:
* vsl: The VSL_data context
* cp: A NULL-terminated array of VSL_cursor pointers
* fo: A FILE* pointer, stdout if NULL
*
* Return values:
* 0: OK
* !=0: Return value from either VSL_Next or VSL_Print
*/
FILE *VSL_WriteOpen(struct VSL_data *vsl, const char *name, int append,
int unbuffered);
/*
* Open file name for writing using the VSL_Write* functions. If
* append is true, the file will be opened for appending.
*
* Arguments:
* vsl: The VSL data context
* name: The file name
* append: If true, the file will be appended instead of truncated
* unbuf: If true, use unbuffered mode
*
* Return values:
* NULL: Error - see VSL_Error
* non-NULL: Success
*/
int VSL_Write(const struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
/*
* Write the currect record pointed to be c to the FILE* fo
*
* Return values:
* 0: Success
* -5: I/O error - see VSL_Error
*/
int VSL_WriteAll(struct VSL_data *vsl, const struct VSL_cursor *c, void *fo);
/*
* Calls VSL_Next on c until c is exhausted. In turn calls
* VSL_Write on all records where VSL_Match returns true.
*
* Return values:
* 0: OK
* !=0: Return value from either VSL_Next or VSL_Write
*/
VSLQ_dispatch_f VSL_WriteTransactions;
/*
* Write all transactions in ptrans using VSL_WriteAll
* Return values:
* 0: OK
* !=0: Return value from either VSL_Next or VSL_Write
*/
struct VSLQ *VSLQ_New(struct VSL_data *vsl, struct VSL_cursor **cp,
enum VSL_grouping_e grouping, const char *query);
/*
* Create a new query context.
*
* If cp is not NULL, the cursor pointed to by cp will be
* transferred to the query, and *cp set to NULL.
*
* Arguments:
* vsl: The VSL_data context
* cp: Pointer to the cursor to use or NULL
* grouping: VXID grouping to report on
* query: Query match expression
*
* Return values:
* non-NULL: OK
* NULL: Error - see VSL_Error
*/
void VSLQ_Delete(struct VSLQ **pvslq);
/*
* Delete the query pointed to by pvslq, freeing up the resources.
*
* Any cursor owned by the query will be deleted.
*/
void VSLQ_SetCursor(struct VSLQ *vslq, struct VSL_cursor **cp);
/*
* Set the cursor to use.
*
* Any previous cursor owned by the query will be deleted. Will
* call VSLQ_Flush.
*
* Arguments:
* vslq: The VSLQ query
* cp: Pointer to the cursor to use or NULL
*/
int VSLQ_Dispatch(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv);
/*
* Process log and call func for each set matching the specified
* query
*
* Arguments:
* vslq: The VSLQ query
* func: The callback function to call. Can be NULL to ignore records.
* priv: An argument passed to func
*
* Return values:
* 1: Call again
* 0: No more log records available
* !=0: func returned non-zero or enum vsl_status
*/
int VSLQ_Flush(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv);
/*
* Flush any pending record sets from the query until func
* (if given) returns non-zero.
*
* Arguments:
* vslq: The VSL context
* func: The callback function to call. Pass NULL to discard the
* pending messages or call repeatedly until 0 is returned.
* priv: An argument passed to func
*
* Return values:
* 0: OK
* !=0: The return value from func
*/
#endif /* VAPI_VSL_H_INCLUDED */
PK wFZ.�� vapi/vapi_options.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2014 Varnish Software AS
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* VSL options */
#define VSL_iI_PS \
"If a tag include option is the first of any tag selection" \
" options, all tags are first marked excluded."
#define VSL_OPT_b \
VOPT("b", "[-b]", "Only display backend records", \
"Only display transactions and log records coming from" \
" backend communication." \
)
#define VSL_OPT_c \
VOPT("c", "[-c]", "Only display client records", \
"Only display transactions and log records coming from" \
" client communication." \
)
#define VSL_OPT_C \
VOPT("C", "[-C]", "Caseless regular expressions", \
"Do all regular expression and string matching caseless." \
)
#define VSL_OPT_i \
VOPT("i:", "[-i <taglist>]", "Include tags", \
"Include log records of these tags in output. Taglist is" \
" a comma-separated list of tag globs. Multiple -i" \
" options may be given.\n" \
"\n" \
VSL_iI_PS \
)
#define VSL_OPT_I \
VOPT("I:", "[-I <[taglist:]regex>]", "Include by regex", \
"Include by regex matching. Output only records matching" \
" taglist and regular expression. Applies to any tag if" \
" taglist is absent. Multiple -I options may be given.\n" \
"\n" \
VSL_iI_PS \
)
#define VSL_OPT_L \
VOPT("L:", "[-L <limit>]", "Incomplete transaction limit", \
"Sets the upper limit of incomplete transactions kept" \
" before the oldest transaction is force completed. A" \
" warning record is synthesized when this happens. This" \
" setting keeps an upper bound on the memory usage of" \
" running queries. Defaults to 1000 transactions." \
)
#define VSL_OPT_R \
VOPT("R:", "[-R <limit[/duration]>]", "Output rate limit", \
"Restrict the output to the specified limit." \
" Transactions exceeding the limit will be suppressed." \
" The limit is specified as the maximum number of" \
" transactions (with respect to the chosen grouping" \
" method) and an optional time period. If no duration" \
" is specified, a default of ``s`` is used. The duration" \
" field can be formatted as in VCL (e.g. ``-R 10/2m``) or" \
" as a simple time period without the prefix (e.g." \
" ``-R 5/m``)." \
" When in ``-g raw`` grouping mode, this setting can" \
" not be used alongside ``-i``, ``-I``, ``-x`` or " \
"``-X``, and we advise using ``-q`` instead." \
)
#define VSL_OPT_T \
VOPT("T:", "[-T <seconds>]", "Transaction end timeout", \
"Sets the transaction timeout in seconds. This defines the" \
" maximum number of seconds elapsed between a Begin tag" \
" and the End tag. If the timeout expires, a warning" \
" record is synthesized and the transaction is force" \
" completed. Defaults to 120 seconds." \
)
#define VSL_OPT_v \
VOPT("v", "[-v]", "Verbose record printing", \
"Use verbose output on record set printing, giving the" \
" VXID on every log line. Without this option, the VXID" \
" will only be given on the header of that transaction." \
)
#define VSL_OPT_x \
VOPT("x:", "[-x <taglist>]", "Exclude tags", \
"Exclude log records of these tags in output. Taglist is" \
" a comma-separated list of tag globs. Multiple -x" \
" options may be given.\n" \
)
#define VSL_OPT_X \
VOPT("X:", "[-X <[taglist:]regex>]", "Exclude by regex", \
"Exclude by regex matching. Do not output records matching" \
" taglist and regular expression. Applies to any tag if" \
" taglist is absent. Multiple -X options may be given.\n" \
)
PK wFZ�@s�� �
vapi/vsm.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This is the public API for the VSM access.
*
* The VSM "class" acts as parent class for the VSL and VSC subclasses.
*
*/
#ifndef VAPI_VSM_H_INCLUDED
#define VAPI_VSM_H_INCLUDED
struct vsm;
/*
* This structure is used to reference a VSM chunk
*/
struct vsm_fantom {
uintptr_t priv; /* VSM private */
uintptr_t priv2; /* VSM private */
void *b; /* first byte of payload */
void *e; /* first byte past payload */
char *class;
char *ident;
};
#define VSM_FANTOM_NULL { 0, 0, 0, 0, 0, 0 }
/*---------------------------------------------------------------------
* VSM level access functions
*/
struct vsm *VSM_New(void);
/*
* Allocate and initialize a VSL_data handle structure.
* This is the first thing you will always have to do.
* You can have multiple active vsm handles at the same time
* referencing the same or different shared memory files.
* Returns:
* Pointer to usable VSL_data handle.
* NULL: malloc failed.
*/
void VSM_Destroy(struct vsm **vd);
/*
* Close and deallocate all storage and mappings.
* (including any VSC and VSL "sub-classes" XXX?)
*/
const char *VSM_Error(const struct vsm *vd);
/*
* Return the first recorded error message.
*/
void VSM_ResetError(struct vsm *vd);
/*
* Reset recorded error message.
*/
#define VSM_n_USAGE "[-n varnish_name]"
#define VSM_t_USAGE "[-t <seconds|off>]"
int VSM_Arg(struct vsm *, char flag, const char *arg);
/*
* Handle all VSM specific command line arguments.
*
* Returns:
* 1 on success
* <0 on failure, VSM_Error() returns diagnostic string
*
* 't' Configure patience during startup
*
* If arg is "off", VSM_Attach() will wait forever.
* Otherwise arg is the number of seconds to be patient
* while the varnishd manager process gets started.
*
* The default is five seconds.
*
* 'n' Configure varnishd instance to access
*
* The default is the hostname.
*/
int VSM_Attach(struct vsm *, int progress);
/*
* Attach to the master process VSM segment, according to
* the 't' argument. If `progress_fd` is non-negative, a
* period ('.') will be output for each second waited, and if
* any periods were output, a NL ('\n') is output before the
* function returns.
*
* Returns:
* 0 Attached
* -1 Not Attached.
*/
#define VSM_MGT_RUNNING (1U<<1)
#define VSM_MGT_CHANGED (1U<<2)
#define VSM_MGT_RESTARTED (1U<<3)
#define VSM_WRK_RUNNING (1U<<9)
#define VSM_WRK_CHANGED (1U<<10)
#define VSM_WRK_RESTARTED (1U<<11)
unsigned VSM_Status(struct vsm *);
/*
* Returns a bitmap of the current status and changes in it
* since the previous call to VSM_Status
*/
void VSM__iter0(const struct vsm *, struct vsm_fantom *vf);
int VSM__itern(struct vsm *, struct vsm_fantom *vf);
#define VSM_FOREACH(vf, vd) \
for (VSM__iter0((vd), (vf)); VSM__itern((vd), (vf));)
/*
* Iterate over all chunks in shared memory
* vf = "struct vsm_fantom *"
* vd = "struct vsm *"
*/
int VSM_Map(struct vsm *, struct vsm_fantom *vf);
int VSM_Unmap(struct vsm *, struct vsm_fantom *vf);
struct vsm_valid {
const char *name;
};
extern const struct vsm_valid VSM_invalid[];
extern const struct vsm_valid VSM_valid[];
const struct vsm_valid *VSM_StillValid(const struct vsm *, const struct vsm_fantom *vf);
/*
* Check the validity of a previously looked up vsm_fantom.
*
* VSM_invalid means that the SHM chunk this fantom points to does
* not exist in the log file any longer.
*
* VSM_valid means that the SHM chunk this fantom points to is still
* good.
*
* Return:
* VSM_invalid: fantom is not valid any more.
* VSM_valid: fantom is still the same.
*/
int VSM_Get(struct vsm *, struct vsm_fantom *vf,
const char *class, const char *ident);
/*
* Find a chunk, produce fantom for it.
* Returns zero on failure.
* class is mandatory, ident optional.
*/
char *VSM_Dup(struct vsm*, const char *class, const char *ident);
/*
* Returns a malloc'ed copy of the fanton.
*
* Return:
* NULL = Failure
* !NULL = malloc'ed pointer
*/
#endif /* VAPI_VSM_H_INCLUDED */
PK wFZ��פ
vapi/vsc.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This is the public API for the VSC access.
*
* VSC is a "subclass" of VSM.
*
*/
#ifndef VAPI_VSC_H_INCLUDED
#define VAPI_VSC_H_INCLUDED
struct vsm;
struct vsc;
struct vsm_fantom;
struct VSC_level_desc {
const char *name; /* name */
const char *label; /* label */
const char *sdesc; /* short description */
const char *ldesc; /* long description */
};
struct VSC_point {
const volatile uint64_t *ptr; /* field value */
const char *name; /* field name */
const char *ctype; /* C-type */
int semantics; /* semantics
* 'c' = Counter
* 'g' = Gauge
* 'b' = bitmap
* '?' = unknown
*/
int format; /* display format
* 'i' = integer
* 'B' = bytes
* 'b' = bitmap
* 'd' = duration
* '?' = unknown
*/
const struct VSC_level_desc *level; /* verbosity level */
const char *sdesc; /* short description */
const char *ldesc; /* long description */
void *priv; /* return val from VSC_new_f */
};
/*---------------------------------------------------------------------
* Function pointers
*/
typedef void *VSC_new_f(void *priv, const struct VSC_point *const pt);
/*
* priv is from VSC_State().
*
* The return value is installed in pt->priv
*/
typedef void VSC_destroy_f(void *priv, const struct VSC_point *const pt);
/*
* priv is from VSC_State().
*/
typedef int VSC_iter_f(void *priv, const struct VSC_point *const pt);
/*
* priv is the argument to VSC_Iter() and not from VSC_State().
*
* A non-zero return terminates the iteration
*/
/*---------------------------------------------------------------------
* VSC level access functions
*/
struct vsc *VSC_New(void);
/*
* Create a new VSC instance
*/
void VSC_Destroy(struct vsc **, struct vsm *);
/*
* Destroy a VSC instance
*
* If a destroy function was installed with VSC_State()
* it will be called for all remaining points
*/
int VSC_Arg(struct vsc *, char arg, const char *opt);
/*
* Handle standard stat-presenter arguments
* 'f' - filter
*
* Return:
* -1 error, VSM_Error() returns diagnostic string
* 0 not handled
* 1 Handled.
*/
void VSC_State(struct vsc *, VSC_new_f *, VSC_destroy_f *, void *);
/*
* Install function pointers for create/destroy and their
* priv pointer. All arguments can be NULL.
*/
int VSC_Iter(struct vsc *, struct vsm *, VSC_iter_f *, void *priv);
/*
* Iterate over all statistics counters, calling a function for
* each counter not suppressed by any "-f" arguments.
*
* To discover new/deleted points, call VSM_Status() first.
*
* The returned points are valid until the next call to VSC_Iter()
*
* Not safe for concurrent reads with the same vsc and vsm
* handles. For concurrency, initialize and attach separate
* structs vsc and vsm.
*
* Arguments:
* vd: The vsm context
* func: The callback function
* priv: Passed as argument to func
*
* Returns:
* !=0: func returned non-zero
* 0: Done
*/
const struct VSC_level_desc *VSC_ChangeLevel(const struct VSC_level_desc*, int);
/*
* Change a level up or down.
*/
#endif /* VAPI_VSC_H_INCLUDED */
PK wFZ��o�
vapi/voptget.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2014 Varnish Software AS
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Legend: VOPT(o,s,r,d,l) where
* o: Option string part
* s: Synopsis
* d: Description
* l: Long description
*/
struct vopt_list {
const char *option;
const char *synopsis;
const char *desc;
const char *ldesc;
};
struct vopt_spec {
const struct vopt_list *vopt_list;
unsigned vopt_list_n;
const char *vopt_optstring;
const char *vopt_synopsis;
const char **vopt_usage;
};
extern const struct vopt_spec vopt_spec;
#ifdef VOPT_DEFINITION
#ifndef VOPT_INC
#error "VOPT_INC undefined"
#endif
#define VOPT(o,s,d,l) o
static const char vopt_optstring[] =
#include VOPT_INC
;
#undef VOPT
#define VOPT(o,s,d,l) " " s
static const char vopt_synopsis[] =
#include VOPT_INC
;
#undef VOPT
#define VOPT(o,s,d,l) s, d,
static const char *vopt_usage[] = {
#include VOPT_INC
NULL, NULL,
};
#undef VOPT
#define VOPT(o,s,d,l) { o,s,d,l },
static const struct vopt_list vopt_list[] = {
#include VOPT_INC
};
#undef VOPT
const struct vopt_spec vopt_spec = {
vopt_list,
sizeof vopt_list / sizeof vopt_list[0],
vopt_optstring,
vopt_synopsis,
vopt_usage
};
#endif /* VOPT_DEFINITION */
PK wFZ���O� � vapi/vsl_int.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Define the layout of the shared memory log segment.
*
* This file SHALL only be included from:
* bin/varnishd/cache/cache.h
* include/vsl_priv.h
* include/vapi/vsl.h
*
*/
#ifndef VAPI_VSL_INT_H_INCLUDED
#define VAPI_VSL_INT_H_INCLUDED
#define VSL_CLASS "Log"
#define VSL_SEGMENTS 8U
/*
* Shared memory log format
*
* The log member points to an array of 32bit unsigned integers containing
* log records.
*
* Each logrecord consist of:
* [n] = ((type & 0xff) << 24) | (length & 0xffff)
* [n + 1] = ((marker & 0x03) << 30) | (identifier & 0x3fffffff)
* [n + 2] ... [m] = content (NUL-terminated)
*
* Logrecords are NUL-terminated so that string functions can be run
* directly on the shmlog data.
*
* Notice that the constants in these macros cannot be changed without
* changing corresponding magic numbers in varnishd/cache/cache_shmlog.c
*/
#define VSL_CLIENTMARKER (1U<<30)
#define VSL_BACKENDMARKER (1U<<31)
#define VSL_IDENTMASK (~(3U<<30))
#define VSL_LENMASK 0xffff
#define VSL_WORDS(len) (((len) + 3) / 4)
#define VSL_BYTES(words) ((words) * 4)
#define VSL_END(ptr, len) ((ptr) + 2 + VSL_WORDS(len))
#define VSL_NEXT(ptr) VSL_END(ptr, VSL_LEN(ptr))
#define VSL_LEN(ptr) ((ptr)[0] & VSL_LENMASK)
#define VSL_TAG(ptr) ((enum VSL_tag_e)((ptr)[0] >> 24))
#define VSL_ID(ptr) (((ptr)[1]) & VSL_IDENTMASK)
#define VSL_CLIENT(ptr) (((ptr)[1]) & VSL_CLIENTMARKER)
#define VSL_BACKEND(ptr) (((ptr)[1]) & VSL_BACKENDMARKER)
#define VSL_DATA(ptr) ((char*)((ptr)+2))
#define VSL_CDATA(ptr) ((const char*)((ptr)+2))
#define VSL_BATCHLEN(ptr) ((ptr)[1])
#define VSL_BATCHID(ptr) (VSL_ID((ptr) + 2))
#define VSL_ENDMARKER (((uint32_t)SLT__Reserved << 24) | 0x454545) /* "EEE" */
#define VSL_WRAPMARKER (((uint32_t)SLT__Reserved << 24) | 0x575757) /* "WWW" */
/*
* The identifiers in shmlogtag are "SLT_" + XML tag. A script may be run
* on this file to extract the table rather than handcode it
*/
#define SLT__MAX 256
enum VSL_tag_e {
SLT__Bogus = 0,
#define SLTM(foo,flags,sdesc,ldesc) SLT_##foo,
#include "tbl/vsl_tags.h"
SLT__Reserved = 254,
SLT__Batch = 255
};
/* VSL tag flags */
#define SLT_F_UNUSED (1 << 0)
#define SLT_F_UNSAFE (1 << 1)
#define SLT_F_BINARY (1 << 2)
#endif /* VAPI_VSL_INT_H_INCLUDED */
PK wFZf �l[ [ vsha256.hnu �[��� /*-
* Copyright 2005 Colin Percival
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/lib/libmd/sha256.h 154479 2006-01-17 15:35:57Z phk $
*/
#ifndef _VSHA256_H_
#define _VSHA256_H_
#define VSHA256_LEN 32
#define VSHA256_DIGEST_LENGTH 32
typedef struct VSHA256Context {
uint32_t state[8];
uint64_t count;
unsigned char buf[64];
} VSHA256_CTX;
void VSHA256_Init(VSHA256_CTX *);
void VSHA256_Update(VSHA256_CTX *, const void *, size_t);
void VSHA256_Final(unsigned char [VSHA256_LEN], VSHA256_CTX *);
void VSHA256_Test(void);
#define SHA256_LEN VSHA256_LEN
#define SHA256_DIGEST_LENGTH VSHA256_DIGEST_LENGTH
#define SHA256Context VSHA256Context
#define SHA256_CTX VSHA256_CTX
#define SHA256_Init VSHA256_Init
#define SHA256_Update VSHA256_Update
#define SHA256_Final VSHA256_Final
#define SHA256_Test VSHA256_Test
#endif /* !_VSHA256_H_ */
PK wFZ)�bU{ { tbl/acct_fields_bereq.hnu �[��� /*-
* Copyright (c) 2008 Verdens Gang AS
* Copyright (c) 2008-2014 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* These are the stats we keep track of per busyobj.
*/
/*lint -save -e525 -e539 */
ACCT(bereq_hdrbytes)
ACCT(bereq_bodybytes)
ACCT(beresp_hdrbytes)
ACCT(beresp_bodybytes)
#undef ACCT
/*lint -restore */
PK wFZ^��� � tbl/http_headers.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2010 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Argument list:
* ---------------------------------------
* a Http header name
* b enum name
* c Supress header in filter ops
*
* see [RFC2616 13.5.1 End-to-end and Hop-by-hop Headers]
*
*/
/*lint -save -e525 -e539 */
/* Shorthand for this file only, to keep table narrow */
#if defined(P) || defined(F) || defined(I) || defined(H) || defined(S) || \
defined(K)
#error "Macro overloading" // Trust but verify
#endif
#define P HTTPH_R_PASS
#define F HTTPH_R_FETCH
#define I HTTPH_A_INS
#define S HTTPH_A_PASS
#define K HTTPH_C_SPECIFIC
#define H(s,e,f) HTTPH(s, e, f)
H("Accept", H_Accept, 0 ) // 2616 14.1
H("Accept-Charset", H_Accept_Charset, 0 ) // 2616 14.2
H("Accept-Encoding", H_Accept_Encoding, 0 ) // 2616 14.3
H("Accept-Language", H_Accept_Language, 0 ) // 2616 14.4
H("Accept-Ranges", H_Accept_Ranges, P|F|I ) // 2616 14.5
H("Age", H_Age, I|S ) // 2616 14.6
H("Allow", H_Allow, 0 ) // 2616 14.7
H("Authorization", H_Authorization, 0 ) // 2616 14.8
H("Cache-Control", H_Cache_Control, F ) // 2616 14.9
H("Connection", H_Connection, P|F|I|S|K) // 2616 14.10
H("Content-Encoding", H_Content_Encoding, 0 ) // 2616 14.11
H("Content-Language", H_Content_Language, 0 ) // 2616 14.12
H("Content-Length", H_Content_Length, 0 ) // 2616 14.13
H("Content-Location", H_Content_Location, 0 ) // 2616 14.14
H("Content-MD5", H_Content_MD5, 0 ) // 2616 14.15
H("Content-Range", H_Content_Range, F|I ) // 2616 14.16
H("Content-Type", H_Content_Type, 0 ) // 2616 14.17
H("Cookie", H_Cookie, 0 ) // 6265 4.2
H("Date", H_Date, 0 ) // 2616 14.18
H("ETag", H_ETag, 0 ) // 2616 14.19
H("Expect", H_Expect, 0 ) // 2616 14.20
H("Expires", H_Expires, 0 ) // 2616 14.21
H("From", H_From, 0 ) // 2616 14.22
H("Host", H_Host, 0 ) // 2616 14.23
H("HTTP2-Settings", H_HTTP2_Settings, P|F|I|S|K) // 7540 3.2.1
H("If-Match", H_If_Match, F ) // 2616 14.24
H("If-Modified-Since", H_If_Modified_Since, F ) // 2616 14.25
H("If-None-Match", H_If_None_Match, F ) // 2616 14.26
H("If-Range", H_If_Range, F ) // 2616 14.27
H("If-Unmodified-Since",H_If_Unmodified_Since, F ) // 2616 14.28
H("Keep-Alive", H_Keep_Alive, P|F|I|S|K) // 2616 13.5.1
H("Last-Modified", H_Last_Modified, 0 ) // 2616 14.29
H("Location", H_Location, 0 ) // 2616 14.30
H("Max-Forwards", H_Max_Forwards, 0 ) // 2616 14.31
H("Pragma", H_Pragma, 0 ) // 2616 14.32
H("Proxy-Authenticate", H_Proxy_Authenticate, F|I ) // 2616 14.33
H("Proxy-Authorization",H_Proxy_Authorization, F|I ) // 2616 14.34
H("Range", H_Range, F|I ) // 2616 14.35
H("Referer", H_Referer, 0 ) // 2616 14.36
H("Retry-After", H_Retry_After, 0 ) // 2616 14.37
H("Server", H_Server, 0 ) // 2616 14.38
H("Set-Cookie", H_Set_Cookie, 0 ) // 6265 4.1
H("TE", H_TE, P|F|I|S ) // 2616 14.39
H("Trailer", H_Trailer, P|F|I|S ) // 2616 14.40
H("Transfer-Encoding", H_Transfer_Encoding, P|F|I|S|K) // 2616 14.41
H("Upgrade", H_Upgrade, P|F|I|S|K) // 2616 14.42
H("User-Agent", H_User_Agent, 0 ) // 2616 14.43
H("Vary", H_Vary, 0 ) // 2616 14.44
H("Via", H_Via, 0 ) // 2616 14.45
H("Warning", H_Warning, 0 ) // 2616 14.46
H("WWW-Authenticate", H_WWW_Authenticate, 0 ) // 2616 14.47
H("X-Forwarded-For", H_X_Forwarded_For, 0 ) // No RFC
#undef P
#undef F
#undef I
#undef S
#undef K
#undef H
#undef HTTPH
/*lint -restore */
PK wFZ �� � tbl/vhd_fsm_funcs.hnu �[��� /*-
* Copyright (c) 2016 Varnish Software
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
VHD_FSM_FUNC(SKIP, vhd_skip)
VHD_FSM_FUNC(GOTO, vhd_goto)
VHD_FSM_FUNC(IDLE, vhd_idle)
VHD_FSM_FUNC(INTEGER, vhd_integer)
VHD_FSM_FUNC(SET_MAX, vhd_set_max)
VHD_FSM_FUNC(SET_IDX, vhd_set_idx)
VHD_FSM_FUNC(LOOKUP, vhd_lookup)
VHD_FSM_FUNC(NEW, vhd_new)
VHD_FSM_FUNC(NEW_IDX, vhd_new_idx)
VHD_FSM_FUNC(BRANCH_ZIDX, vhd_branch_zidx)
VHD_FSM_FUNC(BRANCH_BIT0, vhd_branch_bit0)
VHD_FSM_FUNC(RAW, vhd_raw)
VHD_FSM_FUNC(HUFFMAN, vhd_huffman)
#undef VHD_FSM_FUNC
/*lint -restore */
PK wFZK|(2w
w
tbl/debug_bits.hnu �[��� /*-
* Copyright (c) 2012 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Fields in the debug parameter
*
*/
/*lint -save -e525 -e539 */
DEBUG_BIT(REQ_STATE, req_state, "VSL Request state engine")
DEBUG_BIT(WORKSPACE, workspace, "VSL Workspace operations")
DEBUG_BIT(WAITER, waiter, "VSL Waiter internals")
DEBUG_BIT(WAITINGLIST, waitinglist, "VSL Waitinglist events")
DEBUG_BIT(SYNCVSL, syncvsl, "Make VSL synchronous")
DEBUG_BIT(HASHEDGE, hashedge, "Edge cases in Hash")
DEBUG_BIT(VCLREL, vclrel, "Rapid VCL release")
DEBUG_BIT(LURKER, lurker, "VSL Ban lurker")
DEBUG_BIT(ESI_CHOP, esi_chop, "Chop ESI fetch to bits")
DEBUG_BIT(FLUSH_HEAD, flush_head, "Flush after http1 head")
DEBUG_BIT(VTC_MODE, vtc_mode, "Varnishtest Mode")
DEBUG_BIT(WITNESS, witness, "Emit WITNESS lock records")
DEBUG_BIT(VSM_KEEP, vsm_keep, "Keep the VSM file on restart")
DEBUG_BIT(DROP_POOLS, drop_pools, "Drop thread pools (testing)")
DEBUG_BIT(SLOW_ACCEPTOR, slow_acceptor, "Slow down Acceptor")
DEBUG_BIT(H2_NOCHECK, h2_nocheck, "Disable various H2 checks")
DEBUG_BIT(VMOD_SO_KEEP, vmod_so_keep, "Keep copied VMOD libraries")
DEBUG_BIT(PROCESSORS, processors, "Fetch/Deliver processors")
DEBUG_BIT(PROTOCOL, protocol, "Protocol debugging")
DEBUG_BIT(VCL_KEEP, vcl_keep, "Keep VCL C and so files")
#undef DEBUG_BIT
/*lint -restore */
PK wFZCH�� � tbl/locks.hnu �[��� /*-
* Copyright (c) 2010 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
LOCK(backend)
LOCK(ban)
LOCK(busyobj)
LOCK(cli)
LOCK(exp)
LOCK(hcb)
LOCK(lru)
LOCK(mempool)
LOCK(objhdr)
LOCK(pipestat)
LOCK(sess)
LOCK(tcp_pool)
LOCK(vbe)
LOCK(vcapace)
LOCK(vcl)
LOCK(vxid)
LOCK(waiter)
LOCK(wq)
LOCK(wstat)
#undef LOCK
/*lint -restore */
PK wFZ@V tbl/boc_state.hnu �[��� /*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Federico G. Schwindt <fgsch@lodoss.net>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*lint -save -e525 -e539 */
BOC_STATE(INVALID, invalid) /* don't touch (yet) */
BOC_STATE(REQ_DONE, req_done) /* bereq.* can be examined */
BOC_STATE(PREP_STREAM, prep_stream) /* Prepare for streaming */
BOC_STATE(STREAM, stream) /* beresp.* can be examined */
BOC_STATE(FINISHED, finished) /* object is complete */
BOC_STATE(FAILED, failed) /* something went wrong */
#undef BOC_STATE
/*lint -restore */
PK wFZ�JgTQ Q tbl/http_response.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2009 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
HTTP_RESP(100, "Continue")
HTTP_RESP(101, "Switching Protocols")
HTTP_RESP(102, "Processing")
HTTP_RESP(103, "Early Hints")
HTTP_RESP(200, "OK")
HTTP_RESP(201, "Created")
HTTP_RESP(202, "Accepted")
HTTP_RESP(203, "Non-Authoritative Information")
HTTP_RESP(204, "No Content")
HTTP_RESP(205, "Reset Content")
HTTP_RESP(206, "Partial Content")
HTTP_RESP(207, "Multi-Status")
HTTP_RESP(208, "Already Reported")
HTTP_RESP(226, "IM Used")
HTTP_RESP(300, "Multiple Choices")
HTTP_RESP(301, "Moved Permanently")
HTTP_RESP(302, "Found")
HTTP_RESP(303, "See Other")
HTTP_RESP(304, "Not Modified")
HTTP_RESP(305, "Use Proxy")
HTTP_RESP(306, "(Unused)")
HTTP_RESP(307, "Temporary Redirect")
HTTP_RESP(308, "Permanent Redirect")
HTTP_RESP(400, "Bad Request")
HTTP_RESP(401, "Unauthorized")
HTTP_RESP(402, "Payment Required")
HTTP_RESP(403, "Forbidden")
HTTP_RESP(404, "Not Found")
HTTP_RESP(405, "Method Not Allowed")
HTTP_RESP(406, "Not Acceptable")
HTTP_RESP(407, "Proxy Authentication Required")
HTTP_RESP(408, "Request Timeout")
HTTP_RESP(409, "Conflict")
HTTP_RESP(410, "Gone")
HTTP_RESP(411, "Length Required")
HTTP_RESP(412, "Precondition Failed")
HTTP_RESP(413, "Request Entity Too Large")
HTTP_RESP(414, "Request-URI Too Long")
HTTP_RESP(415, "Unsupported Media Type")
HTTP_RESP(416, "Requested Range Not Satisfiable")
HTTP_RESP(417, "Expectation Failed")
HTTP_RESP(421, "Misdirected Request")
HTTP_RESP(422, "Unprocessable Entity")
HTTP_RESP(423, "Locked")
HTTP_RESP(424, "Failed Dependency")
HTTP_RESP(425, "Too Early")
HTTP_RESP(426, "Upgrade Required")
HTTP_RESP(428, "Precondition Required")
HTTP_RESP(429, "Too Many Requests")
HTTP_RESP(431, "Request Header Fields Too Large")
HTTP_RESP(451, "Unavailable For Legal Reasons")
HTTP_RESP(500, "Internal Server Error")
HTTP_RESP(501, "Not Implemented")
HTTP_RESP(502, "Bad Gateway")
HTTP_RESP(503, "Service Unavailable")
HTTP_RESP(504, "Gateway Timeout")
HTTP_RESP(505, "HTTP Version Not Supported")
HTTP_RESP(506, "Variant Also Negotiates")
HTTP_RESP(507, "Insufficient Storage")
HTTP_RESP(508, "Loop Detected")
HTTP_RESP(510, "Not Extended")
HTTP_RESP(511, "Network Authentication Required")
#undef HTTP_RESP
/*lint -restore */
PK wFZ�8� tbl/vcl_returns.hnu �[��� /*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run lib/libvcc/generate.py instead.
*/
/*lint -save -e525 -e539 */
#ifdef VCL_RET_MAC
VCL_RET_MAC(abandon, ABANDON,
VCL_MET_BACKEND_ERROR |
VCL_MET_BACKEND_FETCH |
VCL_MET_BACKEND_RESPONSE
)
VCL_RET_MAC(deliver, DELIVER,
VCL_MET_BACKEND_ERROR |
VCL_MET_BACKEND_RESPONSE |
VCL_MET_DELIVER |
VCL_MET_HIT |
VCL_MET_SYNTH
)
VCL_RET_MAC(error, ERROR,
VCL_MET_BACKEND_FETCH |
VCL_MET_BACKEND_RESPONSE
)
VCL_RET_MAC(fail, FAIL,
VCL_MET_BACKEND_ERROR |
VCL_MET_BACKEND_FETCH |
VCL_MET_BACKEND_RESPONSE |
VCL_MET_DELIVER |
VCL_MET_HASH |
VCL_MET_HIT |
VCL_MET_INIT |
VCL_MET_MISS |
VCL_MET_PASS |
VCL_MET_PIPE |
VCL_MET_PURGE |
VCL_MET_RECV |
VCL_MET_SYNTH
)
VCL_RET_MAC(fetch, FETCH,
VCL_MET_BACKEND_FETCH |
VCL_MET_MISS |
VCL_MET_PASS
)
VCL_RET_MAC(hash, HASH,
VCL_MET_RECV
)
VCL_RET_MAC(lookup, LOOKUP,
VCL_MET_HASH
)
VCL_RET_MAC(miss, MISS,
VCL_MET_HIT
)
VCL_RET_MAC(ok, OK,
VCL_MET_FINI |
VCL_MET_INIT
)
VCL_RET_MAC(pass, PASS,
VCL_MET_BACKEND_RESPONSE |
VCL_MET_HIT |
VCL_MET_MISS |
VCL_MET_RECV
)
VCL_RET_MAC(pipe, PIPE,
VCL_MET_PIPE |
VCL_MET_RECV
)
VCL_RET_MAC(purge, PURGE,
VCL_MET_RECV
)
VCL_RET_MAC(restart, RESTART,
VCL_MET_DELIVER |
VCL_MET_HIT |
VCL_MET_MISS |
VCL_MET_PASS |
VCL_MET_PURGE |
VCL_MET_RECV |
VCL_MET_SYNTH
)
VCL_RET_MAC(retry, RETRY,
VCL_MET_BACKEND_ERROR |
VCL_MET_BACKEND_RESPONSE
)
VCL_RET_MAC(synth, SYNTH,
VCL_MET_DELIVER |
VCL_MET_HIT |
VCL_MET_MISS |
VCL_MET_PASS |
VCL_MET_PIPE |
VCL_MET_PURGE |
VCL_MET_RECV
)
VCL_RET_MAC(vcl, VCL,
VCL_MET_RECV
)
#undef VCL_RET_MAC
#endif
#ifdef VCL_MET_MAC
VCL_MET_MAC(backend_error, BACKEND_ERROR, B, (
(1U << VCL_RET_ABANDON) |
(1U << VCL_RET_DELIVER) |
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_RETRY))
)
VCL_MET_MAC(backend_fetch, BACKEND_FETCH, B, (
(1U << VCL_RET_ABANDON) |
(1U << VCL_RET_ERROR) |
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_FETCH))
)
VCL_MET_MAC(backend_response, BACKEND_RESPONSE, B, (
(1U << VCL_RET_ABANDON) |
(1U << VCL_RET_DELIVER) |
(1U << VCL_RET_ERROR) |
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_PASS) |
(1U << VCL_RET_RETRY))
)
VCL_MET_MAC(deliver, DELIVER, C, (
(1U << VCL_RET_DELIVER) |
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_RESTART) |
(1U << VCL_RET_SYNTH))
)
VCL_MET_MAC(fini, FINI, H, (
(1U << VCL_RET_OK))
)
VCL_MET_MAC(hash, HASH, C, (
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_LOOKUP))
)
VCL_MET_MAC(hit, HIT, C, (
(1U << VCL_RET_DELIVER) |
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_MISS) |
(1U << VCL_RET_PASS) |
(1U << VCL_RET_RESTART) |
(1U << VCL_RET_SYNTH))
)
VCL_MET_MAC(init, INIT, H, (
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_OK))
)
VCL_MET_MAC(miss, MISS, C, (
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_FETCH) |
(1U << VCL_RET_PASS) |
(1U << VCL_RET_RESTART) |
(1U << VCL_RET_SYNTH))
)
VCL_MET_MAC(pass, PASS, C, (
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_FETCH) |
(1U << VCL_RET_RESTART) |
(1U << VCL_RET_SYNTH))
)
VCL_MET_MAC(pipe, PIPE, C, (
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_PIPE) |
(1U << VCL_RET_SYNTH))
)
VCL_MET_MAC(purge, PURGE, C, (
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_RESTART) |
(1U << VCL_RET_SYNTH))
)
VCL_MET_MAC(recv, RECV, C, (
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_HASH) |
(1U << VCL_RET_PASS) |
(1U << VCL_RET_PIPE) |
(1U << VCL_RET_PURGE) |
(1U << VCL_RET_RESTART) |
(1U << VCL_RET_SYNTH) |
(1U << VCL_RET_VCL))
)
VCL_MET_MAC(synth, SYNTH, C, (
(1U << VCL_RET_DELIVER) |
(1U << VCL_RET_FAIL) |
(1U << VCL_RET_RESTART))
)
#undef VCL_MET_MAC
#endif
/*lint -restore */
PK wFZ�&�� � tbl/vhd_return.hnu �[��� /*-
* Copyright (c) 2016 Varnish Software
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
VHD_RET(ERR_ARG, -1, "Invalid HPACK instruction")
VHD_RET(ERR_INT, -2, "Integer overflow")
VHD_RET(ERR_IDX, -3, "Invalid table index")
VHD_RET(ERR_LEN, -4, "Invalid length")
VHD_RET(ERR_HUF, -5, "Invalid huffman code")
VHD_RET(ERR_UPD, -6, "Spurious update")
VHD_RET(OK, 0, "OK")
VHD_RET(MORE, 1, "Feed me")
VHD_RET(NAME, 2, "Name")
VHD_RET(VALUE, 3, "Value")
VHD_RET(NAME_SEC, 4, "Name never index")
VHD_RET(VALUE_SEC, 5, "Value never index")
VHD_RET(BUF, 6, "Stuffed")
VHD_RET(AGAIN, 7, "Call again")
#undef VHD_RET
/*lint -restore */
PK wFZ�>�D tbl/ban_vars.hnu �[��� /*-
* Copyright (c) 2008-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Define which variables we can ban on, and which function does it.
*
*/
/*lint -save -e525 -e539 */
PVAR("req.url", BANS_FLAG_REQ, BANS_ARG_URL)
PVAR("req.http.", BANS_FLAG_REQ | BANS_FLAG_HTTP, BANS_ARG_REQHTTP)
PVAR("obj.status", BANS_FLAG_OBJ, BANS_ARG_OBJSTATUS)
PVAR("obj.http.", BANS_FLAG_OBJ | BANS_FLAG_HTTP, BANS_ARG_OBJHTTP)
#undef PVAR
/*lint -restore */
PK wFZ�B6 6 tbl/vcc_types.hnu �[��� /*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run lib/libvcc/generate.py instead.
*/
/*lint -save -e525 -e539 */
VCC_TYPE(ACL)
VCC_TYPE(BACKEND)
VCC_TYPE(BLOB)
VCC_TYPE(BODY)
VCC_TYPE(BOOL)
VCC_TYPE(BYTES)
VCC_TYPE(DURATION)
VCC_TYPE(ENUM)
VCC_TYPE(HEADER)
VCC_TYPE(HTTP)
VCC_TYPE(INSTANCE)
VCC_TYPE(INT)
VCC_TYPE(IP)
VCC_TYPE(PROBE)
VCC_TYPE(REAL)
VCC_TYPE(STEVEDORE)
VCC_TYPE(STRANDS)
VCC_TYPE(STRING)
VCC_TYPE(STRINGS)
VCC_TYPE(STRING_LIST)
VCC_TYPE(SUB)
VCC_TYPE(TIME)
VCC_TYPE(VCL)
VCC_TYPE(VOID)
#undef VCC_TYPE
/*lint -restore */
PK wFZe�ê � tbl/vcl_states.hnu �[��� /*lint -save -e525 -e539 */
VCL_STATE(COLD, "cold")
VCL_STATE(WARM, "warm")
VCL_STATE(AUTO, "auto")
#undef VCL_STATE
// LABEL is private to mgt_vcl.c
/*lint -restore */
PK wFZ_]I�� � tbl/body_status.hnu �[��� /*-
* Copyright (c) 2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Various ways to handle the body coming from the backend.
*/
/*lint -save -e525 -e539 */
BODYSTATUS(NONE, none)
BODYSTATUS(ERROR, error)
BODYSTATUS(CHUNKED, chunked)
BODYSTATUS(LENGTH, length)
BODYSTATUS(EOF, eof)
#undef BODYSTATUS
/*lint -restore */
PK wFZ:�l�$ $ tbl/cli_cmds.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* These macros define the common data for requests in the CLI protocol.
* The fields are:
* const char * upper-case C-ident request_name
* const char * request_name
* const char * request_syntax (for short help)
* const char * request_help (for long help)
* const char * documentation (for sphinx)
* int minimum_arguments
* int maximum_arguments
*/
/*lint -save -e525 -e539 */
CLI_CMD(BAN,
"ban",
"ban <field> <operator> <arg> [&& <field> <oper> <arg> ...]",
"Mark obsolete all objects where all the conditions match.",
"See :ref:`vcl(7)_ban` for details",
3, -1
)
CLI_CMD(BAN_LIST,
"ban.list",
"ban.list [-j]",
"List the active bans.",
" Unless ``-j`` is specified (for JSON output), "
" the output format is:\n\n"
" * Time the ban was issued.\n\n"
" * Objects referencing this ban.\n\n"
" * ``C`` if ban is completed = no further testing against it.\n\n"
" * if ``lurker`` debugging is enabled:\n\n"
" * ``R`` for req.* tests\n\n"
" * ``O`` for obj.* tests\n\n"
" * Pointer to ban object\n\n"
" * Ban specification",
0, 0
)
CLI_CMD(VCL_LOAD,
"vcl.load",
"vcl.load <configname> <filename> [auto|cold|warm]",
"Compile and load the VCL file under the name provided.",
"",
2, 3
)
CLI_CMD(VCL_INLINE,
"vcl.inline",
"vcl.inline <configname> <quoted_VCLstring> [auto|cold|warm]",
"Compile and load the VCL data under the name provided.",
" Multi-line VCL can be input using the here document"
" :ref:`ref_syntax`.",
2, 3
)
CLI_CMD(VCL_STATE,
"vcl.state",
"vcl.state <configname> [auto|cold|warm]",
"Force the state of the named configuration.",
"",
2, 2
)
CLI_CMD(VCL_DISCARD,
"vcl.discard",
"vcl.discard <configname|label>",
"Unload the named configuration (when possible).",
"",
1, 1
)
CLI_CMD(VCL_LIST,
"vcl.list",
"vcl.list [-j]",
"List all loaded configuration.",
"``-j`` specifies JSON output.",
0, 0
)
CLI_CMD(VCL_SHOW,
"vcl.show",
"vcl.show [-v] <configname>",
"Display the source code for the specified configuration.",
"",
1, 2
)
CLI_CMD(VCL_USE,
"vcl.use",
"vcl.use <configname|label>",
"Switch to the named configuration immediately.",
"",
1, 1
)
CLI_CMD(VCL_LABEL,
"vcl.label",
"vcl.label <label> <configname>",
"Apply label to configuration.",
"",
2, 2
)
CLI_CMD(PARAM_RESET,
"param.reset",
"param.reset <param>",
"Reset parameter to default value.",
"",
1,1
)
CLI_CMD(PARAM_SHOW,
"param.show",
"param.show [-l|-j] [<param>|changed]",
"Show parameters and their values.",
"The long form with ``-l`` shows additional information, including"
" documentation and minimum, maximum and default values, if defined"
" for the parameter. JSON output is specified with ``-j``, in which"
" the information for the long form is included; only one of ``-l`` or"
" ``-j`` is permitted. If a parameter is specified with ``<param>``,"
" show only that parameter. If ``changed`` is specified, show only"
" those parameters whose values differ from their defaults.",
0, 2
)
CLI_CMD(PARAM_SET,
"param.set",
"param.set <param> <value>",
"Set parameter value.",
"",
2,2
)
CLI_CMD(SERVER_STOP,
"stop",
"stop",
"Stop the Varnish cache process.",
"",
0, 0
)
CLI_CMD(SERVER_START,
"start",
"start",
"Start the Varnish cache process.",
"",
0, 0
)
CLI_CMD(PING,
"ping",
"ping [-j] [<timestamp>]",
"Keep connection alive.",
"The response is formatted as JSON if ``-j`` is specified.",
0, 1
)
CLI_CMD(HELP,
"help",
"help [-j] [<command>]",
"Show command/protocol help.",
"``-j`` specifies JSON output.",
0, 1
)
CLI_CMD(QUIT,
"quit",
"quit",
"Close connection.",
"",
0, 0
)
CLI_CMD(SERVER_STATUS,
"status",
"status [-j]",
"Check status of Varnish cache process.",
"``-j`` specifies JSON output.",
0, 0
)
CLI_CMD(BANNER,
"banner",
"banner",
"Print welcome banner.",
"",
0, 0
)
CLI_CMD(AUTH,
"auth",
"auth <response>",
"Authenticate.",
"",
1, 1
)
CLI_CMD(PANIC_SHOW,
"panic.show",
"panic.show [-j]",
"Return the last panic, if any.",
"``-j`` specifies JSON output -- the panic message is returned as an"
" unstructured JSON string.",
0, 0
)
CLI_CMD(PANIC_CLEAR,
"panic.clear",
"panic.clear [-z]",
"Clear the last panic, if any,"
" -z will clear related varnishstat counter(s)",
"",
0, 1
)
CLI_CMD(DEBUG_LISTEN_ADDRESS,
"debug.listen_address",
"debug.listen_address",
"Report the actual listen address.",
"",
0, 0
)
CLI_CMD(BACKEND_LIST,
"backend.list",
"backend.list [-j] [-p] [<backend_pattern>]",
"List backends. -p also shows probe status.",
"``-j`` specifies JSON output.",
0, 2
)
CLI_CMD(BACKEND_SET_HEALTH,
"backend.set_health",
"backend.set_health <backend_pattern> [auto|healthy|sick]",
"Set health status on the backends.",
"",
2, 2
)
CLI_CMD(DEBUG_FRAGFETCH,
"debug.fragfetch",
"debug.fragfetch",
"Enable fetch fragmentation.",
"",
1, 1
)
CLI_CMD(DEBUG_REQPOOLFAIL,
"debug.reqpool.fail",
"debug.reqpool.fail",
"Schedule req-pool failures.",
"The argument is read L-R and 'f' means fail:\n\n"
"\tparam.set debug.reqpoolfail F__F\n\n"
"Means that the frist and the third attempted allocation will fail",
1, 1
)
CLI_CMD(DEBUG_XID,
"debug.xid",
"debug.xid",
"Examine or set XID.",
"",
0, 1
)
CLI_CMD(DEBUG_SRANDOM,
"debug.srandom",
"debug.srandom",
"Seed the random(3) function.",
"",
0, 1
)
CLI_CMD(DEBUG_PANIC_WORKER,
"debug.panic.worker",
"debug.panic.worker",
"Panic the worker process.",
"",
0, 0
)
CLI_CMD(DEBUG_PANIC_MASTER,
"debug.panic.master",
"debug.panic.master",
"Panic the master process.",
"",
0, 0
)
CLI_CMD(DEBUG_VMOD,
"debug.vmod",
"debug.vmod",
"Show loaded vmods.",
"",
0, 0
)
CLI_CMD(DEBUG_PERSISTENT,
"debug.persistent",
"debug.persistent [<stevedore>] [<cmd>]",
"Persistent debugging magic:\n"
"With no cmd arg, a summary of the silo is returned.\n"
"Possible commands:\n"
"\tsync\tClose current segment, open a new one\n"
"\tdump\tinclude objcores in silo summary",
"",
0, 2
)
CLI_CMD(STORAGE_LIST,
"storage.list",
"storage.list [-j]",
"List storage devices.",
"``-j`` specifies JSON output.",
0, 0
)
CLI_CMD(PID,
"pid",
"pid [-j]",
"Show the pid of the master process, and the worker if it's running.",
" ``-j`` specifies JSON output.",
0, 0
)
#undef CLI_CMD
/*lint -restore */
PK wFZ���) tbl/vsl_tags_http.hnu �[��� /*-
* Copyright (c) 2012 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Define the VSL tags for HTTP protocol messages
*
* NB: The order of this table is not random, DO NOT RESORT.
*
* Specifically FIRST, UNSET and LOST entries must be last, in that order.
*
* See bin/varnishd/cache/cache_http.c::http_VSLH() for the other side.
*
* Arguments:
* Tag-Name
* struct http header index
* 1 if this header is used in requests
* 1 if this header is used in responses
* short description postfix
* long description (in RST "definition list" format)
*
*/
/*lint -save -e525 -e539 -e835 */
SLTH(Method, HTTP_HDR_METHOD, 1, 0, "method",
"The HTTP request method used.\n\n"
)
SLTH(URL, HTTP_HDR_URL, 1, 0, "URL",
"The HTTP request URL.\n\n"
)
SLTH(Protocol, HTTP_HDR_PROTO, 1, 1, "protocol",
"The HTTP protocol version information.\n\n"
)
SLTH(Status, HTTP_HDR_STATUS, 0, 1, "status",
"The HTTP status code received.\n\n"
)
SLTH(Reason, HTTP_HDR_REASON, 0, 1, "response",
"The HTTP response string received.\n\n"
)
SLTH(Header, HTTP_HDR_FIRST, 1, 1, "header",
"HTTP header contents.\n\n"
"The format is::\n\n"
"\t%s: %s\n"
"\t| |\n"
"\t| +- Header value\n"
"\t+----- Header name\n"
"\n"
)
SLTH(Unset, HTTP_HDR_UNSET, 0, 0, "unset header",
"HTTP header contents.\n\n"
"The format is::\n\n"
"\t%s: %s\n"
"\t| |\n"
"\t| +- Header value\n"
"\t+----- Header name\n"
"\n"
)
SLTH(Lost, HTTP_HDR_LOST, 0, 0, "lost header",
""
)
#undef SLTH
/*lint -restore */
PK wFZ�#L\� � tbl/feature_bits.hnu �[��� /*-
* Copyright (c) 2012 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Fields in the feature parameter
*
*/
/*lint -save -e525 -e539 */
FEATURE_BIT(SHORT_PANIC, short_panic,
"Short panic message.",
"Reduce level of detail for panic messages."
)
FEATURE_BIT(WAIT_SILO, wait_silo,
"Wait for persistent silo.",
"Wait for persistent silos to load completely before serving requests."
)
FEATURE_BIT(NO_COREDUMP, no_coredump,
"No coredumps.",
"Don't attempt to coredump child process on panics."
)
FEATURE_BIT(ESI_IGNORE_HTTPS, esi_ignore_https,
"Treat HTTPS as HTTP in ESI:includes",
"Convert <esi:include src\"https://... to http://..."
)
FEATURE_BIT(ESI_DISABLE_XML_CHECK, esi_disable_xml_check,
"Don't check of body looks like XML",
"Allow ESI processing on any kind of object"
)
FEATURE_BIT(ESI_IGNORE_OTHER_ELEMENTS, esi_ignore_other_elements,
"Ignore non-esi XML-elements",
"Allows syntax errors in the XML"
)
FEATURE_BIT(ESI_REMOVE_BOM, esi_remove_bom,
"Remove UTF-8 BOM",
"Remove UTF-8 BOM from front of object."
"Ignore and remove the UTF-8 BOM (0xeb 0xbb 0xbf) from front of object."
)
FEATURE_BIT(HTTPS_SCHEME, https_scheme,
"Also split https URIs",
"Extract host from full URI in the request line if the scheme is https."
)
FEATURE_BIT(HTTP2, http2,
"Support HTTP/2 protocol",
"Enable HTTP/2 protocol support."
)
FEATURE_BIT(HTTP_DATE_POSTEL, http_date_postel,
"Relax parsing of timestamps in HTTP headers",
"Tolerate non standards conforming variations of timestamp headers"
"like Date:, Last-Modified:, Expires: etc."
)
FEATURE_BIT(VCL_REQ_RESET, vcl_req_reset,
"Stop processing client VCL once the client is gone.",
"Stop processing client VCL once the client is gone. "
"When this happens MAIN.req_reset is incremented."
)
#undef FEATURE_BIT
/*lint -restore */
PK wFZb��| |
tbl/waiters.hnu �[��� /*-
* Copyright (c) 2017 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* WAITER(nm)
*/
/*lint -save -e525 -e539 */
#if defined(HAVE_KQUEUE)
WAITER(kqueue)
#endif
#if defined(HAVE_PORT_CREATE)
WAITER(ports)
#endif
#if defined(HAVE_EPOLL_CTL)
WAITER(epoll)
#endif
WAITER(poll)
#undef WAITER
/*lint -restore */
PK wFZ�X�c�
�
tbl/sess_close.hnu �[��� /*-
* Copyright (c) 2012 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
// enum sess_close sc_* stat is_err Description
SESS_CLOSE(REM_CLOSE, rem_close, 0, "Client Closed")
SESS_CLOSE(REQ_CLOSE, req_close, 0, "Client requested close")
SESS_CLOSE(REQ_HTTP10, req_http10, 1, "Proto < HTTP/1.1")
SESS_CLOSE(RX_BAD, rx_bad, 1, "Received bad req/resp")
SESS_CLOSE(RX_BODY, rx_body, 1, "Failure receiving req.body")
SESS_CLOSE(RX_JUNK, rx_junk, 1, "Received junk data")
SESS_CLOSE(RX_OVERFLOW, rx_overflow, 1, "Received buffer overflow")
SESS_CLOSE(RX_TIMEOUT, rx_timeout, 1, "Receive timeout")
SESS_CLOSE(TX_PIPE, tx_pipe, 0, "Piped transaction")
SESS_CLOSE(TX_ERROR, tx_error, 1, "Error transaction")
SESS_CLOSE(TX_EOF, tx_eof, 0, "EOF transmission")
SESS_CLOSE(RESP_CLOSE, resp_close, 0, "Backend/VCL requested close")
SESS_CLOSE(OVERLOAD, overload, 1, "Out of some resource")
SESS_CLOSE(PIPE_OVERFLOW, pipe_overflow,1, "Session pipe overflow")
SESS_CLOSE(RANGE_SHORT, range_short, 1, "Insufficient data for range")
SESS_CLOSE(REQ_HTTP20, req_http20, 1, "HTTP2 not accepted")
SESS_CLOSE(VCL_FAILURE, vcl_failure, 1, "VCL failure")
SESS_CLOSE(RAPID_RESET, rapid_reset, 1, "HTTP2 rapid reset")
SESS_CLOSE(BANKRUPT, bankrupt, 1, "HTTP2 credit bankruptcy")
#undef SESS_CLOSE
/*lint -restore */
PK wFZ{�lt tbl/symbol_kind.hnu �[��� /*-
* Copyright (c) 2010-2014 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
VCC_KIND(NONE, none)
VCC_KIND(ACL, acl)
VCC_KIND(ACTION, action)
VCC_KIND(BACKEND, backend)
VCC_KIND(FUNC, func)
VCC_KIND(INSTANCE, instance)
VCC_KIND(METHOD, method)
VCC_KIND(OBJECT, object)
VCC_KIND(PROBE, probe)
VCC_KIND(STEVEDORE, stevedore)
VCC_KIND(SUB, sub)
VCC_KIND(VAR, var)
VCC_KIND(VCL, vcl)
VCC_KIND(VMOD, vmod)
#undef VCC_KIND
/*lint -restore */
PK wFZA1A� � tbl/bo_flags.hnu �[��� /*-
* Copyright (c) 2014-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
/* lower, vcl_r, vcl_w, doc */
BO_FLAG(do_esi, 1, 1, "")
BO_FLAG(do_gzip, 1, 1, "")
BO_FLAG(do_gunzip, 1, 1, "")
BO_FLAG(do_stream, 1, 1, "")
BO_FLAG(do_pass, 0, 0, "")
BO_FLAG(uncacheable, 0, 0, "")
BO_FLAG(was_304, 1, 0, "")
BO_FLAG(is_bgfetch, 0, 0, "")
#undef BO_FLAG
/*lint -restore */
PK wFZEX��) ) tbl/vsc_levels.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2014 Varnish Software AS
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Fields (v, l, e, d):
* v - Verbosity lvl: Field name, in C-source
* l - Label: Display name, in stats programs
* e - Explanation: Short description of this counter type
* d - Description: Long description of this counter type
*/
/*lint -save -e525 -e539 */
VSC_LEVEL_F(info, "INFO", "Informational counters",
"Counters giving runtime information"
)
VSC_LEVEL_F(diag, "DIAG", "Diagnostic counters",
"Counters giving diagnostic information"
)
VSC_LEVEL_F(debug, "DEBUG", "Debug counters",
"Counters giving Varnish internals debug information"
)
#undef VSC_LEVEL_F
/*lint -restore */
PK wFZ�⤲ tbl/backend_poll.hnu �[��� /*-
* Copyright (c) 2008-2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
BITMAP(good_ipv4, '4', "Good IPv4", 0)
BITMAP(good_ipv6, '6', "Good IPv6", 0)
BITMAP(good_unix, 'U', "Good UNIX", 0)
BITMAP( err_xmit, 'x', "Error Xmit", 0)
BITMAP(good_xmit, 'X', "Good Xmit", 0)
BITMAP( err_recv, 'r', "Error Recv", 0)
BITMAP(good_recv, 'R', "Good Recv", 0)
BITMAP(happy, 'H', "Happy", 1)
#undef BITMAP
/*lint -restore */
PK wFZ��8 8 tbl/htc.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* HTC status values
*/
/*lint -save -e525 -e539 */
// enum htc_status_e n short long
HTC_STATUS(JUNK, -5, "junk", "Received unexpected data")
HTC_STATUS(CLOSE, -4, "close", "Connection closed") // unused?
HTC_STATUS(TIMEOUT, -3, "timeout", "Timed out")
HTC_STATUS(OVERFLOW, -2, "overflow", "Buffer/workspace too small")
HTC_STATUS(EOF, -1, "eof", "Unexpected end of input")
HTC_STATUS(EMPTY, 0, "empty", "Empty response")
HTC_STATUS(MORE, 1, "more", "More data required")
HTC_STATUS(COMPLETE, 2, "complete", "Data complete (no error)")
HTC_STATUS(IDLE, 3, "idle", "Connection was closed while idle")
#undef HTC_STATUS
/*lint -restore */
PK wFZFo �/ / tbl/req_flags.hnu �[��� /*-
* Copyright (c) 2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
/* lower, vcl_r, vcl_w, doc */
REQ_FLAG(disable_esi, 0, 0, "")
REQ_FLAG(hash_ignore_busy, 1, 1, "")
REQ_FLAG(hash_always_miss, 1, 1, "")
REQ_FLAG(is_hit, 0, 0, "")
REQ_FLAG(is_hitmiss, 1, 0, "")
REQ_FLAG(is_hitpass, 1, 0, "")
REQ_FLAG(waitinglist, 0, 0, "")
REQ_FLAG(want100cont, 0, 0, "")
REQ_FLAG(late100cont, 0, 0, "")
REQ_FLAG(req_reset, 0, 0, "")
#undef REQ_FLAG
/*lint -restore */
PK wFZQ�q�* * tbl/vrt_stv_var.hnu �[��� /*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run lib/libvcc/generate.py instead.
*/
/*lint -save -e525 -e539 */
VRTSTVVAR(free_space, BYTES, int64_t, 0.)
VRTSTVVAR(used_space, BYTES, int64_t, 0.)
VRTSTVVAR(happy, BOOL, unsigned, 0)
#undef VRTSTVVAR
/*lint -restore */
PK wFZ���� � tbl/vhp_static.hnu �[��� /*-
* Written by Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
*
* This file is in the public domain.
*
* HPACK: Static Table Definition (RFC 7540 Appendix A)
*/
/*lint -save -e525 -e539 */
HPS( 1, ":authority", "")
HPS( 2, ":method", "GET")
HPS( 3, ":method", "POST")
HPS( 4, ":path", "/")
HPS( 5, ":path", "/index.html")
HPS( 6, ":scheme", "http")
HPS( 7, ":scheme", "https")
HPS( 8, ":status", "200")
HPS( 9, ":status", "204")
HPS(10, ":status", "206")
HPS(11, ":status", "304")
HPS(12, ":status", "400")
HPS(13, ":status", "404")
HPS(14, ":status", "500")
HPS(15, "accept-charset", "")
HPS(16, "accept-encoding", "gzip, deflate")
HPS(17, "accept-language", "")
HPS(18, "accept-ranges", "")
HPS(19, "accept", "")
HPS(20, "access-control-allow-origin", "")
HPS(21, "age", "")
HPS(22, "allow", "")
HPS(23, "authorization", "")
HPS(24, "cache-control", "")
HPS(25, "content-disposition", "")
HPS(26, "content-encoding", "")
HPS(27, "content-language", "")
HPS(28, "content-length", "")
HPS(29, "content-location", "")
HPS(30, "content-range", "")
HPS(31, "content-type", "")
HPS(32, "cookie", "")
HPS(33, "date", "")
HPS(34, "etag", "")
HPS(35, "expect", "")
HPS(36, "expires", "")
HPS(37, "from", "")
HPS(38, "host", "")
HPS(39, "if-match", "")
HPS(40, "if-modified-since", "")
HPS(41, "if-none-match", "")
HPS(42, "if-range", "")
HPS(43, "if-unmodified-since", "")
HPS(44, "last-modified", "")
HPS(45, "link", "")
HPS(46, "location", "")
HPS(47, "max-forwards", "")
HPS(48, "proxy-authenticate", "")
HPS(49, "proxy-authorization", "")
HPS(50, "range", "")
HPS(51, "referer", "")
HPS(52, "refresh", "")
HPS(53, "retry-after", "")
HPS(54, "server", "")
HPS(55, "set-cookie", "")
HPS(56, "strict-transport-security", "")
HPS(57, "transfer-encoding", "")
HPS(58, "user-agent", "")
HPS(59, "vary", "")
HPS(60, "via", "")
HPS(61, "www-authenticate", "")
#undef HPS
/*lint -restore */
PK wFZ��}� � tbl/acct_fields_req.hnu �[��� /*-
* Copyright (c) 2008 Verdens Gang AS
* Copyright (c) 2008-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* These are the stats we keep track of per request.
* NB: Remember to mark those in vsc_fields.h to be included in struct dstat.
*/
/*lint -save -e525 -e539 */
ACCT(req_hdrbytes)
ACCT(req_bodybytes)
ACCT(resp_hdrbytes)
ACCT(resp_bodybytes)
#undef ACCT
/*lint -restore */
PK wFZ��n�R �R tbl/vsl_tags.hnu �[��� /*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Define the tags in the shared memory in a reusable format.
* Whoever includes this get to define what the SLTM macro does.
*
* REMEMBER to update the documentation (especially the varnishlog(1) man
* page) whenever this list changes.
*
* XXX: Please add new entries a the end to not break saved log-segments.
*
* Arguments:
* Tag-Name
* Flags
* Short Description (1 line, max ? chars)
* Long Description (in RST "definition list" format)
*/
/*lint -save -e525 -e539 */
#define NODEF_NOTICE \
"NB: This log record is masked by default.\n\n"
#define NOSUP_NOTICE \
"\tNOTE: This tag is currently not in use in the Varnish log.\n" \
"\tIt is mentioned here to document legacy versions of the log,\n" \
"\tor reserved for possible use in future versions.\n\n"
SLTM(Debug, SLT_F_UNSAFE, "Debug messages",
"Debug messages can normally be ignored, but are sometimes"
" helpful during trouble-shooting. Most debug messages must"
" be explicitly enabled with parameters.\n\n"
"Debug messages may be added, changed or removed without"
" prior notice and shouldn't be considered stable.\n\n"
)
SLTM(Error, 0, "Error messages",
"Error messages are stuff you probably want to know.\n\n"
)
SLTM(CLI, 0, "CLI communication",
"CLI communication between varnishd master and child process.\n\n"
)
/*---------------------------------------------------------------------*/
SLTM(SessOpen, 0, "Client connection opened",
"The first record for a client connection, with the socket-endpoints"
" of the connection.\n\n"
"The format is::\n\n"
"\t%s %d %s %s %s %d\n"
"\t| | | | | |\n"
"\t| | | | | +- File descriptor number\n"
"\t| | | | +---- Local TCP port\n"
"\t| | | +------- Local IPv4/6 address\n"
"\t| | +---------- Socket name (from -a argument)\n"
"\t| +------------- Remote TCP port\n"
"\t+---------------- Remote IPv4/6 address\n"
"\n"
)
SLTM(SessClose, 0, "Client connection closed",
"SessClose is the last record for any client connection.\n\n"
"The format is::\n\n"
"\t%s %f\n"
"\t| |\n"
"\t| +- How long the session was open\n"
"\t+---- Why the connection closed\n"
"\n"
)
/*---------------------------------------------------------------------*/
SLTM(BackendOpen, 0, "Backend connection opened",
"Logged when a new backend connection is opened.\n\n"
"The format is::\n\n"
"\t%d %s %s %s %s %s\n"
"\t| | | | | |\n"
"\t| | | | | +- Local port\n"
"\t| | | | +---- Local address\n"
"\t| | | +------- Remote port\n"
"\t| | +---------- Remote address\n"
"\t| +------------- Backend display name\n"
"\t+---------------- Connection file descriptor\n"
"\n"
)
SLTM(BackendReuse, 0, "Backend connection put up for reuse",
"Logged when a backend connection is put up for reuse by a later"
" connection.\n\n"
"The format is::\n\n"
"\t%d %s\n"
"\t| |\n"
"\t| +- Backend display name\n"
"\t+---- Connection file descriptor\n"
"\n"
)
SLTM(BackendClose, 0, "Backend connection closed",
"Logged when a backend connection is closed.\n\n"
"The format is::\n\n"
"\t%d %s [ %s ]\n"
"\t| | |\n"
"\t| | +- Optional reason\n"
"\t| +------ Backend display name\n"
"\t+--------- Connection file descriptor\n"
"\n"
)
SLTM(HttpGarbage, SLT_F_UNSAFE, "Unparseable HTTP request",
"Logs the content of unparseable HTTP requests.\n\n"
)
SLTM(Proxy, 0, "PROXY protocol information",
"PROXY protocol information.\n\n"
"The format is::\n\n"
"\t%d %s %d %s %d\n"
"\t| | | | |\n"
"\t| | | | +- server port\n"
"\t| | | +---- server ip\n"
"\t| | +------- client port\n"
"\t| +---------- client ip\n"
"\t+------------- PROXY protocol version\n"
"\t\n"
"\tAll fields are \"local\" for PROXY local connections (command 0x0)\n"
"\n"
)
SLTM(ProxyGarbage, 0, "Unparseable PROXY request",
"A PROXY protocol header was unparseable.\n\n"
)
SLTM(Backend, 0, "Backend selected",
"Logged when a connection is selected for handling a backend"
" request.\n\n"
"The format is::\n\n"
"\t%d %s %s\n"
"\t| | |\n"
"\t| | +- Backend display name\n"
"\t| +---- VCL name\n"
"\t+------- Connection file descriptor\n"
"\n"
NOSUP_NOTICE
)
SLTM(Length, 0, "Size of object body",
"Logs the size of a fetch object body.\n\n"
)
/*
* XXX generate HTC info below from tbl include
*
* #include <stdio.h>
* int main(void) {
* #define HTC_STATUS(e, n, s, l) \
* printf("\t\"\\t* %s (%d): %s\\n\"\n", s, n, l);
* #include "include/tbl/htc.h"
* return (0);
* }
*/
SLTM(FetchError, 0, "Error while fetching object",
"Logs the error message of a failed fetch operation.\n\n"
"Error messages should be self-explanatory, yet the http connection"
"(HTC) class of errors is reported with these symbols:\n\n"
"\t* junk (-5): Received unexpected data\n"
"\t* close (-4): Connection closed\n"
"\t* timeout (-3): Timed out\n"
"\t* overflow (-2): Buffer/workspace too small\n"
"\t* eof (-1): Unexpected end of input\n"
"\t* empty (0): Empty response\n"
"\t* more (1): More data required\n"
"\t* complete (2): Data complete (no error)\n"
"\t* idle (3): Connection was closed while idle\n"
"\nNotice that some HTC errors are never emitted."
)
#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
SLTM(Req##tag, (req ? 0 : SLT_F_UNUSED), "Client request " sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH
#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
SLTM(Resp##tag, (resp ? 0 : SLT_F_UNUSED), "Client response " sdesc, \
ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH
#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
SLTM(Bereq##tag, (req ? 0 : SLT_F_UNUSED), "Backend request " sdesc, \
ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH
#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
SLTM(Beresp##tag, (resp ? 0 : SLT_F_UNUSED), "Backend response " \
sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH
#define SLTH(tag, ind, req, resp, sdesc, ldesc) \
SLTM(Obj##tag, (resp ? 0 : SLT_F_UNUSED), "Object " sdesc, ldesc)
#include "tbl/vsl_tags_http.h"
#undef SLTH
SLTM(BogoHeader, 0, "Bogus HTTP received",
"Contains the first 20 characters of received HTTP headers we could"
" not make sense of. Applies to both req.http and beresp.http.\n\n"
)
SLTM(LostHeader, 0, "Failed attempt to set HTTP header",
"Logs the header name of a failed HTTP header operation due to"
" resource exhaustion or configured limits.\n\n"
)
SLTM(TTL, 0, "TTL set on object",
"A TTL record is emitted whenever the ttl, grace or keep"
" values for an object is set as well as whether the object is "
" cacheable or not.\n\n"
"The format is::\n\n"
"\t%s %d %d %d %d [ %d %d %u %u ] %s\n"
"\t| | | | | | | | | |\n"
"\t| | | | | | | | | +- \"cacheable\" or \"uncacheable\"\n"
"\t| | | | | | | | +------ Max-Age from Cache-Control header\n"
"\t| | | | | | | +--------- Expires header\n"
"\t| | | | | | +------------ Date header\n"
"\t| | | | | +--------------- Age (incl Age: header value)\n"
"\t| | | | +-------------------- Reference time for TTL\n"
"\t| | | +----------------------- Keep\n"
"\t| | +-------------------------- Grace\n"
"\t| +----------------------------- TTL\n"
"\t+-------------------------------- \"RFC\", \"VCL\" or \"HFP\"\n"
"\n"
"The four optional fields are only present in \"RFC\" headers.\n\n"
"Examples::\n\n"
"\tRFC 60 10 -1 1312966109 1312966109 1312966109 0 60 cacheable\n"
"\tVCL 120 10 0 1312966111 uncacheable\n"
"\tHFP 2 0 0 1312966113 uncacheable\n"
"\n"
)
SLTM(Fetch_Body, 0, "Body fetched from backend",
"Ready to fetch body from backend.\n\n"
"The format is::\n\n"
"\t%d (%s) %s\n"
"\t| | |\n"
"\t| | +---- 'stream' or '-'\n"
"\t| +--------- Text description of body fetch mode\n"
"\t+------------- Body fetch mode\n"
"\n"
)
SLTM(VCL_acl, 0, "VCL ACL check results",
"Logs VCL ACL evaluation results.\n\n"
)
SLTM(VCL_call, 0, "VCL method called",
"Logs the VCL method name when a VCL method is called.\n\n"
)
SLTM(VCL_trace, 0, "VCL trace data",
"Logs VCL execution trace data.\n\n"
"The format is::\n\n"
"\t%s %u %u.%u.%u\n"
"\t| | | | |\n"
"\t| | | | +- VCL program line position\n"
"\t| | | +---- VCL program line number\n"
"\t| | +------- VCL program source index\n"
"\t| +---------- VCL trace point index\n"
"\t+------------- VCL configname\n"
"\n"
NODEF_NOTICE
)
SLTM(VCL_return, 0, "VCL method return value",
"Logs the VCL method terminating statement.\n\n"
)
SLTM(ReqStart, 0, "Client request start",
"Start of request processing. Logs the client address, port number "
" and listener endpoint name (from the -a command-line argument).\n\n"
"The format is::\n\n"
"\t%s %s %s\n"
"\t| | |\n"
"\t| | +-- Listener name (from -a)\n"
"\t| +----- Client Port number (0 for Unix domain sockets)\n"
"\t+-------- Client IP4/6 address (0.0.0.0 for UDS)\n"
"\n"
)
SLTM(Hit, 0, "Hit object in cache",
"Object looked up in cache.\n\n"
"The format is::\n\n"
"\t%u %f %f %f\n"
"\t| | | |\n"
"\t| | | +- Keep period\n"
"\t| | +---- Grace period\n"
"\t| +------- Remaining TTL\n"
"\t+---------- VXID of the object\n"
"\n"
)
SLTM(HitPass, 0, "Hit for pass object in cache.",
"Hit-for-pass object looked up in cache.\n\n"
"The format is::\n\n"
"\t%u %f\n"
"\t| |\n"
"\t| +- Remaining TTL\n"
"\t+---- VXID of the object\n"
"\n"
)
SLTM(ExpBan, 0, "Object evicted due to ban",
"Logs the VXID when an object is banned.\n\n"
)
SLTM(ExpKill, 0, "Object expiry event",
"Logs events related to object expiry. The events are:\n\n"
"EXP_Rearm\n"
"\tLogged when the expiry time of an object changes.\n\n"
"EXP_Inbox\n"
"\tLogged when the expiry thread picks an object from the inbox for"
" processing.\n\n"
"EXP_Kill\n"
"\tLogged when the expiry thread kills an object from the inbox.\n\n"
"EXP_When\n"
"\tLogged when the expiry thread moves an object on the binheap.\n\n"
"EXP_Expired\n"
"\tLogged when the expiry thread expires an object.\n\n"
"LRU_Cand\n"
"\tLogged when an object is evaluated for LRU force expiry.\n\n"
"LRU\n"
"\tLogged when an object is force expired due to LRU.\n\n"
"LRU_Fail\n"
"\tLogged when no suitable candidate object is found for LRU force"
" expiry.\n\n"
"The format is::\n\n"
"\tEXP_Rearm p=%p E=%f e=%f f=0x%x\n"
"\tEXP_Inbox p=%p e=%f f=0x%x\n"
"\tEXP_Kill p=%p e=%f f=0x%x\n"
"\tEXP_When p=%p e=%f f=0x%x\n"
"\tEXP_Expired x=%u t=%f\n"
"\tLRU_Cand p=%p f=0x%x r=%d\n"
"\tLRU x=%u\n"
"\tLRU_Fail\n"
"\t\n"
"\tLegend:\n"
"\tp=%p Objcore pointer\n"
"\tt=%f Remaining TTL (s)\n"
"\te=%f Expiry time (unix epoch)\n"
"\tE=%f Old expiry time (unix epoch)\n"
"\tf=0x%x Objcore flags\n"
"\tr=%d Objcore refcount\n"
"\tx=%u Object VXID\n"
"\n"
)
SLTM(WorkThread, 0, "Logs thread start/stop events",
"Logs worker thread creation and termination events.\n\n"
"The format is::\n\n"
"\t%p %s\n"
"\t| |\n"
"\t| +- [start|end]\n"
"\t+---- Worker struct pointer\n"
"\n"
NODEF_NOTICE
)
SLTM(ESI_xmlerror, 0, "ESI parser error or warning message",
"An error or warning was generated during parsing of an ESI object."
" The log record describes the problem encountered."
)
SLTM(Hash, SLT_F_UNSAFE, "Value added to hash",
"This value was added to the object lookup hash.\n\n"
NODEF_NOTICE
)
/*
* Probe window bits:
*
* the documentation below could get auto-generated like so:
*
* ( echo '#define PROBE_BITS_DOC \' ; \
* $CC -D 'BITMAP(n, c, t, b)="\t" #c ": " t "\n" \' \
* -E ./include/tbl/backend_poll.h | grep -E '^"' ; \
* echo '""' ) >./include/tbl/backend_poll_doc.h
*
* as this has a hackish feel to it, the documentation is included here as text
* until we find a better solution or the above is accepted
*/
SLTM(Backend_health, 0, "Backend health check",
"The result of a backend health probe.\n\n"
"The format is::\n\n"
"\t%s %s %s %s %u %u %u %f %f %s\n"
"\t| | | | | | | | | |\n"
"\t| | | | | | | | | +- Probe HTTP response / error information\n"
"\t| | | | | | | | +---- Average response time\n"
"\t| | | | | | | +------- Response time\n"
"\t| | | | | | +---------- Probe window size\n"
"\t| | | | | +------------- Probe threshold level\n"
"\t| | | | +---------------- Number of good probes in window\n"
"\t| | | +------------------- Probe window bits\n"
"\t| | +---------------------- \"healthy\" or \"sick\"\n"
"\t| +------------------------- \"Back\", \"Still\" or \"Went\"\n"
"\t+---------------------------- Backend name\n"
"\n"
"Probe window bits are::\n\n"
"\t" "'4'" ": " "Good IPv4" "\n"
"\t" "'6'" ": " "Good IPv6" "\n"
"\t" "'U'" ": " "Good UNIX" "\n"
"\t" "'x'" ": " "Error Xmit" "\n"
"\t" "'X'" ": " "Good Xmit" "\n"
"\t" "'r'" ": " "Error Recv" "\n"
"\t" "'R'" ": " "Good Recv" "\n"
"\t" "'H'" ": " "Happy" "\n"
"\n"
)
SLTM(VCL_Log, 0, "Log statement from VCL",
"User generated log messages insert from VCL through std.log()"
)
SLTM(VCL_Error, 0, "VCL execution error message",
"Logs error messages generated during VCL execution.\n\n"
)
SLTM(Gzip, 0, "G(un)zip performed on object",
"A Gzip record is emitted for each instance of gzip or gunzip"
" work performed. Worst case, an ESI transaction stored in"
" gzip'ed objects but delivered gunziped, will run into many of"
" these.\n\n"
"The format is::\n\n"
"\t%c %c %c %d %d %d %d %d\n"
"\t| | | | | | | |\n"
"\t| | | | | | | +- Bit length of compressed data\n"
"\t| | | | | | +---- Bit location of 'last' bit\n"
"\t| | | | | +------- Bit location of first deflate block\n"
"\t| | | | +---------- Bytes output\n"
"\t| | | +------------- Bytes input\n"
"\t| | +---------------- 'E': ESI, '-': Plain object\n"
"\t| +------------------- 'F': Fetch, 'D': Deliver\n"
"\t+---------------------- 'G': Gzip, 'U': Gunzip, 'u': Gunzip-test\n"
"\n"
"Examples::\n\n"
"\tU F E 182 159 80 80 1392\n"
"\tG F E 159 173 80 1304 1314\n"
"\n"
)
SLTM(Link, 0, "Links to a child VXID",
"Links this VXID to any child VXID it initiates.\n\n"
"The format is::\n\n"
"\t%s %d %s\n"
"\t| | |\n"
"\t| | +- Reason\n"
"\t| +---- Child vxid\n"
"\t+------- Child type (\"req\" or \"bereq\")\n"
"\n"
)
SLTM(Begin, 0, "Marks the start of a VXID",
"The first record of a VXID transaction.\n\n"
"The format is::\n\n"
"\t%s %d %s\n"
"\t| | |\n"
"\t| | +- Reason\n"
"\t| +---- Parent vxid\n"
"\t+------- Type (\"sess\", \"req\" or \"bereq\")\n"
"\n"
)
SLTM(End, 0, "Marks the end of a VXID",
"The last record of a VXID transaction.\n\n"
)
SLTM(VSL, 0, "VSL API warnings and error message",
"Warnings and error messages generated by the VSL API while"
" reading the shared memory log.\n\n"
)
SLTM(Storage, 0, "Where object is stored",
"Type and name of the storage backend the object is stored in.\n\n"
"The format is::\n\n"
"\t%s %s\n"
"\t| |\n"
"\t| +- Name of storage backend\n"
"\t+---- Type (\"malloc\", \"file\", \"persistent\" etc.)\n"
"\n"
)
SLTM(Timestamp, 0, "Timing information",
"Contains timing information for the Varnish worker threads.\n\n"
"Time stamps are issued by Varnish on certain events,"
" and show the absolute time of the event, the time spent since the"
" start of the work unit, and the time spent since the last timestamp"
" was logged. See the TIMESTAMPS section below for information about"
" the individual time stamps.\n\n"
"The format is::\n\n"
"\t%s: %f %f %f\n"
"\t| | | |\n"
"\t| | | +- Time since last timestamp\n"
"\t| | +---- Time since start of work unit\n"
"\t| +------- Absolute time of event\n"
"\t+----------- Event label\n"
"\n"
)
SLTM(ReqAcct, 0, "Request handling byte counts",
"Contains byte counts for the request handling.\n"
"The body bytes count includes transmission overhead"
" (ie: chunked encoding).\n"
"ESI sub-requests show the body bytes this ESI fragment including"
" any subfragments contributed to the top level request.\n"
"The format is::\n\n"
"\t%d %d %d %d %d %d\n"
"\t| | | | | |\n"
"\t| | | | | +- Total bytes transmitted\n"
"\t| | | | +---- Body bytes transmitted\n"
"\t| | | +------- Header bytes transmitted\n"
"\t| | +---------- Total bytes received\n"
"\t| +------------- Body bytes received\n"
"\t+---------------- Header bytes received\n"
"\n"
)
SLTM(PipeAcct, 0, "Pipe byte counts",
"Contains byte counters for pipe sessions.\n\n"
"The format is::\n\n"
"\t%d %d %d %d\n"
"\t| | | |\n"
"\t| | | +------- Piped bytes to client\n"
"\t| | +---------- Piped bytes from client\n"
"\t| +------------- Backend request headers\n"
"\t+---------------- Client request headers\n"
"\n"
)
SLTM(BereqAcct, 0, "Backend request accounting",
"Contains byte counters from backend request processing.\n\n"
"The format is::\n\n"
"\t%d %d %d %d %d %d\n"
"\t| | | | | |\n"
"\t| | | | | +- Total bytes received\n"
"\t| | | | +---- Body bytes received\n"
"\t| | | +------- Header bytes received\n"
"\t| | +---------- Total bytes transmitted\n"
"\t| +------------- Body bytes transmitted\n"
"\t+---------------- Header bytes transmitted\n"
"\n"
)
SLTM(VfpAcct, 0, "Fetch filter accounting",
"Contains name of VFP and statistics.\n\n"
"The format is::\n\n"
"\t%s %d %d\n"
"\t| | |\n"
"\t| | +- Total bytes produced\n"
"\t| +---- Number of calls made\n"
"\t+------- Name of filter\n"
"\n"
NODEF_NOTICE
)
SLTM(Witness, 0, "Lock order witness records",
"Diagnostic recording of locking order.\n"
)
SLTM(BackendStart, 0, "Backend request start",
"Start of backend processing. Logs the backend IP address and port"
" number.\n\n"
"The format is::\n\n"
"\t%s %s\n"
"\t| |\n"
"\t| +- Backend Port number\n"
"\t+---- Backend IP4/6 address\n"
"\n"
)
SLTM(H2RxHdr, SLT_F_BINARY, "Received HTTP2 frame header",
"Binary data"
)
SLTM(H2RxBody, SLT_F_BINARY, "Received HTTP2 frame body",
"Binary data"
)
SLTM(H2TxHdr, SLT_F_BINARY, "Transmitted HTTP2 frame header",
"Binary data"
)
SLTM(H2TxBody, SLT_F_BINARY, "Transmitted HTTP2 frame body",
"Binary data"
)
SLTM(HitMiss, 0, "Hit for miss object in cache.",
"Hit-for-miss object looked up in cache.\n\n"
"The format is::\n\n"
"\t%u %f\n"
"\t| |\n"
"\t| +- Remaining TTL\n"
"\t+---- VXID of the object\n"
"\n"
)
SLTM(Filters, 0, "Body filters",
"List of filters applied to the body.\n\n"
NOSUP_NOTICE
)
SLTM(SessError, 0, "Client connection accept failed",
"Accepting a client connection has failed.\n\n"
"The format is::\n\n"
"\t%s %s %s %d %d %s\n"
"\t| | | | | |\n"
"\t| | | | | +- Detailed error message\n"
"\t| | | | +---- Error Number (errno) from accept(2)\n"
"\t| | | +------- File descriptor number\n"
"\t| | +---------- Local TCP port / 0 for UDS\n"
"\t| +------------- Local IPv4/6 address / 0.0.0.0 for UDS\n"
"\t+---------------- Socket name (from -a argument)\n"
"\n"
NOSUP_NOTICE
)
SLTM(VCL_use, 0, "VCL in use",
"Records the name of the VCL being used.\n\n"
"The format is::\n\n"
"\t%s [ %s %s ]\n"
"\t| | |\n"
"\t| | +- Name of label used to find it\n"
"\t| +---- \"via\"\n"
"\t+--------- Name of VCL put in use\n"
"\n"
)
SLTM(Notice, 0, "Informational messages about request handling",
"Informational log messages on events occured during request"
" handling. Lines are prefixed with either [core] or [<VMOD name>]."
" See the NOTICE MESSAGES section below or the individual VMOD manual"
" pages for detailed information of notice messages.\n"
)
#undef NOSUP_NOTICE
#undef NODEF_NOTICE
#undef SLTM
/*lint -restore */
PK wFZ�I�!� � tbl/h2_settings.hnu �[��� /*-
* Copyright (c) 2016 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* RFC7540 section 11.3
*
* Upper
* lower
* tag
* default
* min
* max
* range_error
*/
/*lint -save -e525 -e539 */
H2_SETTING( // rfc7540,l,2097,2103
HEADER_TABLE_SIZE,
header_table_size,
0x1,
4096, // rfc7540,l,4224,4224
0,
0xffffffff,
0
)
#ifndef H2_SETTINGS_PARAM_ONLY
H2_SETTING( // rfc7540,l,2105,2114
ENABLE_PUSH,
enable_push,
0x2,
1, // rfc7540,l,4225,4225
0,
1,
H2CE_PROTOCOL_ERROR
)
#endif
H2_SETTING( // rfc7540,l,2116,2121
MAX_CONCURRENT_STREAMS,
max_concurrent_streams,
0x3,
0xffffffff, // rfc7540,l,4226,4226
0,
0xffffffff,
0
)
H2_SETTING( // rfc7540,l,2139,2148
INITIAL_WINDOW_SIZE,
initial_window_size,
0x4,
65535, // rfc7540,l,4227,4227
0,
0x7fffffff,
H2CE_FLOW_CONTROL_ERROR
)
H2_SETTING( // rfc7540,l,2150,2157
MAX_FRAME_SIZE,
max_frame_size,
0x5,
16384, // rfc7540,l,4228,4228
16384,
0x00ffffff,
H2CE_PROTOCOL_ERROR
)
H2_SETTING( // rfc7540,l,2159,2167
MAX_HEADER_LIST_SIZE,
max_header_list_size,
0x6,
0x7fffffff, // rfc7540,l,4229,4229
0,
0xffffffff,
0
)
#undef H2_SETTING
/*lint -restore */
PK wFZ\��z z tbl/req_body.hnu �[��� /*-
* Copyright (c) 2013-2015 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*lint -save -e525 -e539 */
REQ_BODY(INIT)
REQ_BODY(WITHOUT_LEN)
REQ_BODY(WITH_LEN)
/* states >= TAKEN imply that no body is to be read */
REQ_BODY(TAKEN)
REQ_BODY(CACHED)
REQ_BODY(FAIL)
REQ_BODY(NONE)
#undef REQ_BODY
/*lint -restore */
PK wFZ5�Y &"