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_QUERYSEARCH_H__2141B926_3F6B_4A5D_9FBD_C67FD0A5C46C__INCLUDED_)
00023 #define AFX_QUERYSEARCH_H__2141B926_3F6B_4A5D_9FBD_C67FD0A5C46C__INCLUDED_
00024
00025 #pragma once
00026
00027 class CPacket;
00028 class CSchema;
00029 class CXMLElement;
00030 class CSearchWnd;
00031 class CG1Packet;
00032 class CG2Packet;
00033 class CEDPacket;
00034
00035
00036 class CQuerySearch
00037 {
00038
00039 public:
00040 CQuerySearch(BOOL bGUID = TRUE);
00041 CQuerySearch(CQuerySearch* pCopy);
00042 virtual ~CQuerySearch();
00043
00044
00045 public:
00046 GGUID m_pGUID;
00047 public:
00048 CString m_sSearch;
00049 CSchema* m_pSchema;
00050 CXMLElement* m_pXML;
00051 QWORD m_nMinSize;
00052 QWORD m_nMaxSize;
00053 public:
00054 BOOL m_bSHA1;
00055 SHA1 m_pSHA1;
00056 BOOL m_bTiger;
00057 TIGEROOT m_pTiger;
00058 BOOL m_bED2K;
00059 MD4 m_pED2K;
00060 BOOL m_bBTH;
00061 SHA1 m_pBTH;
00062 public:
00063 BOOL m_bSimilarSearch;
00064 MD4 m_pSimilarED2K;
00065 public:
00066 BOOL m_bWantURL;
00067 BOOL m_bWantDN;
00068 BOOL m_bWantXML;
00069 BOOL m_bWantCOM;
00070 BOOL m_bWantPFS;
00071 BOOL m_bAndG1;
00072 public:
00073 BOOL m_bUDP;
00074 SOCKADDR_IN m_pEndpoint;
00075 DWORD m_nKey;
00076 BOOL m_bFirewall;
00077 public:
00078 DWORD m_nWords;
00079 LPCTSTR* m_pWordPtr;
00080 DWORD* m_pWordLen;
00081
00082
00083 public:
00084 CG1Packet* ToG1Packet();
00085 CG2Packet* ToG2Packet(SOCKADDR_IN* pUDP, DWORD nKey);
00086 CEDPacket* ToEDPacket(BOOL bUDP, DWORD nServerFlags = 0);
00087 static CQuerySearch* FromPacket(CPacket* pPacket, SOCKADDR_IN* pEndpoint = NULL);
00088 protected:
00089 BOOL ReadG1Packet(CPacket* pPacket);
00090 BOOL ReadG2Packet(CG2Packet* pPacket, SOCKADDR_IN* pEndpoint = NULL);
00091
00092
00093 public:
00094 BOOL Match(LPCTSTR pszFilename, QWORD nSize, LPCTSTR pszSchemaURI, CXMLElement* pXML, SHA1* pSHA1 = NULL, TIGEROOT* pTiger = NULL, MD4* pED2K = NULL);
00095 TRISTATE MatchMetadata(LPCTSTR pszSchemaURI, CXMLElement* pXML);
00096 BOOL MatchMetadataShallow(LPCTSTR pszSchemaURI, CXMLElement* pXML);
00097 void BuildWordList();
00098 void Serialize(CArchive& ar);
00099 CSearchWnd* OpenWindow();
00100 BOOL CheckValid();
00101 protected:
00102 void AddStringToWordList(LPCTSTR pszString);
00103 BOOL WriteHashesToEDPacket( CEDPacket* pPacket, BOOL bUDP );
00104
00105
00106 public:
00107 static BOOL WordMatch(LPCTSTR pszString, LPCTSTR pszFind);
00108 static BOOL NumberMatch(const CString& strValue, const CString& strRange);
00109
00110 };
00111
00112 #endif // !defined(AFX_QUERYSEARCH_H__2141B926_3F6B_4A5D_9FBD_C67FD0A5C46C__INCLUDED_)