This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
mesa-platform-gquic/src/gquic.h

97 lines
2.2 KiB
C
Raw Normal View History

2020-05-12 12:18:02 +08:00
/*
* quic.h
*
* Created on: 2019-4-4
* Author: root
*/
#ifndef SRC_GQUIC_H_
#define SRC_GQUIC_H_
2020-05-22 18:44:00 +08:00
enum GQUIC_VERSION
{
GQUIC_UNKNOWN=0,
GQUIC_OTHERS,
GQUIC_Q046
};
2020-05-12 12:18:02 +08:00
#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)
#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
2020-05-20 11:01:38 +08:00
quic_tlv_t** ext_tags; //extensions or tags
2020-05-12 12:18:02 +08:00
};
struct quic_server_hello {
2020-05-20 11:01:38 +08:00
/*include random,session,ciphersuit,compress_method...*/
uint16_t ext_tag_num; //number of extensions or tags
quic_tlv_t** ext_tags; //extensions or tags
2020-05-12 12:18:02 +08:00
};
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;
2020-05-20 11:01:38 +08:00
struct quic_tlv cert_chain;
struct quic_tlv cached_cert;
struct quic_tlv common_cert;
2020-05-12 12:18:02 +08:00
struct quic_business_info* business;
enum quic_interested_region output_region_mask;
uint64_t output_region_flag;
};
#endif /* SRC_GQUIC_H_ */