104 lines
1.6 KiB
C
104 lines
1.6 KiB
C
#ifndef _PUB_H
|
|
#define _PUB_H
|
|
|
|
#ifdef __cpluscplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include <ctype.h>
|
|
#include <event2/buffer.h>
|
|
#include <tfe_resource.h>
|
|
#include <tfe_proxy.h>
|
|
#include <tfe_plugin.h>
|
|
#include <MESA/Maat_rule.h>
|
|
#include <MESA/MESA_prof_load.h>
|
|
#include <tfe_kafka_logger.h>
|
|
|
|
#include "dns.h"
|
|
|
|
#define MS_OK 0
|
|
#define MS_ERROR -1
|
|
|
|
enum pangu_http_stat
|
|
{
|
|
STAT_SESSION,
|
|
STAT_LOG_NUM,
|
|
STAT_ACTION_HIJACK,
|
|
DOH_STAT_MAX
|
|
};
|
|
|
|
enum table_type
|
|
{
|
|
TYPE_ADDR,
|
|
TYPE_APPID,
|
|
TYPE_QNAME,
|
|
TYPE_HOST,
|
|
TYPE_MAX
|
|
};
|
|
|
|
enum doh_content_type
|
|
{
|
|
DOH_TYPE_MESSAGE,
|
|
DOH_TYPE_UDPWIREFORMAT,
|
|
};
|
|
|
|
struct maat_table
|
|
{
|
|
int id;
|
|
char name[TFE_STRING_MAX];
|
|
};
|
|
|
|
struct doh_conf
|
|
{
|
|
int enable;
|
|
int thread_num;
|
|
|
|
void *local_logger;
|
|
|
|
int entry_id;
|
|
int en_sendlog;
|
|
const char *device_id;
|
|
const char *effective_device_tag;
|
|
tfe_kafka_logger_t *kafka_logger;
|
|
|
|
int fs_id[DOH_STAT_MAX];
|
|
long long stat_val[DOH_STAT_MAX];
|
|
struct event *gcev;
|
|
struct event_base *gc_evbase;
|
|
screen_stat_handle_t fs_handle;
|
|
|
|
Maat_feather_t maat;
|
|
struct maat_table tables[TYPE_MAX];
|
|
};
|
|
|
|
struct doh_ctx
|
|
{
|
|
int count;
|
|
u_int32_t min_ttl;
|
|
int thread_id;
|
|
int magic_num;
|
|
int manipulate;
|
|
int opts_num;
|
|
int vsys_id;
|
|
size_t result_num;
|
|
Maat_rule_t *result;
|
|
cheat_pkt_opt_t *opts;
|
|
scan_status_t scan_mid;
|
|
enum doh_content_type type;
|
|
struct evbuffer *http_req_body;
|
|
dns_info_t *doh_req;
|
|
|
|
char *asn_client;
|
|
char *asn_server;
|
|
char *location_client;
|
|
char *location_server;
|
|
};
|
|
|
|
int base64_encode(char *dst, int dstlen, const char *src, int srclen);
|
|
int base64_decode(char *dst, int dstlen, const char *src, int srclen);
|
|
|
|
#ifdef __cpluscplus
|
|
}
|
|
#endif
|
|
#endif |