eBPF for Windows
bpf_legacy.h
Go to the documentation of this file.
1 // Copyright (c) eBPF for Windows contributors
2 // SPDX-License-Identifier: MIT
3 #pragma once
4 
5 #include "libbpf.h"
6 
7 #pragma warning(push)
8 #pragma warning(disable : 4201) // nonstandard extension used: nameless struct/union
9 
16 {
17  const char* name;
28  union
29  {
32  };
33 };
34 
53 __declspec(deprecated("Use bpf_map_create() instead.")) int bpf_create_map(
54  enum bpf_map_type map_type, int key_size, int value_size, int max_entries, __u32 map_flags);
55 
76 __declspec(deprecated("Use bpf_map_create() instead.")) int bpf_create_map_in_map(
77  enum bpf_map_type map_type, const char* name, int key_size, int inner_map_fd, int max_entries, __u32 map_flags);
78 
93 __declspec(deprecated("Use bpf_map_create() instead.")) int bpf_create_map_xattr(
94  const struct bpf_create_map_attr* create_attr);
95 
104 {
105  enum bpf_prog_type prog_type;
106  enum bpf_attach_type expected_attach_type;
107  const char* name;
108  const struct bpf_insn* insns;
109  size_t insns_cnt;
110  const char* license;
111  union
112  {
115  };
116  union
117  {
120  };
123  const void* func_info;
126  const void* line_info;
130 };
131 
156 __declspec(deprecated("Use bpf_prog_load() instead.")) int bpf_load_program(
157  enum bpf_prog_type type,
158  const struct bpf_insn* insns,
159  size_t insns_cnt,
160  const char* license,
161  __u32 kern_version,
162  char* log_buf,
163  size_t log_buf_sz);
164 
185 __declspec(deprecated("Use bpf_prog_load() instead.")) int bpf_load_program_xattr(
186  const struct bpf_load_program_attr* load_attr, char* log_buf, size_t log_buf_sz);
187 
190 #pragma warning(pop)
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_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_create_map(enum bpf_map_type map_type, int key_size, int value_size, int max_entries, __u32 map_flags)
Create a new map.
int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr)
Create a new map.
int bpf_create_map_in_map(enum bpf_map_type map_type, const char *name, int key_size, int inner_map_fd, int max_entries, __u32 map_flags)
Create a new map-in-map.
int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, size_t insns_cnt, const char *license, __u32 kern_version, char *log_buf, size_t log_buf_sz)
Load (but do not attach) an eBPF program from eBPF instructions supplied by the caller.
int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, char *log_buf, size_t log_buf_sz)
Load (but do not attach) an eBPF program from eBPF instructions supplied by the caller.
bpf_prog_type
Definition: ebpf_structs.h:173
bpf_attach_type
Definition: ebpf_structs.h:263
bpf_map_type
Definition: ebpf_structs.h:18
Definition: bpf_legacy.h:16
__u32 inner_map_fd
Definition: bpf_legacy.h:30
__u32 btf_key_type_id
Definition: bpf_legacy.h:25
__u32 map_ifindex
Definition: bpf_legacy.h:27
const char * name
Definition: bpf_legacy.h:17
__u32 map_flags
Definition: bpf_legacy.h:19
__u32 max_entries
Definition: bpf_legacy.h:22
__u32 value_size
Definition: bpf_legacy.h:21
__u32 btf_vmlinux_value_type_id
Definition: bpf_legacy.h:31
__u32 btf_fd
Definition: bpf_legacy.h:24
__u32 btf_value_type_id
Definition: bpf_legacy.h:26
enum bpf_map_type map_type
Definition: bpf_legacy.h:18
__u32 key_size
Definition: bpf_legacy.h:20
__u32 numa_node
Definition: bpf_legacy.h:23
Definition: bpf_legacy.h:104
__u32 prog_ifindex
Definition: bpf_legacy.h:118
const void * func_info
Definition: bpf_legacy.h:123
size_t insns_cnt
Definition: bpf_legacy.h:109
__u32 line_info_rec_size
Definition: bpf_legacy.h:125
const char * license
Definition: bpf_legacy.h:110
const struct bpf_insn * insns
Definition: bpf_legacy.h:108
__u32 func_info_rec_size
Definition: bpf_legacy.h:122
__u32 prog_flags
Definition: bpf_legacy.h:129
__u32 func_info_cnt
Definition: bpf_legacy.h:124
__u32 prog_btf_fd
Definition: bpf_legacy.h:121
const char * name
Definition: bpf_legacy.h:107
__u32 kern_version
Definition: bpf_legacy.h:113
__u32 attach_prog_fd
Definition: bpf_legacy.h:114
const void * line_info
Definition: bpf_legacy.h:126
__u32 log_level
Definition: bpf_legacy.h:128
__u32 line_info_cnt
Definition: bpf_legacy.h:127
__u32 attach_btf_id
Definition: bpf_legacy.h:119
uint32_t __u32
Definition: types.h:6