3
Copyright (c) 2003, Arvid Norberg
6
Redistribution and use in source and binary forms, with or without
7
modification, are permitted provided that the following conditions
10
* Redistributions of source code must retain the above copyright
11
notice, this list of conditions and the following disclaimer.
12
* Redistributions in binary form must reproduce the above copyright
13
notice, this list of conditions and the following disclaimer in
14
the documentation and/or other materials provided with the distribution.
15
* Neither the name of the author nor the names of its
16
contributors may be used to endorse or promote products derived
17
from this software without specific prior written permission.
19
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
POSSIBILITY OF SUCH DAMAGE.
33
#ifndef TORRENT_PEER_INFO_HPP_INCLUDED
34
#define TORRENT_PEER_INFO_HPP_INCLUDED
38
#include "libtorrent/socket.hpp"
39
#include "libtorrent/peer_id.hpp"
40
#include "libtorrent/size_type.hpp"
41
#include "libtorrent/config.hpp"
45
struct TORRENT_EXPORT peer_info
51
remote_interested = 0x4,
53
supports_extensions = 0x10,
54
local_connection = 0x20,
60
optimistic_unchoke = 0x800
61
#ifndef TORRENT_DISABLE_ENCRYPTION
62
, rc4_encrypted = 0x100000,
63
plaintext_encrypted = 0x200000
69
enum peer_source_flags
84
float payload_up_speed;
85
float payload_down_speed;
86
size_type total_download;
87
size_type total_upload;
89
std::vector<bool> pieces;
93
// time since last request
94
time_duration last_request;
96
// time since last download or upload
97
time_duration last_active;
99
// the size of the send buffer for this peer
100
int send_buffer_size;
102
// the number of failed hashes for this peer
105
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
106
// in case the session settings is set
107
// to resolve countries, this is set to
108
// the two character country code this
113
size_type load_balancing;
115
// this is the number of requests
116
// we have sent to this peer
117
// that we haven't got a response
119
int download_queue_length;
121
// the number of requests that is
122
// tried to be maintained (this is
123
// typically a function of download speed)
124
int target_dl_queue_length;
126
// this is the number of requests
127
// the peer has sent to us
128
// that we haven't sent yet
129
int upload_queue_length;
131
// the number of times this IP
132
// has failed to connect
135
// the currently downloading piece
136
// if piece index is -1 all associated
137
// members are just set to 0
138
int downloading_piece_index;
139
int downloading_block_index;
140
int downloading_progress;
141
int downloading_total;
147
standard_bittorrent = 0,
152
// approximate peer download rate
155
// number of bytes this peer has in
156
// the disk write queue
157
int pending_disk_bytes;
162
#endif // TORRENT_PEER_INFO_HPP_INCLUDED