#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* tcpdump header (ether.h) defines ETHER_HDRLEN) */ #ifndef ETHER_HDRLEN #define ETHER_HDRLEN 14 #endif /* *Constante */ #define DEVICE "eth1" #define NRIP 3000 MYSQL mysql, mysql2, mysql3, mysql4, *mysqlsock; MYSQL_RES *res; MYSQL_ROW row; #define DB_HOST "127.0.0.1" #define DB_USER "trafic" #define DB_PASSWORD "imperatoR" #define DB_DATABASE "trafic" #define MAX_QUERY 1024 char db_host[255], db_user[10], db_database[15]; char db_password[15]; /* * Variabile */ typedef struct client { unsigned long int ipn; char ipch[16]; char table[22]; char subrc[16]; unsigned long int subrn; int nm; unsigned long int tdownb; unsigned long int tupb; unsigned long int ltdownb; unsigned long int ltupb; unsigned long int atdownb; unsigned long int atupb; } clients; clients ipc[NRIP],xipc[NRIP]; int luna,an; pthread_t thread_id; pthread_t thread_id2; pthread_t thread_id3; pthread_t thread_id4; struct timezone tz,tz2,tz3,tz4; struct timeval c_time; time_t l_time; unsigned long int locip=375591690; unsigned int nripc,xnr; unsigned long int contor; /* *Structuri de date */ struct my_ip { u_int8_t ip_vhl; /* header length, version */ #define IP_V(ip) (((ip)->ip_vhl & 0xf0) >> 4) #define IP_HL(ip) ((ip)->ip_vhl & 0x0f) u_int8_t ip_tos; /* type of service */ u_int16_t ip_len; /* total length */ u_int16_t ip_id; /* identification */ u_int16_t ip_off; /* fragment offset field */ #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ u_int8_t ip_ttl; /* time to live */ u_int8_t ip_p; /* protocol */ u_int16_t ip_sum; /* checksum */ struct in_addr ip_src,ip_dst; /* source and dest address */ };