100 lines
2.6 KiB
C
100 lines
2.6 KiB
C
#ifndef KNI_COMMON_H
|
|
#define KNI_COMMON_H
|
|
|
|
|
|
#ifndef KNI_MAX_THREADNUM
|
|
#define KNI_MAX_THREADNUM 64
|
|
#endif
|
|
|
|
|
|
#define FS2_COLUMN_NUM 43
|
|
#define FS2_APPNAME "KNI"
|
|
|
|
|
|
enum kni_FS_COLUME
|
|
{
|
|
COLUME_TCPALL_ENTRY=0,
|
|
COLUME_UDP_ENTRY,
|
|
COLUME_IP_ENTRY,
|
|
COLUME_WITELIST_IP,
|
|
COLUME_WITELIST_DOMAIN,
|
|
COLUME_INTERCEPT,
|
|
COLUME_RATELIMIT,
|
|
COLUME_REPLACE,
|
|
COLUME_HTTP,
|
|
COLUME_SSL,
|
|
COLUME_TCP_NOT_HTTPSSL,
|
|
COLUME_TUN_WRITE,
|
|
COLUME_TUN_READ,
|
|
COLUME_SEND_PKT,
|
|
COLUME_CLIENTHELLO,
|
|
COLUME_SNI,
|
|
COLUME_DROP_IPV6OPT,
|
|
COLUME_DROP_NOIN_HTABLE,
|
|
COLUME_DROP_NOTIPV46_SAPP,
|
|
COLUME_DROP_NOTIPV46_TUN,
|
|
COLUME_DROP_ADDHTABLE_ERROR,
|
|
COLUME_DROPPKT_OTHER,
|
|
COLUME_TCPREPAIR_TOTAL,
|
|
COLUME_TCPREPAIR_SOCKET_ERR,
|
|
COLUME_TCPREPAIR_ERROR,
|
|
COLUME_TCPREPAIR_JOINLQ_ERR,
|
|
COLUME_TCPREPAIR_GETLQ_ERR,
|
|
COLUME_TCPREPAIR_SEND_SUCC,
|
|
COLUME_TCPREPAIR_SEND_ERR,
|
|
COLUME_ADD_LQUEUE_SUCC,
|
|
COLUME_ADD_LQUEUE_ERR,
|
|
COLUME_GET_LQUEUE_SUCC,
|
|
COLUME_GET_LQUEUE_ERR,
|
|
COLUME_WRITE_TUN_SUCC,
|
|
COLUME_WRITE_TUN_ERR,
|
|
COLUME_PENDING,
|
|
COLUME_CLOSE_TIMEOUT,
|
|
COLUME_CLOSE_FIN,
|
|
COLUME_CLOSE_DROPME,
|
|
COLUME_PMENUM,
|
|
COLUME_REPLAY_WINDOW,
|
|
COLUME_HTABLE_ADD,
|
|
COLUME_HTABLE_DEL
|
|
};
|
|
|
|
|
|
//field stat2
|
|
struct kni_fs2_info
|
|
{
|
|
screen_stat_handle_t handler;
|
|
int column_id[FS2_COLUMN_NUM];
|
|
unsigned long long column_value_pkt[KNI_MAX_THREADNUM][FS2_COLUMN_NUM];
|
|
unsigned long long column_value_bytes[KNI_MAX_THREADNUM][FS2_COLUMN_NUM];
|
|
int metric_tun_read;
|
|
int metric_forward;
|
|
int metric_sapp_proc;
|
|
int metric_tcprepair;
|
|
int metric_tun_write;
|
|
int metric_sendfd;
|
|
int metric_qout_fd;
|
|
int metric_qout_pkt;
|
|
};
|
|
|
|
|
|
|
|
int kni_log_info(char* module,const struct layer_addr* addr,unsigned short protocol,char* domain,char* scan_result,char* action,struct kni_pme_info* pmeinfo);
|
|
int kni_log_debug(int level,char* module,const void* a_packet,const char * format,...);
|
|
int kni_get_ipaddr_v4(void* a_packet,struct stream_tuple4_v4* ipaddr);
|
|
int kni_get_ipaddr_v6(void* a_packet,struct stream_tuple4_v6* ipaddr);
|
|
|
|
int kni_get_tcpinfo(struct kni_wndpro_reply_info* lastpkt_info,struct kni_tcp_hdr* tcphdr,int tcplen);
|
|
int kni_get_tcpopt(struct kni_tcp_hdr* tcphdr,int tcp_hdr_len,unsigned short* mss,unsigned char* winscale,unsigned char* scak,unsigned char* timestamps);
|
|
char* kni_get_payload(const struct streaminfo* pstream,int* datalen);
|
|
|
|
int kni_filestate2_set(int thread_seq,enum kni_FS_COLUME colum_index,int bytes,int pktnum);
|
|
void* kni_filestat2(void* arg);
|
|
int kni_order_action(int old_action,int new_action);
|
|
|
|
int kni_process_maatresult(int result_num,struct Maat_rule_t* maat_result,struct kni_pme_info* pmeinfo);
|
|
char* kni_memncasemem(const char *strsrc,int len1,const char *substr,int len2);
|
|
|
|
|
|
#endif
|
|
|