39 lines
650 B
C
39 lines
650 B
C
|
|
#ifndef _CTRL_PACKET_H
|
||
|
|
#define _CTRL_PACKET_H
|
||
|
|
|
||
|
|
#ifdef __cpluscplus
|
||
|
|
extern "C"
|
||
|
|
{
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
enum session_state
|
||
|
|
{
|
||
|
|
SESSION_STATE_OPENING = 1,
|
||
|
|
SESSION_STATE_CLONING = 2,
|
||
|
|
SESSION_STATE_ACTIVE = 3,
|
||
|
|
SESSION_STATE_RESETALL = 4,
|
||
|
|
};
|
||
|
|
|
||
|
|
struct ctrl_pkt_parser
|
||
|
|
{
|
||
|
|
char tsync[4];
|
||
|
|
uint64_t session_id;
|
||
|
|
enum session_state state;
|
||
|
|
int policy_ids[32];
|
||
|
|
int policy_id_num;
|
||
|
|
};
|
||
|
|
|
||
|
|
void ctrl_packet_parser_init(struct ctrl_pkt_parser *handler);
|
||
|
|
|
||
|
|
// return 0 : success
|
||
|
|
// return -1 : error
|
||
|
|
int ctrl_packet_parser_parse(struct ctrl_pkt_parser *handler, const void *data, size_t length);
|
||
|
|
|
||
|
|
#ifdef __cpluscplus
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|