2019-06-03 20:19:04 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#define KNI_CMSG_TLV_NR_MAX 64
|
|
|
|
|
struct kni_cmsg;
|
|
|
|
|
struct kni_cmsg_serialize_header;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum kni_cmsg_errno{
|
|
|
|
|
KNI_CMSG_INVALID_FORMAT = -1,
|
|
|
|
|
KNI_CMSG_BUFF_NOT_ENOUGH = -2,
|
2019-06-04 21:18:55 +08:00
|
|
|
KNI_CMSG_INVALID_TYPE = -3,
|
|
|
|
|
KNI_CMSG_TYPE_UNSET = -4,
|
2019-06-03 20:19:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum tfe_cmsg_tlv_type
|
|
|
|
|
{
|
|
|
|
|
/* 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,
|
2019-06-05 15:42:46 +08:00
|
|
|
TFE_CMSG_TCP_RESTORE_WINDOW_CLIENT = 0xb,
|
|
|
|
|
TFE_CMSG_TCP_RESTORE_WINDOW_SERVER = 0xc,
|
2019-06-03 20:19:04 +08:00
|
|
|
|
|
|
|
|
TFE_CMSG_POLICY_ID = 0x10,
|
|
|
|
|
TFE_CMSG_STREAM_TRACE_ID = 0x11,
|
|
|
|
|
|
|
|
|
|
TFE_CMSG_SSL_INTERCEPT_STATE, //size uint64_t, 0-passthrough, 1-intercept, 2-shutdown, referer from enum ssl_stream_action
|
|
|
|
|
TFE_CMSG_SSL_UPSTREAM_LATENCY, //size uint64_t, milisecond
|
|
|
|
|
TFE_CMSG_SSL_DOWNSTREAM_LATENCY, //size uint64_t, milisecond
|
|
|
|
|
TFE_CMSG_SSL_UPSTREAM_VERSION, //string, SSLv3 TLSv1 TLSv1.1 TLSv1.2 TLSv1.3 unknown
|
2019-06-05 15:42:46 +08:00
|
|
|
TFE_CMSG_SSL_DOWNSTREAM_VERSION,
|
2019-06-03 20:19:04 +08:00
|
|
|
TFE_CMSG_SSL_PINNING_STATE, //size uint64_t, 0-not pinning 1-pinning 2-maybe pinning
|
2019-06-05 15:42:46 +08:00
|
|
|
TFE_CMSG_SSL_CERT_VERIFY, //uint16_t
|
|
|
|
|
TFE_CMSG_SSL_ERROR //string
|
2019-06-03 20:19:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct kni_cmsg* kni_cmsg_init();
|
|
|
|
|
void kni_cmsg_destroy(struct kni_cmsg *cmsg);
|
|
|
|
|
int kni_cmsg_get(struct kni_cmsg *cmsg, uint16_t type, uint16_t *size, unsigned char **pvalue);
|
|
|
|
|
int kni_cmsg_set(struct kni_cmsg *cmsg, uint16_t type, const unsigned char *value, uint16_t size);
|
|
|
|
|
uint16_t kni_cmsg_serialize_size_get(struct kni_cmsg *cmsg);
|
|
|
|
|
int kni_cmsg_serialize(struct kni_cmsg *cmsg, unsigned char *buff, uint16_t bufflen, uint16_t *serialize_len);
|
|
|
|
|
int kni_cmsg_deserialize(const unsigned char *data, uint16_t len, struct kni_cmsg** pcmsg);
|