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#define EBPF_MAX_PROGRAM_DESCRIPTOR_NAME_LENGTH 256
10#define EBPF_MAX_HELPER_FUNCTION_NAME_LENGTH 256
11
12// This is the type definition for the eBPF program type descriptor
13// when version is EBPF_PROGRAM_TYPE_DESCRIPTOR_CURRENT_VERSION.
23
28
29// This is the type definition for the eBPF helper function prototype
30// when version is EBPF_HELPER_FUNCTION_PROTOTYPE_CURRENT_VERSION.
41
42// This is the type definition for the eBPF program information
43// when version is EBPF_PROGRAM_INFORMATION_CURRENT_VERSION.
53
54// This is the type definition for the eBPF helper function addresses
55// when version is EBPF_HELPER_FUNCTION_ADDRESSES_CURRENT_VERSION.
62
64 _In_reads_bytes_opt_(data_size_in) const uint8_t* data_in,
65 size_t data_size_in,
66 _In_reads_bytes_opt_(context_size_in) const uint8_t* context_in,
67 size_t context_size_in,
68 _Outptr_ void** context);
69
71 _In_ void* context,
72 _Out_writes_bytes_to_opt_(*data_size_out, *data_size_out) uint8_t* data_out,
73 _Inout_ size_t* data_size_out,
74 _Out_writes_bytes_to_opt_(*context_size_out, *context_size_out) uint8_t* context_out,
75 _Inout_ size_t* context_size_out);
76
77#pragma warning(push)
78#pragma warning(disable : 4201) // nonstandard extension used: nameless struct/union
80{
82 struct
83 {
84 bool supports_context_header : 1; // Program supports context header.
85 };
87
88// This is the type definition for the eBPF program data
89// when version is EBPF_PROGRAM_DATA_CURRENT_VERSION.
104#pragma warning(pop)
105
106static_assert(
107 EBPF_FIELD_SIZE(ebpf_program_data_t, capabilities) == sizeof(uint32_t), "Size of capabilities is 32 bits.");
108
109// This is the type definition for the eBPF program section information
110// 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:63
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:70
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
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:153
Definition ebpf_program_types.h:57
uint64_t * helper_function_address
Definition ebpf_program_types.h:60
ebpf_extension_header_t header
Definition ebpf_program_types.h:58
uint32_t helper_function_count
Definition ebpf_program_types.h:59
Definition ebpf_program_types.h:25
bool reallocate_packet
Definition ebpf_program_types.h:26
Definition ebpf_program_types.h:32
ebpf_argument_type_t arguments[5]
Definition ebpf_program_types.h:37
ebpf_return_type_t return_type
Definition ebpf_program_types.h:36
ebpf_helper_function_prototype_flags_t flags
Definition ebpf_program_types.h:38
const char * name
Definition ebpf_program_types.h:35
bool implicit_context
Definition ebpf_program_types.h:39
uint32_t helper_id
Definition ebpf_program_types.h:34
ebpf_extension_header_t header
Definition ebpf_program_types.h:33
Definition ebpf_program_types.h:91
ebpf_extension_header_t header
Definition ebpf_program_types.h:92
const ebpf_program_info_t * program_info
Pointer to program information.
Definition ebpf_program_types.h:93
ebpf_program_context_destroy_t context_destroy
Pointer to context destroy function.
Definition ebpf_program_types.h:100
const ebpf_helper_function_addresses_t * global_helper_function_addresses
Pointer to global helper function addresses being overriden.
Definition ebpf_program_types.h:98
ebpf_program_context_create_t context_create
Pointer to context create function.
Definition ebpf_program_types.h:99
const ebpf_helper_function_addresses_t * program_type_specific_helper_function_addresses
Definition ebpf_program_types.h:95
uint8_t required_irql
IRQL at which the program is invoked.
Definition ebpf_program_types.h:101
program_data_capabilities_t capabilities
Capabilities supported by the program information provider.
Definition ebpf_program_types.h:102
Definition ebpf_program_types.h:45
const ebpf_program_type_descriptor_t * program_type_descriptor
Definition ebpf_program_types.h:47
ebpf_extension_header_t header
Definition ebpf_program_types.h:46
const ebpf_helper_function_prototype_t * global_helper_prototype
Definition ebpf_program_types.h:51
const ebpf_helper_function_prototype_t * program_type_specific_helper_prototype
Definition ebpf_program_types.h:49
uint32_t count_of_program_type_specific_helpers
Definition ebpf_program_types.h:48
uint32_t count_of_global_helpers
Definition ebpf_program_types.h:50
Definition ebpf_program_types.h:112
const GUID * attach_type
Definition ebpf_program_types.h:116
const wchar_t * section_name
Definition ebpf_program_types.h:114
const GUID * program_type
Definition ebpf_program_types.h:115
ebpf_extension_header_t header
Definition ebpf_program_types.h:113
uint32_t bpf_attach_type
Definition ebpf_program_types.h:118
uint32_t bpf_program_type
Definition ebpf_program_types.h:117
Definition ebpf_program_types.h:15
uint32_t bpf_prog_type
Definition ebpf_program_types.h:20
const char * name
Definition ebpf_program_types.h:17
GUID program_type
Definition ebpf_program_types.h:19
char is_privileged
Definition ebpf_program_types.h:21
ebpf_extension_header_t header
Definition ebpf_program_types.h:16
const ebpf_context_descriptor_t * context_descriptor
Definition ebpf_program_types.h:18
Definition ebpf_program_types.h:80
uint32_t value
Definition ebpf_program_types.h:81
bool supports_context_header
Definition ebpf_program_types.h:84