2012年3月8日
摘要: /** * Search for a black hole node. */voidNEIGHBOURS::SearchForBlackHole(int percentile_of_loss, int32_t ownIP, int heartbeat_malicious, int immediate_reaction_duration, double pktime) { int j; char text[200]; char protocol_name[MAX_PROTOCOL_NAME]; neighbour *n; double percentage; ... 阅读全文
posted @ 2012-03-08 15:20 Fuzzy Joke 阅读(295) 评论(0) 推荐(0) 编辑
摘要: /** * A packet from a neighbour has been detected. */voidWATCHDOG::neighboursPacketDetected(int32_t source_ip, int32_t destination_ip, int source_mac, int destination_mac, int sourcePort, int destinationPort, char * tmp_data, packet_t packet_type, double pktime) { if (debug > 2) printf("Neig 阅读全文
posted @ 2012-03-08 14:33 Fuzzy Joke 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 节点发送数据包,则将数据包缓存。/** * I read my own packet. */voidWATCHDOG::ownPacketDetected(int32_t source_ip, int32_t destination_ip, int sourcePort, int destinationPort, int mac_dst, char * tmp_data, packet_t packet_type, double pktime) { if (debug > 2) printf("Ownpacket\n"); int data_size; neighbo 阅读全文
posted @ 2012-03-08 14:11 Fuzzy Joke 阅读(309) 评论(0) 推荐(0) 编辑
摘要: watchdog读取数据包,维护以下四个包计数器。 float readed_packets; float ip_packets; float arp_packets; float interesting_readed_packets;如果是ARP,AODV数据包,则维护邻居。如果是IP报文,则interesting_readed_packets++。若接收到的是来源于自身的报文,则调用ownPacketDetected,否则维护邻居表,并针对非广播报文调用neighboursPacketDetected/** * Read one packet of the netw... 阅读全文
posted @ 2012-03-08 13:51 Fuzzy Joke 阅读(381) 评论(0) 推荐(0) 编辑
摘要: /*Constructor*/WATCHDOG::WATCHDOG(int32_t own_IP) { port = PORTW; //Port of the GW. devalue = 0; //Devalue old packets. readed_packets = 0; ip_packets = 0; arp_packets = 0; interesting_readed_packets = 0; heartbeat_malicious = HEARTBEAT_MALICIOUS_NODE; immediate_reaction_dura... 阅读全文
posted @ 2012-03-08 12:44 Fuzzy Joke 阅读(374) 评论(0) 推荐(0) 编辑