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_HOSTBROWSER_H__062DB5F6_EAE7_484D_BA12_28B4BCD99599__INCLUDED_)
00023 #define AFX_HOSTBROWSER_H__062DB5F6_EAE7_484D_BA12_28B4BCD99599__INCLUDED_
00024
00025 #pragma once
00026
00027 #include "Transfer.h"
00028
00029 class CG1Packet;
00030 class CG2Packet;
00031 class CGProfile;
00032 class CBuffer;
00033 class CVendor;
00034 class CBrowseHostWnd;
00035
00036
00037 class CHostBrowser : public CTransfer
00038 {
00039
00040 public:
00041 CHostBrowser(CBrowseHostWnd* pNotify = NULL, IN_ADDR* pAddress = NULL, WORD nPort = 0, BOOL bMustPush = FALSE, GGUID* pClientID = NULL);
00042 virtual ~CHostBrowser();
00043
00044
00045 public:
00046 int m_nState;
00047 CBrowseHostWnd* m_pNotify;
00048 CGProfile* m_pProfile;
00049 public:
00050 BOOL m_bNewBrowse;
00051 IN_ADDR m_pAddress;
00052 WORD m_nPort;
00053 BOOL m_bMustPush;
00054 BOOL m_bCanPush;
00055 GGUID m_pPushID;
00056 GGUID m_pClientID;
00057 DWORD m_tPushed;
00058 BOOL m_bConnect;
00059 int m_nHits;
00060 CVendor* m_pVendor;
00061 BOOL m_bCanChat;
00062 public:
00063 CString m_sServer;
00064 DWORD m_nProtocol;
00065 BOOL m_bDeflate;
00066 DWORD m_nLength;
00067 DWORD m_nReceived;
00068 CBuffer* m_pBuffer;
00069 LPVOID m_pInflate;
00070
00071 enum { hbsNull, hbsConnecting, hbsRequesting, hbsHeaders, hbsContent };
00072
00073
00074 public:
00075 BOOL Browse();
00076 void Stop(BOOL bCompleted = FALSE);
00077 BOOL IsBrowsing() const;
00078 float GetProgress() const;
00079 protected:
00080 BOOL SendPush(BOOL bMessage);
00081 void SendRequest();
00082 BOOL ReadResponseLine();
00083 BOOL ReadContent();
00084 BOOL StreamContent();
00085 BOOL StreamPacketsG1();
00086 BOOL StreamPacketsG2();
00087 BOOL StreamHTML();
00088 BOOL OnPacket(CG1Packet* pPacket);
00089 BOOL OnPacket(CG2Packet* pPacket);
00090 void OnProfilePacket(CG2Packet* pPacket);
00091 protected:
00092 virtual BOOL OnConnected();
00093 virtual BOOL OnRead();
00094 virtual void OnDropped(BOOL bError);
00095 virtual BOOL OnHeaderLine(CString& strHeader, CString& strValue);
00096 virtual BOOL OnHeadersComplete();
00097 virtual BOOL OnRun();
00098 public:
00099 virtual BOOL OnPush(GGUID* pClientID, CConnection* pConnection);
00100
00101 };
00102
00103 #endif // !defined(AFX_HOSTBROWSER_H__062DB5F6_EAE7_484D_BA12_28B4BCD99599__INCLUDED_)