summaryrefslogtreecommitdiff
path: root/utils.h
blob: f1f52f458a5debd37d7daf3a8c66e87a1ec04b60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

/*! Determine number of elements in an array of static size */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

#define LOG(fmt, args ...) \
	fprintf(stderr, ">>> UDTRACE: " fmt, ## args)

/* add a file descriptor from the list of to-be-traced ones */
void udtrace_add_fd(int fd);

/* delete a file descriptor from the list of to-be-traced ones */
void udtrace_del_fd(int fd);

/* set the path of a given fd */
void udtrace_fd_set_path(int fd, const char *path);

/* is the given file descriptor part of the to-be-traced unix domain fd's? */
bool is_unix_socket(int fd);

void udtrace_data(int fd, bool is_out, const char *fn, const uint8_t *data, unsigned int len);
personal git repositories of Harald Welte. Your mileage may vary