SeaBee
Loading...
Searching...
No Matches
seabee_maps.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2#ifndef SEABEE_MAPS_H_
3#define SEABEE_MAPS_H_
8#include <bpf/vmlinux.h>
9#include <bpf/bpf_helpers.h>
10#include "shared_rust_types.h"
11
13 u32 pol_id;
14 u32 is_pinning; // treated like a bool
15};
16
18 __uint(type, BPF_MAP_TYPE_TASK_STORAGE);
19 // this flag is required for this map type
20 __uint(map_flags, BPF_F_NO_PREALLOC);
21 // must be 4 bytes
22 __type(key, u32);
23 // seabee task data
24 __type(value, struct seabee_task_data);
25};
26
28 __uint(type, BPF_MAP_TYPE_INODE_STORAGE);
29 // this flag is required for this map type
30 __uint(map_flags, BPF_F_NO_PREALLOC);
31 // must be 4 bytes
32 __type(key, u32);
33 // policy id
34 __type(value, u32);
35};
36
37struct sk_storage {
38 __uint(type, BPF_MAP_TYPE_SK_STORAGE);
39 // this flag is required for this map type
40 __uint(map_flags, BPF_F_NO_PREALLOC);
41 __type(key, u32);
42 // policy id
43 __type(value, u32);
44};
45
46struct policy_map {
48 __uint(type, BPF_MAP_TYPE_HASH);
50 __uint(map_flags, BPF_F_NO_PREALLOC);
52 __type(key, u32);
54 __type(value, struct c_policy_config);
55};
56
61 unsigned int policy_id;
62 char name[BPF_MAP_NAME_LEN];
63};
64
67 __uint(type, BPF_MAP_TYPE_HASH);
69 __uint(map_flags, BPF_F_NO_PREALLOC);
71 __type(key, struct bpf_map *);
73 __type(value, struct bpf_map_data);
74};
75
76#endif // SEABEE_MAPS_H_
#define BPF_MAP_NAME_LEN
the length of the name of an eBPF map
Definition constants.h:26
Definition seabee_maps.h:60
c_policy_config contains security levels for protected objects and corresponds to a policy id.
Definition shared_rust_types.h:31
Definition seabee_maps.h:27
Definition seabee_maps.h:65
unsigned int type
Hash map so we don't have to prealloc memory.
Definition seabee_maps.h:67
struct bpf_map * key
map pointer
Definition seabee_maps.h:71
unsigned int map_flags
for more efficient memory usage
Definition seabee_maps.h:69
struct bpf_map_data value
map data
Definition seabee_maps.h:73
Definition seabee_maps.h:46
struct c_policy_config value
a seabee security policy
Definition seabee_maps.h:54
unsigned int map_flags
enables more efficient memory usage
Definition seabee_maps.h:50
u32 key
a seabee policy ID
Definition seabee_maps.h:52
unsigned int type
Hash map so we don't have to prealloc memory.
Definition seabee_maps.h:48
Definition seabee_maps.h:12
Definition seabee_maps.h:37
Definition seabee_maps.h:17