08 2011 档案

摘要:(1)系统调用 int nids_init() 初始化程序(2)int nids_init() 调用函数 init_procs(); 以下是该函数的实现代码: 1 staticvoid init_procs() 2 { 3 ip_frag_procs = mknew(struct proc_node); 4 ip_frag_procs->item = gen_ip_frag_proc; 5 ip_frag_procs->next =0; 6 ip_procs = mknew(struct proc_node); 7 ip_procs->item = g... 阅读全文
posted @ 2011-08-29 16:39 戴安澜式编程 阅读(2748) 评论(0) 推荐(0)
摘要:1 void 2 register_callback(struct proc_node **procs, void (*x)) 3 { 4 struct proc_node *ipp; 5 6 for (ipp =*procs; ipp; ipp = ipp->next)//判断该回调函数是否存在 7 if (x == ipp->item) 8 return; 9 ipp = mknew(struct proc_node);10 ipp->item = x;11 ipp->next =*procs;12 *procs = ipp;13 }采用函数链表存储处理函数,采用前 阅读全文
posted @ 2011-08-29 13:55 戴安澜式编程 阅读(595) 评论(0) 推荐(1)
摘要:if (!(a_tcp = find_stream(this_tcphdr, this_iphdr, &from_client))) {//没有找到 if ((this_tcphdr->th_flags & TH_SYN) && //报文头SYN为1!(this_tcphdr->th_flags & TH_ACK) &&//报文头ACK为0!(this_tcphdr->th_flags & TH_RST))//报文头RST为0 add_new_tcp(this_tcphdr, this_iphdr);//加入新包 阅读全文
posted @ 2011-08-26 14:38 戴安澜式编程 阅读(444) 评论(0) 推荐(0)
摘要:[1] IP四元组hashu_intmkhash (u_int src, u_short sport, u_int dest, u_short dport){ u_int res = 0; int i; u_char data[12]; u_int *stupid_strict_aliasing_warnings=(u_int*)data; *stupid_strict_aliasing_warnings = src; *(u_int *) (data + 4) = dest; *(u_short *) (data + 8) = sport; *(u_short *) (data + 10) 阅读全文
posted @ 2011-08-26 11:46 戴安澜式编程 阅读(777) 评论(0) 推荐(0)
摘要:1、主页地址:http://www.pcre.org/ 下载pcre-7.8.tar.bz22、解压缩: tar xjpf pcre-7.8.tar.bz23、配置: cd pcre-7.8 ./configure --prefix=/usr/local/pcre-7.8 --libdir=/usr/local/lib/pcre --includedir=/usr/local/include/pcre configure有许多参数可配,具体参见./configure --help及手册4、编译: make5、安装: make install6、检查: ls /usr/local 检查是否有pc 阅读全文
posted @ 2011-08-17 16:26 戴安澜式编程 阅读(24477) 评论(0) 推荐(1)