~ubuntu-branches/debian/lenny/libtorrent/lenny

« back to all changes in this revision

Viewing changes to src/download/download_wrapper.h

  • Committer: Bazaar Package Importer
  • Author(s): James Vega
  • Date: 2008-04-15 21:38:37 UTC
  • mfrom: (4.1.6 hardy)
  • Revision ID: james.westby@ubuntu.com-20080415213837-znilhi7a44yec99u
Tags: 0.11.9-1.1
* Non-maintainer upload.
* Fix FTBFS with gcc-4.3.  (Closes: #420920)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// libTorrent - BitTorrent library
2
 
// Copyright (C) 2005-2006, Jari Sundell
 
2
// Copyright (C) 2005-2007, Jari Sundell
3
3
//
4
4
// This program is free software; you can redistribute it and/or modify
5
5
// it under the terms of the GNU General Public License as published by
42
42
#include <sigc++/signal.h>
43
43
 
44
44
#include "data/chunk_handle.h"
45
 
#include "torrent/peer.h"
 
45
#include "torrent/peer/peer.h"
46
46
#include "download/download_info.h"
47
47
 
48
48
#include "download_main.h"
51
51
 
52
52
// Remember to clean up the pointers, DownloadWrapper won't do it.
53
53
 
 
54
class AddressList;
54
55
class FileManager;
55
56
class HashQueue;
56
57
class HashTorrent;
60
61
 
61
62
class DownloadWrapper {
62
63
public:
63
 
  typedef std::list<rak::socket_address>          AddressList;
64
 
 
65
64
  typedef sigc::signal0<void>                     Signal;
66
65
  typedef sigc::signal1<void, uint32_t>           SignalChunk;
67
66
  typedef sigc::signal1<void, const std::string&> SignalString;
81
80
 
82
81
  DownloadMain*       main()                                  { return &m_main; }
83
82
  const DownloadMain* main() const                            { return &m_main; }
84
 
  HashTorrent*        hash_checker()                          { return m_hash; }
 
83
  HashTorrent*        hash_checker()                          { return m_hashChecker; }
85
84
 
86
85
  Object*             bencode()                               { return m_bencode; }
87
86
  void                set_bencode(Object* o)                  { m_bencode = o; }
88
87
 
 
88
  HashQueue*          hash_queue()                            { return m_hashQueue; }
 
89
  void                set_hash_queue(HashQueue* q)            { m_hashQueue = q; }
 
90
 
 
91
  const std::string&  complete_hash()                            { return m_hash; }
 
92
  const char*         chunk_hash(unsigned int index)             { return m_hash.c_str() + 20 * index; }
 
93
  void                set_complete_hash(const std::string& hash) { m_hash = hash; }
 
94
 
89
95
  DownloadInfo*       info()                                  { return m_main.info(); }
90
96
 
91
97
  int                 connection_type() const                 { return m_connectionType; }
92
98
  void                set_connection_type(int t)              { m_connectionType = t; }
93
99
 
94
100
  void                receive_initial_hash();
 
101
  void                receive_hash_done(ChunkHandle handle, const char* hash);
95
102
 
96
103
  void                check_chunk_hash(ChunkHandle handle);
97
 
  void                receive_hash_done(ChunkHandle handle, const char* hash);
98
104
 
99
105
  void                receive_storage_error(const std::string& str);
100
106
  void                receive_tracker_success(AddressList* l);
128
134
 
129
135
  DownloadMain        m_main;
130
136
  Object*             m_bencode;
131
 
  HashTorrent*        m_hash;
 
137
  HashTorrent*        m_hashChecker;
 
138
  HashQueue*          m_hashQueue;
 
139
 
 
140
  std::string         m_hash;
132
141
 
133
142
  int                 m_connectionType;
134
143