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

CBuffer Class Reference

#include <Buffer.h>

List of all members.

Public Member Functions

 CBuffer (DWORD *pLimit=NULL)
virtual ~CBuffer ()
void Add (const void *pData, DWORD nLength)
void Insert (DWORD nOffset, const void *pData, DWORD nLength)
void Remove (DWORD nLength)
void Clear ()
void Print (LPCSTR pszText)
void Print (LPCWSTR pszText, UINT nCodePage=CP_ACP)
DWORD AddBuffer (CBuffer *pBuffer, DWORD nLength=0xFFFFFFFF)
void AddReversed (const void *pData, DWORD nLength)
void Prefix (LPCSTR pszText)
void EnsureBuffer (DWORD nLength)
CString ReadString (DWORD nBytes, UINT nCodePage=CP_ACP)
BOOL ReadLine (CString &strLine, BOOL bPeek=FALSE, UINT nCodePage=CP_ACP)
BOOL StartsWith (LPCSTR pszString, BOOL bRemove=FALSE)
DWORD Receive (SOCKET hSocket)
DWORD Send (SOCKET hSocket)
BOOL Deflate (BOOL bIfSmaller=FALSE)
BOOL Inflate (DWORD nSuggest=0)
BOOL Ungzip ()
void WriteDIME (DWORD nFlags, LPCSTR pszID, LPCSTR pszType, LPCVOID pBody, DWORD nBody)
BOOL ReadDIME (DWORD *pnFlags, CString *psID, CString *psType, DWORD *pnBody)

Static Public Member Functions

static void ReverseBuffer (const void *pInput, void *pOutput, DWORD nLength)

Public Attributes

CBufferm_pNext
BYTE * m_pBuffer
DWORD m_nLength
DWORD m_nBuffer


Constructor & Destructor Documentation

CBuffer::CBuffer DWORD *  pLimit = NULL  ) 
 

Definition at line 52 of file Buffer.cpp.

References m_nBuffer, m_nLength, m_pBuffer, m_pNext, and NULL.

CBuffer::~CBuffer  )  [virtual]
 

Definition at line 63 of file Buffer.cpp.

References m_pBuffer.


Member Function Documentation

void CBuffer::Add const void *  pData,
DWORD  nLength
 

Definition at line 74 of file Buffer.cpp.

References BLOCK_MASK, BLOCK_SIZE, m_nBuffer, m_nLength, and m_pBuffer.

Referenced by CDatagramIn::Add(), AddBuffer(), Deflate(), Inflate(), CBTClient::OnBeHandshake(), CDownloadTransferED2K::OnCompressedPart(), CQueryHashTable::OnPatch(), CConnection::OnRead(), CBTClient::OnRun(), CDownloadTransferBT::OnSourceResponse(), CUploadTransferHTTP::OnWrite(), Print(), Receive(), CUploadTransferHTTP::RequestMetadata(), CUploadTransferHTTP::RequestPreview(), CUploadTransferHTTP::RequestTigerTreeDIME(), CUploadTransferHTTP::RequestTigerTreeRaw(), CBTClient::SendHandshake(), CUploadTransferHTTP::SendResponse(), CHttpRequest::SetPostData(), CG2Packet::ToBuffer(), CG1Packet::ToBuffer(), CEDPacket::ToBuffer(), CBTPacket::ToBuffer(), Ungzip(), and WriteDIME().

DWORD CBuffer::AddBuffer CBuffer pBuffer,
DWORD  nLength = 0xFFFFFFFF
 

Definition at line 229 of file Buffer.cpp.

References Add(), m_nLength, m_pBuffer, and Remove().

Referenced by CRemote::OnHeadersComplete(), CIEProtocol::OnRequestRAZACOL(), CHostBrowser::ReadContent(), CUploadTransferHTTP::RequestHostBrowse(), and CDatagramIn::ToG2Packet().

void CBuffer::AddReversed const void *  pData,
DWORD  nLength
 

Definition at line 244 of file Buffer.cpp.

References EnsureBuffer(), m_nLength, m_pBuffer, and ReverseBuffer().

Referenced by CUploadTransferHTTP::OnWrite().

void CBuffer::Clear  ) 
 

Definition at line 167 of file Buffer.cpp.

References m_nLength.

Referenced by CDownloadTransferED2K::ClearRequests(), CBTInfo::LoadTorrentFile(), CDownloadTransferED2K::OnCompressedPart(), CRemote::OnHeadersComplete(), CQueryHashTable::OnPatch(), CDownloadTransferFTP::CFTPRETR::OnRead(), CDownloadTransferFTP::CFTPLIST::OnRead(), CQueryHashTable::OnReset(), CIEProtocolRequest::OnTerminate(), CDownloadTransferHTTP::ReadContent(), CDownloadTransferHTTP::ReadTiger(), CDatagrams::Remove(), CDownloadTransferFTP::SendCommand(), and Ungzip().

