feat(integration decoders): http and glimpse_detector

compile pass, todo test
This commit is contained in:
yangwei
2024-08-20 19:01:06 +08:00
committed by lijia
parent 6e46dbf762
commit dafbecd49a
804 changed files with 66904 additions and 4 deletions

View File

@@ -0,0 +1,112 @@
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include </usr/include/bits/types/struct_iovec.h>
#ifdef __cplusplus
extern "C"
{
#endif
#include <stellar/session.h>
#include <stellar/stellar_mq.h>
#include <stellar/stellar_exdata.h>
#include <stellar/stellar.h>
#ifdef __cplusplus
}
#endif
struct packet{
const char *payload;
size_t payload_len;
u_int8_t dir; //FLOW_DIRECTION_C2S FLOW_DIRECTION_S2C
};
typedef struct packet stellar_message;
struct exdata_mgr{
const char *name;
int exdata_id;
void *arg;
void *user_ptr;
stellar_exdata_free *free_func;
struct exdata_mgr *next, *prev;
};
struct sub_topic_mgr{
int topic_id;
int plugin_id;
void *plugin_env;
};
struct topic_mgr{
struct topic_mgr *next, *prev;
const char *topic_name;
int topic_id;
stellar_msg_free_cb_func *pub_free_cb;
void *pub_free_arg;
struct sub_topic_cb_list *sub_free_cb_list_head;
};
struct stellar{
struct topic_mgr *topic_mgr_head;
struct exdata_mgr *exdata_mgr_head;
};
//todo, native stellar can't get addr
enum session_addr_type
{
SESSION_ADDR_TYPE_IPV4_TCP,
SESSION_ADDR_TYPE_IPV4_UDP,
SESSION_ADDR_TYPE_IPV6_TCP,
SESSION_ADDR_TYPE_IPV6_UDP,
SESSION_ADDR_TYPE_UNKNOWN,
__SESSION_ADDR_TYPE_MAX,
};
struct session_addr_ipv4{
uint32_t saddr; /* network order */
uint32_t daddr; /* network order */
uint16_t sport; /* network order */
uint16_t dport; /* network order */
};
#include <netinet/in.h>
#ifndef IPV6_ADDR_LEN
#define IPV6_ADDR_LEN (sizeof(struct in6_addr))
#endif
struct session_addr_ipv6
{
uint8_t saddr[IPV6_ADDR_LEN] ;
uint8_t daddr[IPV6_ADDR_LEN] ;
uint16_t sport; /* network order */
uint16_t dport; /* network order */
};
struct session_addr
{
union
{
struct session_addr_ipv4 ipv4;
struct session_addr_ipv6 ipv6;
};
};
struct session{
struct stellar *st;
enum session_state sess_state;
enum session_addr_type addr_type;
struct session_addr addr;
void *exdata;
struct packet pkt;
struct exdata_mgr *runtime_exdata_head;
};
struct plugin_mgr{
struct plugin_mgr *next, *prev;
int plugin_id;
void *plugin_env;
session_ctx_new_func *session_ctx_new;
session_ctx_free_func *session_ctx_free;
};
struct sub_topic_cb_list{
int plugin_id;
void *plugin_env;
on_session_msg_cb_func *sub_cb;
struct sub_topic_cb_list *next, *prev;
};