#pragma once #define TFE_CMSG_TLV_NR_MAX 64 struct tfe_cmsg; struct tfe_cmsg_serialize_header; enum tfe_cmsg_errno { TFE_CMSG_INVALID_FORMAT = -1, TFE_CMSG_BUFF_NOT_ENOUGH = -2, 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 }; 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); 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);