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

Transfer.cpp

Go to the documentation of this file.
00001 //
00002 // Transfer.cpp
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "Settings.h"
00025 #include "Transfers.h"
00026 #include "Transfer.h"
00027 
00028 #ifdef _DEBUG
00029 #undef THIS_FILE
00030 static char THIS_FILE[]=__FILE__;
00031 #define new DEBUG_NEW
00032 #endif
00033 
00034 
00036 // CTransfer construction
00037 
00038 CTransfer::CTransfer()
00039 {
00040         m_nRunCookie = 0;
00041 }
00042 
00043 CTransfer::~CTransfer()
00044 {
00045         ASSERT( m_hSocket == INVALID_SOCKET );
00046         if ( m_hSocket != INVALID_SOCKET ) Close();
00047 }
00048 
00050 // CTransfer operations
00051 
00052 BOOL CTransfer::ConnectTo(IN_ADDR* pAddress, WORD nPort)
00053 {
00054         if ( CConnection::ConnectTo( pAddress, nPort ) )
00055         {
00056                 Transfers.Add( this );
00057                 return TRUE;
00058         }
00059 
00060         return FALSE;
00061 }
00062 
00063 void CTransfer::AttachTo(CConnection* pConnection)
00064 {
00065         CConnection::AttachTo( pConnection );
00066         Transfers.Add( this );
00067 }
00068 
00069 void CTransfer::Close()
00070 {
00071         Transfers.Remove( this );
00072         CConnection::Close();
00073 }
00074 
00076 // CTransfer HTTP headers
00077 
00078 void CTransfer::ClearHeaders()
00079 {
00080         m_pHeaderName.RemoveAll();
00081         m_pHeaderValue.RemoveAll();
00082 }
00083 
00084 BOOL CTransfer::OnHeaderLine(CString& strHeader, CString& strValue)
00085 {
00086         m_pHeaderName.Add( strHeader );
00087         m_pHeaderValue.Add( strValue );
00088 
00089         return CConnection::OnHeaderLine( strHeader, strValue );
00090 }

Generated on Thu Dec 15 10:39:50 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2