#ifndef COMMON_H #define COMMON_H #include #include #include // DNS protocol constants #define DNS_PORT 53 #define DNS_MAX_DOMAIN_LENGTH 253 #define DNS_HEADER_SIZE 12 #define DNS_TYPE_A 1 #define DNS_TYPE_AAAA 28 #define DNS_CLASS_IN 1 #define DNS_MAX_RECURSION_DEPTH 16 // Application constants #define MAX_PACKET_SIZE 65535 #define LOG_BUFFER_SIZE 1024 #define CONFIG_CHECK_INTERVAL_MS 1000 // Filter action types enum FilterAction { ACTION_ALLOW, ACTION_BLOCK }; // Domain rule structure struct DomainRule { std::string domain; FilterAction action; bool is_wildcard; std::string comment; DomainRule() : action(ACTION_ALLOW), is_wildcard(false) {} DomainRule(const std::string& d, FilterAction a, bool w = false, const std::string& c = "") : domain(d), action(a), is_wildcard(w), comment(c) {} }; // Packet statistics struct PacketStats { std::atomic total_packets{0}; std::atomic blocked_packets{0}; std::atomic allowed_packets{0}; std::atomic parse_errors{0}; }; #endif // COMMON_H