P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
ebpf_runtime_test.h
1/*
2Copyright 2018 VMware, Inc.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17/*
18 * Runtime operations specific to the test target. Runs a provided filter
19 * function, records the output, and writes it to a physical file. Does not use
20 * any Linux networking tools and only operates on custom hash maps.
21 */
22
23#ifndef BACKENDS_EBPF_RUNTIME_EBPF_RUNTIME_TEST_H_
24#define BACKENDS_EBPF_RUNTIME_EBPF_RUNTIME_TEST_H_
25
26#include "pcap_util.h"
27#include "ebpf_test.h"
28
29typedef int (*packet_filter)(SK_BUFF* s);
30
31void *run_and_record_output(packet_filter ebpf_filter, const char *pcap_base, pcap_list_t *pkt_list, int debug);
32void init_ebpf_tables(int debug);
33void delete_ebpf_tables(int debug);
34
35#define RUN(ebpf_filter, pcap_base, num_pcaps, input_list, debug) \
36 run_and_record_output(ebpf_filter, pcap_base, input_list, debug)
37#define INIT_EBPF_TABLES(debug) init_ebpf_tables(debug)
38#define DELETE_EBPF_TABLES(debug) delete_ebpf_tables(debug)
39
40#endif // BACKENDS_EBPF_RUNTIME_EBPF_RUNTIME_TEST_H_