summaryrefslogtreecommitdiff
path: root/include/sniffer.h
diff options
context:
space:
mode:
authordaniel <daniel@planethacker.net>2025-05-06 16:57:32 -0700
committerdaniel <daniel@planethacker.net>2025-05-06 16:57:32 -0700
commit2278df1493e064c197913e49b5d1935942d83448 (patch)
tree42f06ab2f76e2ddf228bafbb03f79621975a4534 /include/sniffer.h
initial import
Diffstat (limited to 'include/sniffer.h')
-rw-r--r--include/sniffer.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/sniffer.h b/include/sniffer.h
new file mode 100644
index 0000000..8b85100
--- /dev/null
+++ b/include/sniffer.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "agent_context.h"
+#include "net.h"
+
+#ifndef TH_FIN
+#define TH_FIN 0x01
+#endif
+
+#ifndef TH_SYN
+#define TH_SYN 0x02
+#endif
+
+#ifndef TH_RST
+#define TH_RST 0x04
+#endif
+
+#ifndef TH_PUSH
+#define TH_PUSH 0x08
+#endif
+
+#ifndef TH_ACK
+#define TH_ACK 0x10
+#endif
+
+#ifndef TH_URG
+#define TH_URG 0x20
+#endif
+
+#ifndef TH_ECE
+#define TH_ECE 0x40
+#endif
+
+#ifndef TH_CWR
+#define TH_CWR 0x80
+#endif
+
+sock_t sniffer_init_interface(const char *interface, bool promisc);
+void sniffer_handle_packet(sock_t sniffer, agent_context_t *ctx);
+
+pid_t match_udp_inode(uint32_t ip_be, uint16_t port_be);