File: e2e.h

package info (click to toggle)
bpfilter 0.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,076 kB
  • sloc: ansic: 30,397; sh: 1,383; cpp: 959; python: 495; yacc: 385; lex: 194; makefile: 9
file content (40 lines) | stat: -rw-r--r-- 1,467 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2023 Meta Platforms, Inc. and affiliates.
 */

#pragma once

#include <limits.h>
#include <stddef.h>

#include "core/chain.h"
#include "core/counter.h"
#include "core/verdict.h"
#include "packets.h"

#define BFT_NO_PKTS SIZE_MAX
#define BFT_NO_BYTES SIZE_MAX

struct bft_counter
{
    size_t index;
    struct bf_counter counter;
};

#define bft_counter_p(idx, npkts, nbytes)                                      \
    (struct bft_counter []) {                                                  \
        {                                                                      \
            .index = (idx),                                                    \
            .counter = {                                                       \
                .packets = (npkts),                                            \
                .bytes = (nbytes),                                             \
            },                                                                 \
        }                                                                      \
    }

int bft_e2e_test_with_counter(struct bf_chain *chain, enum bf_verdict expect,
                              const struct bft_prog_run_args *args,
                              const struct bft_counter *counter);
int bft_e2e_test(struct bf_chain *chain, enum bf_verdict expect,
                 const struct bft_prog_run_args *args);