70 строки
2.2 KiB
Plaintext
70 строки
2.2 KiB
Plaintext
// Copyright (c) eBPF for Windows contributors
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import "ebpf_execution_context.h";
|
|
import "ebpf_execution_type.h";
|
|
import "ebpf_result.h";
|
|
import "stdint.h";
|
|
import "wtypes.idl";
|
|
|
|
//
|
|
// Interface Attributes
|
|
//
|
|
|
|
// clang-format off
|
|
[uuid(6bef171d-7205-4b63-a1e5-d00f01e6a0c1), version(1.0), pointer_default(unique)]
|
|
// clang-format on
|
|
|
|
interface ebpf_service_interface {
|
|
typedef[system_handle(sh_file)] HANDLE file_handle_t;
|
|
|
|
typedef struct _original_fd_handle_map
|
|
{
|
|
// Original fd as it appears in the eBPF byte code.
|
|
uint32_t original_fd;
|
|
|
|
uint32_t id;
|
|
|
|
// Inner map's original fd.
|
|
uint32_t inner_map_original_fd;
|
|
|
|
uint32_t inner_id;
|
|
|
|
// Handle from which the rest of the data can be looked up.
|
|
file_handle_t handle;
|
|
} original_fd_handle_map_t;
|
|
|
|
// We can't use struct ebpf_inst since MIDL doesn't support
|
|
// bitfields, so define a structure here that doesn't use bitfields.
|
|
typedef struct _ebpf_instruction
|
|
{
|
|
uint8_t opcode;
|
|
uint8_t dst_src; //< Registers.
|
|
int16_t offset;
|
|
int32_t imm; //< Immediate constant
|
|
} ebpf_instruction_t;
|
|
|
|
typedef struct _ebpf_program_load_info
|
|
{
|
|
// Object name.
|
|
[string] char* object_name;
|
|
// Optional section name.
|
|
[string] char* section_name;
|
|
// Optional program name.
|
|
[string] char* program_name;
|
|
GUID program_type;
|
|
ebpf_execution_type_t execution_type;
|
|
file_handle_t program_handle;
|
|
ebpf_execution_context_t execution_context;
|
|
uint32_t map_count;
|
|
[size_is(map_count)] original_fd_handle_map_t* handle_map;
|
|
uint32_t instruction_count;
|
|
[ size_is(instruction_count), ref ] ebpf_instruction_t* instructions;
|
|
} ebpf_program_load_info;
|
|
|
|
ebpf_result_t verify_and_load_program(
|
|
[ in, ref ] ebpf_program_load_info * info,
|
|
[ out, ref ] uint32_t * logs_size,
|
|
[ out, size_is(, *logs_size), ref ] char** logs);
|
|
}
|