eBPF for Windows
bpf.h
Go to the documentation of this file.
1 // Copyright (c) eBPF for Windows contributors
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 
218 int
220  int fd,
221  void* in_batch,
222  void* out_batch,
223  void* keys,
224  void* values,
225  __u32* count,
226  const struct bpf_map_batch_opts* opts);
227 
249 int
251  int fd,
252  void* in_batch,
253  void* out_batch,
254  void* keys,
255  void* values,
256  __u32* count,
257  const struct bpf_map_batch_opts* opts);
258 
295 int
296 bpf_map_update_batch(int fd, const void* keys, const void* values, __u32* count, const struct bpf_map_batch_opts* opts);
297 
311 int
312 bpf_map_delete_batch(int fd, const void* keys, __u32* count, const struct bpf_map_batch_opts* opts);
313 
329 int
330 bpf_obj_get(const char* pathname);
331 
352 int
353 bpf_obj_get_info_by_fd(int bpf_fd, void* info, __u32* info_len);
354 
365 int
366 bpf_obj_pin(int fd, const char* pathname);
367 
385 int
386 bpf_prog_bind_map(int prog_fd, int map_fd, const struct bpf_prog_bind_opts* opts);
387 
400 int
402 
414 int
415 bpf_prog_get_next_id(__u32 start_id, __u32* next_id);
416 
440 int
442  enum bpf_prog_type prog_type,
443  const char* prog_name,
444  const char* license,
445  const struct bpf_insn* insns,
446  size_t insn_cnt,
447  const struct bpf_prog_load_opts* opts);
448 
451 #else
452 #pragma warning(push)
453 #include "bpf_legacy.h"
454 #include "libbpf/src/bpf.h"
455 #pragma warning(pop)
456 #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_map_lookup_and_delete_batch(int fd, void *in_batch, void *out_batch, void *keys, void *values, __u32 *count, const struct bpf_map_batch_opts *opts)
bpf_map_lookup_and_delete_batch() allows for batch lookup and deletion of BPF map elements where each...
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_update_batch(int fd, const void *keys, const void *values, __u32 *count, const struct bpf_map_batch_opts *opts)
bpf_map_update_batch() updates multiple elements in a map by specifying keys and their corresponding ...
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_map_delete_batch(int fd, const void *keys, __u32 *count, const struct bpf_map_batch_opts *opts)
bpf_map_delete_batch() allows for batch deletion of multiple elements in a BPF map.
int bpf_map_lookup_batch(int fd, void *in_batch, void *out_batch, void *keys, void *values, __u32 *count, const struct bpf_map_batch_opts *opts)
bpf_map_lookup_batch() allows for batch lookup of BPF map elements.
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:173
bpf_map_type
Definition: ebpf_structs.h:18
uint32_t __u32
Definition: types.h:6
uint64_t __u64
Definition: types.h:7