source: trunk/libtransmission/peer-common.h @ 10500

Last change on this file since 10500 was 10500, checked in by charles, 12 years ago

(trunk libT) #3159 "better decision-making when choosing which peers to initiate new connections with" -- experimental commit

  • Property svn:keywords set to Date Rev Author Id
File size: 1.9 KB
Line 
1/*
2 * This file Copyright (C) 2008-2010 Mnemosyne LLC
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id: peer-common.h 10500 2010-04-20 21:54:03Z charles $
11 */
12
13#ifndef __TRANSMISSION__
14#error only libtransmission should #include this header.
15#endif
16
17#ifndef TR_PEER_H
18#define TR_PEER_H
19
20/**
21 * @addtogroup peers Peers
22 * @{
23 */
24
25/**
26*** Fields common to webseed and bittorrent peers
27**/
28
29#include "transmission.h"
30
31enum
32{
33    /** when we're making requests from another peer,
34        batch them together to send enough requests to
35        meet our bandwidth goals for the next N seconds */
36    REQUEST_BUF_SECS = 10
37};
38
39typedef enum
40{
41    TR_ADDREQ_OK = 0,
42    TR_ADDREQ_FULL,
43    TR_ADDREQ_DUPLICATE,
44    TR_ADDREQ_MISSING,
45    TR_ADDREQ_CLIENT_CHOKED
46}
47tr_addreq_t;
48
49/**
50***  Peer Publish / Subscribe
51**/
52
53typedef enum
54{
55    TR_PEER_CLIENT_GOT_BLOCK,
56    TR_PEER_CLIENT_GOT_CHOKE,
57    TR_PEER_CLIENT_GOT_DATA,
58    TR_PEER_CLIENT_GOT_ALLOWED_FAST,
59    TR_PEER_CLIENT_GOT_SUGGEST,
60    TR_PEER_CLIENT_GOT_PORT,
61    TR_PEER_CLIENT_GOT_REJ,
62    TR_PEER_PEER_GOT_DATA,
63    TR_PEER_PEER_PROGRESS,
64    TR_PEER_ERROR
65}
66PeerEventType;
67
68typedef struct
69{
70    PeerEventType    eventType;
71    uint32_t         pieceIndex;   /* for GOT_BLOCK, CANCEL, ALLOWED, SUGGEST */
72    uint32_t         offset;       /* for GOT_BLOCK */
73    uint32_t         length;       /* for GOT_BLOCK + GOT_DATA */
74    float            progress;     /* for PEER_PROGRESS */
75    int              err;          /* errno for GOT_ERROR */
76    tr_bool          wasPieceData; /* for GOT_DATA */
77    tr_port          port;         /* for GOT_PORT */
78}
79tr_peer_event;
80
81#ifdef WIN32
82 #define EMSGSIZE WSAEMSGSIZE
83#endif
84
85/** @} */
86
87#endif
Note: See TracBrowser for help on using the repository browser.