余
余远源
Unregistered / Unconfirmed
GUEST, unregistred user!
extern BOOL PeekAndPump();
extern LPADAPTER g_lpAdapter;
extern CSnifferApp theApp;
extern unsigned char Output_srcMAC[6];
extern unsigned char Output_dstMAC[6];
extern unsigned char g_szOwnMAC[6];//本机MAC地址
extern unsigned char g_szServerSideMAC[6];
extern unsigned long ServerlocalHost;
extern unsigned long ClientlocalHost;
extern unsigned long ServerIss;
extern unsigned long ClientIss;
extern CLIENTINFO ClientInfo[MAX_CLIENT];
extern BOOL bExitThread; //退出所有程序标志
extern void GetTcpFlagDisStr(char tcpFlag,char *cTemp);
static NBuf nBufs[MAXNBUFS];
NBuf *topNBuf;
NBufStats nBufStats;
u_int curFreeBufs; // added by robert to make build
unsigned long netMask; /* IP netmask to set on interface */
unsigned long LocalHost; /* Our IP address in */
static Timer timerHead; /* Sentinal for timer queue. */
static Timer *timerFree; /* The free list pointer. */
static Timer timerHeap[MAXFREETIMERS]; /* The free timer records. */
u_short ipID; /* IP packet ctr, for ID fields. */
char InAndOutLoop; //实现内部收发,不经过网卡
/*
* TCP Control block free list.
*/
TCPCB tcbs[MAXTCP];
TCPCB *topTcpCB; /* Ptr to top TCB on free list. */
TCPCB *tcbTbl[NTCB]; /* Hash table for lookup. */
u_int16_t tcpFreePort = TCP_DEFPORT; /* Initial local port. */
u_int32_t newISNOffset; /* Offset for the next sequence number. */
static UDPCB udps[MAXUDP];
static UDP_QUEUE udpqs[MAXUDPQUEUES];
static UDP_QUEUE* udp_free_list;
ICMPSTATS icmpStats;
static struct sockaddr_in icmpsrc = { sizeof(struct sockaddr_in), AF_INET };
struct sockaddr_in icmpmask = { 8, 0 };
/* TCB state labels for debugging. */
char *tcbStates[] =
{
"CLOSED",
"LISTEN",
"SYN_SENT",
"SYN_RECEIVED",
"ESTABLISHED",
"FINWAIT1",
"FINWAIT2",
"CLOSE_WAIT",
"CLOSING",
"LAST_ACK",
"TIME_WAIT"
};
/***********************************/
/*** PUBLIC FUNCTION DEFINITIONS ***/
/***********************************/
/*
* Initialize the TCP subsystem.
*/
void tcpInit(void)
{
int i;
/* The TCB free list. */
memset(tcbs, 0, sizeof(tcbs));
topTcpCB = &tcbs[0];
for(i = 0; i < MAXTCP; i++)
{
tcbs.next = &tcbs[i + 1];
/* Prev referencing self indicates that it's on the free list. */
tcbs.prev = &tcbs;
memset(&tcbs.resendTimer, 0, sizeof(Timer));
memset(&tcbs.keepTimer, 0, sizeof(Timer));
tcbs.state = CLOSED;
}
tcbs[MAXTCP - 1].next = NULL;
/* The TCB hash table. */
memset(&tcbTbl, 0, sizeof(tcbTbl));
/* The new sequence number offset. */
srand((unsigned)time(NULL));
newISNOffset = rand();
}
extern LPADAPTER g_lpAdapter;
extern CSnifferApp theApp;
extern unsigned char Output_srcMAC[6];
extern unsigned char Output_dstMAC[6];
extern unsigned char g_szOwnMAC[6];//本机MAC地址
extern unsigned char g_szServerSideMAC[6];
extern unsigned long ServerlocalHost;
extern unsigned long ClientlocalHost;
extern unsigned long ServerIss;
extern unsigned long ClientIss;
extern CLIENTINFO ClientInfo[MAX_CLIENT];
extern BOOL bExitThread; //退出所有程序标志
extern void GetTcpFlagDisStr(char tcpFlag,char *cTemp);
static NBuf nBufs[MAXNBUFS];
NBuf *topNBuf;
NBufStats nBufStats;
u_int curFreeBufs; // added by robert to make build
unsigned long netMask; /* IP netmask to set on interface */
unsigned long LocalHost; /* Our IP address in */
static Timer timerHead; /* Sentinal for timer queue. */
static Timer *timerFree; /* The free list pointer. */
static Timer timerHeap[MAXFREETIMERS]; /* The free timer records. */
u_short ipID; /* IP packet ctr, for ID fields. */
char InAndOutLoop; //实现内部收发,不经过网卡
/*
* TCP Control block free list.
*/
TCPCB tcbs[MAXTCP];
TCPCB *topTcpCB; /* Ptr to top TCB on free list. */
TCPCB *tcbTbl[NTCB]; /* Hash table for lookup. */
u_int16_t tcpFreePort = TCP_DEFPORT; /* Initial local port. */
u_int32_t newISNOffset; /* Offset for the next sequence number. */
static UDPCB udps[MAXUDP];
static UDP_QUEUE udpqs[MAXUDPQUEUES];
static UDP_QUEUE* udp_free_list;
ICMPSTATS icmpStats;
static struct sockaddr_in icmpsrc = { sizeof(struct sockaddr_in), AF_INET };
struct sockaddr_in icmpmask = { 8, 0 };
/* TCB state labels for debugging. */
char *tcbStates[] =
{
"CLOSED",
"LISTEN",
"SYN_SENT",
"SYN_RECEIVED",
"ESTABLISHED",
"FINWAIT1",
"FINWAIT2",
"CLOSE_WAIT",
"CLOSING",
"LAST_ACK",
"TIME_WAIT"
};
/***********************************/
/*** PUBLIC FUNCTION DEFINITIONS ***/
/***********************************/
/*
* Initialize the TCP subsystem.
*/
void tcpInit(void)
{
int i;
/* The TCB free list. */
memset(tcbs, 0, sizeof(tcbs));
topTcpCB = &tcbs[0];
for(i = 0; i < MAXTCP; i++)
{
tcbs.next = &tcbs[i + 1];
/* Prev referencing self indicates that it's on the free list. */
tcbs.prev = &tcbs;
memset(&tcbs.resendTimer, 0, sizeof(Timer));
memset(&tcbs.keepTimer, 0, sizeof(Timer));
tcbs.state = CLOSED;
}
tcbs[MAXTCP - 1].next = NULL;
/* The TCB hash table. */
memset(&tcbTbl, 0, sizeof(tcbTbl));
/* The new sequence number offset. */
srand((unsigned)time(NULL));
newISNOffset = rand();
}