105 lines
2.5 KiB
C
105 lines
2.5 KiB
C
#ifndef KNI_COMMON_H
|
|
#define KNI_COMMON_H
|
|
|
|
|
|
#ifndef KNI_MAX_THREADNUM
|
|
#define KNI_MAX_THREADNUM 64
|
|
#endif
|
|
|
|
|
|
//#define FS2_COLUMN_NUM 44
|
|
#define FS2_APPNAME "KNI"
|
|
|
|
enum kni_FS_COLUME
|
|
{
|
|
FS_PENDING=0,
|
|
FS_CLOSE_TIMEOUT,
|
|
FS_CLOSE_FIN,
|
|
FS_CLOSE_DROPME,
|
|
FS_HTTP,
|
|
FS_SSL,
|
|
FS_CLIENT_HELLO,
|
|
FS_SNI,
|
|
FS_NOT_HTTP_SSL,
|
|
FS_NOT_DOUBLE,
|
|
FS_WHITELIST,
|
|
FS_INTERCEPT,
|
|
FS_RATELIMIT,
|
|
FS_REDIRECT,
|
|
FS_REDIRECT_REPLY,
|
|
FS_NOT_HIT,
|
|
FS_RATELIMIT_UDP,
|
|
FS_REPLACE_UDP,
|
|
FS_REPAIR_TOTAL,
|
|
FS_REPAIR_SOCK_ERR,
|
|
FS_REPAIR_SET_ERR,
|
|
FS_REPAIR_JOINLQ_ERR,
|
|
FS_REPAIR_SEND_SUCC,
|
|
FS_REPAIR_SEND_ERR,
|
|
FS_PKT_ADD_LQ_SUCC,
|
|
FS_PKT_ADD_LQ_ERR,
|
|
FS_PKT_GET_LQ_SUCC,
|
|
FS_PKT_GET_LQ_ERR,
|
|
FS_WR_PKTS,
|
|
FS_WR_ERR_PKTS,
|
|
FS_WR_BYTES,
|
|
FS_RD_PKTS,
|
|
FS_RD_BYTES,
|
|
FS_RX_PKTS,
|
|
FS_RX_BYTES,
|
|
FS_TX_PKTS,
|
|
FS_TX_BYTES,
|
|
FS_DROP_IPV6OPT,
|
|
FS_DROP_NOTIN_HTABLE,
|
|
FS_DROP_NOTIPV46_SAPP,
|
|
FS_DROP_NOTIPV46_TUN,
|
|
FS_DROP_ADDHTABLE_ERROR,
|
|
FS_PMENUM,
|
|
FS_REPLAY_WINDOW,
|
|
FS_HTABLE_ADD,
|
|
FS_HTABLE_DEL,
|
|
FS_PRO_ERROR,
|
|
FS2_COLUMN_NUM
|
|
};
|
|
|
|
|
|
//field stat2
|
|
struct kni_fs2_info
|
|
{
|
|
screen_stat_handle_t handler;
|
|
int field_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(const 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, const 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);
|
|
void kni_get_tcpopt(struct kni_tcp_hdr* tcphdr,int tcp_hdr_len,
|
|
unsigned short* mss, unsigned char* wscale_perm, unsigned char* wscale, unsigned char* sack, 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
|
|
|