dnsredir.h
1 #ifndef _DNSREDIR_H 2 #define _DNSREDIR_H 3 #include <stdint.h> 4 5 typedef struct conntrack_info { 6 uint8_t is_ipv6; 7 uint32_t srcip[4]; 8 uint16_t srcport; 9 uint32_t dstip[4]; 10 uint16_t dstport; 11 } conntrack_info_t; 12 13 inline static void ipv4_copy_addr(uint32_t dst[4], const uint32_t src[4]) { 14 dst[0] = src[0]; 15 dst[1] = 0; 16 dst[2] = 0; 17 dst[3] = 0; 18 } 19 20 inline static void ipv6_copy_addr(uint32_t dst[4], const uint32_t src[4]) { 21 dst[0] = src[0]; 22 dst[1] = src[1]; 23 dst[2] = src[2]; 24 dst[3] = src[3]; 25 } 26 27 int dns_handle_incoming(const uint32_t srcip[4], const uint16_t srcport, 28 const char *packet_data, const UINT packet_dataLen, 29 conntrack_info_t *conn_info, const uint8_t is_ipv6); 30 31 int dns_handle_outgoing(const uint32_t srcip[4], const uint16_t srcport, 32 const uint32_t dstip[4], const uint16_t dstport, 33 const char *packet_data, const UINT packet_dataLen, 34 const uint8_t is_ipv6 35 ); 36 37 void flush_dns_cache(); 38 int dns_is_dns_packet(const char *packet_data, const UINT packet_dataLen, const int outgoing); 39 #endif