使用cmsg公共库解析cmsg信息,对业务层提供获取cmsg句柄的接口

This commit is contained in:
luqiuwen
2019-06-01 17:00:36 +08:00
parent 1b872c246d
commit 77aa3063f7
11 changed files with 133 additions and 283 deletions

View File

@@ -9,28 +9,34 @@ enum tfe_cmsg_errno
{
TFE_CMSG_INVALID_FORMAT = -1,
TFE_CMSG_BUFF_NOT_ENOUGH = -2,
TFE_CMSG_INVALID_TYPE = -3
TFE_CMSG_INVALID_TYPE = -3,
};
enum tfe_cmsg_tlv_type
{
TCP_RESTORE_INFO_TLV_SEQ = 0,
TCP_RESTORE_INFO_TLV_ACK,
TCP_RESTORE_INFO_TLV_MSS_CLIENT,
TCP_RESTORE_INFO_TLV_MSS_SERVER,
TCP_RESTORE_INFO_TLV_WSACLE_CLIENT,
TCP_RESTORE_INFO_TLV_WSACLE_SERVER,
TCP_RESTORE_INFO_TLV_SACK_CLIENT,
TCP_RESTORE_INFO_TLV_SACK_SERVER,
TCP_RESTORE_INFO_TLV_TS_CLIENT,
TCP_RESTORE_INFO_TLV_TS_SERVER,
TCP_RESTORE_INFO_TLV_USER_DEFINED
/* TCP restore information */
TFE_CMSG_TCP_RESTORE_SEQ = 0x0,
TFE_CMSG_TCP_RESTORE_ACK = 0x1,
TFE_CMSG_TCP_RESTORE_MSS_CLIENT = 0x2,
TFE_CMSG_TCP_RESTORE_MSS_SERVER = 0x3,
TFE_CMSG_TCP_RESTORE_WSACLE_CLIENT = 0x4,
TFE_CMSG_TCP_RESTORE_WSACLE_SERVER = 0x5,
TFE_CMSG_TCP_RESTORE_SACK_CLIENT = 0x6,
TFE_CMSG_TCP_RESTORE_SACK_SERVER = 0x7,
TFE_CMSG_TCP_RESTORE_TS_CLIENT = 0x8,
TFE_CMSG_TCP_RESTORE_TS_SERVER = 0x9,
TFE_CMSG_TCP_RESTORE_PROTOCOL = 0xa,
TFE_CMSG_POLICY_ID = 0x10,
TFE_CMSG_STREAM_TRACE_ID = 0x11,
};
struct tfe_cmsg* tfe_cmsg_init();
void tfe_cmsg_destroy(struct tfe_cmsg *cmsg);
int tfe_cmsg_get(struct tfe_cmsg *cmsg, uint16_t type, uint16_t *size, unsigned char **pvalue);
int tfe_cmsg_set(struct tfe_cmsg *cmsg, uint16_t type, const unsigned char *value, uint16_t size);
int tfe_cmsg_get_value(struct tfe_cmsg * cmsg, enum tfe_cmsg_tlv_type type, char * out_value,
size_t sz_out_value_buf, uint16_t * out_size);
int tfe_cmsg_set(struct tfe_cmsg * cmsg, enum tfe_cmsg_tlv_type type, const unsigned char * value, uint16_t size);
uint16_t tfe_cmsg_serialize_size_get(struct tfe_cmsg *cmsg);
int tfe_cmsg_serialize(struct tfe_cmsg *cmsg, unsigned char *buff, uint16_t bufflen, uint16_t *serialize_len);
int tfe_cmsg_deserialize(const unsigned char *data, uint16_t len, struct tfe_cmsg** pcmsg);