00001 00047 #ifndef _SNOOP_H 00048 #define _SNOOP_H 00049 #include "common.h" 00050 00052 00056 #define MAXNEIGHBORS 10 00057 00059 00064 #define ALARM_TIMEOUT 3 00065 00066 00068 typedef enum {EXPIRED, LIVE, BAD} r_state; 00069 00071 typedef struct{ 00072 00074 u_int8_t src_ether[6]; 00075 00077 u_int8_t src_ip6[16]; 00078 00080 r_state route_state; 00081 00083 u_int32_t dropcount; 00084 00086 clock_t expiry; 00087 00088 } neighbor; 00089 00091 typedef struct{ 00092 00094 u_int8_t ether_addr[6]; 00095 00097 u_int8_t ip6_addr[16]; 00098 00100 time_t when_detected; 00101 00103 u_int32_t dropcount; 00104 00105 } intruder; 00106 00108 00110 void SIGALRM_handler(int); 00111 00113 00117 void timer_update_state(void); 00118 00120 00124 void pkt_callback(u_char *, const struct pcap_pkthdr *, const u_char*); 00125 00127 00130 u_int16_t handle_ethernet(u_char *, const struct pcap_pkthdr *, const u_char*); 00131 00133 00137 int handle_IPv6(u_char *, const struct pcap_pkthdr *, const u_char*); 00138 00140 00143 int handle_AODV(const u_char*); 00144 00146 00149 int find_neighbor(neighbor *); 00150 00152 int add_neighbor(neighbor *); 00153 00155 void print_neighbors(void); 00156 00158 int incr_dropcount(struct ether_addr*); 00159 00161 00164 void log_intrusions(void); 00165 00166 #endif