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

Last change on this file since 8561 was 8561, checked in by charles, 13 years ago

(trunk libT) re-start work on making libT doxygen friendly. still a long ways to go on this.

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