100 lines
2.6 KiB
C
100 lines
2.6 KiB
C
/*
|
|
* quic.h
|
|
*
|
|
* Created on: 2019-4-4
|
|
* Author: root
|
|
*/
|
|
|
|
#ifndef SRC_GQUIC_H_
|
|
#define SRC_GQUIC_H_
|
|
|
|
|
|
|
|
#include <MESA/stream.h>
|
|
#define MAX_EXTENSION_NUM 128
|
|
#define MAX_TAG_VALUE_LEN 257
|
|
#define SERVER_NAME_LEN 64
|
|
//add in 20191207
|
|
#define USER_AGENT_LEN 256
|
|
#define RANDOM_LEN 32
|
|
#define QUIC_VERSION_LEN 4
|
|
|
|
|
|
#define QUIC_INTEREST_KEY (1<<QUIC_INTEREST_KEY_MASK)
|
|
#define QUIC_CLIENT_HELLO (1<<QUIC_CLIENT_HELLO_MASK)
|
|
#define QUIC_SERVER_HELLO (1<<QUIC_SERVER_HELLO_MASK)
|
|
#define QUIC_CACHED_CERT (1<<QUIC_CACHED_CERT_MASK)
|
|
#define QUIC_COMM_CERT (1<<QUIC_COMM_CERT_MASK)
|
|
#define QUIC_CERT_CHAIN (1<<QUIC_CERT_CHAIN_MASK)
|
|
#define QUIC_APPLICATION_DATA (1<<QUIC_APPLICATION_DATA_MASK)
|
|
#define QUIC_VERSION (1<<QUIC_VERSION_MASK)
|
|
|
|
|
|
enum quic_interested_region {
|
|
QUIC_INTEREST_KEY_MASK = 0,
|
|
QUIC_CLIENT_HELLO_MASK,
|
|
QUIC_SERVER_HELLO_MASK,
|
|
QUIC_CACHED_CERT_MASK,
|
|
QUIC_COMM_CERT_MASK,
|
|
QUIC_CERT_CHAIN_MASK,
|
|
QUIC_APPLICATION_DATA_MASK,
|
|
QUIC_VERSION_MASK
|
|
};
|
|
|
|
|
|
typedef struct quic_tlv{
|
|
unsigned int type;
|
|
unsigned int length;
|
|
void *ptr_value;
|
|
}quic_tlv_t;
|
|
|
|
struct quic_business_info
|
|
{
|
|
void* param;
|
|
uint8_t return_value;
|
|
};
|
|
|
|
struct quic_client_hello {
|
|
int server_name_len;
|
|
char server_name[SERVER_NAME_LEN];
|
|
int user_agent_len;
|
|
char user_agent[USER_AGENT_LEN];
|
|
uint16_t ext_tag_num; //number of extensions or tags
|
|
quic_tlv_t** ext_tags; //extensions or tags
|
|
};
|
|
|
|
struct quic_server_hello {
|
|
/*include random,session,ciphersuit,compress_method...*/
|
|
uint16_t ext_tag_num; //number of extensions or tags
|
|
quic_tlv_t** ext_tags; //extensions or tags
|
|
};
|
|
|
|
|
|
struct quic_stream {
|
|
unsigned char link_state;
|
|
uint8_t version_cfm;
|
|
uint32_t version;
|
|
uint8_t fin_flag;
|
|
uint8_t is_quic_stream;
|
|
uint64_t gquic_cID;
|
|
struct quic_client_hello st_client_hello;
|
|
struct quic_server_hello st_server_hello;
|
|
struct quic_tlv cert_chain;
|
|
struct quic_tlv cached_cert;
|
|
struct quic_tlv common_cert;
|
|
struct quic_business_info* business;
|
|
enum quic_interested_region output_region_mask;
|
|
uint64_t output_region_flag;
|
|
};
|
|
|
|
//struct st_quic_client_hello* quic_get_clienthello(void* app_info);
|
|
//struct st_quic_server_hello* quic_get_serverhello(void* app_info);
|
|
//uint32_t quic_get_version(void* app_info);
|
|
//quic_tlv_t* quic_get_cert_chain(void* app_info);
|
|
//quic_tlv_t* quic_get_cached_cert(void* app_info);
|
|
//quic_tlv_t* quic_get_common_cert(void* app_info);
|
|
//void* quic_get_application_data(void* app_info);
|
|
|
|
|
|
#endif /* SRC_GQUIC_H_ */
|