eBPF for Windows
ebpf_program_types.h
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation
2 // SPDX-License-Identifier: MIT
3 #pragma once
4 
5 #include "ebpf_base.h"
6 #include "ebpf_result.h"
7 
8 #include <guiddef.h>
9 #include <stdint.h>
10 
11 #define EBPF_MAX_PROGRAM_DESCRIPTOR_NAME_LENGTH 256
12 #define EBPF_MAX_HELPER_FUNCTION_NAME_LENGTH 256
13 
15 {
16  const char* name;
17  const ebpf_context_descriptor_t* context_descriptor;
19  uint32_t bpf_prog_type;
22 
24 {
25  uint32_t helper_id;
26  const char* name;
27  ebpf_return_type_t return_type;
28  ebpf_argument_type_t arguments[5];
30 
31 typedef struct _ebpf_program_info
32 {
39 
41 {
45 
47  _In_reads_bytes_opt_(data_size_in) const uint8_t* data_in,
48  size_t data_size_in,
49  _In_reads_bytes_opt_(context_size_in) const uint8_t* context_in,
50  size_t context_size_in,
51  _Outptr_ void** context);
52 
54  _In_ void* context,
55  _Out_writes_bytes_to_opt_(*data_size_out, *data_size_out) uint8_t* data_out,
56  _Inout_ size_t* data_size_out,
57  _Out_writes_bytes_to_opt_(*context_size_out, *context_size_out) uint8_t* context_out,
58  _Inout_ size_t* context_size_out);
59 
60 typedef struct _ebpf_program_data
61 {
70  uint8_t required_irql;
72 
74 {
75  const wchar_t* section_name;
77  const GUID* attach_type;
78  uint32_t bpf_program_type;
79  uint32_t bpf_attach_type;
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:46
struct _ebpf_program_data ebpf_program_data_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:53
struct _ebpf_helper_function_prototype ebpf_helper_function_prototype_t
struct _ebpf_helper_function_addresses ebpf_helper_function_addresses_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:13
Definition: ebpf_program_types.h:41
uint64_t * helper_function_address
Definition: ebpf_program_types.h:43
uint32_t helper_function_count
Definition: ebpf_program_types.h:42
Definition: ebpf_program_types.h:24
ebpf_argument_type_t arguments[5]
Definition: ebpf_program_types.h:28
ebpf_return_type_t return_type
Definition: ebpf_program_types.h:27
const char * name
Definition: ebpf_program_types.h:26
uint32_t helper_id
Definition: ebpf_program_types.h:25
Definition: ebpf_program_types.h:61
const ebpf_program_info_t * program_info
Pointer to program information.
Definition: ebpf_program_types.h:62
ebpf_program_context_destroy_t context_destroy
Pointer to context destroy function.
Definition: ebpf_program_types.h:69
const ebpf_helper_function_addresses_t * global_helper_function_addresses
Pointer to global helper function addresses being overriden.
Definition: ebpf_program_types.h:67
ebpf_program_context_create_t context_create
Pointer to context create function.
Definition: ebpf_program_types.h:68
const ebpf_helper_function_addresses_t * program_type_specific_helper_function_addresses
Definition: ebpf_program_types.h:64
uint8_t required_irql
IRQL at which the program is invoked.
Definition: ebpf_program_types.h:70
Definition: ebpf_program_types.h:32
const ebpf_helper_function_prototype_t * global_helper_prototype
Definition: ebpf_program_types.h:37
const ebpf_helper_function_prototype_t * program_type_specific_helper_prototype
Definition: ebpf_program_types.h:35
ebpf_program_type_descriptor_t program_type_descriptor
Definition: ebpf_program_types.h:33
uint32_t count_of_program_type_specific_helpers
Definition: ebpf_program_types.h:34
uint32_t count_of_global_helpers
Definition: ebpf_program_types.h:36
Definition: ebpf_program_types.h:74
const GUID * attach_type
Definition: ebpf_program_types.h:77
const wchar_t * section_name
Definition: ebpf_program_types.h:75
const GUID * program_type
Definition: ebpf_program_types.h:76
uint32_t bpf_attach_type
Definition: ebpf_program_types.h:79
uint32_t bpf_program_type
Definition: ebpf_program_types.h:78
Definition: ebpf_program_types.h:15
uint32_t bpf_prog_type
Definition: ebpf_program_types.h:19
const char * name
Definition: ebpf_program_types.h:16
GUID program_type
Definition: ebpf_program_types.h:18
char is_privileged
Definition: ebpf_program_types.h:20
const ebpf_context_descriptor_t * context_descriptor
Definition: ebpf_program_types.h:17