[Javanetsim-cvs] IceScan/icesockets sock_arp.h, 1.6, 1.7 sock_eth.h, 1.5, 1.6 sock_name.h, 1.13, 1.
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-12-21 10:13:57
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9607/icesockets Modified Files: sock_arp.h sock_eth.h sock_name.h sock_pcap.h sock_types.h Log Message: Index: sock_types.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_types.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** sock_types.h 18 Dec 2006 08:40:01 -0000 1.24 --- sock_types.h 21 Dec 2006 10:13:53 -0000 1.25 *************** *** 6,9 **** --- 6,10 ---- #ifndef __CYGWIN__ #include <dnet.h> + #define __WITH_DNET__ 1 #endif Index: sock_pcap.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_pcap.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sock_pcap.h 19 Dec 2006 21:09:04 -0000 1.8 --- sock_pcap.h 21 Dec 2006 10:13:53 -0000 1.9 *************** *** 18,21 **** --- 18,25 ---- } + pcap_t* start_pcap(int iface, bool block, char *filter_exp){ + return NULL; + } + void listdev_pcap(){ } *************** *** 258,261 **** --- 262,277 ---- } + pcap_t* open_pcap(int iface, bool block, char *filter_exp){ + pcap_t* p = init_pcap(iface); + + if(!p) return NULL; + + pcap_block(p, block); + + pcap_filter(p, filter_exp); + + return p; + } + void close_pcap(pcap_t *p){ pcap_close(p); Index: sock_name.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_name.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sock_name.h 19 Dec 2006 21:09:04 -0000 1.13 --- sock_name.h 21 Dec 2006 10:13:53 -0000 1.14 *************** *** 118,122 **** icestring get_source_ip(const icestring &destip, icestring &sourceint){ ! #ifdef __CYGWIN__ char local_hostname[80]; if(gethostname(local_hostname, 80)) exit(-1); --- 118,122 ---- icestring get_source_ip(const icestring &destip, icestring &sourceint){ ! #ifndef DNET_H char local_hostname[80]; if(gethostname(local_hostname, 80)) exit(-1); Index: sock_eth.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_eth.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sock_eth.h 17 Dec 2006 18:49:55 -0000 1.5 --- sock_eth.h 21 Dec 2006 10:13:53 -0000 1.6 *************** *** 248,252 **** ip_t *i = i_ip_open(); ! i_ip_send(i, buf, len); i_ip_close(i); --- 248,252 ---- ip_t *i = i_ip_open(); ! i_ip_send(i, buf, len); i_ip_close(i); Index: sock_arp.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_arp.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sock_arp.h 17 Dec 2006 15:06:37 -0000 1.6 --- sock_arp.h 21 Dec 2006 10:13:53 -0000 1.7 *************** *** 6,10 **** */ ! #ifndef _icearp_H #define _icearp_H --- 6,10 ---- */ ! #ifndef _icearp_H #define _icearp_H *************** *** 14,22 **** icestring get_arp_from_cache(icestring &ip) { ! char arp[24]; ! #if __CYGWIN__ return ""; ! #elif WIN32 PMIB_IPNETTABLE pIPNetTable = NULL; PMIB_IPNETROW pIPNetRow = NULL; --- 14,49 ---- icestring get_arp_from_cache(icestring &ip) { ! char arp[24]; ! ! #ifdef __CYGWIN__ return ""; ! #elif __WITH_DNET__ ! struct arp_entry ae; ! ! addr_pton(ip.c_str(), &ae.arp_pa); ! ! arp_t *p = arp_open(); ! ! arp_get(p, &ae); ! ! arp_close(p); ! ! struct sockaddr sa; ! ! addr_ntos(&(ae.arp_ha), &sa); ! ! sprintf(arp, "%02x:%02x:%02x:%02x:%02x:%02x", ! sa.sa_data[0] & 0xFF, ! sa.sa_data[1] & 0xFF, ! sa.sa_data[2] & 0xFF, ! sa.sa_data[3] & 0xFF, ! sa.sa_data[4] & 0xFF, ! sa.sa_data[5] & 0xFF); ! ! icestring ret(arp); ! ! return ret; ! #elif WIN32 && !__WITH_DNET__ PMIB_IPNETTABLE pIPNetTable = NULL; PMIB_IPNETROW pIPNetRow = NULL; *************** *** 53,58 **** return ""; ! } ! #else struct sockaddr_in sin = { 0 }; struct arpreq myarp = { { 0 } }; --- 80,85 ---- return ""; ! } ! #elif __linux__ && !__WITH_DNET__ struct sockaddr_in sin = { 0 }; struct arpreq myarp = { { 0 } }; *************** *** 63,70 **** memcpy(&myarp.arp_pa, &sin, sizeof myarp.arp_pa); ! strcpy(myarp.arp_dev, "eth0"); ! // ^^^^^^^^^^^^^^^^^^^^^^^^ ! //UGLY, check ALL interfaces ! if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { perror("socket"); --- 90,95 ---- memcpy(&myarp.arp_pa, &sin, sizeof myarp.arp_pa); ! strcpy(myarp.arp_dev, "any"); //UGLY ! if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { perror("socket"); *************** *** 82,89 **** myarp.arp_ha.sa_data[4] & 0xFF, myarp.arp_ha.sa_data[5] & 0xFF); ! #endif ! icestring ret(arp); return ret; } --- 107,116 ---- myarp.arp_ha.sa_data[4] & 0xFF, myarp.arp_ha.sa_data[5] & 0xFF); ! icestring ret(arp); return ret; + #else + return ""; + #endif } |