feat: Go转C

This commit is contained in:
2026-03-30 13:52:56 +08:00
parent fd0270084b
commit d5ef84200e
46 changed files with 14830 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
#ifndef OMNI_KCP_PACKET_DEBUG_H
#define OMNI_KCP_PACKET_DEBUG_H
#include "omni_common.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct kcp_packet_debug_segment {
uint8_t cmd;
uint32_t sn;
uint32_t una;
uint8_t frg;
uint16_t wnd;
uint32_t len;
} kcp_packet_debug_segment_t;
typedef struct kcp_packet_debug_record {
char event[OMNI_MAX_EVENT_NAME];
char node_role[OMNI_MAX_NODE_ROLE];
char node_id[OMNI_MAX_PEER_ID];
char local_addr[OMNI_MAX_ADDR_TEXT];
char remote_addr[OMNI_MAX_ADDR_TEXT];
int packet_bytes;
int has_udp_tx_id;
uint32_t udp_tx_id;
int has_kcp_conv;
uint32_t kcp_conv;
int64_t ts_unix_nano;
kcp_packet_debug_segment_t *segments;
size_t segment_count;
} kcp_packet_debug_record_t;
typedef struct kcp_packet_debug_logger {
omni_file_logger_t file_logger;
int enabled;
} kcp_packet_debug_logger_t;
kcp_packet_debug_logger_t *kcp_packet_debug_open_jsonl(const char *path);
void kcp_packet_debug_close(kcp_packet_debug_logger_t *logger);
int kcp_packet_debug_log(kcp_packet_debug_logger_t *logger, const kcp_packet_debug_record_t *record);
void kcp_packet_debug_record_clear(kcp_packet_debug_record_t *record);
#ifdef __cplusplus
}
#endif
#endif