eBPF for Windows
bpf.h
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation
2 // SPDX-License-Identifier: MIT
3 
4 #ifdef __doxygen
5 
24 int
25 bpf_link_detach(int link_fd);
26 
39 int
41 
53 int
54 bpf_link_get_next_id(__u32 start_id, __u32* next_id);
55 
80 int
82  enum bpf_map_type map_type,
83  const char* map_name,
84  __u32 key_size,
85  __u32 value_size,
86  __u32 max_entries,
87  const struct bpf_map_create_opts* opts);
88 
102 int
103 bpf_map_delete_elem(int fd, const void* key);
104 
117 int
119 
131 int
132 bpf_map_get_next_id(__u32 start_id, __u32* next_id);
133 
151 int
152 bpf_map_get_next_key(int fd, const void* key, void* next_key);
153 
170 int
171 bpf_map_lookup_elem(int fd, const void* key, void* value);
172 
186 int
187 bpf_map_update_elem(int fd, const void* key, const void* value, __u64 flags);
188 
204 int
205 bpf_obj_get(const char* pathname);
206 
227 int
228 bpf_obj_get_info_by_fd(int bpf_fd, void* info, __u32* info_len);
229 
240 int
241 bpf_obj_pin(int fd, const char* pathname);
242 
260 int
261 bpf_prog_bind_map(int prog_fd, int map_fd, const struct bpf_prog_bind_opts* opts);
262 
275 int
277 
289 int
290 bpf_prog_get_next_id(__u32 start_id, __u32* next_id);
291 
315 int
317  enum bpf_prog_type prog_type,
318  const char* prog_name,
319  const char* license,
320  const struct bpf_insn* insns,
321  size_t insn_cnt,
322  const struct bpf_prog_load_opts* opts);
323 
326 #else
327 #pragma warning(push)
328 #include "bpf_legacy.h"
329 #include "libbpf/src/bpf.h"
330 #pragma warning(pop)
331 #endif
int bpf_map_get_next_key(int fd, const void *key, void *next_key)
Look up an element by key in a map and get the next key. If the specific key is not found,...
int bpf_prog_get_next_id(__u32 start_id, __u32 *next_id)
Look for the next program ID greater than a given ID.
int bpf_map_get_next_id(__u32 start_id, __u32 *next_id)
Look for the next map ID greater than a given ID.
int bpf_link_get_next_id(__u32 start_id, __u32 *next_id)
Look for the next link ID greater than a given ID.
int bpf_obj_get_info_by_fd(int bpf_fd, void *info, __u32 *info_len)
Obtain information about the eBPF object referred to by bpf_fd. This function populates up to info_le...
int bpf_obj_get(const char *pathname)
Get a file descriptor for a pinned object by pin path.
int bpf_map_create(enum bpf_map_type map_type, const char *map_name, __u32 key_size, __u32 value_size, __u32 max_entries, const struct bpf_map_create_opts *opts)
Create a new map.
int bpf_map_lookup_elem(int fd, const void *key, void *value)
Look up an element by key in a specified map and return its value.
int bpf_link_detach(int link_fd)
Detach a link.
int bpf_map_get_fd_by_id(__u32 id)
Get a file descriptor referring to a map with a given ID.
int bpf_obj_pin(int fd, const char *pathname)
Pin an eBPF program or map referred to by fd to the provided pathname.
int bpf_prog_bind_map(int prog_fd, int map_fd, const struct bpf_prog_bind_opts *opts)
Bind a map to a program so that it holds a reference on the map.
int bpf_link_get_fd_by_id(__u32 id)
Get a file descriptor referring to a link with a given ID.
int bpf_prog_load(enum bpf_prog_type prog_type, const char *prog_name, const char *license, const struct bpf_insn *insns, size_t insn_cnt, const struct bpf_prog_load_opts *opts)
Load (but do not attach) an eBPF programs.
int bpf_map_update_elem(int fd, const void *key, const void *value, __u64 flags)
Create or update an element (key/value pair) in a specified map.
int bpf_map_delete_elem(int fd, const void *key)
Look up and delete an element by key in a specified map.
int bpf_prog_get_fd_by_id(__u32 id)
Get a file descriptor referring to a program with a given ID.
bpf_prog_type
Definition: ebpf_structs.h:167
bpf_map_type
Definition: ebpf_structs.h:18
uint32_t __u32
Definition: types.h:6
uint64_t __u64
Definition: types.h:7