summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-10-31 19:14:20 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-10-31 19:14:20 +0700
commit0578d751b1ea0ac10ad2b033f9b73c922f120fdb (patch)
treea88851240340e70e96c52c7e552e25ccc2123731
parent6424fba52d31b51a7875114c9a8906266810e56e (diff)
utils.h: share 'sock_state' struct from 'utils.c'
-rw-r--r--utils.c8
-rw-r--r--utils.h9
2 files changed, 9 insertions, 8 deletions
diff --git a/utils.c b/utils.c
index bf9b935..f188205 100644
--- a/utils.c
+++ b/utils.c
@@ -47,19 +47,11 @@ static char *hexdump(const unsigned char *buf, int len, char *delim)
return hexd_buff;
}
-typedef void (*udtrace_dissector)(int fd, bool is_out, const char *fn, const uint8_t *data, unsigned int len);
-
static void default_dissector(int fd, bool is_out, const char *fn, const uint8_t *data, unsigned int len)
{
fprintf(stderr, "%d %s %c %s\n", fd, fn, is_out ? 'W' : 'R', hexdump(data, len, ""));
}
-struct sock_state {
- int fd;
- const char *path;
- udtrace_dissector dissector;
-};
-
static struct sock_state unix_fds[MAX_UNIX_FDS];
__attribute__ ((constructor)) static void udtrace_init(void)
diff --git a/utils.h b/utils.h
index 8ac4859..8145c9b 100644
--- a/utils.h
+++ b/utils.h
@@ -6,6 +6,15 @@
#define LOG(fmt, args ...) \
fprintf(stderr, ">>> UDTRACE: " fmt, ## args)
+typedef void (*udtrace_dissector)(int fd, bool is_out, const char *fn,
+ const uint8_t *data, unsigned int len);
+
+struct sock_state {
+ int fd;
+ const char *path;
+ udtrace_dissector dissector;
+};
+
/* find the state corresponding to a given file descriptor */
struct sock_state *udtrace_sstate_by_fd(int fd);
personal git repositories of Harald Welte. Your mileage may vary