source: trunk/libtransmission/peer-msgs.h @ 6073

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

#800 initial support for GetRight?-style fetching of data through http and ftp servers specified in the .torrent's "url-list" tag

  • Property svn:keywords set to Date Rev Author Id
File size: 2.4 KB
Line 
1/*
2 * This file Copyright (C) 2007-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-msgs.h 6073 2008-06-07 21:26:41Z charles $
11 */
12
13#ifndef TR_PEER_MSGS_H
14#define TR_PEER_MSGS_H
15
16#include <inttypes.h>
17#include "peer-common.h"
18#include "publish.h"
19
20struct tr_torrent;
21struct tr_peer;
22struct tr_bitfield;
23
24typedef struct tr_peermsgs tr_peermsgs;
25
26tr_peermsgs* tr_peerMsgsNew( struct tr_torrent  * torrent,
27                             struct tr_peer     * peer,
28                             tr_delivery_func     func,
29                             void               * user,
30                             tr_publisher_tag   * setme );
31
32
33void         tr_peerMsgsSetChoke( tr_peermsgs *, int doChoke );
34
35void         tr_peerMsgsHave( tr_peermsgs * msgs,
36                              uint32_t      pieceIndex );
37
38void         tr_peerMsgsCancel( tr_peermsgs * msgs,
39                                uint32_t      pieceIndex,
40                                uint32_t      offset,
41                                uint32_t      length );
42
43void         tr_peerMsgsFree( tr_peermsgs* );
44
45
46#if 0
47enum {
48    TR_ADDREQ_OK=0,
49    TR_ADDREQ_FULL,
50    TR_ADDREQ_DUPLICATE,
51    TR_ADDREQ_MISSING,
52    TR_ADDREQ_CLIENT_CHOKED
53};
54#endif
55
56int          tr_peerMsgsAddRequest( tr_peermsgs * peer,
57                                    uint32_t      index,
58                                    uint32_t      begin,
59                                    uint32_t      length );
60
61/**
62***  PeerMsgs Publish / Subscribe
63**/
64
65#if 0
66typedef enum
67{
68    TR_PEERMSG_CLIENT_HAVE,
69    TR_PEERMSG_CLIENT_BLOCK,
70    TR_PEERMSG_PIECE_DATA,
71    TR_PEERMSG_PEER_PROGRESS,
72    TR_PEERMSG_ERROR,
73    TR_PEERMSG_CANCEL,
74    TR_PEERMSG_NEED_REQ
75}
76PeerMsgsEventType;
77
78typedef struct
79{
80    PeerMsgsEventType eventType;
81    uint32_t pieceIndex; /* for TR_PEERMSG_GOT_BLOCK, TR_PEERMSG_GOT_HAVE */
82    uint32_t offset;     /* for TR_PEERMSG_GOT_BLOCK */
83    uint32_t length;     /* for TR_PEERMSG_GOT_BLOCK */
84    float progress;      /* for TR_PEERMSG_PEER_PROGRESS */
85    tr_errno err;        /* for TR_PEERMSG_GOT_ERROR */
86}
87tr_peermsgs_event;
88#endif
89
90void  tr_peerMsgsUnsubscribe ( tr_peermsgs       * peer,
91                               tr_publisher_tag    tag );
92
93#endif
Note: See TracBrowser for help on using the repository browser.