#ifndef NAT_FORMAT_H_ #define NAT_FORMAT_H_ #include #include #include #define FORMAT_LOG_MAGIC_NUMBER 0x004e4154 #define FORMAT_LOG_VERSION 0x0200 #define FORMAT_LOG_PROTOCOL_ICMP 0x01 #define FORMAT_LOG_PROTOCOL_TCP 0x06 #define FORMAT_LOG_PROTOCOL_UDP 0x17 // 目前均采用UDP传输 // 全局配置信息 struct nat_format_global_info { u_int32_t batch_size; char host_ip[64]; u_int32_t host_port; char multicast_ip[64]; u_int32_t multicast_port; int32_t hw_syslog_port; int32_t hw_binary_port; int32_t h3_syslog_port; int32_t h3_binary_port; int32_t dp_syslog_port; int32_t dp_binary_port; char log_path[256]; u_int32_t log_level; void *log; }; // 格式化NAT报文载荷 struct nat_payload { unsigned int magic_num = FORMAT_LOG_MAGIC_NUMBER; unsigned short version = FORMAT_LOG_VERSION; unsigned int fw_log_timestamp; unsigned int fw_ip; char action; unsigned int stream_start_timestamp; unsigned int stream_end_timestamp; unsigned int src_intra_ip; unsigned short src_intra_port; unsigned int src_extra_ip; unsigned short src_extra_port; unsigned int dst_ip; unsigned short dst_port; char protocol = FORMAT_LOG_PROTOCOL_UDP; }; #endif // NAT_FORMAT_H_