eBPF for Windows
|
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | _bind_md |
struct | bpf_sock_addr |
Data structure used as context for BPF_PROG_TYPE_CGROUP_SOCK_ADDR program type. More... | |
struct | _bpf_sock_ops |
Macros | |
#define | BPF_SOCK_ADDR_VERDICT_REJECT 0 |
#define | BPF_SOCK_ADDR_VERDICT_PROCEED 1 |
#define | SOCK_ADDR_EXT_HELPER_FN_BASE 0xFFFF |
Typedefs | |
typedef enum _bind_operation | bind_operation_t |
typedef struct _bind_md | bind_md_t |
typedef enum _bind_action | bind_action_t |
typedef bind_action_t | bind_hook_t(bind_md_t *context) |
Handle an AF_INET socket bind() request. | |
typedef struct bpf_sock_addr | bpf_sock_addr_t |
Data structure used as context for BPF_PROG_TYPE_CGROUP_SOCK_ADDR program type. | |
typedef int | sock_addr_hook_t(bpf_sock_addr_t *context) |
Handle socket operation. Currently supports ingress/egress connection initialization. | |
typedef enum _bpf_sock_op_type | bpf_sock_op_type_t |
typedef struct _bpf_sock_ops | bpf_sock_ops_t |
typedef int | sock_ops_hook_t(bpf_sock_ops_t *context) |
Handle socket event notification. Currently notifies ingress/egress connection establishment and tear down. | |
Enumerations | |
enum | _bind_operation { BIND_OPERATION_BIND , BIND_OPERATION_POST_BIND , BIND_OPERATION_UNBIND } |
enum | _bind_action { BIND_PERMIT , BIND_DENY , BIND_REDIRECT } |
enum | ebpf_sock_addr_helper_id_t { BPF_FUNC_sock_addr_get_current_pid_tgid = SOCK_ADDR_EXT_HELPER_FN_BASE + 1 , BPF_FUNC_sock_addr_set_redirect_context = SOCK_ADDR_EXT_HELPER_FN_BASE + 2 } |
enum | _bpf_sock_op_type { BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB , BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB , BPF_SOCK_OPS_CONNECTION_DELETED_CB } |
Functions | |
int | bpf_sock_addr_set_redirect_context (bpf_sock_addr_t *ctx, void *data, uint32_t data_size) |
Set a context for consumption by a user-mode application (sock_addr specific only). This function is not supported for the recv_accept hooks. | |
#define BPF_SOCK_ADDR_VERDICT_PROCEED 1 |
#define BPF_SOCK_ADDR_VERDICT_REJECT 0 |
#define SOCK_ADDR_EXT_HELPER_FN_BASE 0xFFFF |
typedef enum _bind_action bind_action_t |
typedef bind_action_t bind_hook_t(bind_md_t *context) |
Handle an AF_INET socket bind() request.
Program type: EBPF_PROGRAM_TYPE_BIND
[in] | context | Socket metadata. |
BIND_PERMIT | Permit the bind operation. |
BIND_DENY | Deny the bind operation. |
BIND_REDIRECT | Change the bind endpoint. |
typedef enum _bind_operation bind_operation_t |
typedef struct bpf_sock_addr bpf_sock_addr_t |
Data structure used as context for BPF_PROG_TYPE_CGROUP_SOCK_ADDR program type.
typedef enum _bpf_sock_op_type bpf_sock_op_type_t |
typedef struct _bpf_sock_ops bpf_sock_ops_t |
typedef int sock_addr_hook_t(bpf_sock_addr_t *context) |
Handle socket operation. Currently supports ingress/egress connection initialization.
Program type: EBPF_PROGRAM_TYPE_CGROUP_SOCK_ADDR
Attach type(s): EBPF_ATTACH_TYPE_CGROUP_INET4_CONNECT EBPF_ATTACH_TYPE_CGROUP_INET6_CONNECT EBPF_ATTACH_TYPE_CGROUP_INET4_RECV_ACCEPT EBPF_ATTACH_TYPE_CGROUP_INET6_RECV_ACCEPT
[in] | context | bpf_sock_addr_t |
BPF_SOCK_ADDR_VERDICT_PROCEED | Block the socket operation. |
BPF_SOCK_ADDR_VERDICT_REJECT | Allow the socket operation. |
Any other return value other than the two mentioned above is treated as BPF_SOCK_ADDR_VERDICT_REJECT.
typedef int sock_ops_hook_t(bpf_sock_ops_t *context) |
Handle socket event notification. Currently notifies ingress/egress connection establishment and tear down.
Program type: EBPF_PROGRAM_TYPE_SOCK_OPS
Attach type(s): EBPF_ATTACH_TYPE_CGROUP_SOCK_OPS
[in] | context | bpf_sock_ops_t |
enum _bind_action |
enum _bind_operation |
enum _bpf_sock_op_type |
int bpf_sock_addr_set_redirect_context | ( | bpf_sock_addr_t * | ctx, |
void * | data, | ||
uint32_t | data_size | ||
) |
Set a context for consumption by a user-mode application (sock_addr specific only). This function is not supported for the recv_accept hooks.
[in] | ctx | Pointer to bpf_sock_addr_t context. |
[in] | data | Pointer to data to store. |
[in] | data_size | The size of the data to store. |
0 | The operation was successful. |
<0 | A failure occurred. |