P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
ebpf_map.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 * This file defines a library of simple hashmap operations which emulate the behavior
19 * of the kernel ebpf map API. This library is currently not thread-safe.
20 */
21
22#ifndef BACKENDS_EBPF_RUNTIME_EBPF_MAP_H_
23#define BACKENDS_EBPF_RUNTIME_EBPF_MAP_H_
24
25#include "contrib/uthash.h" // exports string.h, stddef.h, and stdlib.h
26
27struct bpf_map {
28 void *key;
29 void *value;
30 UT_hash_handle hh; // makes this structure hashable
31};
32
41int bpf_map_update_elem(struct bpf_map **map, void *key, unsigned int key_size, void *value,unsigned int value_size, unsigned long long flags);
42
50void *bpf_map_lookup_elem(struct bpf_map *map, void *key, unsigned int key_size);
51
59int bpf_map_delete_elem(struct bpf_map *map, void *key, unsigned int key_size);
60
68int bpf_map_delete_map(struct bpf_map *map);
69
70
71#endif // BACKENDS_EBPF_RUNTIME_EBPF_MAP_H_
Definition uthash.h:1206
Definition ebpf_map.h:27