eBPF for Windows
Loading...
Searching...
No Matches
ebpf_program_types.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 "ebpf_base.h"
6#include "ebpf_result.h"
7#include "ebpf_windows.h"
8
9// Backward-compatible typedef: the verifier submodule renamed
10// ebpf_context_descriptor_t to ebpf_ctx_descriptor_t. Keep the old
11// name available so that extensions and consumers are not broken.
12typedef ebpf_ctx_descriptor_t ebpf_context_descriptor_t;
13
14#define EBPF_MAX_PROGRAM_DESCRIPTOR_NAME_LENGTH 256
15#define EBPF_MAX_HELPER_FUNCTION_NAME_LENGTH 256
16
17// This is the type definition for the eBPF program type descriptor
18// when version is EBPF_PROGRAM_TYPE_DESCRIPTOR_CURRENT_VERSION.
28
33
34// This is the type definition for the eBPF helper function prototype
35// when version is EBPF_HELPER_FUNCTION_PROTOTYPE_CURRENT_VERSION.
46
47// This is the type definition for the eBPF program information
48// when version is EBPF_PROGRAM_INFORMATION_CURRENT_VERSION.
58
59// This is the type definition for the eBPF helper function addresses
60// when version is EBPF_HELPER_FUNCTION_ADDRESSES_CURRENT_VERSION.
67
69 _In_reads_bytes_opt_(data_size_in) const uint8_t* data_in,
70 size_t data_size_in,
71 _In_reads_bytes_opt_(context_size_in) const uint8_t* context_in,
72 size_t context_size_in,
73 _Outptr_ void** context);
74
76 _In_ void* context,
77 _Out_writes_bytes_to_opt_(*data_size_out, *data_size_out) uint8_t* data_out,
78 _Inout_ size_t* data_size_out,
79 _Out_writes_bytes_to_opt_(*context_size_out, *context_size_out) uint8_t* context_out,
80 _Inout_ size_t* context_size_out);
81
82#pragma warning(push)
83#pragma warning(disable : 4201) // nonstandard extension used: nameless struct/union
85{
87 struct
88 {
89 bool reserved : 1; // Reserved (must be zero).
90 };
92
93// This is the type definition for the eBPF program data
94// when version is EBPF_PROGRAM_DATA_CURRENT_VERSION.
109#pragma warning(pop)
110
111static_assert(
112 EBPF_FIELD_SIZE(ebpf_program_data_t, capabilities) == sizeof(uint32_t), "Size of capabilities is 32 bits.");
113
114// This is the type definition for the eBPF program section information
115// when version is EBPF_PROGRAM_SECTION_INFORMATION_CURRENT_VERSION.
struct _ebpf_program_type_descriptor ebpf_program_type_descriptor_t
ebpf_result_t(* ebpf_program_context_create_t)(_In_reads_bytes_opt_(data_size_in) const uint8_t *data_in, size_t data_size_in, _In_reads_bytes_opt_(context_size_in) const uint8_t *context_in, size_t context_size_in, void **context)
Definition ebpf_program_types.h:68
struct _ebpf_program_data ebpf_program_data_t
struct _ebpf_helper_function_prototype_flags ebpf_helper_function_prototype_flags_t
void(* ebpf_program_context_destroy_t)(void *context, _Out_writes_bytes_to_opt_(*data_size_out, *data_size_out) uint8_t *data_out, _Inout_ size_t *data_size_out, _Out_writes_bytes_to_opt_(*context_size_out, *context_size_out) uint8_t *context_out, _Inout_ size_t *context_size_out)
Definition ebpf_program_types.h:75
struct _ebpf_helper_function_prototype ebpf_helper_function_prototype_t
struct _ebpf_helper_function_addresses ebpf_helper_function_addresses_t
union _program_data_capabilities program_data_capabilities_t
struct _ebpf_program_section_info ebpf_program_section_info_t
ebpf_ctx_descriptor_t ebpf_context_descriptor_t
Definition ebpf_program_types.h:12
struct _ebpf_program_info ebpf_program_info_t
enum ebpf_result ebpf_result_t
uint8_t GUID[16]
Definition ebpf_windows.h:12
#define EBPF_FIELD_SIZE(s, m)
Definition ebpf_windows.h:6
Header of an eBPF extension data structure. Every eBPF extension data structure must start with this ...
Definition ebpf_windows.h:198
Definition ebpf_program_types.h:62
uint64_t * helper_function_address
Definition ebpf_program_types.h:65
ebpf_extension_header_t header
Definition ebpf_program_types.h:63
uint32_t helper_function_count
Definition ebpf_program_types.h:64
Definition ebpf_program_types.h:30
bool reallocate_packet
Definition ebpf_program_types.h:31
Definition ebpf_program_types.h:37
ebpf_argument_type_t arguments[5]
Definition ebpf_program_types.h:42
ebpf_return_type_t return_type
Definition ebpf_program_types.h:41
ebpf_helper_function_prototype_flags_t flags
Definition ebpf_program_types.h:43
const char * name
Definition ebpf_program_types.h:40
bool implicit_context
Definition ebpf_program_types.h:44
uint32_t helper_id
Definition ebpf_program_types.h:39
ebpf_extension_header_t header
Definition ebpf_program_types.h:38
Definition ebpf_program_types.h:96
ebpf_extension_header_t header
Definition ebpf_program_types.h:97
const ebpf_program_info_t * program_info
Pointer to program information.
Definition ebpf_program_types.h:98
ebpf_program_context_destroy_t context_destroy
Pointer to context destroy function.
Definition ebpf_program_types.h:105
const ebpf_helper_function_addresses_t * global_helper_function_addresses
Pointer to global helper function addresses being overriden.
Definition ebpf_program_types.h:103
ebpf_program_context_create_t context_create
Pointer to context create function.
Definition ebpf_program_types.h:104
const ebpf_helper_function_addresses_t * program_type_specific_helper_function_addresses
Definition ebpf_program_types.h:100
uint8_t required_irql
IRQL at which the program is invoked.
Definition ebpf_program_types.h:106
program_data_capabilities_t capabilities
Capabilities supported by the program information provider.
Definition ebpf_program_types.h:107
Definition ebpf_program_types.h:50
const ebpf_program_type_descriptor_t * program_type_descriptor
Definition ebpf_program_types.h:52
ebpf_extension_header_t header
Definition ebpf_program_types.h:51
const ebpf_helper_function_prototype_t * global_helper_prototype
Definition ebpf_program_types.h:56
const ebpf_helper_function_prototype_t * program_type_specific_helper_prototype
Definition ebpf_program_types.h:54
uint32_t count_of_program_type_specific_helpers
Definition ebpf_program_types.h:53
uint32_t count_of_global_helpers
Definition ebpf_program_types.h:55
Definition ebpf_program_types.h:117
const GUID * attach_type
Definition ebpf_program_types.h:121
const wchar_t * section_name
Definition ebpf_program_types.h:119
const GUID * program_type
Definition ebpf_program_types.h:120
ebpf_extension_header_t header
Definition ebpf_program_types.h:118
uint32_t bpf_attach_type
Definition ebpf_program_types.h:123
uint32_t bpf_program_type
Definition ebpf_program_types.h:122
Definition ebpf_program_types.h:20
uint32_t bpf_prog_type
Definition ebpf_program_types.h:25
const char * name
Definition ebpf_program_types.h:22
GUID program_type
Definition ebpf_program_types.h:24
char is_privileged
Definition ebpf_program_types.h:26
ebpf_extension_header_t header
Definition ebpf_program_types.h:21
const ebpf_context_descriptor_t * context_descriptor
Definition ebpf_program_types.h:23
Definition ebpf_program_types.h:85
uint32_t value
Definition ebpf_program_types.h:86
bool reserved
Definition ebpf_program_types.h:89