Code Coverage: vinyl-cache/lib/libvinylapi/vsl_api.h
 
82217aa4fc7094b3610340078afaf78cd95a8ec9
 
0
/*-
1
 * Copyright (c) 2006 Verdens Gang AS
2
 * Copyright (c) 2006-2015 Varnish Software AS
3
 * All rights reserved.
4
 *
5
 * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
6
 * Author: Martin Blix Grydeland <martin@varnish-software.com>
7
 *
8
 * SPDX-License-Identifier: BSD-2-Clause
9
 *
10
 * Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions
12
 * are met:
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in the
17
 *    documentation and/or other materials provided with the distribution.
18
 *
19
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
23
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
 * SUCH DAMAGE.
30
 *
31
 */
32
33
extern const char                       vsl_file_id[4];
34
35 9
#define VSL_FILE_ID                     (vsl_file_id)
36
37
/*lint -esym(534, vsl_diag) */
38
int vsl_diag(struct VSL_data *vsl, const char *fmt, ...) v_printflike_(2, 3);
39
void vsl_vbm_bitset(int bit, void *priv);
40
void vsl_vbm_bitclr(int bit, void *priv);
41
42
typedef void vslc_delete_f(const struct VSL_cursor *);
43
typedef enum vsl_status vslc_next_f(const struct VSL_cursor *);
44
typedef enum vsl_status vslc_reset_f(const struct VSL_cursor *);
45
typedef enum vsl_check vslc_check_f(const struct VSL_cursor *,
46
    const struct VSLC_ptr *);
47
48
struct vslc_tbl {
49
        unsigned                        magic;
50
#define VSLC_TBL_MAGIC                  0x5007C0DE
51
52
        vslc_delete_f                   *delete;
53
        vslc_next_f                     *next;
54
        vslc_reset_f                    *reset;
55
        vslc_check_f                    *check;
56
};
57
58
struct vslf {
59
        unsigned                        magic;
60
#define VSLF_MAGIC                      0x08650B39
61
        VTAILQ_ENTRY(vslf)              list;
62
63
        struct vbitmap                  *tags;
64
        vre_t                           *vre;
65
};
66
67
typedef VTAILQ_HEAD(,vslf)              vslf_list;
68
69
struct VSL_data {
70
        unsigned                        magic;
71
#define VSL_MAGIC                       0x8E6C92AA
72
73
        struct vsb                      *diag;
74
75
        unsigned                        flags;
76 86
#define F_SEEN_ixIX                     (1 << 0)
77
78
        /* Bitmaps of -ix selected tags */
79
        struct vbitmap                  *vbm_select;
80
        struct vbitmap                  *vbm_suppress;
81
82
        /* Lists of -IX filters */
83
        vslf_list                       vslf_select;
84
        vslf_list                       vslf_suppress;
85
86
        int                             b_opt;
87
        int                             c_opt;
88
        int                             C_opt;
89
        int                             E_opt;
90
        int                             L_opt;
91
        int                             R_opt_l;
92
        vtim_dur                        R_opt_p;
93
        double                          T_opt;
94
        int                             v_opt;
95
};
96
97
/* vsl_query.c */
98
struct vslq_query;
99
struct vslq_query *vslq_newquery(struct VSL_data *vsl,
100
    enum VSL_grouping_e grouping, const char *query);
101
void vslq_deletequery(struct vslq_query **pquery);
102
int vslq_runquery(const struct vslq_query *query,
103
    struct VSL_transaction * const ptrans[]);