diff options
Diffstat (limited to 'src/gquic.h')
| -rw-r--r-- | src/gquic.h | 91 |
1 files changed, 39 insertions, 52 deletions
diff --git a/src/gquic.h b/src/gquic.h index 2349548..6cbcdf5 100644 --- a/src/gquic.h +++ b/src/gquic.h @@ -8,24 +8,6 @@ #ifndef SRC_GQUIC_H_ #define SRC_GQUIC_H_ -enum GQUIC_VERSION -{ - GQUIC_UNKNOWN=0, - GQUIC_OTHERS, - GQUIC_Q046 -}; - - -#include <MESA/stream.h> -#define MAX_EXTENSION_NUM 128 -#define MAX_TAG_VALUE_LEN 257 -#define SERVER_NAME_LEN 128 -//add in 20191207 -#define USER_AGENT_LEN 512 -#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) @@ -47,50 +29,55 @@ enum quic_interested_region { QUIC_VERSION_MASK }; - -typedef struct quic_tlv{ +typedef struct _quic_tlv +{ unsigned int type; unsigned int length; - void *ptr_value; + void *value; }quic_tlv_t; -struct quic_business_info +#define MAX_CONNECT_ID_LEN 18 + +struct _quic_public_header { - void* param; - uint8_t return_value; + unsigned char public_flags; + unsigned int quic_version; + unsigned int server_CID_len; + unsigned int client_CID_len; + unsigned long long packet_number; + unsigned char server_CID[MAX_CONNECT_ID_LEN]; ////use first 8 bytes if GQUIC version 1~43 + unsigned char client_CID[MAX_CONNECT_ID_LEN]; // no used if GQUIC version 1~43 }; - -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 _gquic_frame_header +{ + unsigned char frame_type; + unsigned char fin_state; + unsigned short data_len; + unsigned int stream_id; + unsigned long long offset; }; -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 count; + unsigned char sni_idx; + unsigned char ua_idx; + unsigned char ver_idx; + unsigned int 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 _quic_info +{ + struct _quic_stream *rej; + struct _quic_stream *client_hello; + struct _quic_stream *server_hello; + struct _gquic_frame_header frame_hdr; + struct _quic_public_header quic_hdr; }; +//buff_len minimun 32bytes +int quic_version_int2string(unsigned int version, char *buff, int buff_len); + #endif /* SRC_GQUIC_H_ */ |
