1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 13:35:36 +00:00
transmission/libtransmission/handshake.h
Charles Kerr 02b9e17207
refactor: make tr_peerIo a class (#1928)
* refactor: make tr_peerIo a class

No behavioral changes.

Use `new` and `delete` and change `struct` references to `class`.

* refactor: make some tr_peerIo fields const

* refactor: reorganize tr_peerIo fields to remove padding holes

* refactor: remove redundant field tr_peerIo.isIncoming

* refactor: make tr_peerIo.inbuf, .outbuf fields const*
2021-10-11 16:54:16 -05:00

45 lines
1.1 KiB
C++

/*
* This file Copyright (C) 2007-2014 Mnemosyne LLC
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
*
*/
#pragma once
#ifndef __TRANSMISSION__
#error only libtransmission should #include this header.
#endif
#include "transmission.h"
#include "net.h"
/** @addtogroup peers Peers
@{ */
class tr_peerIo;
/** @brief opaque struct holding hanshake state information.
freed when the handshake is completed. */
struct tr_handshake;
/* returns true on success, false on error */
using handshakeDoneCB = bool (*)(
struct tr_handshake* handshake,
tr_peerIo* io,
bool readAnythingFromPeer,
bool isConnected,
uint8_t const* peerId,
void* userData);
/** @brief instantiate a new handshake */
tr_handshake* tr_handshakeNew(tr_peerIo* io, tr_encryption_mode encryptionMode, handshakeDoneCB doneCB, void* doneUserData);
tr_address const* tr_handshakeGetAddr(struct tr_handshake const* handshake, tr_port* port);
void tr_handshakeAbort(tr_handshake* handshake);
tr_peerIo* tr_handshakeStealIO(tr_handshake* handshake);
/** @} */