first add
This commit is contained in:
118
test/dpkt_plug_gquic.cpp
Normal file
118
test/dpkt_plug_gquic.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
|
||||
#include "dpkt_plug_gquic.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
#include "gquic.h"
|
||||
|
||||
|
||||
void a_ntoa( unsigned int in, char *buffer)
|
||||
{
|
||||
unsigned char *bytes = (unsigned char *) ∈
|
||||
int i = snprintf( buffer, 15, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3] );
|
||||
}
|
||||
|
||||
int DPKT_GQUIC_INIT()
|
||||
{
|
||||
int plugid = DK_PLUGID_GQUIC;
|
||||
return plugid;
|
||||
}
|
||||
|
||||
void DPKT_GQUIC_DESTROY()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
char DPKT_GQUIC_ENTRY(stSessionInfo* session_info, void **pme, int _thread_num, struct streaminfo *pstream, void *a_packet)
|
||||
{
|
||||
int thread_num = pstream->threadnum;
|
||||
|
||||
if(session_info->session_state & SESSION_STATE_CLOSE)
|
||||
{
|
||||
return PROT_STATE_GIVEME;
|
||||
}
|
||||
|
||||
if(session_info->app_info ==NULL)
|
||||
{
|
||||
return PROT_STATE_GIVEME;
|
||||
}
|
||||
|
||||
if(session_info->prot_flag == QUIC_CLIENT_HELLO){
|
||||
printf("DPKT_QUIC_ENTRY\tQUIC_CLIENT_HELLO\n");
|
||||
struct quic_stream *quic = (struct quic_stream*)session_info->app_info;
|
||||
if(quic){
|
||||
struct quic_client_hello client_hello = quic->st_client_hello;
|
||||
|
||||
printf("BUSINESS PLUG:QUIC_CLIENT_HELLO ext_tag_num=%d--------------------\n",client_hello.ext_tag_num);
|
||||
if(quic->version){
|
||||
printf("BUSINESS PLUG:QUIC_CLIENT_HELLO version=%d--------------------\n",quic->version);
|
||||
|
||||
}
|
||||
if(client_hello.server_name){
|
||||
printf("BUSINESS PLUG:QUIC_CLIENT_HELLO server_name=%s--------------------\n",client_hello.server_name);
|
||||
|
||||
}
|
||||
if(client_hello.user_agent){
|
||||
printf("BUSINESS PLUG:QUIC_CLIENT_HELLO user_agent=%s--------------------\n",client_hello.user_agent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int i = 0, j = 0;
|
||||
if(session_info->prot_flag == QUIC_VERSION){
|
||||
printf("DPKT_QUIC_ENTRY\tQUIC_VERSION\n");
|
||||
struct quic_stream *quic = (struct quic_stream*)session_info->app_info;
|
||||
if(quic){
|
||||
printf("version:%d\n",quic->version);
|
||||
}
|
||||
}
|
||||
|
||||
if(session_info->prot_flag == QUIC_SERVER_HELLO){
|
||||
printf("DPKT_QUIC_ENTRY\tQUIC_SERVER_HELLO\n");
|
||||
struct quic_stream *quic = (struct quic_stream*)session_info->app_info;
|
||||
struct quic_server_hello server_hello = quic->st_server_hello;
|
||||
printf("BUSINESS PLUG:QUIC_SERVER_HELLO ext_tag_num=%d--------------------\n",server_hello.ext_tag_num);
|
||||
}
|
||||
|
||||
if(session_info->prot_flag == QUIC_CACHED_CERT){
|
||||
printf("DPKT_QUIC_ENTRY\tQUIC_CACHED_CERT\n");
|
||||
struct quic_stream *quic = (struct quic_stream*)session_info->app_info;
|
||||
quic_tlv_t cached_cert = quic->cached_cert;
|
||||
printf("--------------------BUSINESS PLUG:QUIC_CACHED_CERT cached_cert_length=%d--------------------\n",cached_cert.length);
|
||||
for(i = 0; i < cached_cert.length; i++){
|
||||
printf("%02X",((unsigned char*)cached_cert.ptr_value)[i]);
|
||||
}
|
||||
printf("----------------------------------------\n");
|
||||
}
|
||||
|
||||
if(session_info->prot_flag == QUIC_COMM_CERT){
|
||||
printf("DPKT_QUIC_ENTRY\tQUIC_COMM_CERT\n");
|
||||
struct quic_stream *quic = (struct quic_stream*)session_info->app_info;
|
||||
quic_tlv_t comm_cert = quic->common_cert;
|
||||
printf("--------------------BUSINESS PLUG:QUIC_COMM_CERT common_cert_length=%d--------------------\n",comm_cert.length);
|
||||
for(i = 0; i < comm_cert.length; i++){
|
||||
printf("%02X",((unsigned char*)comm_cert.ptr_value)[i]);
|
||||
}
|
||||
printf("--------------------T--------------------\n");
|
||||
}
|
||||
|
||||
if(session_info->prot_flag == QUIC_CERT_CHAIN){
|
||||
printf("DPKT_QUIC_ENTRY\tQUIC_CERT_CHAIN\n");
|
||||
struct quic_stream *quic = (struct quic_stream*)session_info->app_info;
|
||||
quic_tlv_t cert_chain = quic->cert_chain;
|
||||
printf("--------------------BUSINESS PLUG:QUIC_CERT_CHAIN cert_chain_length=%d--------------------\n",cert_chain.length);
|
||||
for(i = 0; i < cert_chain.length; i++){
|
||||
printf("%02X",((unsigned char*)cert_chain.ptr_value)[i]);
|
||||
}
|
||||
printf("----------------------------------------\n");
|
||||
}
|
||||
|
||||
|
||||
return PROT_STATE_GIVEME;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user