101 lines
1.6 KiB
C
101 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.h>
|
|
#include <MESA/MESA_prof_load.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_APPID,
|
|
TYPE_QNAME,
|
|
TYPE_HOST,
|
|
TYPE_MAX
|
|
};
|
|
|
|
enum doh_content_type
|
|
{
|
|
DOH_TYPE_MESSAGE,
|
|
DOH_TYPE_UDPWIREFORMAT,
|
|
};
|
|
|
|
struct doh_conf
|
|
{
|
|
int enable;
|
|
int thread_num;
|
|
|
|
void *local_logger;
|
|
|
|
int entry_id;
|
|
int en_sendlog;
|
|
const char *effective_device_tag;
|
|
|
|
int fs_id[DOH_STAT_MAX];
|
|
long long stat_val[DOH_STAT_MAX];
|
|
struct event *gcev;
|
|
struct event_base *gc_evbase;
|
|
struct fieldstat_easy *fs_handle;
|
|
|
|
struct maat *maat;
|
|
};
|
|
|
|
struct doh_maat_rule_t
|
|
{
|
|
int vsys_id;
|
|
long long config_id;
|
|
uuid_t config_uuid;
|
|
char *config_uuid_string;
|
|
int service_id;
|
|
unsigned char do_log;
|
|
unsigned char do_blacklist;
|
|
unsigned char action;
|
|
char *action_parameter;
|
|
};
|
|
|
|
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;
|
|
struct doh_maat_rule_t *result;
|
|
cheat_pkt_opt_t *opts;
|
|
struct maat_state *scan_mid;
|
|
enum doh_content_type type;
|
|
struct evbuffer *http_req_body;
|
|
dns_info_t *doh_req;
|
|
};
|
|
|
|
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 |