source: branches/1.4x/libtransmission/peer-common.h

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

(1.4x libT) backport handshake, peer, bandwidth, peer-io to 1.4x.

  • 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 7455 2008-12-22 00:51:14Z mikedld $
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
26typedef enum
27{
28    TR_ADDREQ_OK = 0,
29    TR_ADDREQ_FULL,
30    TR_ADDREQ_DUPLICATE,
31    TR_ADDREQ_MISSING,
32    TR_ADDREQ_CLIENT_CHOKED
33}
34tr_addreq_t;
35
36/**
37***  Peer Publish / Subscribe
38**/
39
40typedef enum
41{
42    TR_PEER_CLIENT_GOT_BLOCK,
43    TR_PEER_CLIENT_GOT_DATA,
44    TR_PEER_CLIENT_GOT_ALLOWED_FAST,
45    TR_PEER_CLIENT_GOT_SUGGEST,
46    TR_PEER_PEER_GOT_DATA,
47    TR_PEER_PEER_PROGRESS,
48    TR_PEER_ERROR,
49    TR_PEER_CANCEL,
50    TR_PEER_UPLOAD_ONLY,
51    TR_PEER_NEED_REQ
52}
53PeerEventType;
54
55typedef struct
56{
57    PeerEventType    eventType;
58    uint32_t         pieceIndex;   /* for GOT_BLOCK, CANCEL, ALLOWED, SUGGEST */
59    uint32_t         offset;       /* for GOT_BLOCK */
60    uint32_t         length;       /* for GOT_BLOCK + GOT_DATA */
61    float            progress;     /* for PEER_PROGRESS */
62    int              err;          /* errno for GOT_ERROR */
63    tr_bool          wasPieceData; /* for GOT_DATA */
64    tr_bool          uploadOnly;   /* for UPLOAD_ONLY */
65}
66tr_peer_event;
67
68#ifdef WIN32
69 #define EMSGSIZE WSAEMSGSIZE
70#endif
71
72#endif
Note: See TracBrowser for help on using the repository browser.