📄 updownclient.h
字号:
uint16 GetUDPPort() const { return m_nUDPPort; }
void SetUDPPort(uint16 nPort) { m_nUDPPort = nPort; }
uint8 GetUDPVersion() const { return m_byUDPVer; }
bool SupportsUDP() const { return GetUDPVersion() != 0 && m_nUDPPort != 0; }
uint16 GetKadPort() const { return m_nKadPort; }
void SetKadPort(uint16 nPort) { m_nKadPort = nPort; }
uint8 GetExtendedRequestsVersion() const { return m_byExtendedRequestsVer; }
void RequestSharedFileList();
void ProcessSharedFileList(char* pachPacket, uint32 nSize, LPCTSTR pszDirectory = NULL);
void ClearHelloProperties();
bool ProcessHelloAnswer(char* pachPacket, uint32 nSize);
bool ProcessHelloPacket(char* pachPacket, uint32 nSize);
void SendHelloAnswer();
virtual bool SendHelloPacket();
void SendMuleInfoPacket(bool bAnswer);
void ProcessMuleInfoPacket(char* pachPacket, uint32 nSize);
void ProcessMuleCommentPacket(char* pachPacket, uint32 nSize);
void ProcessEmuleQueueRank(char* packet, UINT size);
void ProcessEdonkeyQueueRank(char* packet, UINT size);
void CheckQueueRankFlood();
bool Compare(const CUpDownClient* tocomp, bool bIgnoreUserhash = false) const;
void ResetFileStatusInfo();
uint32 GetLastSrcReqTime() const { return m_dwLastSourceRequest; }
void SetLastSrcReqTime() { m_dwLastSourceRequest = ::GetTickCount(); }
uint32 GetLastSrcAnswerTime() const { return m_dwLastSourceAnswer; }
void SetLastSrcAnswerTime() { m_dwLastSourceAnswer = ::GetTickCount(); }
uint32 GetLastAskedForSources() const { return m_dwLastAskedForSources; }
void SetLastAskedForSources() { m_dwLastAskedForSources = ::GetTickCount(); }
bool GetFriendSlot() const;
void SetFriendSlot(bool bNV) { m_bFriendSlot = bNV; }
bool IsFriend() const { return m_Friend != NULL; }
void SetCommentDirty(bool bDirty = true) { m_bCommentDirty = bDirty; }
bool GetSentCancelTransfer() const { return m_fSentCancelTransfer; }
void SetSentCancelTransfer(bool bVal) { m_fSentCancelTransfer = bVal; }
void ProcessPublicIPAnswer(const BYTE* pbyData, UINT uSize);
void SendPublicIPRequest();
uint8 GetKadVersion() { return m_byKadVersion; }
bool SendBuddyPingPong() { return m_dwLastBuddyPingPongTime < ::GetTickCount(); }
bool AllowIncomeingBuddyPingPong() { return m_dwLastBuddyPingPongTime < (::GetTickCount()-(3*60*1000)); }
void SetLastBuddyPingPongTime() { m_dwLastBuddyPingPongTime = (::GetTickCount()+(10*60*1000)); }
// secure ident
void SendPublicKeyPacket();
void SendSignaturePacket();
void ProcessPublicKeyPacket(uchar* pachPacket, uint32 nSize);
void ProcessSignaturePacket(uchar* pachPacket, uint32 nSize);
uint8 GetSecureIdentState() const { return m_SecureIdentState; }
void SendSecIdentStatePacket();
void ProcessSecIdentStatePacket(uchar* pachPacket, uint32 nSize);
uint8 GetInfoPacketsReceived() const { return m_byInfopacketsReceived; }
void InfoPacketsReceived();
// preview
void SendPreviewRequest(const CAbstractFile* pForFile);
void SendPreviewAnswer(const CKnownFile* pForFile, CxImage** imgFrames, uint8 nCount);
void ProcessPreviewReq(char* pachPacket, uint32 nSize);
void ProcessPreviewAnswer(char* pachPacket, uint32 nSize);
bool GetPreviewSupport() const { return m_fSupportsPreview && GetViewSharedFilesSupport(); }
bool GetViewSharedFilesSupport() const { return m_fNoViewSharedFiles==0; }
bool SafeSendPacket(Packet* packet);
void CheckForGPLEvilDoer();
//upload
EUploadState GetUploadState() const { return (EUploadState)m_nUploadState; }
void SetUploadState(EUploadState news);
uint32 GetWaitStartTime() const;
void SetWaitStartTime();
void ClearWaitStartTime();
uint32 GetWaitTime() const { return m_dwUploadTime - GetWaitStartTime(); }
bool IsDownloading() const { return (m_nUploadState == US_UPLOADING); }
bool HasBlocks() const { return !m_BlockRequests_queue.IsEmpty(); }
uint32 GetDatarate() const { return m_nUpDatarate; }
uint32 GetScore(bool sysvalue, bool isdownloading = false, bool onlybasevalue = false) const;
void AddReqBlock(Requested_Block_Struct* reqblock);
void CreateNextBlockPackage();
uint32 GetUpStartTimeDelay() const { return ::GetTickCount() - m_dwUploadTime; }
void SetUpStartTime() { m_dwUploadTime = ::GetTickCount(); }
void SendHashsetPacket(char* forfileid);
const uchar* GetUploadFileID() const { return requpfileid; }
void SetUploadFileID(CKnownFile* newreqfile);
uint32 SendBlockData();
void ClearUploadBlockRequests();
void SendRankingInfo();
void SendCommentInfo(/*const*/ CKnownFile *file);
void AddRequestCount(const uchar* fileid);
void UnBan();
void Ban(LPCTSTR pszReason = NULL);
uint32 GetAskedCount() const { return m_cAsked; }
void AddAskedCount() { m_cAsked++; }
void SetAskedCount(uint32 m_cInAsked) { m_cAsked = m_cInAsked; }
void FlushSendBlocks(); // call this when you stop upload, or the socket might be not able to send
uint32 GetLastUpRequest() const { return m_dwLastUpRequest; }
void SetLastUpRequest() { m_dwLastUpRequest = ::GetTickCount(); }
uint32 GetSessionUp() const { return m_nTransferredUp - m_nCurSessionUp; }
void ResetSessionUp() {
m_nCurSessionUp = m_nTransferredUp;
m_addedPayloadQueueSession = 0;
m_nCurQueueSessionPayloadUp = 0;
}
uint32 GetSessionDown() const { return m_nTransferredDown - m_nCurSessionDown; }
void ResetSessionDown() {
m_nCurSessionDown = m_nTransferredDown;
}
uint32 GetQueueSessionPayloadUp() const { return m_nCurQueueSessionPayloadUp; }
uint32 GetPayloadInBuffer() const { return m_addedPayloadQueueSession - GetQueueSessionPayloadUp(); }
void ProcessExtendedInfo(CSafeMemFile* packet, CKnownFile* tempreqfile);
uint16 GetUpPartCount() const { return m_nUpPartCount; }
void DrawUpStatusBar(CDC* dc, RECT* rect, bool onlygreyrect, bool bFlat) const;
bool IsUpPartAvailable(uint16 iPart) const {
return (iPart>=m_nUpPartCount || !m_abyUpPartStatus) ? 0 : m_abyUpPartStatus[iPart];
}
uint8* GetUpPartStatus() const { return m_abyUpPartStatus; }
float GetCombinedFilePrioAndCredit();
//download
uint32 GetAskedCountDown() const { return m_cDownAsked; }
void AddAskedCountDown() { m_cDownAsked++; }
void SetAskedCountDown(uint32 m_cInDownAsked) { m_cDownAsked = m_cInDownAsked; }
EDownloadState GetDownloadState() const { return (EDownloadState)m_nDownloadState; }
void SetDownloadState(EDownloadState nNewState, LPCTSTR pszReason = _T("Unspecified"));
uint32 GetLastAskedTime(const CPartFile* partFile = NULL) const;
void SetLastAskedTime() { m_fileReaskTimes.SetAt(reqfile, ::GetTickCount()); }
bool IsPartAvailable(uint16 iPart) const {
return (iPart>=m_nPartCount || !m_abyPartStatus) ? 0 : m_abyPartStatus[iPart];
}
uint8* GetPartStatus() const { return m_abyPartStatus; }
uint16 GetPartCount() const { return m_nPartCount; }
uint32 GetDownloadDatarate() const { return m_nDownDatarate; }
uint16 GetRemoteQueueRank() const { return m_nRemoteQueueRank; }
void SetRemoteQueueRank(uint16 nr);
bool IsRemoteQueueFull() const { return m_bRemoteQueueFull; }
void SetRemoteQueueFull(bool flag) { m_bRemoteQueueFull = flag; }
void DrawStatusBar(CDC* dc, LPCRECT rect, bool onlygreyrect, bool bFlat) const;
bool AskForDownload();
virtual void SendFileRequest();
void SendStartupLoadReq();
void ProcessFileInfo(CSafeMemFile* data, CPartFile* file);
void ProcessFileStatus(bool bUdpPacket, CSafeMemFile* data, CPartFile* file);
void ProcessHashSet(char* data, uint32 size);
void ProcessAcceptUpload();
bool AddRequestForAnotherFile(CPartFile* file);
void CreateBlockRequests(int iMaxBlocks);
virtual void SendBlockRequests();
virtual bool SendHttpBlockRequests();
virtual void ProcessBlockPacket(char* packet, uint32 size, bool packed = false);
virtual void ProcessHttpBlockPacket(const BYTE* pucData, UINT uSize);
void ClearDownloadBlockRequests();
void SendOutOfPartReqsAndAddToWaitingQueue();
uint32 CalculateDownloadRate();
UINT GetAvailablePartCount() const;
bool SwapToAnotherFile(LPCTSTR pszReason, bool bIgnoreNoNeeded, bool ignoreSuspensions, bool bRemoveCompletely, CPartFile* toFile = NULL, bool allowSame = true, bool isAboutToAsk = false, bool debug = false); // ZZ:DownloadManager
void DontSwapTo(/*const*/ CPartFile* file);
bool IsSwapSuspended(const CPartFile* file, const bool allowShortReaskTime = false, const bool fileIsNNP = false) /*const*/; // ZZ:DownloadManager
uint32 GetTimeUntilReask() const;
uint32 GetTimeUntilReask(const CPartFile* file) const;
uint32 GetTimeUntilReask(const CPartFile* file, const bool allowShortReaskTime, const bool useGivenNNP = false, const bool givenNNP = false) const;
void UDPReaskACK(uint16 nNewQR);
void UDPReaskFNF();
void UDPReaskForDownload();
bool IsSourceRequestAllowed() const;
bool IsSourceRequestAllowed(CPartFile* partfile, bool sourceExchangeCheck = false) const; // ZZ:DownloadManager
bool IsValidSource() const;
ESourceFrom GetSourceFrom() const { return (ESourceFrom)m_nSourceFrom; }
void SetSourceFrom(ESourceFrom val) { m_nSourceFrom = val; }
void SetDownStartTime() { m_dwDownStartTime = ::GetTickCount(); }
uint32 GetDownTimeDifference(boolean clear = true) {
uint32 myTime = m_dwDownStartTime;
if(clear) m_dwDownStartTime = 0;
return ::GetTickCount() - myTime;
}
bool GetTransferredDownMini() const { return m_bTransferredDownMini; }
void SetTransferredDownMini() { m_bTransferredDownMini = true; }
void InitTransferredDownMini() { m_bTransferredDownMini = false; }
uint16 GetA4AFCount() const { return m_OtherRequests_list.GetCount(); }
uint16 GetUpCompleteSourcesCount() const { return m_nUpCompleteSourcesCount; }
void SetUpCompleteSourcesCount(uint16 n) { m_nUpCompleteSourcesCount = n; }
//chat
EChatState GetChatState() const { return (EChatState)m_nChatstate; }
void SetChatState(EChatState nNewS) { m_nChatstate = nNewS; }
//KadIPCheck
EKadState GetKadState() const { return (EKadState)m_nKadState; }
void SetKadState(EKadState nNewS) { m_nKadState = nNewS; }
//File Comment
bool HasFileComment() const { return !m_strFileComment.IsEmpty(); }
const CString& GetFileComment() const { return m_strFileComment; }
void SetFileComment(LPCTSTR pszComment) { m_strFileComment = pszComment; }
bool HasFileRating() const { return m_uFileRating > 0; }
uint8 GetFileRating() const { return m_uFileRating; }
void SetFileRating(uint8 uRating) { m_uFileRating = uRating; }
// Barry - Process zip file as it arrives, don't need to wait until end of block
int unzip(Pending_Block_Struct* block, BYTE* zipped, uint32 lenZipped, BYTE** unzipped, uint32* lenUnzipped, int iRecursion = 0);
void UpdateDisplayedInfo(bool force = false);
int GetFileListRequested() const { return m_iFileListRequested; }
void SetFileListRequested(int iFileListRequested) { m_iFileListRequested = iFileListRequested; }
// message filtering
uint8 GetMessagesReceived() const { return m_cMessagesReceived; }
void SetMessagesReceived(uint8 nCount) { m_cMessagesReceived = nCount; }
void IncMessagesReceived() { m_cMessagesReceived++; }
uint8 GetMessagesSent() const { return m_cMessagesSent; }
void SetMessagesSent(uint8 nCount) { m_cMessagesSent = nCount; }
void IncMessagesSent() { m_cMessagesSent++; }
bool IsSpammer() const { return m_fIsSpammer; }
void SetSpammer(bool bVal) { m_fIsSpammer = bVal ? 1 : 0; }
bool GetMessageFiltered() const { return m_fMessageFiltered; }
void SetMessageFiltered(bool bVal) { m_fMessageFiltered = bVal ? 1 : 0; }
virtual void SetRequestFile(CPartFile* pReqFile);
CPartFile* GetRequestFile() const { return reqfile; }
// AICH Stuff
void SetReqFileAICHHash(CAICHHash* val);
CAICHHash* GetReqFileAICHHash() const { return m_pReqFileAICHHash; }
bool IsSupportingAICH() const { return m_fSupportsAICH & 0x01; }
void SendAICHRequest(CPartFile* pForFile, uint16 nPart);
bool IsAICHReqPending() const { return m_fAICHRequested; }
void ProcessAICHAnswer(char* packet, UINT size);
void ProcessAICHRequest(char* packet, UINT size);
void ProcessAICHFileHash(CSafeMemFile* data, CPartFile* file);
EUtf8Str GetUnicodeSupport() const;
CString GetDownloadStateDisplayString() const;
CString GetUploadStateDisplayString() const;
LPCTSTR DbgGetDownloadState() const;
LPCTSTR DbgGetUploadState() const;
CString DbgGetClientInfo(bool bFormatIP = false) const;
CString DbgGetFullClientSoftVer() const;
const CString& DbgGetHelloInfo() const { return m_strHelloInfo; }
const CString& DbgGetMuleInfo() const { return m_strMuleInfo; }
// ZZ:DownloadManager -->
const bool IsInNoNeededList(const CPartFile* fileToCheck) const;
const bool SwapToRightFile(CPartFile* SwapTo, CPartFile* cur_file, bool ignoreSuspensions, bool SwapToIsNNPFile, bool isNNPFile, bool& wasSkippedDueToSourceExchange, bool doAgressiveSwapping = false, bool debug = false);
const DWORD getLastTriedToConnectTime() { return m_dwLastTriedToConnect; }
// <-- ZZ:DownloadManager
#ifdef _DEBUG
// Diagnostic Support
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
CClientReqSocket* socket;
CClientCredits* credits;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -