summaryrefslogtreecommitdiff
path: root/include/sniffer.h
blob: 8b85100fd13005df791e73af91f8870e99cad387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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);