eBPF for Windows
libbpf_legacy.h
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation
2 // SPDX-License-Identifier: MIT
3 #pragma once
4 
27 __declspec(deprecated("Use bpf_xdp_attach() instead.")) int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags);
28 
48 __declspec(deprecated("Use bpf_object__next_map() instead.")) struct bpf_map* bpf_map__next(
49  const struct bpf_map* map, const struct bpf_object* obj);
50 
63 __declspec(deprecated("Use bpf_object__prev_map() instead.")) struct bpf_map* bpf_map__prev(
64  const struct bpf_map* map, const struct bpf_object* obj);
65 
74 {
75  struct bpf_object* obj;
76  int log_level;
77  const char* target_btf_path;
78 };
79 
97 __declspec(deprecated("Use bpf_object__load() instead.")) int bpf_object__load_xattr(struct bpf_object_load_attr* attr);
98 
108 __declspec(deprecated("Track bpf_objects in application code instead.")) struct bpf_object* bpf_object__next(
109  struct bpf_object* prev);
110 
111 #define bpf_object__for_each_safe(pos, tmp) \
112  for ((pos) = bpf_object__next(NULL), (tmp) = bpf_object__next(pos); (pos) != NULL; \
113  (pos) = (tmp), (tmp) = bpf_object__next(tmp))
114 
129 __declspec(deprecated("Use bpf_object__close() instead.")) int bpf_object__unload(struct bpf_object* obj);
130 
164 __declspec(deprecated("Use bpf_object__open() and bpf_object__load() instead.")) int bpf_prog_load_deprecated(
165  const char* file, enum bpf_prog_type type, struct bpf_object** pobj, int* prog_fd);
166 
179 __declspec(deprecated("Use bpf_object__next_program() instead.")) struct bpf_program* bpf_program__next(
180  struct bpf_program* prog, const struct bpf_object* obj);
181 
194 __declspec(deprecated("Use bpf_object__prev_program() instead.")) struct bpf_program* bpf_program__prev(
195  struct bpf_program* prog, const struct bpf_object* obj);
196 
206 __declspec(deprecated("Use bpf_program__insn_cnt() instead.")) size_t bpf_program__size(const struct bpf_program* prog);
207 
bpf_object__open
struct bpf_object * bpf_object__open(const char *path)
Open a file without loading the programs.
bpf_object__load_xattr
int bpf_object__load_xattr(struct bpf_object_load_attr *attr)
Load all the programs in a given object.
bpf_prog_load_deprecated
int bpf_prog_load_deprecated(const char *file, enum bpf_prog_type type, struct bpf_object **pobj, int *prog_fd)
Load (but do not attach) eBPF maps and programs from an ELF file.
bpf_map__prev
struct bpf_map * bpf_map__prev(const struct bpf_map *map, const struct bpf_object *obj)
Get the previous map for a given eBPF object.
bpf_object_load_attr::target_btf_path
const char * target_btf_path
Definition: libbpf_legacy.h:77
bpf_prog_type
bpf_prog_type
Definition: ebpf_structs.h:160
bpf_object__unload
int bpf_object__unload(struct bpf_object *obj)
Unload all the programs in a given object.
bpf_program__size
size_t bpf_program__size(const struct bpf_program *prog)
Get the eBPF program size in bytes.
bpf_object__prev_map
struct bpf_map * bpf_object__prev_map(const struct bpf_object *obj, const struct bpf_map *map)
Get the previous map for a given eBPF object.
bpf_object_load_attr::log_level
int log_level
Definition: libbpf_legacy.h:76
bpf_object__next
struct bpf_object * bpf_object__next(struct bpf_object *prev)
Get the next eBPF object opened by the calling process.
bpf_object__next_program
struct bpf_program * bpf_object__next_program(const struct bpf_object *obj, struct bpf_program *prog)
Get the next program for a given eBPF object.
bpf_program__insn_cnt
size_t bpf_program__insn_cnt(const struct bpf_program *prog)
bpf_program__insn_cnt() returns number of struct bpf_insn's that form specified BPF program.
bpf_object__prev_program
struct bpf_program * bpf_object__prev_program(const struct bpf_object *obj, struct bpf_program *prog)
Get the previous eBPF program for a given eBPF object.
bpf_object__next_map
struct bpf_map * bpf_object__next_map(const struct bpf_object *obj, const struct bpf_map *map)
Get the next map for a given eBPF object.
bpf_object__load
int bpf_object__load(struct bpf_object *obj)
Load all the programs in a given object.
__u32
uint32_t __u32
Definition: types.h:6
bpf_object_load_attr
Definition: libbpf_legacy.h:73
bpf_map
#define bpf_map
Definition: bpf_helpers_platform.h:10
bpf_map__next
struct bpf_map * bpf_map__next(const struct bpf_map *map, const struct bpf_object *obj)
Get the next map for a given eBPF object.
bpf_program__prev
struct bpf_program * bpf_program__prev(struct bpf_program *prog, const struct bpf_object *obj)
Get the previous eBPF program for a given eBPF object.
bpf_object_load_attr::obj
struct bpf_object * obj
Definition: libbpf_legacy.h:75
bpf_program__next
struct bpf_program * bpf_program__next(struct bpf_program *prog, const struct bpf_object *obj)
Get the next program for a given eBPF object.
bpf_set_link_xdp_fd
int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags)
Attach an XDP program to a given interface.