varnish-6.2.1/0000755000175000017500000000000013531244431010173 500000000000000varnish-6.2.1/configure.ac0000644000175000017500000005536713531244202012415 00000000000000AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2019 Varnish Software]) AC_REVISION([$Id$]) AC_INIT([Varnish], [6.2.1], [varnish-dev@varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AC_USE_SYSTEM_EXTENSIONS # save command line CFLAGS for use in VCC_CC (to pass through things like -m64) # and make distcheck configure OCFLAGS="$CFLAGS" EXTCFLAGS="$CFLAGS" AC_SUBST(EXTCFLAGS) AC_CANONICAL_SYSTEM AC_LANG(C) AM_MAINTAINER_MODE([disable]) AM_INIT_AUTOMAKE([1.11 foreign color-tests parallel-tests]) AM_SILENT_RULES([yes]) AC_DISABLE_STATIC AC_PROG_LIBTOOL # Checks for programs. AC_GNU_SOURCE AC_PROG_CC AC_PROG_CC_STDC AX_PTHREAD(,[AC_MSG_ERROR([Could not configure pthreads support])]) LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" AC_PROG_INSTALL AC_ARG_WITH([rst2man], AS_HELP_STRING([--with-rst2man=PATH], [Location of rst2man (auto)]), [RST2MAN="$withval"], AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py rst2man-3.6 rst2man-3], [no])) if test "x$RST2MAN" = "xno"; then AC_MSG_ERROR( [rst2man is needed to build Varnish, please install python3-docutils.]) fi AC_ARG_WITH([sphinx-build], AS_HELP_STRING([--with-sphinx-build=PATH], [Location of sphinx-build (auto)]), [SPHINX="$withval"], AC_CHECK_PROGS(SPHINX, [sphinx-build sphinx-build-3.6 sphinx-build-3], [no])) if test "x$SPHINX" = "xno"; then AC_MSG_ERROR( [sphinx-build is needed to build Varnish, please install python3-sphinx.]) fi AC_ARG_WITH([rst2html], AS_HELP_STRING([--with-rst2html=PATH], [Location of rst2html (auto)]), [RST2HTML="$withval"], [AC_CHECK_PROGS(RST2HTML, [rst2html rst2html.py], "no") if test "x$RST2HTML" = "xno"; then AC_MSG_WARN([rst2html not found - not building changelog]) fi]) AM_CONDITIONAL(HAVE_RST2HTML,[test "x$RST2HTML" != "xno"]) AC_ARG_WITH([dot], AS_HELP_STRING([--with-dot=PATH], [Location of the dot tool from graphviz (auto)]), [DOT="$withval"], [AC_CHECK_PROGS(DOT, [dot], [no]) if test "x$DOT" = "xno"; then AC_MSG_WARN( [dot not found - build will fail if svg files are out of date.]) fi]) AM_CONDITIONAL(HAVE_DOT,[test "x$DOT" != "xno"]) # Define VMOD flags _VARNISH_VMOD_LDFLAGS # Check for python. _VARNISH_CHECK_PYTHON # Check for libraries. _VARNISH_SEARCH_LIBS(pthread, pthread_create, [thr pthread c_r]) _VARNISH_CHECK_LIB(rt, clock_gettime) _VARNISH_CHECK_LIB(dl, dlopen) _VARNISH_CHECK_LIB(socket, socket) _VARNISH_CHECK_LIB(nsl, getaddrinfo) AC_SUBST(NET_LIBS, "${SOCKET_LIBS} ${NSL_LIBS}") # Userland slab allocator from Solaris, ported to other systems AC_CHECK_HEADERS([umem.h]) # XXX: This _may_ be for OS/X AC_CHECK_LIBM AC_SUBST(LIBM) m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([pkg.m4 missing, please install pkg-config])]) PKG_PROG_PKG_CONFIG if test -n $PKG_CONFIG; then PKG_CHECK_MODULES([PCRE], [libpcre]) else AC_CHECK_PROG(PCRE_CONFIG, pcre-config, pcre-config) AC_ARG_WITH(pcre-config, AS_HELP_STRING([--with-pcre-config=PATH], [Location of PCRE pcre-config (auto)]), [pcre_config="$withval"], [pcre_config=""]) if test "x$pcre_config" != "x" ; then AC_MSG_CHECKING(for $pcre_config) if test -f $pcre_config ; then PCRE_CONFIG=$pcre_config AC_MSG_RESULT(yes) else AC_MSG_RESULT(no - searching PATH) fi fi if test "x$PCRE_CONFIG" = "x"; then AC_CHECK_PROGS(PCRE_CONFIG, pcre-config) fi PCRE_CFLAGS=`$PCRE_CONFIG --cflags` PCRE_LIBS=`$PCRE_CONFIG --libs` fi AC_SUBST(PCRE_CFLAGS) AC_SUBST(PCRE_LIBS) # --enable-pcre-jit AC_ARG_ENABLE(pcre-jit, AS_HELP_STRING([--enable-pcre-jit], [use the PCRE JIT compiler (default is YES)]), [], [enable_pcre_jit=yes]) if test "$enable_pcre_jit" = yes; then AC_MSG_CHECKING(for PCRE JIT usability) save_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} ${PCRE_CFLAGS}" save_LIBS="${LIBS}" LIBS="${LIBS} ${PCRE_LIBS}" AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #if PCRE_MAJOR != 8 || PCRE_MINOR < 32 #error no jit #endif ]],[[ const char *error; pcre *re; int erroroffset; re = pcre_compile(".", 0, &error, &erroroffset, NULL); if (!pcre_study(re, PCRE_STUDY_JIT_COMPILE, &error)) return (1); ]])], [AC_MSG_RESULT(yes) AC_DEFINE([USE_PCRE_JIT], [1], [Use the PCRE JIT compiler]) ], [AC_MSG_RESULT(no)] ) CFLAGS="${save_CFLAGS}" LIBS="${save_LIBS}" fi AC_CHECK_HEADERS([edit/readline/readline.h], [AC_DEFINE([HAVE_LIBEDIT], [1], [Define if we have libedit]) LIBEDIT_LIBS="-ledit"], [PKG_CHECK_MODULES([LIBEDIT], [libedit], # having the module does not imply having the header [AC_CHECK_HEADERS([editline/readline.h], [AC_DEFINE([HAVE_LIBEDIT], [1], [Define if we have libedit])], [AC_MSG_ERROR([Found libedit, but header file is missing. Hint: Install dev package?])])], [ # AX_LIB_READLINE overwrites LIBS which leads to every binary getting # linked against libreadline uselessly. So we re-use LIBEDIT_LIBS which # we have for libedit to add the lib specifically where needed save_LIBS="${LIBS}" AX_LIB_READLINE LIBS="${save_LIBS}" if test "$ax_cv_lib_readline" = "no"; then AC_MSG_ERROR([neither libedit nor another readline compatible library found]) fi if test "x$ax_cv_lib_readline_history" != "xyes"; then AC_MSG_ERROR([need readline history support]) fi LIBEDIT_LIBS="$ax_cv_lib_readline" ]) ]) PKG_CHECK_MODULES([CURSES], [ncursesw], [], [ PKG_CHECK_MODULES([CURSES], [ncurses], [], [ PKG_CHECK_MODULES([CURSES], [curses], [], [ AX_WITH_CURSES if test "x$ax_cv_curses" != xyes; then AC_MSG_ERROR([requires an X/Open-compatible Curses library]) fi CURSES_LIBS="$CURSES_LIB" ]) ]) ]) AC_SUBST([CURSES_LIBS]) AC_CHECK_HEADERS([ncursesw/curses.h ncursesw.h ncurses/curses.h ncurses.h curses.h]) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([sys/endian.h]) AC_CHECK_HEADERS([sys/filio.h]) AC_CHECK_HEADERS([sys/mount.h], [], [], [#include ]) AC_CHECK_HEADERS([sys/personality.h]) AC_CHECK_HEADERS([sys/statvfs.h]) AC_CHECK_HEADERS([sys/vfs.h]) AC_CHECK_HEADERS([endian.h]) AC_CHECK_HEADERS([pthread_np.h], [], [], [#include ]) AC_CHECK_HEADERS([priv.h]) AC_CHECK_HEADERS([fnmatch.h], [], [AC_MSG_ERROR([fnmatch.h is required])]) # Checks for library functions. _VARNISH_CHECK_EXPLICIT_BZERO AC_CHECK_FUNCS([nanosleep]) AC_CHECK_FUNCS([setppriv]) AC_CHECK_FUNCS([fallocate]) AC_CHECK_FUNCS([closefrom]) AC_CHECK_FUNCS([sigaltstack]) AC_CHECK_FUNCS([getpeereid]) AC_CHECK_FUNCS([getpeerucred]) AC_CHECK_FUNCS([fnmatch], [], [AC_MSG_ERROR([fnmatch(3) is required])]) save_LIBS="${LIBS}" LIBS="${PTHREAD_LIBS}" AC_CHECK_FUNCS([pthread_set_name_np]) AC_CHECK_FUNCS([pthread_setname_np]) AC_CHECK_FUNCS([pthread_mutex_isowned_np]) AC_CHECK_FUNCS([pthread_getattr_np]) LIBS="${save_LIBS}" AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) # Support for visibility attribute save_CFLAGS="${CFLAGS}" if test "$SUNCC" = "yes" ; then CFLAGS="${CFLAGS} -errwarn=%all,no%E_EMPTY_TRANSLATION_UNIT" else CFLAGS="${CFLAGS} -Werror" fi AC_CACHE_CHECK([whether we have support for visibility attributes], [ac_cv_have_viz], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33 || defined(__SUNPRO_C)) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL #endif int ZLIB_INTERNAL foo; ]],[])], [ac_cv_have_viz=yes], [ac_cv_have_viz=no]) ]) if test "$ac_cv_have_viz" = no; then libvgz_extra_cflags="-DNO_VIZ" AC_SUBST(libvgz_extra_cflags) fi CFLAGS="${save_CFLAGS}" if test "x$GCC" = "xyes"; then libvgz_extra_cflags="${libvgz_extra_cflags} -Wno-unknown-warning-option -Wno-implicit-fallthrough" AC_SUBST(libvgz_extra_cflags) fi SAN_CFLAGS= SAN_LDFLAGS= UBSAN_CFLAGS= UBSAN_LDFLAGS= AC_ARG_ENABLE(ubsan, AS_HELP_STRING([--enable-ubsan],[enable undefined behavior sanitizer (default is NO)]), UBSAN_FLAGS="-fsanitize=undefined") TSAN_CFLAGS= TSAN_LDFLAGS= AC_ARG_ENABLE(tsan, AS_HELP_STRING([--enable-tsan],[enable thread sanitizer (default is NO)]), TSAN_FLAGS="-fsanitize=thread") ASAN_CFLAGS= ASAN_LDFLAGS= AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan],[enable address sanitizer (default is NO)]), ASAN_FLAGS="-fsanitize=address" AX_CHECK_COMPILE_FLAG([-fsanitize=address -fsanitize-address-use-after-scope], [ASAN_FLAGS="${ASAN_FLAGS} -fsanitize-address-use-after-scope"])) MSAN_CFLAGS= MSAN_LDFLAGS= AC_ARG_ENABLE(msan, AS_HELP_STRING([--enable-msan],[enable memory sanitizer (default is NO)]), MSAN_FLAGS="-fsanitize=memory") if test "x$UBSAN_FLAGS$TSAN_FLAGS$ASAN_FLAGS$MSAN_FLAGS" != "x"; then SAN_CFLAGS="-D__SANITIZER=1 ${UBSAN_FLAGS} ${TSAN_FLAGS} ${ASAN_FLAGS} ${MSAN_FLAGS} -fPIC -fPIE -fno-omit-frame-pointer" SAN_LDFLAGS="${UBSAN_FLAGS} ${TSAN_FLAGS} ${ASAN_FLAGS} ${MSAN_FLAGS}" save_CFLAGS="${CFLAGS}" CFLAGS="${CFLAGS} -Werror=unused-command-line-argument" AX_CHECK_LINK_FLAG([-pie], [SAN_LDFLAGS="${SAN_LDFLAGS} -pie"]) CFLAGS="${save_CFLAGS}" case $CC in gcc*) SAN_CFLAGS="${SAN_CFLAGS} -fuse-ld=gold" ;; esac fi AC_SUBST(SAN_CFLAGS) AC_SUBST(SAN_LDFLAGS) # Use jemalloc on Linux JEMALLOC_LDADD= AC_ARG_WITH([jemalloc], [AS_HELP_STRING([--with-jemalloc], [use jemalloc memory allocator. Default is yes on Linux, no elsewhere])], [], [with_jemalloc=check]) case $target in *-*-linux*) if test "x$with_jemalloc" != xno; then AC_CHECK_LIB([jemalloc], [malloc_conf], [JEMALLOC_LDADD="-ljemalloc"], [AC_MSG_WARN([No system jemalloc found, using system malloc])]) fi ;; esac AC_SUBST(JEMALLOC_LDADD) AC_CHECK_FUNCS([setproctitle]) AC_SEARCH_LIBS(backtrace, [execinfo], [], [ AC_MSG_ERROR([Could not find backtrace() support]) ]) # white lie - we don't actually test it AC_MSG_CHECKING([whether daemon() works]) case $target in *-*-darwin*) # present but not functional AC_MSG_RESULT([no]) ac_cv_func_daemon=no ;; *) AC_CHECK_FUNCS([daemon]) ;; esac AM_CONDITIONAL(HAVE_DAEMON, [test "x$ac_cv_func_daemon" != "xno"]) AC_SYS_LARGEFILE save_LIBS="${LIBS}" LIBS="${LIBS} ${RT_LIBS}" AC_CHECK_FUNCS([clock_gettime]) AC_CHECK_FUNCS([gethrtime]) LIBS="${save_LIBS}" if test "x$ac_cv_func_gethrtime" = xyes && \ test "x$ac_cv_func_clock_gettime" = xyes ; then AC_MSG_CHECKING(if clock_gettime is faster than gethrtime) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include static hrtime_t cl() { struct timespec ts; (void) clock_gettime(CLOCK_MONOTONIC, &ts); return (ts.tv_sec * 1e9 + ts.tv_nsec); } ]],[[ hrtime_t s, c, e, t_hr, t_cl; int i, r, wins; wins = 0; for (r = 0; r < 10; r++) { c = 0; s = gethrtime(); for (i=0; i<100000; i++) c += gethrtime(); e = gethrtime(); t_hr = e - s; fprintf(stderr, "hrtime\t\t%12lu check %lu\n", (unsigned long)t_hr, (unsigned long)c); c = 0; s = gethrtime(); for (i=0; i<100000; i++) c += cl(); e = gethrtime(); t_cl = e - s; fprintf(stderr, "clock_gettime\t%12lu check %lu\n", (unsigned long)t_cl, (unsigned long)c); if (t_cl * 2 < t_hr) wins++; } fprintf(stderr, "clock_gettime wins %d/%d\n", wins, r); if (2 * wins >= r) return (0); return (1); ]])], [AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no) AC_DEFINE([USE_GETHRTIME], [1], [Define if gethrtime is preferred]) ] ) fi # --enable-kqueue AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue], [use kqueue if available (default is YES)]), , [enable_kqueue=yes]) if test "$enable_kqueue" = yes; then AC_CHECK_FUNCS([kqueue]) else ac_cv_func_kqueue=no fi # --enable-epoll AC_ARG_ENABLE(epoll, AS_HELP_STRING([--enable-epoll], [use epoll if available (default is YES)]), , [enable_epoll=yes]) if test "$enable_epoll" = yes; then AC_CHECK_FUNCS([epoll_ctl]) else ac_cv_func_epoll_ctl=no fi # --enable-ports AC_ARG_ENABLE(ports, AS_HELP_STRING([--enable-ports], [use ports if available (default is YES)]), , [enable_ports=yes]) if test "$enable_ports" = yes; then AC_CHECK_FUNCS([port_create]) else ac_cv_func_port_create=no fi # --with-persistent-storage AC_ARG_WITH(persistent-storage, AS_HELP_STRING([--with-persistent-storage], [use deprecated persistent storage (default is NO)]), [], [with_persistent_storage=no]) if test "$with_persistent_storage" = yes; then AC_DEFINE([WITH_PERSISTENT_STORAGE], [1], [Define to 1 to build the deprecated peristent storage.]) fi AM_CONDITIONAL([WITH_PERSISTENT_STORAGE], [test "$with_persistent_storage" = yes]) AM_MISSING_HAS_RUN AC_CHECK_DECL([SO_ACCEPTFILTER], AC_DEFINE(HAVE_ACCEPT_FILTERS,1,[Define to 1 if you have accept filters]), , [ #include #include ] ) # Older Solaris versions define SO_{RCV,SND}TIMEO, but do not # implement them. # # Varnish will build and run without these, but connections will not # time out, which may leave Varnish vulnerable to denail-of-service # attacks which would not be possible on other platforms. # # Newer Solaris releases with the Volo framework (Solaris 11, # Opensolaris starting with onnv_106) do support SO_{RCV,SND}TIMEO # (see PSARC 2007/587, initially committed into onnv-gate / # OpenSolaris 8348:4137e18bfaf0 Thu Dec 11 20:04:13 2008) save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" AC_CACHE_CHECK([whether SO_RCVTIMEO works], [ac_cv_so_rcvtimeo_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include #include ]],[[ int s = socket(AF_INET, SOCK_STREAM, 0); struct timeval tv = { 1, 0 }; if (s < 0 && errno == EPROTONOSUPPORT) s = socket(AF_INET6, SOCK_STREAM, 0); if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv) == 0) { socklen_t l = sizeof tv; if (getsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, &l) == 0) { return (l != sizeof tv); } } return 1; ]])], [ac_cv_so_rcvtimeo_works=yes], [ac_cv_so_rcvtimeo_works=no]) ]) if test "$ac_cv_so_rcvtimeo_works" = yes; then AC_DEFINE([SO_RCVTIMEO_WORKS], [1], [Define if SO_RCVTIMEO works]) fi LIBS="${save_LIBS}" save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" AC_CACHE_CHECK([whether SO_SNDTIMEO works], [ac_cv_so_sndtimeo_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include #include ]],[[ int s = socket(AF_INET, SOCK_STREAM, 0); struct timeval tv = { 1, 0 }; if (s < 0 && errno == EPROTONOSUPPORT) s = socket(AF_INET6, SOCK_STREAM, 0); if (setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv) == 0) { socklen_t l = sizeof tv; if (getsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, &l) == 0) { return (l != sizeof tv); } } return 1; ]])], [ac_cv_so_sndtimeo_works=yes], [ac_cv_so_sndtimeo_works=no]) ]) if test "$ac_cv_so_sndtimeo_works" = yes; then AC_DEFINE([SO_SNDTIMEO_WORKS], [1], [Define if SO_SNDTIMEO works]) fi if test "$ac_cv_so_rcvtimeo_works" = no || test "$ac_cv_so_sndtimeo_works" = no; then AC_MSG_WARN([connection timeouts will not work]) fi LIBS="${save_LIBS}" # Check if the OS supports TCP_KEEP(CNT|IDLE|INTVL) socket options save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" AC_CACHE_CHECK([for TCP_KEEP(CNT|IDLE|INTVL) socket options], [ac_cv_have_tcp_keep], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include #include #include ]],[[ int s = socket(AF_INET, SOCK_STREAM, 0); int i = 5; if (s < 0 && errno == EPROTONOSUPPORT) s = socket(AF_INET6, SOCK_STREAM, 0); if (setsockopt(s, IPPROTO_TCP, TCP_KEEPCNT, &i, sizeof i)) return (1); if (setsockopt(s, IPPROTO_TCP, TCP_KEEPIDLE, &i, sizeof i)) return (1); if (setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL, &i, sizeof i)) return (1); return (0); ]])], [ac_cv_have_tcp_keep=yes], [ac_cv_have_tcp_keep=no]) ]) if test "$ac_cv_have_tcp_keep" = yes; then AC_DEFINE([HAVE_TCP_KEEP], [1], [Define if OS supports TCP_KEEP* socket options]) fi LIBS="${save_LIBS}" # Check if the OS supports TCP_FASTOPEN socket option save_LIBS="${LIBS}" LIBS="${LIBS} ${NET_LIBS}" AC_CACHE_CHECK([for TCP_FASTOPEN socket option], [ac_cv_have_tcp_fastopen], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include #include #include ]],[[ int s = socket(AF_INET, SOCK_STREAM, 0); int i = 5; if (s < 0 && errno == EPROTONOSUPPORT) s = socket(AF_INET6, SOCK_STREAM, 0); if (setsockopt(s, SOL_TCP, TCP_FASTOPEN, &i, sizeof i)) return (1); return (0); ]])], [ac_cv_have_tcp_fastopen=yes], [ac_cv_have_tcp_fastopen=no]) ]) if test "$ac_cv_have_tcp_fastopen" = yes; then AC_DEFINE([HAVE_TCP_FASTOPEN], [1], [Define if OS supports TCP_FASTOPEN socket option]) fi LIBS="${save_LIBS}" # Run-time directory VARNISH_STATE_DIR='${localstatedir}/varnish' AC_SUBST(VARNISH_STATE_DIR) # Default configuration directory. pkgsysconfdir='${sysconfdir}/varnish' AC_SUBST(pkgsysconfdir) # Check for linker script support gl_LD_VERSION_SCRIPT ####################################################################### # Now that we're done using the compiler to look for functions and # libraries, set CFLAGS to what we want them to be for our own code # This is a test to see how much havoc Jenkins exposes. # # The reason for -Wno-error=unused-result is a glibc/gcc interaction # idiocy where write is marked as warn_unused_result, causing build # failures. AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="${CFLAGS} -Wall" OCFLAGS="${OCFLAGS} -Wall"]) if test "$SUNCC" = "yes" ; then SUNCC_CFLAGS=" \ -errwarn=%all,no%E_EMPTY_TRANSLATION_UNIT \ -errtags=yes \ " AX_CHECK_COMPILE_FLAG([${SUNCC_CFLAGS}], [CFLAGS="${CFLAGS} ${SUNCC_CFLAGS}" OCFLAGS="${OCFLAGS} ${SUNCC_CFLAGS}"]) else AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="${CFLAGS} -Werror" OCFLAGS="${OCFLAGS} -Werror"]) fi AX_CHECK_COMPILE_FLAG([-Werror=unused-result], [CFLAGS="${CFLAGS} -Wno-error=unused-result" OCFLAGS="${OCFLAGS} -Wno-error=unused-result"], [AX_CHECK_COMPILE_FLAG([-Wunused-result], [CFLAGS="${CFLAGS} -Wno-unused-result" OCFLAGS="${OCFLAGS} -Wno-unused-result"])]) # This corresponds to FreeBSD's WARNS level 6 DEVELOPER_CFLAGS=" \ -Werror \ -Wno-format-y2k \ -Wstrict-prototypes \ -Wmissing-prototypes \ -Wpointer-arith \ -Wcast-qual \ -Wwrite-strings \ -Wshadow \ -Wunused-parameter \ -Wcast-align \ -Wchar-subscripts \ -Wnested-externs \ -Wextra \ -Wno-sign-compare \ " # These are not compliable yet DEVELOPER_GCC_CFLAGS="-Wold-style-definition -Wredundant-decls " #DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_GCC_CFLAGS}" # These are compilable DEVELOPER_CLANG_CFLAGS="-Wmissing-variable-declarations -Wno-string-plus-int" # -Wno-empty-body #DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_CLANG_CFLAGS}" # --enable-stack-protector AC_ARG_ENABLE(stack-protector, AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is YES)]), [], [enable_stack_protector=yes]) if test "x$enable_stack_protector" != "xno"; then AX_CHECK_COMPILE_FLAG([-fstack-protector], AX_CHECK_LINK_FLAG([-fstack-protector], [DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -fstack-protector"], [], []), [], []) fi # --enable-developer-warnings AC_ARG_ENABLE(developer-warnings, AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]), [], [enable_developer_warnings=no]) if test "x$SUNCC" != "xyes" && test "x$enable_developer_warnings" != "xno"; then # no known way to specifically disabling missing-field-initializers # warnings keeping the rest of Wextra AX_CHECK_COMPILE_FLAG([-Wno-missing-field-initializers], [DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-missing-field-initializers"], [DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-extra"], []) CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}" OCFLAGS="${OCFLAGS} ${DEVELOPER_CFLAGS}" fi # gcc on solaris needs -fstack-protector when calling gcc in linker # mode but libtool does not pass it on, so we need to trick it # specifically case $CFLAGS in *-fstack-protector*) case $target in *-*-solaris*) case $CC in gcc*) AM_LT_LDFLAGS="${AM_LT_LDFLAGS} -Wc,-fstack-protector" ;; esac ;; esac ;; esac # --enable-debugging-symbols AC_ARG_ENABLE(debugging-symbols, AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]), if test "x$SUNCC" = "xyes" ; then CFLAGS="${CFLAGS} -O0 -g" else CFLAGS="${CFLAGS} -O0 -g -fno-inline" fi) AC_SUBST(AM_LT_LDFLAGS) # Command line for compiling VCL code. I wish there were a simple way # to figure this out dynamically without introducing a run-time # dependency on libtool. AC_ARG_VAR([VCC_CC], [C compiler command line for VCL code]) if test "$ac_cv_env_VCC_CC_set" = "set"; then VCC_CC="$ac_cv_env_VCC_CC_value" else case $target in *-*-solaris*) case $PTHREAD_CC in *gcc*) VCC_CC="$PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -fpic -shared -o %o %s" break ;; *cc) VCC_CC="$PTHREAD_CC $OCFLAGS -errwarn=%all,no%E_STATEMENT_NOT_REACHED $PTHREAD_CFLAGS -Kpic -G -o %o %s" ;; esac ;; *-*-darwin*) VCC_CC="exec cc $OCFLAGS -dynamiclib -Wl,-undefined,dynamic_lookup -o %o %s" ;; *) VCC_CC="exec $PTHREAD_CC $OCFLAGS $PTHREAD_CFLAGS -fpic -shared -Wl,-x -o %o %s" ;; esac fi AC_DEFINE_UNQUOTED([VCC_CC],"$VCC_CC",[C compiler command line for VCL code]) # Stupid automake needs this VTC_TESTS="$(cd $srcdir/bin/varnishtest && echo tests/*.vtc)" AC_SUBST(VTC_TESTS) VSC_SRC="$(cd $srcdir/bin/varnishd && echo *.vsc)" VSC_GEN_C="$(echo $VSC_SRC | sed 's:\.vsc:.c:g')" VSC_GEN_H="$(echo $VSC_SRC | sed 's:\.vsc:.h:g')" # automake does not allow to AC_SUBST _SOURCES files (for a good # reason), so we automate the cleanup at least AC_SUBST(VSC_GEN_C) AC_SUBST(VSC_GEN_H) # Make sure this include dir exists AC_CONFIG_COMMANDS([mkdir], [$MKDIR_P doc/sphinx/include]) # Generate output AC_CONFIG_FILES([ Makefile bin/Makefile bin/varnishadm/Makefile bin/varnishd/Makefile bin/varnishlog/Makefile bin/varnishstat/Makefile bin/varnishtop/Makefile bin/varnishhist/Makefile bin/varnishtest/Makefile bin/varnishncsa/Makefile doc/Makefile doc/graphviz/Makefile doc/sphinx/Makefile doc/sphinx/conf.py etc/Makefile include/Makefile lib/Makefile lib/libvarnish/Makefile lib/libvarnishapi/Makefile lib/libvcc/Makefile lib/libvgz/Makefile lib/libvmod_debug/Makefile lib/libvmod_std/Makefile lib/libvmod_directors/Makefile lib/libvmod_purge/Makefile lib/libvmod_vtc/Makefile lib/libvmod_blob/Makefile lib/libvmod_unix/Makefile lib/libvmod_proxy/Makefile man/Makefile varnishapi.pc varnishapi-uninstalled.pc ]) AC_OUTPUT varnish-6.2.1/autogen.sh0000755000175000017500000000152113527745146012131 00000000000000#!/bin/sh # warn() { echo "WARNING: $@" 1>&2 } case `uname -s` in Darwin) LIBTOOLIZE=glibtoolize ;; FreeBSD) LIBTOOLIZE=libtoolize ;; NetBSD) LIBTOOLIZE=libtoolize ;; OpenBSD) LIBTOOLIZE=libtoolize ;; Linux) LIBTOOLIZE=libtoolize ;; SunOS) LIBTOOLIZE=libtoolize ;; *) warn "unrecognized platform:" `uname -s` LIBTOOLIZE=libtoolize esac automake_version=`automake --version | tr ' ' '\n' | egrep '^[0-9]\.[0-9a-z.-]+'` if [ -z "$automake_version" ] ; then warn "unable to determine automake version" else case $automake_version in 0.*|1.[0-8]|1.[0-8][.-]*) warn "automake ($automake_version) detected; 1.9 or newer recommended" ;; *) ;; esac fi set -ex $LIBTOOLIZE --copy --force aclocal -I m4 -I . autoheader automake --add-missing --copy --foreign autoconf varnish-6.2.1/etc/0000755000175000017500000000000013531244420010744 500000000000000varnish-6.2.1/etc/Makefile.am0000644000175000017500000000110213527745146012732 00000000000000# DISTCLEANFILES = builtin.vcl dist_doc_DATA = builtin.vcl \ example.vcl builtin.vcl: $(top_srcdir)/bin/varnishd/builtin.vcl ( printf "This is the VCL configuration Varnish will automatically append to your VCL\nfile during compilation/loading. See the vcl(7) man page for details on syntax\nand semantics.\n\ New users is recommended to use the example.vcl file as a starting point.\n\n";\ sed -n '/vcl_recv/,$$p' $(top_srcdir)/bin/varnishd/builtin.vcl ) | \ sed 's/^\(.*\)$$/# \1/' > builtin.vcl vcldir=$(datarootdir)/$(PACKAGE)/vcl dist_vcl_DATA = devicedetect.vcl varnish-6.2.1/etc/devicedetect.vcl0000644000175000017500000001400013531244202014013 00000000000000# Copyright (c) 2012-2014 Varnish Software AS # # 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. # # detectdevice.vcl - regex based device detection for Varnish # https://github.com/varnishcache/varnish-devicedetect/ # # Author: Lasse Karstensen sub devicedetect { unset req.http.X-UA-Device; set req.http.X-UA-Device = "pc"; # Handle that a cookie may override the detection alltogether. if (req.http.Cookie ~ "(?i)X-UA-Device-force") { /* ;?? means zero or one ;, non-greedy to match the first. */ set req.http.X-UA-Device = regsub(req.http.Cookie, "(?i).*X-UA-Device-force=([^;]+);??.*", "\1"); /* Clean up our mess in the cookie header */ set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *X-UA-Device-force=[^;]+;? *", "\1"); /* If the cookie header is now empty, or just whitespace, unset it. */ if (req.http.Cookie ~ "^ *$") { unset req.http.Cookie; } } else { if (req.http.User-Agent ~ "\(compatible; Googlebot-Mobile/2.1; \+http://www.google.com/bot.html\)" || (req.http.User-Agent ~ "(Android|iPhone)" && req.http.User-Agent ~ "\(compatible.?; Googlebot/2.1.?; \+http://www.google.com/bot.html") || (req.http.User-Agent ~ "(iPhone|Windows Phone)" && req.http.User-Agent ~ "\(compatible; bingbot/2.0; \+http://www.bing.com/bingbot.htm")) { set req.http.X-UA-Device = "mobile-bot"; } elsif (req.http.User-Agent ~ "(?i)(ads|google|bing|msn|yandex|baidu|ro|career|seznam|)bot" || req.http.User-Agent ~ "(?i)(baidu|jike|symantec)spider" || req.http.User-Agent ~ "(?i)scanner" || req.http.User-Agent ~ "(?i)(web)crawler") { set req.http.X-UA-Device = "bot"; } elsif (req.http.User-Agent ~ "(?i)ipad") { set req.http.X-UA-Device = "tablet-ipad"; } elsif (req.http.User-Agent ~ "(?i)ip(hone|od)") { set req.http.X-UA-Device = "mobile-iphone"; } /* how do we differ between an android phone and an android tablet? http://stackoverflow.com/questions/5341637/how-do-detect-android-tablets-in-general-useragent */ elsif (req.http.User-Agent ~ "(?i)android.*(mobile|mini)") { set req.http.X-UA-Device = "mobile-android"; } // android 3/honeycomb was just about tablet-only, and any phones will probably handle a bigger page layout. elsif (req.http.User-Agent ~ "(?i)android 3") { set req.http.X-UA-Device = "tablet-android"; } /* Opera Mobile */ elsif (req.http.User-Agent ~ "Opera Mobi") { set req.http.X-UA-Device = "mobile-smartphone"; } // May very well give false positives towards android tablets. Suggestions welcome. elsif (req.http.User-Agent ~ "(?i)android") { set req.http.X-UA-Device = "tablet-android"; } elsif (req.http.User-Agent ~ "PlayBook; U; RIM Tablet") { set req.http.X-UA-Device = "tablet-rim"; } elsif (req.http.User-Agent ~ "hp-tablet.*TouchPad") { set req.http.X-UA-Device = "tablet-hp"; } elsif (req.http.User-Agent ~ "Kindle/3") { set req.http.X-UA-Device = "tablet-kindle"; } elsif (req.http.User-Agent ~ "Touch.+Tablet PC" || req.http.User-Agent ~ "Windows NT [0-9.]+; ARM;" ) { set req.http.X-UA-Device = "tablet-microsoft"; } elsif (req.http.User-Agent ~ "Mobile.+Firefox") { set req.http.X-UA-Device = "mobile-firefoxos"; } elsif (req.http.User-Agent ~ "^HTC" || req.http.User-Agent ~ "Fennec" || req.http.User-Agent ~ "IEMobile" || req.http.User-Agent ~ "BlackBerry" || req.http.User-Agent ~ "BB10.*Mobile" || req.http.User-Agent ~ "GT-.*Build/GINGERBREAD" || req.http.User-Agent ~ "SymbianOS.*AppleWebKit") { set req.http.X-UA-Device = "mobile-smartphone"; } elsif (req.http.User-Agent ~ "(?i)symbian" || req.http.User-Agent ~ "(?i)^sonyericsson" || req.http.User-Agent ~ "(?i)^nokia" || req.http.User-Agent ~ "(?i)^samsung" || req.http.User-Agent ~ "(?i)^lg" || req.http.User-Agent ~ "(?i)bada" || req.http.User-Agent ~ "(?i)blazer" || req.http.User-Agent ~ "(?i)cellphone" || req.http.User-Agent ~ "(?i)iemobile" || req.http.User-Agent ~ "(?i)midp-2.0" || req.http.User-Agent ~ "(?i)u990" || req.http.User-Agent ~ "(?i)netfront" || req.http.User-Agent ~ "(?i)opera mini" || req.http.User-Agent ~ "(?i)palm" || req.http.User-Agent ~ "(?i)nintendo wii" || req.http.User-Agent ~ "(?i)playstation portable" || req.http.User-Agent ~ "(?i)portalmmm" || req.http.User-Agent ~ "(?i)proxinet" || req.http.User-Agent ~ "(?i)sonyericsson" || req.http.User-Agent ~ "(?i)symbian" || req.http.User-Agent ~ "(?i)windows\ ?ce" || req.http.User-Agent ~ "(?i)winwap" || req.http.User-Agent ~ "(?i)eudoraweb" || req.http.User-Agent ~ "(?i)htc" || req.http.User-Agent ~ "(?i)240x320" || req.http.User-Agent ~ "(?i)avantgo") { set req.http.X-UA-Device = "mobile-generic"; } } } varnish-6.2.1/etc/builtin.vcl0000644000175000017500000001007213531244407013045 00000000000000# This is the VCL configuration Varnish will automatically append to your VCL # file during compilation/loading. See the vcl(7) man page for details on syntax # and semantics. # New users is recommended to use the example.vcl file as a starting point. # # sub vcl_recv { # if (req.method == "PRI") { # /* This will never happen in properly formed traffic (see: RFC7540) */ # return (synth(405)); # } # if (!req.http.host && # req.esi_level == 0 && # req.proto ~ "^(?i)HTTP/1.1") { # /* In HTTP/1.1, Host is required. */ # return (synth(400)); # } # if (req.method != "GET" && # req.method != "HEAD" && # req.method != "PUT" && # req.method != "POST" && # req.method != "TRACE" && # req.method != "OPTIONS" && # req.method != "DELETE" && # req.method != "PATCH") { # /* Non-RFC2616 or CONNECT which is weird. */ # return (pipe); # } # # if (req.method != "GET" && req.method != "HEAD") { # /* We only deal with GET and HEAD by default */ # return (pass); # } # if (req.http.Authorization || req.http.Cookie) { # /* Not cacheable by default */ # return (pass); # } # return (hash); # } # # sub vcl_pipe { # # By default Connection: close is set on all piped requests, to stop # # connection reuse from sending future requests directly to the # # (potentially) wrong backend. If you do want this to happen, you can undo # # it here. # # unset bereq.http.connection; # return (pipe); # } # # sub vcl_pass { # return (fetch); # } # # sub vcl_hash { # hash_data(req.url); # if (req.http.host) { # hash_data(req.http.host); # } else { # hash_data(server.ip); # } # return (lookup); # } # # sub vcl_purge { # return (synth(200, "Purged")); # } # # sub vcl_hit { # return (deliver); # } # # sub vcl_miss { # return (fetch); # } # # sub vcl_deliver { # return (deliver); # } # # /* # * We can come here "invisibly" with the following errors: 500 & 503 # */ # sub vcl_synth { # set resp.http.Content-Type = "text/html; charset=utf-8"; # set resp.http.Retry-After = "5"; # set resp.body = {" # # # "} + resp.status + " " + resp.reason + {" # # #

Error "} + resp.status + " " + resp.reason + {"

#

"} + resp.reason + {"

#

Guru Meditation:

#

XID: "} + req.xid + {"

#
#

Varnish cache server

# # # "}; # return (deliver); # } # # ####################################################################### # # Backend Fetch # # sub vcl_backend_fetch { # if (bereq.method == "GET") { # unset bereq.body; # } # return (fetch); # } # # sub vcl_backend_response { # if (bereq.uncacheable) { # return (deliver); # } else if (beresp.ttl <= 0s || # beresp.http.Set-Cookie || # beresp.http.Surrogate-control ~ "(?i)no-store" || # (!beresp.http.Surrogate-Control && # beresp.http.Cache-Control ~ "(?i:no-cache|no-store|private)") || # beresp.http.Vary == "*") { # # Mark as "Hit-For-Miss" for the next 2 minutes # set beresp.ttl = 120s; # set beresp.uncacheable = true; # } # return (deliver); # } # # sub vcl_backend_error { # set beresp.http.Content-Type = "text/html; charset=utf-8"; # set beresp.http.Retry-After = "5"; # set beresp.body = {" # # # "} + beresp.status + " " + beresp.reason + {" # # #

Error "} + beresp.status + " " + beresp.reason + {"

#

"} + beresp.reason + {"

#

Guru Meditation:

#

XID: "} + bereq.xid + {"

#
#

Varnish cache server

# # # "}; # return (deliver); # } # # ####################################################################### # # Housekeeping # # sub vcl_init { # return (ok); # } # # sub vcl_fini { # return (ok); # } varnish-6.2.1/etc/Makefile.in0000644000175000017500000004213213531244360012736 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = etc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/varnish.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/ld-version-script.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(dist_doc_DATA) $(dist_vcl_DATA) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(docdir)" "$(DESTDIR)$(vcldir)" DATA = $(dist_doc_DATA) $(dist_vcl_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LT_LDFLAGS = @AM_LT_LDFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_CFLAGS = @CURSES_CFLAGS@ CURSES_LIB = @CURSES_LIB@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ DOT = @DOT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXTCFLAGS = @EXTCFLAGS@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JEMALLOC_LDADD = @JEMALLOC_LDADD@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBEDIT_CFLAGS = @LIBEDIT_CFLAGS@ LIBEDIT_LIBS = @LIBEDIT_LIBS@ LIBM = @LIBM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ NSL_LIBS = @NSL_LIBS@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_CFLAGS = @PCRE_CFLAGS@ PCRE_CONFIG = @PCRE_CONFIG@ PCRE_LIBS = @PCRE_LIBS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RST2HTML = @RST2HTML@ RST2MAN = @RST2MAN@ RT_LIBS = @RT_LIBS@ SAN_CFLAGS = @SAN_CFLAGS@ SAN_LDFLAGS = @SAN_LDFLAGS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOCKET_LIBS = @SOCKET_LIBS@ SPHINX = @SPHINX@ STRIP = @STRIP@ VARNISH_STATE_DIR = @VARNISH_STATE_DIR@ VCC_CC = @VCC_CC@ VERSION = @VERSION@ VMOD_LDFLAGS = @VMOD_LDFLAGS@ VSC_GEN_C = @VSC_GEN_C@ VSC_GEN_H = @VSC_GEN_H@ VTC_TESTS = @VTC_TESTS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ ax_pthread_config = @ax_pthread_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libvgz_extra_cflags = @libvgz_extra_cflags@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ pkgsysconfdir = @pkgsysconfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DISTCLEANFILES = builtin.vcl dist_doc_DATA = builtin.vcl \ example.vcl vcldir = $(datarootdir)/$(PACKAGE)/vcl dist_vcl_DATA = devicedetect.vcl all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign etc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign etc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-dist_docDATA: $(dist_doc_DATA) @$(NORMAL_INSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-dist_docDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) install-dist_vclDATA: $(dist_vcl_DATA) @$(NORMAL_INSTALL) @list='$(dist_vcl_DATA)'; test -n "$(vcldir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(vcldir)'"; \ $(MKDIR_P) "$(DESTDIR)$(vcldir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(vcldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(vcldir)" || exit $$?; \ done uninstall-dist_vclDATA: @$(NORMAL_UNINSTALL) @list='$(dist_vcl_DATA)'; test -n "$(vcldir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(vcldir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(docdir)" "$(DESTDIR)$(vcldir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_docDATA install-dist_vclDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_docDATA uninstall-dist_vclDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_docDATA install-dist_vclDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am uninstall-dist_docDATA \ uninstall-dist_vclDATA .PRECIOUS: Makefile builtin.vcl: $(top_srcdir)/bin/varnishd/builtin.vcl ( printf "This is the VCL configuration Varnish will automatically append to your VCL\nfile during compilation/loading. See the vcl(7) man page for details on syntax\nand semantics.\n\ New users is recommended to use the example.vcl file as a starting point.\n\n";\ sed -n '/vcl_recv/,$$p' $(top_srcdir)/bin/varnishd/builtin.vcl ) | \ sed 's/^\(.*\)$$/# \1/' > builtin.vcl # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: varnish-6.2.1/etc/example.vcl0000644000175000017500000000231113530745476013042 00000000000000# # This is an example VCL file for Varnish. # # It does not do anything by default, delegating control to the # builtin VCL. The builtin VCL is called when there is no explicit # return statement. # # See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/ # and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples. # Marker to tell the VCL compiler that this VCL has been adapted to the # new 4.0 format. vcl 4.0; # Default backend definition. Set this to point to your content server. backend default { .host = "127.0.0.1"; .port = "8080"; } sub vcl_recv { # Happens before we check if we have this in cache already. # # Typically you clean up the request here, removing cookies you don't need, # rewriting the request, etc. } sub vcl_backend_response { # Happens after we have read the response headers from the backend. # # Here you clean the response headers, removing silly Set-Cookie headers # and other mistakes your backend does. } sub vcl_deliver { # Happens when we have all the pieces we need, and are about to send the # response to the client. # # You can do accounting or modifying the final object here. } varnish-6.2.1/include/0000755000175000017500000000000013531244417011622 500000000000000varnish-6.2.1/include/vcl.h0000644000175000017500000000726713531244373012514 00000000000000/* * 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_FAIL 3 #define VCL_RET_FETCH 4 #define VCL_RET_HASH 5 #define VCL_RET_LOOKUP 6 #define VCL_RET_OK 7 #define VCL_RET_PASS 8 #define VCL_RET_PIPE 9 #define VCL_RET_PURGE 10 #define VCL_RET_RESTART 11 #define VCL_RET_RETRY 12 #define VCL_RET_SYNTH 13 #define VCL_RET_VCL 14 #define VCL_RET_MAX 15 /* 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; VCL_BACKEND *default_director; VCL_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; }; varnish-6.2.1/include/vrt_obj.h0000644000175000017500000001305613531244373013366 00000000000000/* * 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_beresp_filters(VRT_CTX); void VRT_l_beresp_filters(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_STRING VRT_r_resp_filters(VRT_CTX); void VRT_l_resp_filters(VRT_CTX, const char *, ...); VCL_TIME VRT_r_now(VRT_CTX); 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 *); varnish-6.2.1/include/vnum.h0000644000175000017500000000372513531244202012677 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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/vnum.c */ double VNUM(const char *p); double VNUMpfx(const char *p, const char **e); vtim_dur VNUM_duration_unit(vtim_dur r, const char *b, const char *e); vtim_dur VNUM_duration(const char *p); double VNUM_bytes_unit(double r, const char *b, const char *e, uintmax_t rel); const char *VNUM_2bytes(const char *p, uintmax_t *r, uintmax_t rel); #define VNUM_LEGAL_DURATION \ "Legal duration units are 'ms', 's', 'm', 'h', 'd', 'w' and 'y'" #define VNUM_LEGAL_BYTES \ "Legal byte units are 'B', 'KB', 'MB', 'GB', 'TB' and 'PB'" varnish-6.2.1/include/vpf.h0000644000175000017500000000331413531244202012477 00000000000000/*- * Copyright (c) 2005 Pawel Jakub Dawidek * 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 AUTHORS 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 AUTHORS 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. * * Derived from: * $FreeBSD: src/lib/libutil/libutil.h,v 1.41 2005/08/24 17:21:38 pjd Exp $ */ #ifndef VPF_H_INCLUDED #define VPF_H_INCLUDED struct vpf_fh; struct vpf_fh *VPF_Open(const char *path, mode_t mode, pid_t *pidptr); int VPF_Read(const char *path, pid_t *); void VPF_Write(const struct vpf_fh *pfh); void VPF_Remove(struct vpf_fh *pfh); #endif varnish-6.2.1/include/vct.h0000644000175000017500000000643713531244202012511 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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/vct.c */ #include "vas.h" #define VCT_SP (1<<0) #define VCT_CRLF (1<<1) #define VCT_LWS (VCT_CRLF | VCT_SP) #define VCT_CTL (1<<2) #define VCT_ALPHA (1<<3) #define VCT_SEPARATOR (1<<4) #define VCT_DIGIT (1<<5) #define VCT_HEX (1<<6) #define VCT_XMLNAMESTART (1<<7) #define VCT_XMLNAME (1<<8) #define VCT_TCHAR (1<<9) #define VCT_ID (1<<10) #define VCT_IDENT (VCT_ALPHA | VCT_DIGIT | VCT_ID) #define VCT_VAR (1<<11) #define VCT_VT (1<<12) #define VCT_SPACE (VCT_LWS | VCT_VT) extern const uint16_t vct_typtab[256]; const char *VCT_invalid_name(const char *b, const char *e); static inline int vct_is(int x, uint16_t y) { x &= 0xff; return (vct_typtab[x] & (y)); } #define vct_issp(x) vct_is(x, VCT_SP) #define vct_ishex(x) vct_is(x, VCT_HEX) #define vct_islws(x) vct_is(x, VCT_LWS) #define vct_isctl(x) vct_is(x, VCT_CTL) #define vct_isspace(x) vct_is(x, VCT_SPACE) #define vct_isdigit(x) vct_is(x, VCT_DIGIT) #define vct_isalpha(x) vct_is(x, VCT_ALPHA) #define vct_isalnum(x) vct_is(x, VCT_ALPHA | VCT_DIGIT) #define vct_issep(x) vct_is(x, VCT_SEPARATOR) #define vct_issepctl(x) vct_is(x, VCT_SEPARATOR | VCT_CTL) #define vct_isident1(x) vct_isalpha(x) #define vct_isident(x) vct_is(x, VCT_IDENT) #define vct_isvar(x) vct_is(x, VCT_IDENT | VCT_VAR) #define vct_isxmlnamestart(x) vct_is(x, VCT_XMLNAMESTART) #define vct_isxmlname(x) vct_is(x, VCT_XMLNAMESTART | VCT_XMLNAME) #define vct_istchar(x) vct_is(x, VCT_ALPHA | VCT_DIGIT | VCT_TCHAR) static inline int vct_iscrlf(const char* p, const char* end) { assert(p <= end); if (p == end) return (0); if ((p[0] == 0x0d && (p+1 < end) && p[1] == 0x0a)) // CR LF return (2); if (p[0] == 0x0a) // LF return (1); return (0); } /* NB: VCT always operate in ASCII, don't replace 0x0d with \r etc. */ static inline char* vct_skipcrlf(char* p, const char* end) { return (p + vct_iscrlf(p, end)); } varnish-6.2.1/include/vsl_priv.h0000644000175000017500000000475413527745146013603 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * Author: Martin Blix Grydeland * * 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. * * NB: THIS IS NOT A PUBLIC API TO VARNISH! */ #ifdef VSL_PRIV_H_INCLUDED # error "vsl_priv.h included more than once" #endif #define VSL_PRIV_H_INCLUDED #include "vapi/vsl_int.h" #define VSL_CLASS "Log" #define VSL_SEGMENTS 8U // power of two /* * Shared memory log format * * The segments array has index values providing safe entry points into * the log, where each element N gives the index of the first log record * in the Nth segment of the log. An index value of -1 indicates that no * log records in this segment exists. * * The segment_n member is incremented only, natively wrapping at * UINT_MAX. When taken modulo VSL_SEGMENTS, it gives the current index * into the offset array. * * The format of the actual log is in vapi/vsl_int.h * */ struct VSL_head { #define VSL_HEAD_MARKER "VSLHEAD1" /* Incr. as version# */ char marker[8]; ssize_t segsize; unsigned segment_n; ssize_t offset[VSL_SEGMENTS]; uint32_t log[]; }; varnish-6.2.1/include/vdef.h0000644000175000017500000001131413531244202012627 00000000000000/*- * 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 * Author: Rogier 'DocWilco' Mulhuijzen * * Inspired by FreeBSD's * * 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) #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 #if __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__)) /********************************************************************* * 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 */ /********************************************************************** * 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 /* VTIM API overhaul WIP */ typedef double vtim_mono; typedef double vtim_real; typedef double vtim_dur; varnish-6.2.1/include/vus.h0000644000175000017500000000327713527745146012553 00000000000000/*- * Copyright (c) 2018 UPLEX - Nils Goroll Systemoptimierung * All rights reserved. * * Author: Geoffrey Simmons * * 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 sockaddr_un; typedef int vus_resolved_f(void *priv, const struct sockaddr_un *); int VUS_resolver(const char *path, vus_resolved_f *func, void *priv, const char **err); int VUS_bind(const struct sockaddr_un *uds, const char **errp); int VUS_connect(const char *path, int msec); varnish-6.2.1/include/vss.h0000644000175000017500000000332513531244202012521 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 Varnish Software AS * 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 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. * */ /* vss.c */ struct suckaddr; typedef int vss_resolved_f(void *priv, const struct suckaddr *); int VSS_resolver(const char *addr, const char *def_port, vss_resolved_f *func, void *priv, const char **err); int VSS_resolver_socktype(const char *addr, const char *def_port, vss_resolved_f *func, void *priv, const char **err, int socktype); varnish-6.2.1/include/vsc_priv.h0000644000175000017500000000345013527745146013562 00000000000000/*- * Copyright (c) 2017 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * Author: Martin Blix Grydeland * * 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 statistics VSM segments * * NB: THIS IS NOT A PUBLIC API TO VARNISH! */ #ifdef VSC_PRIV_H_INCLUDED # error "vsc_priv.h included more than once" #endif #define VSC_PRIV_H_INCLUDED #define VSC_CLASS "Stat" #define VSC_DOC_CLASS "StatDoc" struct vsc_head { volatile int ready; uint64_t body_offset; uintptr_t doc_id; }; varnish-6.2.1/include/compat/0000755000175000017500000000000013531244417013105 500000000000000varnish-6.2.1/include/compat/daemon.h0000644000175000017500000000315712306343772014452 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Smørgrav * * 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 COMPAT_DAEMON_H_INCLUDED #define COMPAT_DAEMON_H_INCLUDED #ifndef HAVE_DAEMON int varnish_daemon(int nochdir, int noclose); #else #define varnish_daemon(a,b) daemon(a,b) #endif #endif varnish-6.2.1/include/vtree.h0000644000175000017500000006401013531244202013031 00000000000000/* $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 * 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 VRBT_HEAD(name, type) \ struct name { \ struct type *rbh_root; /* root of the tree */ \ } #define VRBT_INITIALIZER(root) \ { NULL } #define VRBT_INIT(root) do { \ (root)->rbh_root = NULL; \ } while (/*CONSTCOND*/ 0) #define VRBT_BLACK 0 #define VRBT_RED 1 #define VRBT_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 VRBT_LEFT(elm, field) (elm)->field.rbe_left #define VRBT_RIGHT(elm, field) (elm)->field.rbe_right #define VRBT_PARENT(elm, field) (elm)->field.rbe_parent #define VRBT_COLOR(elm, field) (elm)->field.rbe_color #define VRBT_ROOT(head) (head)->rbh_root #define VRBT_EMPTY(head) (VRBT_ROOT(head) == NULL) #define VRBT_SET(elm, parent, field) do { \ VRBT_PARENT(elm, field) = parent; \ VRBT_LEFT(elm, field) = VRBT_RIGHT(elm, field) = NULL; \ VRBT_COLOR(elm, field) = VRBT_RED; \ } while (/*CONSTCOND*/ 0) #define VRBT_SET_BLACKRED(black, red, field) do { \ VRBT_COLOR(black, field) = VRBT_BLACK; \ VRBT_COLOR(red, field) = VRBT_RED; \ } while (/*CONSTCOND*/ 0) #ifndef VRBT_AUGMENT #define VRBT_AUGMENT(x) do {} while (0) #endif #define VRBT_ROTATE_LEFT(head, elm, tmp, field) do { \ (tmp) = VRBT_RIGHT(elm, field); \ if ((VRBT_RIGHT(elm, field) = VRBT_LEFT(tmp, field)) != NULL) { \ VRBT_PARENT(VRBT_LEFT(tmp, field), field) = (elm); \ } \ VRBT_AUGMENT(elm); \ if ((VRBT_PARENT(tmp, field) = VRBT_PARENT(elm, field)) != NULL) {\ if ((elm) == VRBT_LEFT(VRBT_PARENT(elm, field), field)) \ VRBT_LEFT(VRBT_PARENT(elm, field), field) = (tmp);\ else \ VRBT_RIGHT(VRBT_PARENT(elm, field), field) = (tmp);\ } else \ (head)->rbh_root = (tmp); \ VRBT_LEFT(tmp, field) = (elm); \ VRBT_PARENT(elm, field) = (tmp); \ VRBT_AUGMENT(tmp); \ if ((VRBT_PARENT(tmp, field))) \ VRBT_AUGMENT(VRBT_PARENT(tmp, field)); \ } while (/*CONSTCOND*/ 0) #define VRBT_ROTATE_RIGHT(head, elm, tmp, field) do { \ (tmp) = VRBT_LEFT(elm, field); \ if ((VRBT_LEFT(elm, field) = VRBT_RIGHT(tmp, field)) != NULL) { \ VRBT_PARENT(VRBT_RIGHT(tmp, field), field) = (elm); \ } \ VRBT_AUGMENT(elm); \ if ((VRBT_PARENT(tmp, field) = VRBT_PARENT(elm, field)) != NULL) {\ if ((elm) == VRBT_LEFT(VRBT_PARENT(elm, field), field)) \ VRBT_LEFT(VRBT_PARENT(elm, field), field) = (tmp);\ else \ VRBT_RIGHT(VRBT_PARENT(elm, field), field) = (tmp);\ } else \ (head)->rbh_root = (tmp); \ VRBT_RIGHT(tmp, field) = (elm); \ VRBT_PARENT(elm, field) = (tmp); \ VRBT_AUGMENT(tmp); \ if ((VRBT_PARENT(tmp, field))) \ VRBT_AUGMENT(VRBT_PARENT(tmp, field)); \ } while (/*CONSTCOND*/ 0) /* Generates prototypes and inline functions */ #define VRBT_PROTOTYPE(name, type, field, cmp) \ VRBT_PROTOTYPE_INTERNAL(name, type, field, cmp,) #define VRBT_PROTOTYPE_STATIC(name, type, field, cmp) \ VRBT_PROTOTYPE_INTERNAL(name, type, field, cmp, v_unused_ static) #define VRBT_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ /*lint -esym(528, name##_VRBT_*) */ \ attr void name##_VRBT_INSERT_COLOR(struct name *, struct type *); \ attr void name##_VRBT_REMOVE_COLOR(struct name *, struct type *, struct type *);\ attr struct type *name##_VRBT_REMOVE(struct name *, struct type *); \ attr struct type *name##_VRBT_INSERT(struct name *, struct type *); \ attr struct type *name##_VRBT_FIND(const struct name *, const struct type *); \ attr struct type *name##_VRBT_NFIND(const struct name *, const struct type *); \ attr struct type *name##_VRBT_NEXT(struct type *); \ attr struct type *name##_VRBT_PREV(struct type *); \ attr struct type *name##_VRBT_MINMAX(const struct name *, int); \ \ /* Main rb operation. * Moves node close to the key of elm to top */ #define VRBT_GENERATE(name, type, field, cmp) \ VRBT_GENERATE_INTERNAL(name, type, field, cmp,) #define VRBT_GENERATE_STATIC(name, type, field, cmp) \ VRBT_GENERATE_INTERNAL(name, type, field, cmp, v_unused_ static) #define VRBT_GENERATE_INTERNAL(name, type, field, cmp, attr) \ attr void \ name##_VRBT_INSERT_COLOR(struct name *head, struct type *elm) \ { \ struct type *parent, *gparent, *tmp; \ while ((parent = VRBT_PARENT(elm, field)) != NULL && \ VRBT_COLOR(parent, field) == VRBT_RED) { \ gparent = VRBT_PARENT(parent, field); \ if (parent == VRBT_LEFT(gparent, field)) { \ tmp = VRBT_RIGHT(gparent, field); \ if (tmp && VRBT_COLOR(tmp, field) == VRBT_RED) {\ VRBT_COLOR(tmp, field) = VRBT_BLACK; \ VRBT_SET_BLACKRED(parent, gparent, field);\ elm = gparent; \ continue; \ } \ if (VRBT_RIGHT(parent, field) == elm) { \ VRBT_ROTATE_LEFT(head, parent, tmp, field);\ tmp = parent; \ parent = elm; \ elm = tmp; \ } \ VRBT_SET_BLACKRED(parent, gparent, field); \ VRBT_ROTATE_RIGHT(head, gparent, tmp, field); \ } else { \ tmp = VRBT_LEFT(gparent, field); \ if (tmp && VRBT_COLOR(tmp, field) == VRBT_RED) {\ VRBT_COLOR(tmp, field) = VRBT_BLACK; \ VRBT_SET_BLACKRED(parent, gparent, field);\ elm = gparent; \ continue; \ } \ if (VRBT_LEFT(parent, field) == elm) { \ VRBT_ROTATE_RIGHT(head, parent, tmp, field);\ tmp = parent; \ parent = elm; \ elm = tmp; \ } \ VRBT_SET_BLACKRED(parent, gparent, field); \ VRBT_ROTATE_LEFT(head, gparent, tmp, field); \ } \ } \ VRBT_COLOR(head->rbh_root, field) = VRBT_BLACK; \ } \ \ attr void \ name##_VRBT_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \ { \ struct type *tmp; \ while ((elm == NULL || VRBT_COLOR(elm, field) == VRBT_BLACK) && \ elm != VRBT_ROOT(head)) { \ AN(parent); \ if (VRBT_LEFT(parent, field) == elm) { \ tmp = VRBT_RIGHT(parent, field); \ if (VRBT_COLOR(tmp, field) == VRBT_RED) { \ VRBT_SET_BLACKRED(tmp, parent, field); \ VRBT_ROTATE_LEFT(head, parent, tmp, field);\ tmp = VRBT_RIGHT(parent, field); \ } \ if ((VRBT_LEFT(tmp, field) == NULL || \ VRBT_COLOR(VRBT_LEFT(tmp, field), field) == VRBT_BLACK) &&\ (VRBT_RIGHT(tmp, field) == NULL || \ VRBT_COLOR(VRBT_RIGHT(tmp, field), field) == VRBT_BLACK)) {\ VRBT_COLOR(tmp, field) = VRBT_RED; \ elm = parent; \ parent = VRBT_PARENT(elm, field); \ } else { \ if (VRBT_RIGHT(tmp, field) == NULL || \ VRBT_COLOR(VRBT_RIGHT(tmp, field), field) == VRBT_BLACK) {\ struct type *oleft; \ if ((oleft = VRBT_LEFT(tmp, field)) \ != NULL) \ VRBT_COLOR(oleft, field) = VRBT_BLACK;\ VRBT_COLOR(tmp, field) = VRBT_RED;\ VRBT_ROTATE_RIGHT(head, tmp, oleft, field);\ tmp = VRBT_RIGHT(parent, field);\ } \ VRBT_COLOR(tmp, field) = VRBT_COLOR(parent, field);\ VRBT_COLOR(parent, field) = VRBT_BLACK; \ if (VRBT_RIGHT(tmp, field)) \ VRBT_COLOR(VRBT_RIGHT(tmp, field), field) = VRBT_BLACK;\ VRBT_ROTATE_LEFT(head, parent, tmp, field);\ elm = VRBT_ROOT(head); \ break; \ } \ } else { \ tmp = VRBT_LEFT(parent, field); \ if (VRBT_COLOR(tmp, field) == VRBT_RED) { \ VRBT_SET_BLACKRED(tmp, parent, field); \ VRBT_ROTATE_RIGHT(head, parent, tmp, field);\ tmp = VRBT_LEFT(parent, field); \ } \ if ((VRBT_LEFT(tmp, field) == NULL || \ VRBT_COLOR(VRBT_LEFT(tmp, field), field) == VRBT_BLACK) &&\ (VRBT_RIGHT(tmp, field) == NULL || \ VRBT_COLOR(VRBT_RIGHT(tmp, field), field) == VRBT_BLACK)) {\ VRBT_COLOR(tmp, field) = VRBT_RED; \ elm = parent; \ parent = VRBT_PARENT(elm, field); \ } else { \ if (VRBT_LEFT(tmp, field) == NULL || \ VRBT_COLOR(VRBT_LEFT(tmp, field), field) == VRBT_BLACK) {\ struct type *oright; \ if ((oright = VRBT_RIGHT(tmp, field)) \ != NULL) \ VRBT_COLOR(oright, field) = VRBT_BLACK;\ VRBT_COLOR(tmp, field) = VRBT_RED;\ VRBT_ROTATE_LEFT(head, tmp, oright, field);\ tmp = VRBT_LEFT(parent, field); \ } \ VRBT_COLOR(tmp, field) = VRBT_COLOR(parent, field);\ VRBT_COLOR(parent, field) = VRBT_BLACK; \ if (VRBT_LEFT(tmp, field)) \ VRBT_COLOR(VRBT_LEFT(tmp, field), field) = VRBT_BLACK;\ VRBT_ROTATE_RIGHT(head, parent, tmp, field);\ elm = VRBT_ROOT(head); \ break; \ } \ } \ } \ if (elm) \ VRBT_COLOR(elm, field) = VRBT_BLACK; \ } \ \ attr struct type * \ name##_VRBT_REMOVE(struct name *head, struct type *elm) \ { \ struct type *child, *parent, *old = elm; \ int color; \ if (VRBT_LEFT(elm, field) == NULL) \ child = VRBT_RIGHT(elm, field); \ else if (VRBT_RIGHT(elm, field) == NULL) \ child = VRBT_LEFT(elm, field); \ else { \ struct type *left; \ elm = VRBT_RIGHT(elm, field); \ while ((left = VRBT_LEFT(elm, field)) != NULL) \ elm = left; \ child = VRBT_RIGHT(elm, field); \ parent = VRBT_PARENT(elm, field); \ color = VRBT_COLOR(elm, field); \ if (child) \ VRBT_PARENT(child, field) = parent; \ if (parent) { \ if (VRBT_LEFT(parent, field) == elm) \ VRBT_LEFT(parent, field) = child; \ else \ VRBT_RIGHT(parent, field) = child; \ VRBT_AUGMENT(parent); \ } else \ VRBT_ROOT(head) = child; \ if (VRBT_PARENT(elm, field) == old) \ parent = elm; \ (elm)->field = (old)->field; \ if (VRBT_PARENT(old, field)) { \ if (VRBT_LEFT(VRBT_PARENT(old, field), field) == old)\ VRBT_LEFT(VRBT_PARENT(old, field), field) = elm;\ else \ VRBT_RIGHT(VRBT_PARENT(old, field), field) = elm;\ VRBT_AUGMENT(VRBT_PARENT(old, field)); \ } else \ VRBT_ROOT(head) = elm; \ VRBT_PARENT(VRBT_LEFT(old, field), field) = elm; \ if (VRBT_RIGHT(old, field)) \ VRBT_PARENT(VRBT_RIGHT(old, field), field) = elm;\ if (parent) { \ left = parent; \ do { \ VRBT_AUGMENT(left); \ } while ((left = VRBT_PARENT(left, field)) != NULL);\ } \ goto color; \ } \ parent = VRBT_PARENT(elm, field); \ color = VRBT_COLOR(elm, field); \ if (child) \ VRBT_PARENT(child, field) = parent; \ if (parent) { \ if (VRBT_LEFT(parent, field) == elm) \ VRBT_LEFT(parent, field) = child; \ else \ VRBT_RIGHT(parent, field) = child; \ VRBT_AUGMENT(parent); \ } else \ VRBT_ROOT(head) = child; \ color: \ if (color == VRBT_BLACK) { \ name##_VRBT_REMOVE_COLOR(head, parent, child); \ } \ return (old); \ } \ \ /* Inserts a node into the RB tree */ \ attr struct type * \ name##_VRBT_INSERT(struct name *head, struct type *elm) \ { \ struct type *tmp; \ struct type *parent = NULL; \ int comp = 0; \ tmp = VRBT_ROOT(head); \ while (tmp) { \ parent = tmp; \ comp = (cmp)(elm, parent); \ if (comp < 0) \ tmp = VRBT_LEFT(tmp, field); \ else if (comp > 0) \ tmp = VRBT_RIGHT(tmp, field); \ else \ return (tmp); \ } \ VRBT_SET(elm, parent, field); \ if (parent != NULL) { \ if (comp < 0) \ VRBT_LEFT(parent, field) = elm; \ else \ VRBT_RIGHT(parent, field) = elm; \ VRBT_AUGMENT(parent); \ } else \ VRBT_ROOT(head) = elm; \ name##_VRBT_INSERT_COLOR(head, elm); \ return (NULL); \ } \ \ /* Finds the node with the same key as elm */ \ attr struct type * \ name##_VRBT_FIND(const struct name *head, const struct type *elm) \ { \ struct type *tmp = VRBT_ROOT(head); \ int comp; \ while (tmp) { \ comp = cmp(elm, tmp); \ if (comp < 0) \ tmp = VRBT_LEFT(tmp, field); \ else if (comp > 0) \ tmp = VRBT_RIGHT(tmp, field); \ else \ return (tmp); \ } \ return (NULL); \ } \ \ /* Finds the first node greater than or equal to the search key */ \ attr struct type * \ name##_VRBT_NFIND(const struct name *head, const struct type *elm) \ { \ struct type *tmp = VRBT_ROOT(head); \ struct type *res = NULL; \ int comp; \ while (tmp) { \ comp = cmp(elm, tmp); \ if (comp < 0) { \ res = tmp; \ tmp = VRBT_LEFT(tmp, field); \ } \ else if (comp > 0) \ tmp = VRBT_RIGHT(tmp, field); \ else \ return (tmp); \ } \ return (res); \ } \ \ /* ARGSUSED */ \ attr struct type * \ name##_VRBT_NEXT(struct type *elm) \ { \ if (VRBT_RIGHT(elm, field)) { \ elm = VRBT_RIGHT(elm, field); \ while (VRBT_LEFT(elm, field)) \ elm = VRBT_LEFT(elm, field); \ } else { \ if (VRBT_PARENT(elm, field) && \ (elm == VRBT_LEFT(VRBT_PARENT(elm, field), field))) \ elm = VRBT_PARENT(elm, field); \ else { \ while (VRBT_PARENT(elm, field) && \ (elm == VRBT_RIGHT(VRBT_PARENT(elm, field), field)))\ elm = VRBT_PARENT(elm, field); \ elm = VRBT_PARENT(elm, field); \ } \ } \ return (elm); \ } \ \ /* ARGSUSED */ \ attr struct type * \ name##_VRBT_PREV(struct type *elm) \ { \ if (VRBT_LEFT(elm, field)) { \ elm = VRBT_LEFT(elm, field); \ while (VRBT_RIGHT(elm, field)) \ elm = VRBT_RIGHT(elm, field); \ } else { \ if (VRBT_PARENT(elm, field) && \ (elm == VRBT_RIGHT(VRBT_PARENT(elm, field), field)))\ elm = VRBT_PARENT(elm, field); \ else { \ while (VRBT_PARENT(elm, field) && \ (elm == VRBT_LEFT(VRBT_PARENT(elm, field), field)))\ elm = VRBT_PARENT(elm, field); \ elm = VRBT_PARENT(elm, field); \ } \ } \ return (elm); \ } \ \ attr struct type * \ name##_VRBT_MINMAX(const struct name *head, int val) \ { \ struct type *tmp = VRBT_ROOT(head); \ struct type *parent = NULL; \ while (tmp) { \ parent = tmp; \ if (val < 0) \ tmp = VRBT_LEFT(tmp, field); \ else \ tmp = VRBT_RIGHT(tmp, field); \ } \ return (parent); \ } #define VRBT_NEGINF -1 #define VRBT_INF 1 #define VRBT_INSERT(name, x, y) name##_VRBT_INSERT(x, y) #define VRBT_REMOVE(name, x, y) name##_VRBT_REMOVE(x, y) #define VRBT_FIND(name, x, y) name##_VRBT_FIND(x, y) #define VRBT_NFIND(name, x, y) name##_VRBT_NFIND(x, y) #define VRBT_NEXT(name, x, y) name##_VRBT_NEXT(y) #define VRBT_PREV(name, x, y) name##_VRBT_PREV(y) #define VRBT_MIN(name, x) name##_VRBT_MINMAX(x, VRBT_NEGINF) #define VRBT_MAX(name, x) name##_VRBT_MINMAX(x, VRBT_INF) #define VRBT_FOREACH(x, name, head) \ for ((x) = VRBT_MIN(name, head); \ (x) != NULL; \ (x) = name##_VRBT_NEXT(x)) #define VRBT_FOREACH_FROM(x, name, y) \ for ((x) = (y); \ ((x) != NULL) && ((y) = name##_VRBT_NEXT(x), (x) != NULL); \ (x) = (y)) #define VRBT_FOREACH_SAFE(x, name, head, y) \ for ((x) = VRBT_MIN(name, head); \ ((x) != NULL) && ((y) = name##_VRBT_NEXT(x), (x) != NULL); \ (x) = (y)) #define VRBT_FOREACH_REVERSE(x, name, head) \ for ((x) = VRBT_MAX(name, head); \ (x) != NULL; \ (x) = name##_VRBT_PREV(x)) #define VRBT_FOREACH_REVERSE_FROM(x, name, y) \ for ((x) = (y); \ ((x) != NULL) && ((y) = name##_VRBT_PREV(x), (x) != NULL); \ (x) = (y)) #define VRBT_FOREACH_REVERSE_SAFE(x, name, head, y) \ for ((x) = VRBT_MAX(name, head); \ ((x) != NULL) && ((y) = name##_VRBT_PREV(x), (x) != NULL); \ (x) = (y)) #endif /* _VTREE_H_ */ varnish-6.2.1/include/vlu.h0000644000175000017500000000342713530745476012541 00000000000000/*- * Copyright (c) 2005-2008 Poul-Henning Kamp * 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 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. * * Functions for assembling a bytestream into text-lines and calling * a function on each. */ #ifdef VLU_H_INCLUDED # error "vlu.h included multiple times" #endif #define VLU_H_INCLUDED typedef int (vlu_f)(void *, const char *); struct vlu *VLU_New(vlu_f *, void *, unsigned); int VLU_Fd(struct vlu *, int); void VLU_Destroy(struct vlu **); int VLU_File(int, vlu_f *, void *, unsigned); int VLU_Feed(struct vlu *, const char*, int); varnish-6.2.1/include/vbm.h0000644000175000017500000001036313527745146012514 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2010 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 #include #include /********************************************************************** * 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)); } varnish-6.2.1/include/Makefile.am0000644000175000017500000000563413531244202013576 00000000000000# # API headers nobase_pkginclude_HEADERS = \ tbl/acct_fields_bereq.h \ tbl/acct_fields_req.h \ tbl/backend_poll.h \ tbl/ban_arg_oper.h \ tbl/ban_oper.h \ tbl/ban_vars.h \ tbl/bo_flags.h \ tbl/boc_state.h \ tbl/body_status.h \ tbl/cli_cmds.h \ tbl/debug_bits.h \ tbl/feature_bits.h \ tbl/h2_error.h \ tbl/h2_frames.h \ tbl/h2_settings.h \ tbl/h2_stream.h \ tbl/htc.h \ tbl/http_headers.h \ tbl/http_response.h \ tbl/locks.h \ tbl/obj_attr.h \ tbl/oc_exp_flags.h \ tbl/oc_flags.h \ tbl/params.h \ tbl/req_body.h \ tbl/req_flags.h \ tbl/sess_attr.h \ tbl/sess_close.h \ tbl/steps.h \ tbl/symbol_kind.h \ tbl/vcc_types.h \ tbl/vcl_returns.h \ tbl/vcl_states.h \ tbl/vhd_fsm.h \ tbl/vhd_fsm_funcs.h \ tbl/vhd_return.h \ tbl/vhp_huffman.h \ tbl/vhp_static.h \ tbl/vrt_stv_var.h \ tbl/vsc_levels.h \ tbl/vsig_list.h \ tbl/vsl_tags.h \ tbl/vsl_tags_http.h \ tbl/waiters.h \ vapi/vsc.h \ vapi/vsig.h \ vapi/vsl.h \ vapi/vsl_int.h \ vapi/vsm.h \ vapi/voptget.h \ vapi/vapi_options.h \ vcli.h \ vut.h \ vut_options.h # Headers for use with vmods nobase_pkginclude_HEADERS += \ miniobj.h \ vas.h \ vav.h \ vbm.h \ vcl.h \ vcs.h \ verrno.h \ vmod_abi.h \ vqueue.h \ vre.h \ vdef.h \ vrt.h \ vrt_obj.h \ vsa.h \ vsb.h \ vsha256.h \ vtcp.h \ vtim.h \ vtree.h \ vrnd.h # Private headers nobase_noinst_HEADERS = \ binary_heap.h \ compat/daemon.h \ vfl.h \ libvcc.h \ vcli_serve.h \ vcs_version.h \ vct.h \ vcurses.h \ vend.h \ vev.h \ vfil.h \ vin.h \ vjsn.h \ vlu.h \ vmb.h \ vnum.h \ vpf.h \ vsc_priv.h \ vsl_priv.h \ vsm_priv.h \ vsub.h \ vss.h \ vtcp.h \ vus.h ## keep in sync with lib/libvcc/Makefile.am vcl.h: \ $(top_srcdir)/lib/libvcc/generate.py \ $(top_srcdir)/include/vdef.h \ $(top_srcdir)/include/vrt.h \ $(top_srcdir)/doc/sphinx/reference/vcl_var.rst mkdir -p $(top_builddir)/include/tbl ${PYTHON} $(top_srcdir)/lib/libvcc/generate.py \ $(top_srcdir) $(top_builddir) GEN_H = \ tbl/vrt_stv_var.h \ tbl/vcl_returns.h \ tbl/vcc_types.h \ vrt_obj.h $(GEN_H): vcl.h GENERATED_H = vcl.h $(GEN_H) ## vcs_version.h / vmod_abi.h need to be up-to-date with every build ## except when building from a distribution vcs_version.h: @if test -e $(top_srcdir)/.git || \ ! test -f $(srcdir)/vmod_abi.h || \ ! test -f $(srcdir)/vcs_version.h ; then \ ${PYTHON} $(srcdir)/generate.py \ $(top_srcdir) $(top_builddir) ; \ fi vmod_abi.h: vcs_version.h .PHONY: vcs_version.h ## BUILT_SOURCES = \ $(GENERATED_H) \ vcs_version.h \ vmod_abi.h MAINTAINERCLEANFILES = $(GENERATED_H) CLEANFILES = \ vrt_test \ _vrt_test \ _vrt.c TESTS = vbm_test vrt_test noinst_PROGRAMS = vbm_test vbm_test_SOURCES = vbm_test.c vbm.h _vrt.c: Makefile.am vdef.h vrt.h cat $(srcdir)/vdef.h $(srcdir)/vrt.h > $@ vrt_test: _vrt.c echo "exec ${CC} -c -o _vrt_test _vrt.c" > $@ chmod +x $@ test: ${TESTS} @for test in ${TESTS} ; do ./$${test} ; done varnish-6.2.1/include/vfil.h0000644000175000017500000000402313530745476012664 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 vfil_path; /* from libvarnish/vfil.c */ void VFIL_null_fd(int); char *VFIL_readfile(const char *pfx, const char *fn, ssize_t *sz); int VFIL_writefile(const char *pfx, const char *fn, const char *buf, size_t sz); int VFIL_nonblocking(int fd); int VFIL_fsinfo(int fd, unsigned *pbs, uintmax_t *size, uintmax_t *space); int VFIL_allocate(int fd, off_t size, int insist); void VFIL_setpath(struct vfil_path**, const char *path); typedef int vfil_path_func_f(void *priv, const char *fn); int VFIL_searchpath(const struct vfil_path *, vfil_path_func_f *func, void *priv, const char *fni, char **fno); varnish-6.2.1/include/vfl.h0000644000175000017500000000307513531244202012477 00000000000000/*- * Copyright (c) 2007 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. * * Derived from: * $FreeBSD: src/lib/libutil/libutil.h,v 1.44 2007/05/10 15:01:42 des Exp $ */ #ifndef VFL_H_INCLUDED #define VFL_H_INCLUDED int VFL_Open(const char *, int, ...); #endif varnish-6.2.1/include/vrnd.h0000644000175000017500000000331013527745151012667 00000000000000/*- * Copyright (c) 2013 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 */ varnish-6.2.1/include/miniobj.h0000644000175000017500000000367513531221610013343 00000000000000/* * Written by Poul-Henning Kamp * * 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) varnish-6.2.1/include/vas.h0000644000175000017500000000725513531244202012505 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 #include "verrno.h" 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) /* * Most of this nightmare is stolen from FreeBSD's */ #ifndef __has_extension # define __has_extension(x) 0 #endif #if __has_extension(c_static_assert) # define v_static_assert _Static_assert #elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) # define v_static_assert _Static_assert #else # if defined(__COUNTER__) # define v_static_assert(x, y) __v_static_assert(x, __COUNTER__) # else # define v_static_assert(x, y) __v_static_assert(x, __LINE__) # endif # define __v_static_assert(x, y) ___v_static_assert(x, y) # define ___v_static_assert(x, y) \ typedef char __vassert_## y[(x) ? 1 : -1] v_unused_ #endif #endif varnish-6.2.1/include/vrt.h0000644000175000017500000004030213531244202012515 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 * * * 9.0 (2019-03-15) * Make 'len' in vmod_priv 'long' * HTTP_Copy() removed * HTTP_Dup() added * HTTP_Clone() added * changed type of VCL_BLOB to newly introduced struct vrt_blob * * changed VRT_blob() * req->req_bodybytes removed * use: AZ(ObjGetU64(req->wrk, req->body_oc, OA_LEN, &u)); * struct vdi_methods .list callback signature changed * VRT_LookupDirector() added * VRT_SetChanged() added * VRT_SetHealth() removed * 8.0 (2018-09-15) * VRT_Strands() added * VRT_StrandsWS() added * VRT_CollectStrands() added * VRT_STRANDS_string() removed from vrt.h (never implemented) * VRT_Vmod_Init signature changed * VRT_Vmod_Fini changed to VRT_Vmod_Unload * // directors * VRT_backend_healthy() removed * VRT_Healthy() changed prototype * struct vdi_methods and callback prototypes added * struct director added; * VRT_AddDirector() added * VRT_SetHealth() added * VRT_DisableDirector() added * VRT_DelDirector() added * 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 9U #define VRT_MINOR_VERSION 0U /***********************************************************************/ #include // NULL, size_t #include // [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; }; /* * VCL_BLOB: * * opaque, immutable data (pointer + length), minimum lifetime is the VCL task. * * type (optional) is owned by the creator of the blob. blob consumers may use * it for checks, but should not assert on it. * * The data behind the blob pointer is assumed to be immutable for the blob's * lifetime. * * Memory management is either implicit or up to the vmod: * * - memory for shortlived blobs should come from the respective workspace * * - management of memory for longer lived blobs is up to the vmod * (in which case the blob will probably be embedded in an object or * referenced by other state with vcl lifetime) */ struct vrt_blob { unsigned type; size_t len; const void *blob; }; /*********************************************************************** * 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 vrt_blob * 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; VCL_VCL vcl; struct ws *ws; struct sess *sp; struct req *req; VCL_HTTP http_req; VCL_HTTP http_req_top; VCL_HTTP http_resp; struct busyobj *bo; VCL_HTTP http_bereq; VCL_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 char *func_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) VCL_IP ipv4_suckaddr; VCL_IP ipv6_suckaddr; VCL_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, VCL_HEADER); /*********************************************************************** * 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, VCL_HEADER, 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, unsigned); VCL_VOID VRT_Rollback(VRT_CTX, VCL_HTTP); /* Synthetic pages */ VCL_VOID VRT_synth_page(VRT_CTX, const char *, ...); /* Backend related */ VCL_BACKEND VRT_new_backend(VRT_CTX, const struct vrt_backend *); VCL_BACKEND 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, VCL_BACKEND *); /* VSM related */ struct vsmw_cluster *VRT_VSM_Cluster_New(VRT_CTX, size_t); void VRT_VSM_Cluster_Destroy(VRT_CTX, struct vsmw_cluster **); /* VDI - Director API */ typedef VCL_BOOL vdi_healthy_f(VRT_CTX, VCL_BACKEND, VCL_TIME *); typedef VCL_BACKEND vdi_resolve_f(VRT_CTX, VCL_BACKEND); typedef int vdi_gethdrs_f(VRT_CTX, VCL_BACKEND); typedef VCL_IP vdi_getip_f(VRT_CTX, VCL_BACKEND); typedef void vdi_finish_f(VRT_CTX, VCL_BACKEND); typedef enum sess_close vdi_http1pipe_f(VRT_CTX, VCL_BACKEND); typedef void vdi_event_f(VCL_BACKEND, enum vcl_event_e); typedef void vdi_destroy_f(VCL_BACKEND); typedef void vdi_panic_f(VCL_BACKEND, struct vsb *); typedef void vdi_list_f(VRT_CTX, VCL_BACKEND, struct vsb *, int, int); struct vdi_methods { unsigned magic; #define VDI_METHODS_MAGIC 0x4ec0c4bb const char *type; vdi_http1pipe_f *http1pipe; vdi_healthy_f *healthy; vdi_resolve_f *resolve; vdi_gethdrs_f *gethdrs; vdi_getip_f *getip; vdi_finish_f *finish; vdi_event_f *event; vdi_destroy_f *destroy; vdi_panic_f *panic; vdi_list_f *list; }; struct vcldir; struct director { unsigned magic; #define DIRECTOR_MAGIC 0x3336351d void *priv; char *vcl_name; struct vcldir *vdir; }; VCL_BOOL VRT_Healthy(VRT_CTX, VCL_BACKEND, VCL_TIME *); VCL_VOID VRT_SetChanged(VCL_BACKEND, VCL_TIME); VCL_BACKEND VRT_AddDirector(VRT_CTX, const struct vdi_methods *, void *, const char *, ...) v_printflike_(4, 5); void VRT_DisableDirector(VCL_BACKEND); VCL_BACKEND VRT_LookupDirector(VRT_CTX, VCL_STRING); void VRT_DelDirector(VCL_BACKEND *); /* Suckaddr related */ int VRT_VSA_GetPtr(VCL_IP 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; long 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); varnish-6.2.1/include/vut.h0000644000175000017500000000536313531244202012530 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland * * 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; sig_atomic_t last_sighup; sig_atomic_t last_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); //lint -sem(VUT_Usage, r_no) void VUT_Usage(const struct VUT *, const struct vopt_spec *, int status) v_noreturn_; #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 **); varnish-6.2.1/include/vev.h0000644000175000017500000000434513527745146012533 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 vev; struct vev_root; typedef int vev_cb_f(const struct vev *, int what); struct vev { unsigned magic; #define VEV_MAGIC 0x46bbd419 /* pub */ const char *name; int fd; unsigned fd_flags; unsigned fd_events; #define VEV__RD POLLIN #define VEV__WR POLLOUT #define VEV__ERR POLLERR #define VEV__HUP POLLHUP #define VEV__SIG -1 int sig; unsigned sig_flags; double timeout; vev_cb_f *callback; void *priv; /* priv */ double __when; unsigned __binheap_idx; unsigned __privflags; struct vev_root *__vevb; }; struct vev_root *VEV_New(void); void VEV_Destroy(struct vev_root **); struct vev *VEV_Alloc(void); int VEV_Start(struct vev_root *, struct vev *); void VEV_Stop(struct vev_root *, struct vev *); int VEV_Once(struct vev_root *); int VEV_Loop(struct vev_root *); varnish-6.2.1/include/vcs_version.h0000644000175000017500000000033313531244373014253 00000000000000/* 9f8588e4ab785244e06c3446fe09bf9db5dd8753 */ /* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run include/generate.py instead. */ #define VCS_Version "9f8588e4ab785244e06c3446fe09bf9db5dd8753" varnish-6.2.1/include/binary_heap.h0000644000175000017500000000521413176114437014201 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2009 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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. * * Binary Heap API (see: http://en.wikipedia.org/wiki/Binary_heap) * * XXX: doesn't scale back the array of pointers when items are deleted. */ /* Public Interface --------------------------------------------------*/ struct binheap; typedef int binheap_cmp_t(void *priv, const void *a, const void *b); /* * Comparison function. * Should return true if item 'a' should be closer to the root * than item 'b' */ typedef void binheap_update_t(void *priv, void *a, unsigned newidx); /* * Update function (optional) * When items move in the tree, this function gets called to * notify the item of its new index. * Only needed if deleting non-root items. */ struct binheap *binheap_new(void *priv, binheap_cmp_t, binheap_update_t); /* * Create Binary tree * 'priv' is passed to cmp and update functions. */ void binheap_insert(struct binheap *, void *); /* * Insert an item */ void binheap_reorder(const struct binheap *, unsigned idx); /* * Move an order after changing its key value. */ void binheap_delete(struct binheap *, unsigned idx); /* * Delete an item * The root item has 'idx' zero */ void *binheap_root(const struct binheap *); /* * Return the root item */ #define BINHEAP_NOIDX 0 varnish-6.2.1/include/vut_options.h0000644000175000017500000000704013530745476014317 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland * * 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 ]", "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 ]", "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 ]", "Limit transactions", \ "Process this number of matching log transactions before" \ " exiting." \ ) #define VUT_OPT_n \ VOPT("n:", "[-n ]", "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 ]", "VSL query", \ "Specifies the VSL query to use." \ ) #define VUT_OPT_r \ VOPT("r:", "[-r ]", "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 ]", "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." \ ) varnish-6.2.1/include/vtim.h0000644000175000017500000000337513530745476012714 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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); varnish-6.2.1/include/vjsn.h0000644000175000017500000000420213530745476012703 00000000000000/*- * Copyright (c) 2017 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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. */ extern const char VJSN_OBJECT[]; extern const char VJSN_ARRAY[]; extern const char VJSN_NUMBER[]; extern const char VJSN_STRING[]; extern const char VJSN_TRUE[]; extern const char VJSN_FALSE[]; extern const char VJSN_NULL[]; struct vjsn_val { unsigned magic; #define VJSN_VAL_MAGIC 0x08a06b80 const char *type; const char *name; VTAILQ_ENTRY(vjsn_val) list; VTAILQ_HEAD(,vjsn_val) children; char *value; }; struct vjsn { unsigned magic; #define VJSN_MAGIC 0x86a7f02b char *raw; char *ptr; struct vjsn_val *value; const char *err; }; struct vjsn *vjsn_parse(const char *, const char **); void vjsn_delete(struct vjsn **); void vjsn_dump(const struct vjsn *js, FILE *fo); struct vjsn_val *vjsn_child(const struct vjsn_val *, const char *); varnish-6.2.1/include/vsm_priv.h0000644000175000017500000000313113527745146013570 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 VSM_PRIV_H_INCLUDED #define VSM_PRIV_H_INCLUDED #define VSM_MGT_DIRNAME "_.vsm_mgt" #define VSM_CHILD_DIRNAME "_.vsm_child" #endif /* VSM_PRIV_H_INCLUDED */ varnish-6.2.1/include/vqueue.h0000644000175000017500000004671213527745146013251 00000000000000/*- * 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 */ varnish-6.2.1/include/verrno.h0000644000175000017500000000033513531244202013217 00000000000000/*- * Written by Nils Goroll based upon a draft by Poul-Henning Kamp * * This file is in the public domain. * * trivial strerror() wrapper never returning NULL */ #include const char * vstrerror(int e); varnish-6.2.1/include/tbl/0000755000175000017500000000000013531244417012403 500000000000000varnish-6.2.1/include/tbl/vcl_states.h0000644000175000017500000000025213527745151014650 00000000000000/*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 */ varnish-6.2.1/include/tbl/vsl_tags.h0000644000175000017500000005052413531244202014314 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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. * XXX: we can resort them when we have a major release. * * 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" 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 / 0 for UDS\n" "\t| | | +------- Local IPv4/6 address / 0.0.0.0 for UDS\n" "\t| | +---------- Socket name (from -a argument)\n" "\t| +------------- Remote TCP port / 0 for UDS\n" "\t+---------------- Remote IPv4/6 address / 0.0.0.0 for UDS\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" "\t\n" "\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" "\tand reserved for possible use in future versions.\n" "\n" ) 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 * 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" ) 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" ) 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" ) #undef NODEF_NOTICE #undef SLTM /*lint -restore */ varnish-6.2.1/include/tbl/acct_fields_req.h0000644000175000017500000000330113527745146015612 00000000000000/*- * Copyright (c) 2008 Verdens Gang AS * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 */ varnish-6.2.1/include/tbl/vsig_list.h0000644000175000017500000000316113531244202014470 00000000000000/*- * Copyright (c) 2018 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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. * * NB: Changing the list of signals requires updating libvarnishapi.map * */ /*lint -save -e525 -e539 */ VSIG_SIGNAL(INT, int) VSIG_SIGNAL(HUP, hup) VSIG_SIGNAL(TERM, term) VSIG_SIGNAL(USR1, usr1) #undef VSIG_SIGNAL /*lint -restore */ varnish-6.2.1/include/tbl/debug_bits.h0000644000175000017500000000525413531244202014601 00000000000000/*- * Copyright (c) 2012 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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") DEBUG_BIT(LCK, lck, "Additional lock statistics") #undef DEBUG_BIT /*lint -restore */ varnish-6.2.1/include/tbl/obj_attr.h0000644000175000017500000000413313531244202014271 00000000000000/*- * Copyright (c) 2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 */ /* upper, lower, size */ #ifdef OBJ_FIXATTR OBJ_FIXATTR(LEN, len, 8) OBJ_FIXATTR(VXID, vxid, 4) OBJ_FIXATTR(FLAGS, flags, 1) OBJ_FIXATTR(GZIPBITS, gzipbits, 32) OBJ_FIXATTR(LASTMODIFIED, lastmodified, 8) #undef OBJ_FIXATTR #endif /* upper, lower */ #ifdef OBJ_VARATTR OBJ_VARATTR(VARY, vary) OBJ_VARATTR(HEADERS, headers) #undef OBJ_VARATTR #endif /* upper, lower */ #ifdef OBJ_AUXATTR OBJ_AUXATTR(ESIDATA, esidata) #undef OBJ_AUXATTR #endif #ifdef OBJ_FLAG /* upper, lower, val */ OBJ_FLAG(GZIPED, gziped, (1<<1)) OBJ_FLAG(CHGCE, chgce, (1<<2)) OBJ_FLAG(IMSCAND, imscand, (1<<3)) OBJ_FLAG(ESIPROC, esiproc, (1<<4)) #undef OBJ_FLAG #endif /*lint -restore */ varnish-6.2.1/include/tbl/symbol_kind.h0000644000175000017500000000343013530745476015020 00000000000000/*- * Copyright (c) 2010-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 */ varnish-6.2.1/include/tbl/bo_flags.h0000644000175000017500000000331513527745151014260 00000000000000/*- * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 */ varnish-6.2.1/include/tbl/vhp_static.h0000644000175000017500000000371513527745146014660 00000000000000/*- * Written by Dridi Boukelmoune * * 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 */ varnish-6.2.1/include/tbl/vcc_types.h0000644000175000017500000000106613531244373014477 00000000000000/* * 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 */ varnish-6.2.1/include/tbl/locks.h0000644000175000017500000000324413531221610013600 00000000000000/*- * Copyright (c) 2010 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 */ varnish-6.2.1/include/tbl/cli_cmds.h0000644000175000017500000002332013531244202014241 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * 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 [&& ...]", "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\n\n" " Durations of ban specifications get normalized, for example \"7d\"" " gets changed into \"1w\".", 0, 0 ) CLI_CMD(VCL_LOAD, "vcl.load", "vcl.load [auto|cold|warm]", "Compile and load the VCL file under the name provided.", "", 2, 3 ) CLI_CMD(VCL_INLINE, "vcl.inline", "vcl.inline [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 [auto|cold|warm]", "Force the state of the named configuration.", "", 2, 2 ) CLI_CMD(VCL_DISCARD, "vcl.discard", "vcl.discard ", "Unload the named configuration (when possible).", "", 1, 1 ) CLI_CMD(VCL_LIST, "vcl.list", "vcl.list [-j]", "List all loaded configuration.", " Unless ``-j`` is specified for JSON output, " " the output format is five or seven columns of dynamic width, " " separated by white space with the fields:\n\n" " * status: active, available or discarded\n\n" " * state: label, cold, warm, or auto\n\n" " * temperature: init, cold, warm, busy or cooling\n\n" " * busy: number of references to this vcl (integer)\n\n" " * name: the name given to this vcl or label\n\n" " * [ ``<-`` | ``->`` ] and label info last two fields)\n\n" " * ``->`` : label \"points to\" the named \n\n" " * ``<-`` ( label[s]): the vcl has label(s)\n\n", 0, 0 ) CLI_CMD(VCL_SHOW, "vcl.show", "vcl.show [-v] ", "Display the source code for the specified configuration.", "", 1, 2 ) CLI_CMD(VCL_USE, "vcl.use", "vcl.use ", "Switch to the named configuration immediately.", "", 1, 1 ) CLI_CMD(VCL_LABEL, "vcl.label", "vcl.label