随笔分类 -  网络数据处理

摘要:转载注明出处:http://www.cnblogs.com/renhao/archive/2011/12/16/2289823.html问题1:Packet size limited during capture解决方案(来源):http://blogold.chinaunix.net/u2/71257/showart.php?id=2320384在linux下用tcpdump抓取http数据包,之后用wireshark打开,发现数据包的内容是不全的,如图:这时,想分析和获取http包中的内容是不可能是,在图中可以发现,wireshark给出了“Packet size limited duri 阅读全文
posted @ 2011-12-16 10:27 戴安澜式编程 阅读(2110) 评论(0) 推荐(0)
摘要:DNS解析 API文档参考英文文档:http://docstore.mik.ua/orelly/networking_2ndEd/dns/ch15_02.htmhttp://www.opensource.apple.com/source/libresolv/libresolv-46/ns_name.c一.工具函数集合(1)int ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)功能: 该函数将网络域名格式【eg:3www5baidu3com0】转换为通常类型的域名格式【www.baidu.com】返回:写到buffer中的字节数 阅读全文
posted @ 2011-11-14 16:01 戴安澜式编程 阅读(3366) 评论(0) 推荐(0)
摘要:(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 戴安澜式编程 阅读(2746) 评论(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 戴安澜式编程 阅读(775) 评论(0) 推荐(0)