source: branches/encryption/libtransmission/peer-msgs.h @ 2984

Last change on this file since 2984 was 2984, checked in by charles, 15 years ago

periodic checkin. nothing to see here.

  • Property svn:keywords set to Date Rev Author Id
File size: 1.8 KB
Line 
1/*
2 * This file Copyright (C) 2007 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 2984 2007-09-07 17:05:56Z charles $
11 */
12
13#ifndef TR_P_H
14#define TR_P_H
15
16#include <inttypes.h>
17#include "publish.h"
18
19struct tr_torrent;
20struct tr_peer;
21struct tr_bitfield;
22
23typedef struct tr_peermsgs tr_peermsgs;
24
25tr_peermsgs* tr_peerMsgsNew( struct tr_torrent  * torrent,
26                             struct tr_peer     * peer );
27
28void         tr_peerMsgsSetChoke( tr_peermsgs *, int doChoke );
29
30void         tr_peerMsgsFree( tr_peermsgs* );
31
32int          tr_peerMsgsAddRequest( tr_peermsgs * peer,
33                                    uint32_t      index,
34                                    uint32_t      begin,
35                                    uint32_t      length );
36
37/**
38***  PeerMsgs Publish / Subscribe
39**/
40
41typedef enum
42{
43    TR_PEERMSG_GOT_BITFIELD,
44    TR_PEERMSG_GOT_HAVE,
45    TR_PEERMSG_GOT_PEX,
46    TR_PEERMSG_GOT_ERROR,
47    TR_PEERMSG_BLOCKS_RUNNING_LOW,
48}
49PeerMsgsEventType;
50
51typedef struct
52{
53    PeerMsgsEventType eventType;
54    uint32_t pieceIndex; /* for TR_PEERMSG_GOT_HAVE */
55    const struct tr_bitfield * bitfield; /* for TR_PEERMSG_GOT_BITFIELD */
56}
57tr_peermsgs_event;
58
59tr_publisher_tag  tr_peerMsgsSubscribe   ( tr_peermsgs       * peer,
60                                           tr_delivery_func    func,
61                                           void              * user );
62
63void              tr_peerMsgsUnsubscribe ( tr_peermsgs       * peer,
64                                          tr_publisher_tag     tag );
65
66
67
68#endif
Note: See TracBrowser for help on using the repository browser.