libktorrent  2.2.0
Signals | Public Member Functions | Protected Member Functions | List of all members
utp::UTPServer Class Reference

#include <utpserver.h>

Inheritance diagram for utp::UTPServer:
Inheritance graph
[legend]

Signals

void accepted ()
 Emitted when a connection is accepted if creating sockets is disabled.
 
void handlePendingConnectionsDelayed ()
 

Public Member Functions

 UTPServer (QObject *parent=0)
 
Connection::WPtr acceptedConnection ()
 Get the last accepted connection (Note: for unittest purposes)
 
bool changePort (bt::Uint16 port) override
 
Connection::WPtr connectTo (const net::Address &addr)
 Setup a connection to a remote address.
 
void handlePendingConnections ()
 
void preparePolling (net::Poll *p, net::Poll::Mode mode, Connection::Ptr &conn)
 Prepare the server for polling.
 
bool sendTo (Connection::Ptr conn, const PacketBuffer &packet) override
 Send a packet to some host.
 
void setCreateSockets (bool on)
 Enabled creating sockets (tests need to have this disabled)
 
void setTOS (bt::Uint8 type_of_service)
 Set the TOS byte.
 
void start ()
 Start the UTP server.
 
void stop ()
 Stop the UTP server.
 
void threadStarted ()
 Thread has been started.
 
- Public Member Functions inherited from bt::ServerInterface
 ServerInterface (QObject *parent=0)
 

Protected Member Functions

void closed (Connection::Ptr conn) override
 Called when the connection is closed.
 
void customEvent (QEvent *ev) override
 
virtual void handlePacket (bt::Buffer::Ptr buffer, const net::Address &addr)
 
void stateChanged (Connection::Ptr conn, bool readable, bool writeable) override
 Connection has become readable, writeable or both.
 
- Protected Member Functions inherited from bt::ServerInterface
void newConnection (mse::EncryptedPacketSocket::Ptr sock)
 

Additional Inherited Members

- Static Public Member Functions inherited from bt::ServerInterface
static void addPeerManager (PeerManager *pman)
 
static QStringList bindAddresses ()
 
static void disableEncryption ()
 
static void enableEncryption (bool allow_unencrypted)
 
static bool findInfoHash (const SHA1Hash &skey, SHA1Hash &info_hash)
 
static PeerManagerfindPeerManager (const SHA1Hash &hash)
 
static Uint16 getPort ()
 Get the port in use.
 
static bool isEncryptionEnabled ()
 
static bool isUtpEnabled ()
 
static bool onlyUseUtp ()
 
static TransportProtocol primaryTransportProtocol ()
 
static void removePeerManager (PeerManager *pman)
 
static void setPort (Uint16 p)
 Set the port to use.
 
static void setPrimaryTransportProtocol (TransportProtocol proto)
 
static void setUtpEnabled (bool on, bool only_use_utp)
 
static bool unencryptedConnectionsAllowed ()
 
- Static Protected Attributes inherited from bt::ServerInterface
static bool allow_unencrypted
 
static bool encryption
 
static bool only_use_utp
 
static QList< PeerManager * > peer_managers
 
static Uint16 port
 
static TransportProtocol primary_transport_protocol
 
static bool utp_enabled
 

Detailed Description

Implements the UTP server. It listens for UTP packets and manages all connections.

Definition at line 55 of file utpserver.h.

Member Function Documentation

◆ changePort()

bool utp::UTPServer::changePort ( bt::Uint16  port)
overridevirtual

Change the port.

Parameters
portThe new port

Implements bt::ServerInterface.

◆ handlePendingConnections()

void utp::UTPServer::handlePendingConnections ( )

Handle newly connected sockets, it starts authentication on them. This needs to be called from the main thread.


The documentation for this class was generated from the following file: