• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/transmission/transmission-2.73/libtransmission/
1/*
2 * This file Copyright (C) Mnemosyne LLC
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: handshake.h 12204 2011-03-22 15:19:54Z jordan $
11 */
12
13#ifndef __TRANSMISSION__
14#error only libtransmission should #include this header.
15#endif
16
17#ifndef TR_HANDSHAKE_H
18#define TR_HANDSHAKE_H
19
20#include "transmission.h"
21#include "net.h"
22
23/** @addtogroup peers Peers
24    @{ */
25
26struct tr_peerIo;
27
28/** @brief opaque struct holding hanshake state information.
29           freed when the handshake is completed. */
30typedef struct tr_handshake tr_handshake;
31
32/* returns true on success, false on error */
33typedef bool ( *handshakeDoneCB )( struct tr_handshake * handshake,
34                                   struct tr_peerIo    * io,
35                                   bool                  readAnythingFromPeer,
36                                   bool                  isConnected,
37                                   const uint8_t       * peerId,
38                                   void                * userData );
39
40/** @brief instantiate a new handshake */
41tr_handshake *         tr_handshakeNew( struct tr_peerIo * io,
42                                        tr_encryption_mode encryptionMode,
43                                        handshakeDoneCB    doneCB,
44                                        void *             doneUserData );
45
46const tr_address *     tr_handshakeGetAddr( const struct tr_handshake  * handshake,
47                                            tr_port                    * port );
48
49void                   tr_handshakeAbort( tr_handshake * handshake );
50
51struct tr_peerIo*      tr_handshakeGetIO( tr_handshake * handshake );
52
53struct tr_peerIo*      tr_handshakeStealIO( tr_handshake * handshake );
54
55
56/** @} */
57#endif
58