2023-04-18 16:03:57 +08:00
|
|
|
#ifndef _TFE_CTRL_PACKET_H
|
|
|
|
|
#define _TFE_CTRL_PACKET_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cpluscplus
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2024-09-23 18:35:47 +08:00
|
|
|
#include <uuid/uuid.h>
|
2023-04-18 16:03:57 +08:00
|
|
|
|
|
|
|
|
enum session_state
|
|
|
|
|
{
|
|
|
|
|
SESSION_STATE_OPENING = 1,
|
|
|
|
|
SESSION_STATE_CLOSING = 2,
|
|
|
|
|
SESSION_STATE_ACTIVE = 3,
|
|
|
|
|
SESSION_STATE_RESETALL = 4,
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-21 16:41:59 +08:00
|
|
|
#define MAX_HIT_RULES 32
|
|
|
|
|
|
2023-04-18 16:03:57 +08:00
|
|
|
struct ctrl_pkt_parser
|
|
|
|
|
{
|
|
|
|
|
char tsync[4];
|
|
|
|
|
uint64_t session_id;
|
|
|
|
|
enum session_state state;
|
|
|
|
|
char method[32];
|
2024-09-23 18:35:47 +08:00
|
|
|
uuid_t tfe_policy_ids[MAX_HIT_RULES];
|
2023-04-18 16:03:57 +08:00
|
|
|
int tfe_policy_id_num;
|
2024-09-23 18:35:47 +08:00
|
|
|
uuid_t sce_policy_ids[MAX_HIT_RULES];
|
2023-04-18 16:03:57 +08:00
|
|
|
int sce_policy_id_num;
|
|
|
|
|
struct tfe_cmsg *cmsg;
|
2023-04-24 10:48:40 +08:00
|
|
|
|
|
|
|
|
struct sids seq_sids;
|
|
|
|
|
struct route_ctx seq_route_ctx;
|
|
|
|
|
struct sids ack_sids;
|
|
|
|
|
struct route_ctx ack_route_ctx;
|
2023-05-26 18:50:18 +08:00
|
|
|
char *seq_header;
|
|
|
|
|
int seq_len;
|
|
|
|
|
char *ack_header;
|
|
|
|
|
int ack_len;
|
|
|
|
|
// 0x01 is_single
|
|
|
|
|
// 0x02 is_tunnel
|
|
|
|
|
uint8_t intercpet_data;
|
2023-11-16 19:34:43 +08:00
|
|
|
uint8_t wsacle_client_flag;
|
|
|
|
|
uint8_t wsacle_server_flag;
|
2023-04-18 16:03:57 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const char *session_state_to_string(enum session_state state);
|
|
|
|
|
void ctrl_packet_parser_init(struct ctrl_pkt_parser *handler);
|
|
|
|
|
|
|
|
|
|
// return 0 : success
|
|
|
|
|
// return -1 : error
|
2024-03-26 18:24:53 +08:00
|
|
|
int ctrl_packet_parser_parse(void *ctx, const char* data, size_t length, void *logger, int debug);
|
2023-05-15 16:41:59 +08:00
|
|
|
void ctrl_packet_parser_dump(struct ctrl_pkt_parser *handler, void *logger);
|
2023-04-18 16:03:57 +08:00
|
|
|
|
2023-05-22 15:19:29 +08:00
|
|
|
void ctrl_packet_cmsg_destroy(struct ctrl_pkt_parser *handler);
|
|
|
|
|
|
2023-04-18 16:03:57 +08:00
|
|
|
#ifdef __cpluscplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|