ebpf-for-windows/include/ebpf_program_types.h

81 строка
2.8 KiB
C
Исходник Обычный вид История

// Copyright (c) Microsoft Corporation
// SPDX-License-Identifier: MIT
#pragma once
#include "ebpf_base.h"
#include "ebpf_result.h"
#include <guiddef.h>
#include <stdint.h>
#define EBPF_MAX_PROGRAM_DESCRIPTOR_NAME_LENGTH 256
#define EBPF_MAX_HELPER_FUNCTION_NAME_LENGTH 256
typedef struct _ebpf_program_type_descriptor
{
const char* name;
const ebpf_context_descriptor_t* context_descriptor;
GUID program_type;
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
uint32_t bpf_prog_type;
char is_privileged;
} ebpf_program_type_descriptor_t;
typedef struct _ebpf_helper_function_prototype
{
uint32_t helper_id;
const char* name;
ebpf_return_type_t return_type;
ebpf_argument_type_t arguments[5];
} ebpf_helper_function_prototype_t;
typedef struct _ebpf_program_info
{
ebpf_program_type_descriptor_t program_type_descriptor;
uint32_t count_of_program_type_specific_helpers;
const ebpf_helper_function_prototype_t* program_type_specific_helper_prototype;
uint32_t count_of_global_helpers;
const ebpf_helper_function_prototype_t* global_helper_prototype;
} ebpf_program_info_t;
typedef struct _ebpf_helper_function_addresses
{
uint32_t helper_function_count;
uint64_t* helper_function_address;
} ebpf_helper_function_addresses_t;
typedef 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,
_Outptr_ void** context);
typedef void (*ebpf_program_context_destroy_t)(
_In_ 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);
typedef struct _ebpf_program_data
{
const ebpf_program_info_t* program_info; ///< Pointer to program information.
const ebpf_helper_function_addresses_t*
program_type_specific_helper_function_addresses; ///< Pointer to program type specific helper function
///< addresses.
const ebpf_helper_function_addresses_t*
global_helper_function_addresses; ///< Pointer to global helper function addresses being overriden.
ebpf_program_context_create_t context_create; ///< Pointer to context create function.
ebpf_program_context_destroy_t context_destroy; ///< Pointer to context destroy function.
uint8_t required_irql; ///< IRQL at which the program is invoked.
} ebpf_program_data_t;
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
typedef struct _ebpf_program_section_info
{
const wchar_t* section_name;
const GUID* program_type;
const GUID* attach_type;
Registry changes for program and section data. (#1192) * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * fix expected output * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix * backup * fix backup * msbuild compiling * fix release build * fixes * cmake build fix * fix cmake build * fix analyse build * fix Signed-off-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com> * add pre step for tests * add pre step for tests * add -s option, revert this later * Revert "add -s option, revert this later" This reverts commit 1f42d100e45b296ede3cb9bc6712aca788b7acf6. * code cleanup Signed-off-by: Anurag Saxena <anusa@microsoft.com> * rename driver_registry_helper.h * delete bpf_structs.h * fix * hardcode HKLM * code cleanup * fix build break * fix build break, enable warning * fix bad merge * cleanup * fix * fix tests * add tests, make ebpf_store_helper platform agnostic * fixes, cleanup, common code for store APIs * fix cmake build, driver tests * cleanup * code cleanup * cr comments * code cleanup * cleanup * bugfix * Apply suggestions from code review Co-authored-by: Dave Thaler <dthaler@microsoft.com> * cr comments * fix build break * move UM read store APIs to a different file * cr comments * cr comments * cr comments Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2022-07-01 02:53:03 +03:00
uint32_t bpf_program_type;
uint32_t bpf_attach_type;
} ebpf_program_section_info_t;