BOOL CBuffer::Deflate BOOL  bIfSmaller = FALSE  ) 
 

Definition at line 473 of file Buffer.cpp.

References Add(), CZLib::Compress(), m_nLength, and m_pBuffer.

Referenced by CDatagramOut::Create(), and CUploadTransferHTTP::RequestHostBrowse().

void CBuffer::EnsureBuffer DWORD  nLength  ) 
 

Definition at line 272 of file Buffer.cpp.

References BLOCK_MASK, BLOCK_SIZE, m_nBuffer, m_nLength, and m_pBuffer.

Referenced by CDiscoveryServices::AddDefaults(), AddReversed(), CZIPFile::File::Decompress(), CUploadTransferED2K::DispatchNextChunk(), CSecurity::Import(), CWorldGPS::Load(), CMessageFilter::Load(), CAdultFilter::Load(), CHostCacheList::LoadDefaultED2KServers(), CMediaListCtrl::LoadTextList(), CBTInfo::LoadTorrentFile(), CNeighbour::OnRead(), CNeighbour::OnWrite(), CRemote::PageBanner(), CRemote::PageImage(), Print(), CHostBrowser::ReadContent(), CLibraryBuilderInternals::ReadJPEG(), CHttpRequest::RunResponse(), CUploadTransferBT::ServeRequests(), CG2Packet::ToBuffer(), Ungzip(), and WriteDIME().

BOOL CBuffer::Inflate DWORD  nSuggest = 0  ) 
 

Definition at line 501 of file Buffer.cpp.

References Add(), CZLib::Decompress(), m_nLength, m_pBuffer, and NULL.

Referenced by CHttpRequest::InflateResponse(), and CQueryHashTable::OnPatch().

void CBuffer::Insert DWORD  nOffset,
const void *  pData,
DWORD  nLength
 

Definition at line 106 of file Buffer.cpp.

References BLOCK_MASK, BLOCK_SIZE, m_nBuffer, m_nLength, and m_pBuffer.

Referenced by CDatagramOut::Create(), and Prefix().

void CBuffer::Prefix LPCSTR  pszText  ) 
 

Definition at line 258 of file Buffer.cpp.

References Insert(), and NULL.

Referenced by CUploadTransferHTTP::OnHeadersComplete().

void CBuffer::Print LPCWSTR  pszText,
UINT  nCodePage = CP_ACP
 

Definition at line 189 of file Buffer.cpp.

References EnsureBuffer(), m_nLength, m_pBuffer, and NULL.

void CBuffer::Print LPCSTR  pszText  ) 
 

Definition at line 178 of file Buffer.cpp.

References Add(), and NULL.

Referenced by CShakeNeighbour::OnConnected(), CHandshake::OnConnected(), CChatSession::OnConnected(), CRemote::OnHeadersComplete(), CChatSession::OnHeadersComplete(), CShakeNeighbour::OnHeadersCompleteG1(), CShakeNeighbour::OnHeadersCompleteG2(), CHandshake::OnRead(), CUploadTransferHTTP::OpenFileSendHeaders(), CChatSession::Print(), CUploadTransferHTTP::QueueRequest(), CUploadTransferHTTP::RequestHostBrowse(), CUploadTransferHTTP::RequestMetadata(), CUploadTransferHTTP::RequestPartialFile(), CUploadTransferHTTP::RequestPreview(), CUploadTransferHTTP::RequestTigerTreeDIME(), CUploadTransferHTTP::RequestTigerTreeRaw(), CDownloadTransferFTP::SendCommand(), CUploadTransferHTTP::SendDefaultHeaders(), CUploadTransferHTTP::SendFileHeaders(), CBTClient::SendHandshake(), CShakeNeighbour::SendHostHeaders(), CShakeNeighbour::SendMinimalHeaders(), CConnection::SendMyAddress(), CShakeNeighbour::SendPrivateHeaders(), CShakeNeighbour::SendPublicHeaders(), CHostBrowser::SendRequest(), CDownloadTransferHTTP::SendRequest(), CUploadTransferHTTP::SendResponse(), and WriteDIME().

BOOL CBuffer::ReadDIME DWORD *  pnFlags,
CString *  psID,
CString *  psType,
DWORD *  pnBody
 

Definition at line 738 of file Buffer.cpp.

References m_nLength, m_pBuffer, NULL, and Remove().

Referenced by CDownloadTransferHTTP::ReadTiger().

BOOL CBuffer::ReadLine CString &  strLine,
BOOL  bPeek = FALSE,
UINT  nCodePage = CP_ACP
 

Definition at line 332 of file Buffer.cpp.

