[Javanetsim-cvs] IceScan/icesockets csocket.h, 1.22, 1.23 sock_arp.h, 1.4, 1.5 sock_win.h, 1.4, 1.5
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-12-17 12:14:41
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29602/icesockets Modified Files: csocket.h sock_arp.h sock_win.h Log Message: Index: sock_arp.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_arp.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sock_arp.h 16 Dec 2006 20:44:18 -0000 1.4 --- sock_arp.h 17 Dec 2006 12:14:35 -0000 1.5 *************** *** 10,22 **** #include "sock_types.h" icestring get_arp_from_cache(icestring &ip) { ! #if (__CYGWIN__ || WIN32) return ""; ! #else struct sockaddr_in sin = { 0 }; struct arpreq myarp = { { 0 } }; - char arp[24]; int sockfd; --- 10,60 ---- #include "sock_types.h" + #include <Iphlpapi.h> icestring get_arp_from_cache(icestring &ip) { ! char arp[24]; ! ! #if __CYGWIN__ return ""; ! #elif WIN32 ! PMIB_IPNETTABLE pIPNetTable = NULL; ! PMIB_IPNETROW pIPNetRow = NULL; ! ULONG ulSize = 0; ! IN_ADDR ia; ! ! GetIpNetTable(pIPNetTable, &ulSize, TRUE); ! pIPNetTable = new MIB_IPNETTABLE[ulSize]; ! if (NULL != pIPNetTable) ! { ! GetIpNetTable(pIPNetTable, &ulSize, TRUE); ! ! for (int x = 0; x < pIPNetTable->dwNumEntries; x++) ! { ! pIPNetRow = &(pIPNetTable->table[x]); ! ia.S_un.S_addr = pIPNetRow->dwAddr; ! ! if(!strcmp(inet_ntoa(ia), ip.c_str())){ ! sprintf(arp, "%02x:%02x:%02x:%02x:%02x:%02x", ! pIPNetRow->bPhysAddr[0] & 0xFF, ! pIPNetRow->bPhysAddr[1] & 0xFF, ! pIPNetRow->bPhysAddr[2] & 0xFF, ! pIPNetRow->bPhysAddr[3] & 0xFF, ! pIPNetRow->bPhysAddr[4] & 0xFF, ! pIPNetRow->bPhysAddr[5] & 0xFF); ! ! icestring ret(arp); ! ! return ret; ! } ! } ! ! delete [] pIPNetTable; ! ! return ""; ! } ! #else struct sockaddr_in sin = { 0 }; struct arpreq myarp = { { 0 } }; int sockfd; *************** *** 44,52 **** myarp.arp_ha.sa_data[4] & 0xFF, myarp.arp_ha.sa_data[5] & 0xFF); ! ! icestring ret(arp); return ret; - #endif } --- 82,89 ---- myarp.arp_ha.sa_data[4] & 0xFF, myarp.arp_ha.sa_data[5] & 0xFF); ! #endif ! icestring ret(arp); return ret; } Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** csocket.h 17 Dec 2006 11:31:21 -0000 1.22 --- csocket.h 17 Dec 2006 12:14:35 -0000 1.23 *************** *** 129,133 **** nonblock(true); ! ::connect(sid, (struct sockaddr *) &saddress, sizeof(struct sockaddr)); --- 129,133 ---- nonblock(true); ! ::connect(sid, (struct sockaddr *) &saddress, sizeof(struct sockaddr)); *************** *** 147,151 **** nonblock(false); ! if (res == SOCKET_ERROR && errno != EINTR){ return ICESOCK_ERRNO; --- 147,151 ---- nonblock(false); ! if (res == SOCKET_ERROR && errno != EINTR){ return ICESOCK_ERRNO; Index: sock_win.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_win.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sock_win.h 17 Dec 2006 11:46:35 -0000 1.4 --- sock_win.h 17 Dec 2006 12:14:35 -0000 1.5 *************** *** 19,22 **** --- 19,23 ---- #pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "wpcap.lib") + #pragma comment(lib, "iphlpapi.lib") #ifndef __NO_LIBPCRE__ #pragma comment(lib, "libpcre.lib") |