eBPF for Windows
|
Go to the source code of this file.
Functions | |
Link-related functions | |
int | bpf_link_detach (int link_fd) |
Detach a link. More... | |
int | bpf_link_get_fd_by_id (__u32 id) |
Get a file descriptor referring to a link with a given ID. More... | |
int | bpf_link_get_next_id (__u32 start_id, __u32 *next_id) |
Look for the next link ID greater than a given ID. More... | |
Map-related functions | |
int | bpf_create_map (enum bpf_map_type map_type, int key_size, int value_size, int max_entries, __u32 map_flags) |
Create a new map. More... | |
int | bpf_create_map_xattr (const struct bpf_create_map_attr *create_attr) |
Create a new map. More... | |
int | bpf_map_delete_elem (int fd, const void *key) |
Look up and delete an element by key in a specified map. More... | |
int | bpf_map_get_fd_by_id (__u32 id) |
Get a file descriptor referring to a map with a given ID. More... | |
int | bpf_map_get_next_id (__u32 start_id, __u32 *next_id) |
Look for the next map ID greater than a given ID. More... | |
int | bpf_map_get_next_key (int fd, const void *key, void *next_key) |
Look up an element by key in a map and get the next key. If the specific key is not found, the first key in the map is passed back. More... | |
int | bpf_map_lookup_elem (int fd, const void *key, void *value) |
Look up an element by key in a specified map and return its value. More... | |
int | bpf_map_update_elem (int fd, const void *key, const void *value, __u64 flags) |
Create or update an element (key/value pair) in a specified map. More... | |
Object-related functions | |
int | bpf_obj_get (const char *pathname) |
Get a file descriptor for a pinned object by pin path. More... | |
int | bpf_obj_get_info_by_fd (int bpf_fd, void *info, __u32 *info_len) |
Obtain information about the eBPF object referred to by bpf_fd. This function populates up to info_len bytes of info, which will be in one of the following formats depending on the eBPF object type of bpf_fd: More... | |
int | bpf_obj_pin (int fd, const char *pathname) |
Pin an eBPF program or map referred to by fd to the provided pathname. More... | |
Program-related functions | |
int | bpf_prog_get_fd_by_id (__u32 id) |
Get a file descriptor referring to a program with a given ID. More... | |
int | bpf_prog_get_next_id (__u32 start_id, __u32 *next_id) |
Look for the next program ID greater than a given ID. More... | |
int bpf_create_map | ( | enum bpf_map_type | map_type, |
int | key_size, | ||
int | value_size, | ||
int | max_entries, | ||
__u32 | map_flags | ||
) |
Create a new map.
[in] | map_type | Type of map to create. |
[in] | key_size | Size in bytes of keys. |
[in] | value_size | Size in bytes of values. |
[in] | max_entries | Maximum number of entries in the map. |
[in] | map_flags | Flags (currently 0). |
EINVAL | An invalid argument was provided. |
ENOMEM | Out of memory. |
int bpf_create_map_xattr | ( | const struct bpf_create_map_attr * | create_attr | ) |
Create a new map.
[in] | create_attr | Structure of attributes using which a map gets created. |
EINVAL | An invalid argument was provided. |
ENOMEM | Out of memory. |
int bpf_link_detach | ( | int | link_fd | ) |
Detach a link.
[in] | link_fd | File descriptor of link to detach. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
EBADF | The file descriptor was not found. |
int bpf_link_get_fd_by_id | ( | __u32 | id | ) |
Get a file descriptor referring to a link with a given ID.
[in] | id | ID of link to find. |
ENOENT | No link with the specified ID was found. |
Look for the next link ID greater than a given ID.
[in] | start_id | ID to look for an ID after. The start_id need not exist. |
[out] | next_id | Pointer to where to write the next ID. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
ENOENT | No more IDs found. |
int bpf_map_delete_elem | ( | int | fd, |
const void * | key | ||
) |
Look up and delete an element by key in a specified map.
[in] | fd | File descriptor of map to update. |
[in] | key | Pointer to key to look up. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
EINVAL | An invalid argument was provided. |
EBADF | The file descriptor was not found. |
ENOMEM | Out of memory. |
int bpf_map_get_fd_by_id | ( | __u32 | id | ) |
Get a file descriptor referring to a map with a given ID.
[in] | id | ID of map to find. |
ENOENT | No map with the specified ID was found. |
Look for the next map ID greater than a given ID.
[in] | start_id | ID to look for an ID after. The start_id need not exist. |
[out] | next_id | Pointer to where to write the next ID. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
ENOENT | No more IDs found. |
int bpf_map_get_next_key | ( | int | fd, |
const void * | key, | ||
void * | next_key | ||
) |
Look up an element by key in a map and get the next key. If the specific key is not found, the first key in the map is passed back.
[in] | fd | File descriptor of map. |
[in] | key | Pointer to key to look up. |
[out] | next_key | Pointer to memory in which to write the next key. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
EINVAL | An invalid argument was provided. |
EBADF | The file descriptor was not found. |
ENOMEM | Out of memory. |
int bpf_map_lookup_elem | ( | int | fd, |
const void * | key, | ||
void * | value | ||
) |
Look up an element by key in a specified map and return its value.
[in] | fd | File descriptor of map. |
[in] | key | Pointer to key to look up. |
[out] | value | Pointer to memory in which to write the value. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
EINVAL | An invalid argument was provided. |
EBADF | The file descriptor was not found. |
ENOMEM | Out of memory. |
int bpf_map_update_elem | ( | int | fd, |
const void * | key, | ||
const void * | value, | ||
__u64 | flags | ||
) |
Create or update an element (key/value pair) in a specified map.
[in] | fd | File descriptor of map. |
[in] | key | Pointer to key. |
[in] | value | Pointer to value. |
[in] | flags | Flags (currently 0). |
EINVAL | An invalid argument was provided. |
EBADF | The file descriptor was not found. |
ENOMEM | Out of memory. |
int bpf_obj_get | ( | const char * | pathname | ) |
Get a file descriptor for a pinned object by pin path.
[in] | path | Pin path for the object. |
int bpf_obj_get_info_by_fd | ( | int | bpf_fd, |
void * | info, | ||
__u32 * | info_len | ||
) |
Obtain information about the eBPF object referred to by bpf_fd. This function populates up to info_len bytes of info, which will be in one of the following formats depending on the eBPF object type of bpf_fd:
[in] | bpf_fd | File descriptor referring to an eBPF object. |
[out] | info | Pointer to memory in which to write the info obtained. |
[in,out] | info_len | On input, contains the maximum number of bytes to write into the info. On output, contains the actual number of bytes written. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
int bpf_obj_pin | ( | int | fd, |
const char * | pathname | ||
) |
Pin an eBPF program or map referred to by fd to the provided pathname.
[in] | fd | File descriptor referring to the program or map to pin. |
[in] | pathname | Path name to pin the object to. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
int bpf_prog_get_fd_by_id | ( | __u32 | id | ) |
Get a file descriptor referring to a program with a given ID.
[in] | id | ID of program to find. |
ENOENT | No program with the specified ID was found. |
Look for the next program ID greater than a given ID.
[in] | start_id | ID to look for an ID after. The start_id need not exist. |
[out] | next_id | Pointer to where to write the next ID. |
0 | The operation was successful. |
<0 | An error occured, and errno was set. |
ENOENT | No more IDs found. |