References m_nLength, m_pBuffer, NULL, and Remove().

Referenced by CDiscoveryServices::AddDefaults(), CSecurity::Import(), CMessageFilter::Load(), CAdultFilter::Load(), CHostCacheList::LoadDefaultED2KServers(), CMediaListCtrl::LoadTextList(), CHandshake::OnAcceptGive(), CHandshake::OnAcceptPush(), CRemote::OnRead(), CHandshake::OnRead(), CDownloadTransferFTP::OnRead(), CChatSession::ReadHandshake(), CConnection::ReadHeaders(), CUploadTransferHTTP::ReadRequest(), CShakeNeighbour::ReadResponse(), CHostBrowser::ReadResponseLine(), CDownloadTransferHTTP::ReadResponseLine(), CChatSession::ReadText(), and CHostBrowser::StreamHTML().

CString CBuffer::ReadString DWORD  nBytes,
UINT  nCodePage = CP_ACP
 

Definition at line 293 of file Buffer.cpp.

References m_nLength, m_pBuffer, and NULL.

Referenced by CHttpRequest::GetResponseString(), CCollectionFile::LoadManifest(), CLibraryBuilderInternals::ReadJPEG(), CDownloadTransferHTTP::ReadMetadata(), and CDownloadTransferHTTP::ReadTiger().

DWORD CBuffer::Receive SOCKET  hSocket  ) 
 

Definition at line 398 of file Buffer.cpp.

References Add(), CStatistics::Current, Statistics, and TEMP_BUFFER.

void CBuffer::Remove DWORD  nLength  ) 
 

Definition at line 149 of file Buffer.cpp.

References m_nLength, and m_pBuffer.

Referenced by AddBuffer(), CDownloadTransferED2K::OnCompressedPart(), CBTClient::OnHandshake1(), CBTClient::OnHandshake2(), CNeighbour::OnRead(), CIEProtocolRequest::OnRead(), CNeighbour::OnWrite(), CConnection::OnWrite(), CG2Neighbour::ProcessPackets(), CG1Neighbour::ProcessPackets(), CHostBrowser::ReadContent(), ReadDIME(), CDownloadTransferHTTP::ReadFlush(), ReadLine(), CDownloadTransferHTTP::ReadMetadata(), CChatSession::ReadPackets(), CDownloadTransferHTTP::ReadTiger(), Send(), StartsWith(), CHostBrowser::StreamPacketsG1(), and Ungzip().

void CBuffer::ReverseBuffer const void *  pInput,
void *  pOutput,
DWORD  nLength
[static]
 

Definition at line 647 of file Buffer.cpp.

References SWAP_LONG.

Referenced by AddReversed(), and CDownloadTransferHTTP::ReadContent().

DWORD CBuffer::Send SOCKET  hSocket  ) 
 

Definition at line 437 of file Buffer.cpp.

References CStatistics::Current, m_nLength, m_pBuffer, Remove(), and Statistics.

BOOL CBuffer::StartsWith LPCSTR  pszString,
BOOL  bRemove = FALSE
 

Definition at line 373 of file Buffer.cpp.

References m_nLength, m_pBuffer, and Remove().

BOOL CBuffer::Ungzip  ) 
 

Definition at line 517 of file Buffer.cpp.

References Add(), Clear(), EnsureBuffer(), inflate(), inflateEnd(), inflateInit2, m_nBuffer, m_nLength, m_pBuffer, MAX_WBITS, Remove(), Z_FINISH, Z_OK, and Z_STREAM_END.

Referenced by CHttpRequest::InflateResponse().

void CBuffer::WriteDIME DWORD  nFlags,
LPCSTR  pszID,
LPCSTR  pszType,
LPCVOID  pBody,
DWORD  nBody
 

Definition at line 693 of file Buffer.cpp.

References Add(), EnsureBuffer(), m_nLength, m_pBuffer, NULL, and Print().

Referenced by CUploadTransferHTTP::RequestTigerTreeDIME().


Member Data Documentation

DWORD CBuffer::m_nBuffer
 

Definition at line 44 of file Buffer.h.

Referenced by Add(), CBuffer(), EnsureBuffer(), Insert(), CNeighbour::OnRead(), CNeighbour::OnWrite(), CHostBrowser::ReadContent(), and Ungzip().

DWORD CBuffer::m_nLength
 

Definition at line 43 of file Buffer.h.

