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

QueryHit.h

Go to the documentation of this file.
00001 //
00002 // QueryHit.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_QUERYHIT_H__275CD566_6CDF_4C59_B78D_7082E49C6E15__INCLUDED_)
00023 #define AFX_QUERYHIT_H__275CD566_6CDF_4C59_B78D_7082E49C6E15__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CVendor;
00028 class CMatchFile;
00029 class CXMLElement;
00030 class CQuerySearch;
00031 class CG1Packet;
00032 class CG2Packet;
00033 class CEDPacket;
00034 
00035 
00036 class CQueryHit
00037 {
00038 // Construction
00039 public:
00040         CQueryHit(PROTOCOLID nProtocol, GGUID* pSearchID = NULL);
00041         virtual ~CQueryHit();
00042 
00043 // Attributes
00044 public:
00045         CQueryHit*      m_pNext;
00046         GGUID           m_pSearchID;
00047 public:
00048         PROTOCOLID      m_nProtocol;
00049         GGUID           m_pClientID;
00050         IN_ADDR         m_pAddress;
00051         WORD            m_nPort;
00052         DWORD           m_nSpeed;
00053         CString         m_sSpeed;
00054         CVendor*        m_pVendor;
00055         TRISTATE        m_bPush;
00056         TRISTATE        m_bBusy;
00057         TRISTATE        m_bStable;
00058         TRISTATE        m_bMeasured;
00059         BOOL            m_bChat;
00060         BOOL            m_bBrowseHost;
00061         CString         m_sNick;
00062 public:
00063         int                     m_nGroup;
00064         BOOL            m_bSHA1;
00065         SHA1            m_pSHA1;
00066         BOOL            m_bTiger;
00067         TIGEROOT        m_pTiger;
00068         BOOL            m_bED2K;
00069         MD4                     m_pED2K;
00070         BOOL            m_bBTH;
00071         SHA1            m_pBTH;
00072         CString         m_sURL;
00073         CString         m_sName;
00074         DWORD           m_nIndex;
00075         BOOL            m_bSize;
00076         QWORD           m_nSize;
00077         DWORD           m_nSources;
00078         DWORD           m_nPartial;
00079         BOOL            m_bPreview;
00080         CString         m_sPreview;
00081         int                     m_nUpSlots;
00082         int                     m_nUpQueue;
00083         BOOL            m_bCollection;
00084 public:
00085         CString                 m_sSchemaURI;
00086         CString                 m_sSchemaPlural;
00087         CXMLElement*    m_pXML;
00088         int                             m_nRating;
00089         CString                 m_sComments;
00090 public:
00091         BOOL            m_bBogus;
00092         BOOL            m_bMatched;
00093         BOOL            m_bFiltered;
00094         BOOL            m_bDownload;
00095         BOOL            m_bNew;
00096         BOOL            m_bSelected;
00097 protected:
00098         BOOL            m_bResolveURL;
00099 
00100 // Static Decode Operations
00101 public:
00102         static CQueryHit*       FromPacket(CG1Packet* pPacket, int* pnHops = NULL);
00103         static CQueryHit*       FromPacket(CG2Packet* pPacket, int* pnHops = NULL);
00104         static CQueryHit*       FromPacket(CEDPacket* pPacket, SOCKADDR_IN* pServer, DWORD m_nServerFlags, GGUID* pSearchID = NULL );
00105 protected:
00106         static BOOL                     CheckBogus(CQueryHit* pFirstHit);
00107         static CXMLElement*     ReadXML(CG1Packet* pPacket, int nSize);
00108         static BOOL                     ReadGGEP(CG1Packet* pPacket, BOOL* pbBrowseHost);
00109 
00110 // Operations
00111 public:
00112         void            Copy(CQueryHit* pOther);
00113         void            Delete();
00114         int                     GetRating();
00115         void            Serialize(CArchive& ar, int nVersion);
00116 protected:
00117         void            ReadG1Packet(CG1Packet* pPacket);
00118         void            ParseAttributes(GGUID* pClientID, CVendor* pVendor, BYTE* nFlags, BOOL bChat, BOOL bBrowseHost);
00119         void            ReadG2Packet(CG2Packet* pPacket, DWORD nLength);
00120         BOOL            ReadEDPacket(CEDPacket* pPacket, SOCKADDR_IN* pServer, DWORD m_nServerFlags = 0);
00121         void            ReadEDAddress(CEDPacket* pPacket, SOCKADDR_IN* pServer);
00122         BOOL            ParseXML(CXMLElement* pXML, DWORD nRealIndex);
00123         void            Resolve();
00124         BOOL            AutoDetectSchema(LPCTSTR pszInfo);
00125         BOOL            AutoDetectAudio(LPCTSTR pszInfo);
00126 
00127 // Inlines
00128 public:
00129         inline int GetSources() const
00130         {
00131                 return ( m_nProtocol == PROTOCOL_ED2K )
00132                         ? m_nSources : ( m_nSources ? 1 : 0 );
00133         }
00134 };
00135 
00136 #define HITEQUALS_NOT           0
00137 #define HITEQUALS_SIMILAR       1
00138 #define HITEQUALS_IDENTICAL     2
00139 
00140 #endif // !defined(AFX_QUERYHIT_H__275CD566_6CDF_4C59_B78D_7082E49C6E15__INCLUDED_)

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