85 строки
2.9 KiB
Plaintext
85 строки
2.9 KiB
Plaintext
// Copyright (c) Microsoft Corporation
|
|
// 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 {
|
|
// TODO: (Issue #208): This is a duplicate of EbpfMapDescriptor
|
|
// structure defined in spec_type_descriptor.hpp. See if that
|
|
// file can be included so that we do not have to redefine this.
|
|
typedef struct _ebpf_map_descriptor
|
|
{
|
|
int original_fd;
|
|
uint32_t type; // Platform-specific type value in ELF file.
|
|
unsigned int key_size;
|
|
unsigned int value_size;
|
|
unsigned int max_entries;
|
|
unsigned int inner_map_fd;
|
|
} ebpf_map_descriptor;
|
|
|
|
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;
|
|
|
|
// Inner map's original fd.
|
|
uint32_t inner_map_original_fd;
|
|
|
|
// Handle from which the rest of the data can be looked up.
|
|
file_handle_t handle;
|
|
} original_fd_handle_map_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 byte_code_size;
|
|
[ size_is(byte_code_size), ref ] uint8_t* byte_code;
|
|
} ebpf_program_load_info;
|
|
|
|
typedef struct _ebpf_program_verify_info
|
|
{
|
|
GUID program_type;
|
|
ebpf_execution_context_t execution_context;
|
|
uint32_t map_descriptors_count;
|
|
[size_is(map_descriptors_count)] ebpf_map_descriptor* map_descriptors;
|
|
uint32_t byte_code_size;
|
|
[ size_is(byte_code_size), ref ] uint8_t* byte_code;
|
|
} ebpf_program_verify_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);
|
|
|
|
ebpf_result_t verify_program([ in, ref ] ebpf_program_verify_info * info, [out] uint32_t * logs_size, [
|
|
out,
|
|
size_is(, *logs_size),
|
|
ref
|
|
] char** logs);
|
|
}
|