Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

CrawlSession.h

Go to the documentation of this file.
00001 //
00002 // CrawlSession.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 // Construction
00034 public:
00035         CCrawlSession();
00036         virtual ~CCrawlSession();
00037 
00038 // Attributes
00039 public:
00040         BOOL            m_bActive;
00041         CPtrList        m_pNodes;
00042 
00043 // Operations
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 // Construction
00063 public:
00064         CCrawlNode();
00065         virtual ~CCrawlNode();
00066 
00067 // Attributes
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 // Operations
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_)

Generated on Thu Dec 15 10:39:34 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2