99 lines
1.8 KiB
C
99 lines
1.8 KiB
C
|
|
#define HTTP_PROJECT_NAME "kni_http_tag"
|
|
#define BURST_MAX 1
|
|
|
|
enum kni_protocol{
|
|
KNI_PROTOCOL_UNKNOWN = 0,
|
|
KNI_PROTOCOL_SSL,
|
|
KNI_PROTOCOL_HTTP,
|
|
};
|
|
|
|
struct http_project{
|
|
int host_len;
|
|
char host[KNI_DOMAIN_MAX];
|
|
};
|
|
|
|
struct pme_info{
|
|
int protocol;
|
|
int action;
|
|
struct kni_tcpopt_info *client_tcpopt;
|
|
struct kni_tcpopt_info *server_tcpopt;
|
|
};
|
|
|
|
struct wrapped_packet{
|
|
char data[KNI_MTU];
|
|
};
|
|
|
|
struct tcp_option_restore{
|
|
uint8_t kind;
|
|
uint8_t len;
|
|
uint16_t offset;
|
|
};
|
|
|
|
struct kni_marsio_handle{
|
|
struct mr_instance *instance;
|
|
struct mr_vdev *dev_handler;
|
|
struct mr_sendpath *dev_sendpath;
|
|
};
|
|
|
|
struct protocol_identify_result{
|
|
int protocol;
|
|
char domain[KNI_DOMAIN_MAX];
|
|
int domain_len;
|
|
};
|
|
|
|
//TODO: 有些字段可以不要
|
|
struct pkt_info{
|
|
struct iphdr *iphdr;
|
|
int iphdr_len;
|
|
int ip_totlen;
|
|
struct tcphdr *tcphdr;
|
|
int tcphdr_len;
|
|
char *data;
|
|
int data_len;
|
|
};
|
|
|
|
enum tcp_restore_info_tlv_type
|
|
{
|
|
TCP_RESTORE_INFO_TLV_SEQ,
|
|
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 tcp_restore_info_tlv
|
|
{
|
|
uint16_t type;
|
|
uint16_t length;
|
|
|
|
union
|
|
{
|
|
uint8_t value_as_uint8[0];
|
|
uint16_t value_as_uint16[0];
|
|
uint32_t value_as_uint32[0];
|
|
unsigned char value_as_string[0];
|
|
};
|
|
} __attribute__((packed));
|
|
|
|
struct tcp_restore_info_header
|
|
{
|
|
uint8_t __magic__[2]; /* Must be 0x4d, 0x5a */
|
|
uint16_t nr_tlvs;
|
|
struct tcp_restore_info_tlv tlvs[0];
|
|
} __attribute__((packed));
|
|
|
|
struct kni_handle{
|
|
int http_project_id;
|
|
struct kni_marsio_handle *marsio_handle;
|
|
struct kni_maat_handle *maat_handle;
|
|
void *logger;
|
|
};
|
|
|
|
#define TCP_RESTORE_HEADER_MAX 128 |