2017-12-06 00:06:40 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct conntrack_info {
|
2018-02-16 14:35:24 +00:00
|
|
|
uint8_t is_ipv6;
|
|
|
|
uint32_t srcip[4];
|
2017-12-06 00:06:40 +00:00
|
|
|
uint16_t srcport;
|
2018-02-16 14:35:24 +00:00
|
|
|
uint32_t dstip[4];
|
2017-12-06 00:06:40 +00:00
|
|
|
uint16_t dstport;
|
|
|
|
} conntrack_info_t;
|
|
|
|
|
2018-02-16 14:35:24 +00:00
|
|
|
inline static void ipv4_copy_addr(uint32_t dst[4], const uint32_t src[4]) {
|
|
|
|
dst[0] = src[0];
|
|
|
|
dst[1] = 0;
|
|
|
|
dst[2] = 0;
|
|
|
|
dst[3] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline static void ipv6_copy_addr(uint32_t dst[4], const uint32_t src[4]) {
|
|
|
|
dst[0] = src[0];
|
|
|
|
dst[1] = src[1];
|
|
|
|
dst[2] = src[2];
|
|
|
|
dst[3] = src[3];
|
|
|
|
}
|
|
|
|
|
|
|
|
int dns_handle_incoming(const uint32_t srcip[4], const uint16_t srcport,
|
2017-12-06 00:06:40 +00:00
|
|
|
const char *packet_data, const UINT packet_dataLen,
|
2018-02-16 14:35:24 +00:00
|
|
|
conntrack_info_t *conn_info, const uint8_t is_ipv6);
|
2017-12-06 00:06:40 +00:00
|
|
|
|
2018-02-16 14:35:24 +00:00
|
|
|
int dns_handle_outgoing(const uint32_t srcip[4], const uint16_t srcport,
|
|
|
|
const uint32_t dstip[4], const uint16_t dstport,
|
|
|
|
const char *packet_data, const UINT packet_dataLen,
|
|
|
|
const uint8_t is_ipv6
|
|
|
|
);
|
2017-12-07 19:38:21 +00:00
|
|
|
|
|
|
|
void flush_dns_cache();
|
2017-12-16 11:16:01 +00:00
|
|
|
int dns_is_dns_packet(const char *packet_data, const UINT packet_dataLen, const int outgoing);
|