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

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

(libT) #1379: support "partial seeds" BEP 22

  • Property svn:keywords set to Date Rev Author Id
File size: 1.6 KB
Line 
1/*
2 * This file Copyright (C) 2008 Charles Kerr <charles@rebelbase.com>
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 7238 2008-12-02 19:46:51Z 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*** Fields common to webseed and bittorrent peers
22**/
23
24#include "transmission.h"
25#include "publish.h"
26
27typedef enum
28{
29    TR_ADDREQ_OK = 0,
30    TR_ADDREQ_FULL,
31    TR_ADDREQ_DUPLICATE,
32    TR_ADDREQ_MISSING,
33    TR_ADDREQ_CLIENT_CHOKED
34}
35tr_addreq_t;
36
37/**
38***  Peer Publish / Subscribe
39**/
40
41typedef enum
42{
43    TR_PEER_CLIENT_GOT_BLOCK,
44    TR_PEER_CLIENT_GOT_DATA,
45    TR_PEER_CLIENT_GOT_ALLOWED_FAST,
46    TR_PEER_CLIENT_GOT_SUGGEST,
47    TR_PEER_PEER_GOT_DATA,
48    TR_PEER_PEER_PROGRESS,
49    TR_PEER_ERROR,
50    TR_PEER_CANCEL,
51    TR_PEER_UPLOAD_ONLY,
52    TR_PEER_NEED_REQ
53}
54PeerEventType;
55
56typedef struct
57{
58    PeerEventType    eventType;
59    uint32_t         pieceIndex;   /* for GOT_BLOCK, CANCEL, ALLOWED, SUGGEST */
60    uint32_t         offset;       /* for GOT_BLOCK */
61    uint32_t         length;       /* for GOT_BLOCK + GOT_DATA */
62    float            progress;     /* for PEER_PROGRESS */
63    int              err;          /* errno for GOT_ERROR */
64    int              wasPieceData; /* for GOT_DATA */
65    tr_bool          uploadOnly;   /* for UPLOAD_ONLY */
66}
67tr_peer_event;
68
69#ifdef WIN32
70 #define EMSGSIZE WSAEMSGSIZE
71#endif
72
73#endif
Note: See TracBrowser for help on using the repository browser.