⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uploadtransfer.h

📁 p2p软件
💻 H
字号:
//
// UploadTransfer.h
//
// Copyright (c) Shareaza Development Team, 2002-2004.
// This file is part of SHAREAZA (www.shareaza.com)
//
// Shareaza is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Shareaza is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Shareaza; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//

#if !defined(AFX_UPLOADTRANSFER_H__16B2B6A4_C939_4018_81B6_B1C4460B3CD0__INCLUDED_)
#define AFX_UPLOADTRANSFER_H__16B2B6A4_C939_4018_81B6_B1C4460B3CD0__INCLUDED_

#pragma once

#include "Transfer.h"

class CUploadQueue;
class CUploadFile;
class CTransferFile;
class CLibraryFile;
class CDownload;

#define ULA_SLOTS	16


class CUploadTransfer : public CTransfer
{
// Construction
public:
	CUploadTransfer(PROTOCOLID nProtocol);
	virtual ~CUploadTransfer();

// Attributes
public:
	PROTOCOLID		m_nProtocol;	// Protocol ID
	int				m_nState;		// Common state code
	CUploadQueue*	m_pQueue;		// Queue reference
	CUploadFile*	m_pBaseFile;	// Reference file
	CTransferFile*	m_pDiskFile;	// Disk file
	DWORD			m_nBandwidth;	// Bandwidth
	CString			m_sNick;		// User Nick
public:
	BOOL			m_bSHA1;		// Hash of requested file
	SHA1			m_pSHA1;		// ..
	BOOL			m_bTiger;		// ..
	TIGEROOT		m_pTiger;		// ..
	BOOL			m_bED2K;		// ..
	MD4				m_pED2K;		// ..
	CString			m_sFileName;	// Name of requested file
	CString			m_sFilePath;	// Path of requested file
	QWORD			m_nFileBase;	// Base offset in requested file
	QWORD			m_nFileSize;	// Size of requested file
	BOOL			m_bFilePartial;	// Partial file flag
	CString			m_sFileTags;	// File sharing tags
public:
	BOOL			m_bLive;		// Live connection tag
	DWORD			m_nRequests;	// Request count
	QWORD			m_nUploaded;	// Bytes uploaded
	DWORD			m_tContent;		// Send start timestamp
	QWORD			m_nOffset;		// Fragment offset
	QWORD			m_nLength;		// Fragment length
	QWORD			m_nPosition;	// Send position
protected:
	DWORD			m_tRotateTime;
	DWORD			m_tAverageTime;
	int				m_nAveragePos;
	DWORD			m_nAverageRate[ULA_SLOTS];
	
// Operations
public:
	virtual void	Remove(BOOL bMessage = TRUE);
	virtual void	Close(BOOL bMessage = FALSE);
	virtual BOOL	Promote();
	virtual BOOL	OnRename(LPCTSTR pszSource, LPCTSTR pszTarget);
public:
	virtual float	GetProgress();
	virtual DWORD	GetAverageSpeed();
	virtual DWORD	GetMeasuredSpeed();
	virtual void	SetSpeedLimit(DWORD nLimit);
protected:
	virtual BOOL	OnRun();
	virtual BOOL	OnRead();
	virtual BOOL	OnWrite();
	virtual void	OnQueueKick() {};
protected:
	void		LongTermAverage(DWORD tNow);
	void		RotatingQueue(DWORD tNow);
	void		ClearHashes();
	BOOL		HashesFromURN(LPCTSTR pszURN);
	void		ClearRequest();
	BOOL		RequestComplete(CLibraryFile* pFile);
	BOOL		RequestPartial(CDownload* pFile);
	void		StartSending(int nState);
	void		AllocateBaseFile();
	void		CloseFile();

};

enum UploadState
{
	upsNull, upsReady, upsConnecting,
	upsRequest, upsHeaders, upsQueued,
	upsUploading, upsResponse,
	upsBrowse, upsTigerTree, upsMetadata, upsPreview, upsPreQueue
};

#endif // !defined(AFX_UPLOADTRANSFER_H__16B2B6A4_C939_4018_81B6_B1C4460B3CD0__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -