00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_CRAWLSESSION_H__262E4F3E_1C28_4318_AE74_921A8392BFD9__INCLUDED_)
00023 #define AFX_CRAWLSESSION_H__262E4F3E_1C28_4318_AE74_921A8392BFD9__INCLUDED_
00024
00025 #pragma once
00026
00027 class CG2Packet;
00028 class CCrawlNode;
00029
00030
00031 class CCrawlSession
00032 {
00033
00034 public:
00035 CCrawlSession();
00036 virtual ~CCrawlSession();
00037
00038
00039 public:
00040 BOOL m_bActive;
00041 CPtrList m_pNodes;
00042
00043
00044 public:
00045 void Clear();
00046 void Bootstrap();
00047 void SendCrawl(SOCKADDR_IN* pHost);
00048 int GetHubCount();
00049 int GetLeafCount();
00050 public:
00051 void OnRun();
00052 void OnCrawl(SOCKADDR_IN* pHost, CG2Packet* pPacket);
00053 protected:
00054 CCrawlNode* Find(IN_ADDR* pAddress, BOOL bCreate);
00055
00056 friend class CCrawlNode;
00057 };
00058
00059
00060 class CCrawlNode
00061 {
00062
00063 public:
00064 CCrawlNode();
00065 virtual ~CCrawlNode();
00066
00067
00068 public:
00069 SOCKADDR_IN m_pHost;
00070 int m_nType;
00071 int m_nLeaves;
00072 CString m_sNick;
00073 float m_nLatitude;
00074 float m_nLongitude;
00075 public:
00076 CPtrList m_pNeighbours;
00077 public:
00078 DWORD m_nUnique;
00079 DWORD m_tDiscovered;
00080 DWORD m_tCrawled;
00081 DWORD m_tResponse;
00082
00083 enum { ntUnknown, ntHub, ntLeaf };
00084
00085
00086 public:
00087 void OnCrawl(CCrawlSession* pSession, CG2Packet* pPacket);
00088 protected:
00089 void OnNode(CCrawlSession* pSession, CG2Packet* pPacket, DWORD nPacket, int nType);
00090
00091 enum { parseSelf, parseHub, parseLeaf };
00092 };
00093
00094
00095 extern CCrawlSession CrawlSession;
00096
00097
00098 #endif // !defined(AFX_CRAWLSESSION_H__262E4F3E_1C28_4318_AE74_921A8392BFD9__INCLUDED_)