19 #define bpf_map_lookup_elem ((bpf_map_lookup_elem_t)BPF_FUNC_map_lookup_elem)
35 #define bpf_map_update_elem ((bpf_map_update_elem_t)BPF_FUNC_map_update_elem)
48 #define bpf_map_delete_elem ((bpf_map_delete_elem_t)BPF_FUNC_map_delete_elem)
60 #define bpf_map_lookup_and_delete_elem ((bpf_map_lookup_and_delete_elem_t)BPF_FUNC_map_lookup_and_delete_elem)
72 EBPF_HELPER(int64_t,
bpf_tail_call, (
void* ctx,
void* prog_array_map, uint32_t index));
74 #define bpf_tail_call ((bpf_tail_call_t)BPF_FUNC_tail_call)
84 #define bpf_get_prandom_u32 ((bpf_get_prandom_u32_t)BPF_FUNC_get_prandom_u32)
94 #define bpf_ktime_get_boot_ns ((bpf_ktime_get_boot_ns_t)BPF_FUNC_ktime_get_boot_ns)
104 #define bpf_get_smp_processor_id ((bpf_get_smp_processor_id_t)BPF_FUNC_get_smp_processor_id)
114 #define bpf_ktime_get_ns ((bpf_ktime_get_ns_t)BPF_FUNC_ktime_get_ns)
129 EBPF_HELPER(
int,
bpf_csum_diff, (
void* from,
int from_size,
void* to,
int to_size,
int seed));
131 #define bpf_csum_diff ((bpf_csum_diff_t)BPF_FUNC_csum_diff)
143 EBPF_HELPER(
int,
bpf_ringbuf_output, (
void* ring_buffer,
void* data, uint64_t size, uint64_t flags));
145 #define bpf_ringbuf_output ((bpf_ringbuf_output_t)BPF_FUNC_ringbuf_output)
158 #define bpf_trace_printk2 ((bpf_trace_printk2_t)BPF_FUNC_trace_printk2)
172 #define bpf_trace_printk3 ((bpf_trace_printk3_t)BPF_FUNC_trace_printk3)
185 EBPF_HELPER(
long,
bpf_trace_printk4, (
const char* fmt, uint32_t fmt_size, uint64_t arg3, uint64_t arg4));
187 #define bpf_trace_printk4 ((bpf_trace_printk4_t)BPF_FUNC_trace_printk4)
201 EBPF_HELPER(
long,
bpf_trace_printk5, (
const char* fmt, uint32_t fmt_size, uint64_t arg3, uint64_t arg4, uint64_t arg5));
203 #define bpf_trace_printk5 ((bpf_trace_printk5_t)BPF_FUNC_trace_printk5)
210 #define EBPF_CONCATENATE(X, Y) X##Y
211 #define EBPF_MAKE_HELPER_NAME(PREFIX, ARG_COUNT) EBPF_CONCATENATE(PREFIX, ARG_COUNT)
212 #define EBPF_GET_NTH_ARG(_1, _2, _3, _4, _5, N, ...) N
213 #define EBPF_COUNT_VA_ARGS(...) EBPF_GET_NTH_ARG(__VA_ARGS__, 5, 4, 3, 2, 1)
214 #define EBPF_VA_ARGS_HELPER(PREFIX, ...) EBPF_MAKE_HELPER_NAME(PREFIX, EBPF_COUNT_VA_ARGS(__VA_ARGS__))(__VA_ARGS__)
216 #undef bpf_trace_printk
217 #define bpf_trace_printk(fmt, size, ...) ({ EBPF_VA_ARGS_HELPER(bpf_trace_printk, fmt, size, ##__VA_ARGS__); })
236 #define bpf_printk(fmt, ...) \
238 char ____fmt[] = fmt; \
239 bpf_trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \
269 #define bpf_map_push_elem ((bpf_map_push_elem_t)BPF_FUNC_map_push_elem)
284 #define bpf_map_pop_elem ((bpf_map_pop_elem_t)BPF_FUNC_map_pop_elem)
299 #define bpf_map_peek_elem ((bpf_map_pop_elem_t)BPF_FUNC_map_peek_elem)
310 #define bpf_get_current_pid_tgid ((bpf_get_current_pid_tgid_t)BPF_FUNC_get_current_pid_tgid)
324 #define bpf_get_current_logon_id ((bpf_get_current_logon_id_t)BPF_FUNC_get_current_logon_id)
340 #define bpf_is_current_admin ((bpf_is_current_admin_t)BPF_FUNC_is_current_admin)
354 EBPF_HELPER(
long,
bpf_memcpy, (
void* destination, uint32_t destination_size,
const void* source, uint32_t source_size));
356 #define bpf_memcpy ((bpf_memcpy_t)BPF_FUNC_memcpy)
371 EBPF_HELPER(
int,
bpf_memcmp, (
const void* memory1, uint32_t memory1_size,
const void* memory2, uint32_t memory2_size));
373 #define bpf_memcmp ((bpf_memcmp_t)BPF_FUNC_memcmp)
386 EBPF_HELPER(
long,
bpf_memset, (
void* memory, uint32_t size,
int value));
388 #define bpf_memset ((bpf_memset_t)BPF_FUNC_memset)
404 long,
bpf_memmove, (
void* destination, uint32_t destination_size,
const void* source, uint32_t source_size));
406 #define bpf_memmove ((bpf_memmove_t)BPF_FUNC_memmove)
419 #define bpf_get_socket_cookie ((bpf_get_socket_cookie_t)BPF_FUNC_get_socket_cookie)
433 EBPF_HELPER(
int,
bpf_strncpy_s, (
char* dest,
size_t dest_size,
const char* src,
size_t count));
435 #define bpf_strncpy_s ((bpf_strncpy_s_t)BPF_FUNC_strncpy_s)
449 EBPF_HELPER(
int,
bpf_strncat_s, (
char* dest,
size_t dest_size,
const char* src,
size_t count));
451 #define bpf_strncat_s ((bpf_strncat_s_t)BPF_FUNC_strncat_s)
465 #define bpf_strnlen_s ((bpf_strnlen_s_t)BPF_FUNC_strnlen_s)
469 #define memcpy(dest, src, dest_size) bpf_memcpy(dest, dest_size, src, dest_size)
470 #define memcmp(mem1, mem2, mem1_size) bpf_memcmp(mem1, mem1_size, mem2, mem1_size)
471 #define memset(mem, value, mem_size) bpf_memset(mem, mem_size, value)
472 #define memmove(dest, src, dest_size) bpf_memmove(dest, dest_size, src, dest_size)
473 #define memcpy_s bpf_memcpy
474 #define memmove_s bpf_memmove
int bpf_ringbuf_output(void *ring_buffer, void *data, uint64_t size, uint64_t flags)
Copy data into the ring buffer map.
int64_t bpf_map_delete_elem(void *map, void *key)
Remove an entry from the map.
int bpf_strncpy_s(char *dest, size_t dest_size, const char *src, size_t count)
Copy a string into a buffer, of a fixed size.
int64_t bpf_map_push_elem(void *map, void *value, uint64_t flags)
Insert an element at the end of the map (only valid for stack and queue).
uint64_t bpf_get_current_pid_tgid()
Get the current thread ID (PID) and process ID (TGID).
int32_t bpf_is_current_admin(const void *ctx)
Get whether the current user is admin. In case of sock_addr attach types, returns whether the user in...
void * bpf_map_lookup_and_delete_elem(void *map, void *key)
Get a pointer to an entry in the map and erase that element.
uint64_t bpf_ktime_get_ns()
Return time elapsed since boot in nanoseconds excluding time while suspended.
long bpf_trace_printk5(const char *fmt, uint32_t fmt_size, uint64_t arg3, uint64_t arg4, uint64_t arg5)
Print debug output.
size_t bpf_strnlen_s(const char *str, size_t str_size)
Find the length of a string, up to a certain number of characters.
int bpf_strncat_s(char *dest, size_t dest_size, const char *src, size_t count)
Concatenate a string to an existing buffer, up to a certain number of characters.
long bpf_memcpy(void *destination, uint32_t destination_size, const void *source, uint32_t source_size)
Copy memory from one location to another.
int64_t bpf_map_update_elem(void *map, void *key, void *value, uint64_t flags)
Insert or update an entry in the map.
uint64_t bpf_get_current_logon_id(const void *ctx)
Get the 64-bit logon ID of the current thread. In case of sock_addr attach types, get the logon ID of...
int64_t bpf_tail_call(void *ctx, void *prog_array_map, uint32_t index)
Perform a tail call into another eBPF program.
long bpf_trace_printk4(const char *fmt, uint32_t fmt_size, uint64_t arg3, uint64_t arg4)
Print debug output.
long bpf_memmove(void *destination, uint32_t destination_size, const void *source, uint32_t source_size)
Copy memory from one location to another, handling overlapping regions.
int64_t bpf_map_pop_elem(void *map, void *value)
Copy an entry from the map and remove it from the map (only valid for stack and queue)....
long bpf_trace_printk3(const char *fmt, uint32_t fmt_size, uint64_t arg3)
Print debug output.
int bpf_csum_diff(void *from, int from_size, void *to, int to_size, int seed)
Computes difference of checksum values for two input raw buffers using 1's complement arithmetic.
int64_t bpf_get_socket_cookie(const void *ctx)
Get the socket cookie associated with the socket context. The context can be bpf_sock_addr struct,...
long bpf_trace_printk(const char *fmt, uint32_t size,...)
Print debug output. For instructions on viewing the output, see the Using tracing section of the Gett...
int bpf_memcmp(const void *memory1, uint32_t memory1_size, const void *memory2, uint32_t memory2_size)
Compare two memory regions.
long bpf_printk(const char *fmt,...)
Print debug output. For instructions on viewing the output, see the Using tracing section of the Gett...
void * bpf_map_lookup_elem(void *map, void *key)
Get a pointer to an entry in the map.
uint32_t bpf_get_prandom_u32()
Get a pseudo-random number.
uint64_t bpf_get_smp_processor_id()
Return SMP id of the processor running the program.
int64_t bpf_map_peek_elem(void *map, void *value)
Copy an entry from the map (only valid for stack and queue). Queue peeks at the beginning of the map....
long bpf_trace_printk2(const char *fmt, uint32_t fmt_size)
Print debug output.
long bpf_memset(void *memory, uint32_t size, int value)
Set memory to a specific value.
uint64_t bpf_ktime_get_boot_ns()
Return time elapsed since boot in nanoseconds including time while suspended.