~ubuntu-branches/debian/experimental/libtorrent/experimental

« back to all changes in this revision

Viewing changes to src/protocol/handshake_manager.h

  • Committer: Bazaar Package Importer
  • Author(s): Jose Luis Rivas
  • Date: 2007-03-31 10:31:05 UTC
  • mto: (4.1.4 gutsy) (6.2.1 squeeze) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20070331103105-jzpp1rml6ud0ff75
Tags: upstream-0.11.4
ImportĀ upstreamĀ versionĀ 0.11.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include <rak/functional.h>
43
43
#include <rak/unordered_vector.h>
44
44
#include <rak/socket_address.h>
 
45
#include <torrent/connection_manager.h>
45
46
 
46
47
#include "net/socket_fd.h"
47
48
 
57
58
  typedef rak::unordered_vector<Handshake*> base_type;
58
59
  typedef uint32_t                          size_type;
59
60
 
60
 
  typedef rak::mem_fun1<DownloadManager, DownloadMain*, const std::string&> SlotDownloadId;
 
61
  typedef rak::mem_fun1<DownloadManager, DownloadMain*, const char*> SlotDownloadId;
61
62
 
62
63
  using base_type::empty;
63
64
 
77
78
  void                add_incoming(SocketFd fd, const rak::socket_address& sa);
78
79
  void                add_outgoing(const rak::socket_address& sa, DownloadMain* info);
79
80
 
80
 
  void                slot_download_id(SlotDownloadId s)        { m_slotDownloadId = s; }
 
81
  void                slot_download_id(SlotDownloadId s)                { m_slotDownloadId = s; }
 
82
  void                slot_download_id_obfuscated(SlotDownloadId s)     { m_slotDownloadIdObfuscated = s; }
81
83
 
82
84
  void                receive_succeeded(Handshake* h);
83
 
  void                receive_failed(Handshake* h);
 
85
  void                receive_failed(Handshake* h, int message, int error);
 
86
  void                receive_timeout(Handshake* h);
84
87
 
85
88
  // This needs to be filterable slot.
86
 
  DownloadMain*       download_info(const std::string& hash)    { return m_slotDownloadId(hash); }
 
89
  DownloadMain*       download_info(const char* hash)                   { return m_slotDownloadId(hash); }
 
90
  DownloadMain*       download_info_obfuscated(const char* hash)        { return m_slotDownloadIdObfuscated(hash); }
87
91
 
88
92
private:
 
93
  void                create_outgoing(const rak::socket_address& sa, DownloadMain* info, int encryptionOptions);
89
94
  void                erase(Handshake* handshake);
90
95
 
91
96
  bool                setup_socket(SocketFd fd);
92
97
 
93
 
  inline void         delete_handshake(Handshake* h);
94
 
 
95
 
  inline void         post_insert(Handshake* h, PeerConnectionBase* pcb);
96
 
 
97
98
  SlotDownloadId      m_slotDownloadId;
 
99
  SlotDownloadId      m_slotDownloadIdObfuscated;
98
100
};
99
101
 
100
102
}