15#define MAX_PRINTF_LENGTH 80
23static inline void ubpf_printf_test(
const char *fmt, ...) {
26 char str[MAX_PRINTF_LENGTH];
27 if (vsnprintf(str, MAX_PRINTF_LENGTH, fmt, args) >= 0)
32static inline void *ubpf_packet_data_test(
void *ctx) {
37static inline void *ubpf_adjust_head_test(
void *ctx,
int offset) {
42 }
else if (offset > 0) {
43 dp->data = realloc(dp->data, dp->size_ + offset);
44 memcpy((
char *) dp->data + offset, dp->data, dp->size_);
48 int ofs = abs(offset);
49 memcpy(dp->data, (
char *) dp->data + ofs, dp->size_ - ofs);
50 dp->data = realloc(dp->data, dp->size_ - ofs);
56static inline uint32_t ubpf_truncate_packet_test(
void *ctx,
int maxlen)
64 if (maxlen >= dp->size_) {
67 cutlen = dp->size_ - maxlen;
68 dp->data = realloc(dp->data, maxlen);
Definition ubpf_test.h:18