feat: adapt to stellar-2.0

This commit is contained in:
lijia
2024-06-07 19:03:56 +08:00
parent 1ab2559887
commit 82cd2ced07
17 changed files with 605 additions and 723 deletions

View File

@@ -1,55 +1,41 @@
/*
* quic.h
*
* Created on: 2021-11-08
* Author: liuxueli
*/
#pragma once
#ifndef __QUIC_H__
#define __QUIC_H__
#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_USEING_VERSION (1<<QUIC_USEING_VERSION_MASK)
#define QUIC_NEGOTIATION_VERSION (1<<QUIC_NEGOTIATION_VERSION_MASK)
#define QUIC_REJECTION (1<<QUIC_REJECTION_MASK)
enum quic_interested_region
#ifdef __cplusplus
extern "C"
{
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_USEING_VERSION_MASK,
QUIC_NEGOTIATION_VERSION_MASK,
QUIC_REJECTION_MASK
#endif
enum quic_message_type
{
QUIC_NEW = 0,
QUIC_VERSION,
QUIC_SNI,
QUIC_USER_AGENT,
QUIC_PAYLOAD,
QUIC_FREE,
QUIC_MSG_MAX,
};
struct quic_client_hello
#define QUIC_DECODER_TOPIC "QUIC_DECODER_MESSAGE"
struct quic_message;
enum quic_message_type quic_message_type_get(const struct quic_message *msg);
struct qstring
{
char *sni;
char *user_agent;
const char *str;
size_t str_len;
};
struct quic_info
{
unsigned int quic_version;
struct quic_client_hello *client_hello;
};
void quic_message_get_version(const struct quic_message *msg, unsigned int *result);
void quic_message_get_sni(const struct quic_message *msg, struct qstring *result);
void quic_message_get_user_agent(const struct quic_message *msg, struct qstring *result);
void quic_message_get_payload(const struct quic_message *msg, struct qstring *result);
//buff_len minimun 32bytes
int quic_version_int2string(unsigned int version, char *buff, int buff_len);
//ret: NULL: not quic, quic_info: quic version
struct quic_info *quic_protocol_identify(const struct streaminfo *a_stream);
#endif /* SRC__QUIC_H__ */
#ifdef __cplusplus
}
#endif