2024-08-23 17:53:01 +08:00
|
|
|
#ifndef NAT_FORMAT_H_
|
|
|
|
|
#define NAT_FORMAT_H_
|
|
|
|
|
|
|
|
|
|
#include <MESA/stream.h>
|
|
|
|
|
#include <MESA/MESA_handle_logger.h>
|
|
|
|
|
#include <MESA/MESA_prof_load.h>
|
|
|
|
|
|
|
|
|
|
#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 {
|
2024-08-26 18:31:05 +08:00
|
|
|
u_int32_t batch_size;
|
2024-08-23 17:53:01 +08:00
|
|
|
char host_ip[64];
|
2024-08-27 11:02:31 +08:00
|
|
|
int32_t host_port;
|
2024-08-23 17:53:01 +08:00
|
|
|
char multicast_ip[64];
|
2024-08-27 11:02:31 +08:00
|
|
|
int32_t multicast_port;
|
2024-08-23 17:53:01 +08:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2024-08-26 18:19:47 +08:00
|
|
|
char log_path[256];
|
2024-08-23 17:53:01 +08:00
|
|
|
u_int32_t log_level;
|
|
|
|
|
void *log;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 格式化NAT报文载荷
|
|
|
|
|
struct nat_payload {
|
|
|
|
|
unsigned int magic_num = FORMAT_LOG_MAGIC_NUMBER;
|
2024-08-26 18:19:47 +08:00
|
|
|
unsigned short version = FORMAT_LOG_VERSION;
|
2024-08-23 17:53:01 +08:00
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-27 11:02:31 +08:00
|
|
|
extern "C" int nat_format_init(void);
|
|
|
|
|
extern "C" void nat_format_destroy(void);
|
|
|
|
|
extern "C" char nat_format_entry(struct streaminfo *a_udp, void **pme, int thread_seq, void *a_packet);
|
|
|
|
|
|
2024-08-23 17:53:01 +08:00
|
|
|
#endif // NAT_FORMAT_H_
|