[Javanetsim-cvs] IceScan/icesockets csocket.h, 1.15, 1.16 sock_pcap.h, 1.2, 1.3
Status: Beta
Brought to you by:
darkkey
From: QweR <qw...@us...> - 2006-12-16 20:25:16
|
Update of /cvsroot/javanetsim/IceScan/icesockets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5160/icesockets Modified Files: csocket.h sock_pcap.h Log Message: Index: sock_pcap.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/sock_pcap.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sock_pcap.h 16 Dec 2006 17:29:16 -0000 1.2 --- sock_pcap.h 16 Dec 2006 20:25:13 -0000 1.3 *************** *** 9,12 **** --- 9,29 ---- #define _sock_pcap_H + #ifdef __CYGWIN__ + //typedef int pcap_t + #define pcap_t int + pcap_t* init_pcap(){ + return NULL; + } + char* readip_pcap(pcap_t* pd, unsigned int *len, struct timeval *rcvd_time){ + return NULL; + } + bool pcap_filter(pcap_t *p, char *filter_exp){ + return true; + } + + void close_pcap(pcap_t *p){ + } + #else /* __CYGWIN__ */ + #include <pcap.h> #include <netinet/if_ether.h> *************** *** 163,166 **** --- 180,184 ---- pcap_close(p); } + #endif /* __CYGWIN__ */ #endif /* _sock_pcap_H */ Index: csocket.h =================================================================== RCS file: /cvsroot/javanetsim/IceScan/icesockets/csocket.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** csocket.h 16 Dec 2006 14:42:42 -0000 1.15 --- csocket.h 16 Dec 2006 20:25:13 -0000 1.16 *************** *** 9,12 **** --- 9,15 ---- #include "sock_arp.h" + #define MIN_MAGIC_PORT 20000 + #define MAX_MAGIC_PORT 65535 + class csocket{ int cs_id; *************** *** 264,269 **** } ! static int getMagicPort(){ ! return 33333; } --- 267,295 ---- } ! static int getMagicPort(int type, int tries){ ! int mp; ! int i; ! bool p; ! csocket s(PF_INET, type); ! char hostname[80]; ! ! if(gethostname(hostname,79)){ ! printf("\ngethostname() returned error!\n"); ! exit(-1); ! } ! if(tries <= 0){ ! tries = MAX_MAGIC_PORT - MIN_MAGIC_PORT + 1; ! } ! ! for(i = 0, p = false; i < tries && !p; i++){ ! mp = (unsigned)rand() % (MAX_MAGIC_PORT - MIN_MAGIC_PORT + 1) + MIN_MAGIC_PORT; ! p = s.bind(hostname, mp, 0) == 0; ! if(p){ ! s.shutdown(); ! s.close(); ! } ! } ! ! return (p==false ? 0 : mp); } |