Referenced by Add(), AddBuffer(), CDiscoveryServices::AddDefaults(), AddReversed(), CBuffer(), Clear(), CDatagramOut::Create(), CBENode::Decode(), CZIPFile::File::Decompress(), Deflate(), CUploadTransferED2K::DispatchNextChunk(), EnsureBuffer(), CSearchDetailPanel::ExecuteRequest(), CDatagramOut::GetPacket(), CHttpRequest::GetResponseString(), CBENode::GetSHA1(), CSecurity::Import(), Inflate(), Insert(), CWorldGPS::Load(), CMessageFilter::Load(), CAdultFilter::Load(), CHostCacheList::LoadDefaultED2KServers(), CCollectionFile::LoadManifest(), CMediaListCtrl::LoadTextList(), CBTInfo::LoadTorrentFile(), CDownloadTransferED2K::OnCompressedPart(), CHostBrowser::OnDropped(), CRemote::OnHeadersComplete(), CQueryHashTable::OnPatch(), CRemote::OnRead(), CNeighbour::OnRead(), CIEProtocolRequest::OnRead(), CHandshake::OnRead(), CDownloadTransferFTP::CFTPRETR::OnRead(), CDownloadTransferFTP::CFTPLIST::OnRead(), CBTClient::OnRead(), CUploadTransferHTTP::OnRun(), CBTClient::OnRun(), CIEProtocolRequest::OnStart(), CUploadTransferHTTP::OnWrite(), CNeighbour::OnWrite(), CG2Neighbour::OnWrite(), CG1Neighbour::OnWrite(), CConnection::OnWrite(), CRemote::PageBanner(), CRemote::PageImage(), Print(), CG2Neighbour::ProcessPackets(), CG1Neighbour::ProcessPackets(), CHostBrowser::ReadContent(), CDownloadTransferHTTP::ReadContent(), ReadDIME(), CDownloadTransferHTTP::ReadFlush(), CLibraryBuilderInternals::ReadJPEG(), ReadLine(), CDownloadTransferHTTP::ReadMetadata(), CChatSession::ReadPackets(), ReadString(), CDownloadTransferHTTP::ReadTiger(), Remove(), CUploadTransferHTTP::RequestHostBrowse(), CUploadTransferHTTP::RequestTigerTreeDIME(), CHttpRequest::RunResponse(), CBTInfo::SaveTorrentFile(), Send(), CUploadTransferED2K::ServeRequests(), CUploadTransferBT::ServeRequests(), CDownloadTransferHTTP::StartNextFragment(), StartsWith(), CHostBrowser::StreamPacketsG1(), CG2Packet::ToBuffer(), Ungzip(), and WriteDIME().

BYTE* CBuffer::m_pBuffer
 

Definition at line 42 of file Buffer.h.

Referenced by Add(), AddBuffer(), CDiscoveryServices::AddDefaults(), AddReversed(), CBuffer(), CBENode::Decode(), CZIPFile::File::Decompress(), Deflate(), CUploadTransferED2K::DispatchNextChunk(), EnsureBuffer(), CSearchDetailPanel::ExecuteRequest(), CDatagramOut::GetPacket(), CBENode::GetSHA1(), CSecurity::Import(), Inflate(), Insert(), CWorldGPS::Load(), CMessageFilter::Load(), CAdultFilter::Load(), CHostCacheList::LoadDefaultED2KServers(), CMediaListCtrl::LoadTextList(), CBTInfo::LoadTorrentFile(), CDownloadTransferED2K::OnCompressedPart(), CBTClient::OnHandshake1(), CBTClient::OnHandshake2(), CQueryHashTable::OnPatch(), CNeighbour::OnRead(), CIEProtocolRequest::OnRead(), CHandshake::OnRead(), CDownloadTransferFTP::CFTPRETR::OnRead(), CDownloadTransferFTP::CFTPLIST::OnRead(), CNeighbour::OnWrite(), CConnection::OnWrite(), CRemote::PageBanner(), CRemote::PageImage(), Print(), CG2Neighbour::ProcessPackets(), CG1Neighbour::ProcessPackets(), CHostBrowser::ReadContent(), CDownloadTransferHTTP::ReadContent(), ReadDIME(), CLibraryBuilderInternals::ReadJPEG(), ReadLine(), CChatSession::ReadPackets(), ReadString(), CDownloadTransferHTTP::ReadTiger(), Remove(), CUploadTransferHTTP::RequestTigerTreeDIME(), CHttpRequest::RunResponse(), CBTInfo::SaveTorrentFile(), Send(), CUploadTransferBT::ServeRequests(), StartsWith(), CHostBrowser::StreamPacketsG1(), CG2Packet::ToBuffer(), Ungzip(), WriteDIME(), and ~CBuffer().

CBuffer* CBuffer::m_pNext
 

Definition at line 41 of file Buffer.h.

Referenced by CBuffer(), CDatagrams::Listen(), CDatagrams::OnReceiveSGP(), CDatagrams::Remove(), and CDatagrams::Send().


The documentation for this class was generated from the following files:
Generated on Thu Dec 15 10:40:04 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2