This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-kni/kni_comm.h

65 lines
1.8 KiB
C

#ifndef KNI_COMMON_H
#define KNI_COMMON_H
#ifndef KNI_MAX_THREADNUM
#define KNI_MAX_THREADNUM 64
#endif
#define FS2_COLUMN_NUM 13
#define FS2_APPNAME "KNI"
enum kni_FS_COLUME
{
FS2_COLUME_RECV=0,
FS2_COLUME_WRITE,
FS2_COLUME_READ,
FS2_COLUME_SEND,
FS2_COLUME_WITELIST_IP,
FS2_COLUME_WITELIST_DOMAIN,
FS2_COLUME_HTTP,
FS2_COLUME_SSL,
FS2_COLUME_DROPPKT,
FS2_COLUME_CLIENTHELLO,
FS2_COLUME_SNI,
FS2_COLUME_DROP_SAPP,
FS2_COLUME_DROP_TUN,
};
//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 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_data(const struct streaminfo* pstream,int* datalen);
int kni_filestate2_set(int thread_seq,int 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