libktorrent  2.1.1
Public Types | Signals | Public Member Functions | Static Public Member Functions | List of all members
bt::UDPTrackerSocket Class Reference

#include <udptrackersocket.h>

Inheritance diagram for bt::UDPTrackerSocket:
Inheritance graph
[legend]

Public Types

enum  Action { CONNECT = 0, ANNOUNCE = 1, SCRAPE = 2, ERROR = 3 }
 

Signals

void announceReceived (Int32 tid, const Uint8 *buf, Uint32 size)
 
void connectReceived (Int32 tid, Int64 connection_id)
 
void error (Int32 tid, const QString &error_string)
 
void scrapeReceived (Int32 tid, const Uint8 *buf, Uint32 size)
 

Public Member Functions

void cancelTransaction (Int32 tid)
 
Int32 newTransactionID ()
 
void sendAnnounce (Int32 tid, const Uint8 *data, const net::Address &addr)
 
void sendConnect (Int32 tid, const net::Address &addr)
 
void sendScrape (Int32 tid, const Uint8 *data, const net::Address &addr)
 

Static Public Member Functions

static Uint16 getPort ()
 Get the port in use.
 
static void setPort (Uint16 p)
 

Detailed Description

Author
Joris Guisson

Class which handles communication with one or more UDP trackers.

Definition at line 46 of file udptrackersocket.h.

Member Function Documentation

◆ announceReceived

void bt::UDPTrackerSocket::announceReceived ( Int32  tid,
const Uint8 *  buf,
Uint32  size 
)
signal

Emitted when an announce message is received.

Parameters
tidThe transaction_id
bufThe data
sizeThe data size

◆ cancelTransaction()

void bt::UDPTrackerSocket::cancelTransaction ( Int32  tid)

If a transaction times out, this should be used to cancel it.

Parameters
tid

◆ connectReceived

void bt::UDPTrackerSocket::connectReceived ( Int32  tid,
Int64  connection_id 
)
signal

Emitted when a connect message is received.

Parameters
tidThe transaction_id
connection_idThe connection_id returned

◆ error

void bt::UDPTrackerSocket::error ( Int32  tid,
const QString &  error_string 
)
signal

Signal emitted, when an error occurs during a transaction.

Parameters
tidThe transaction_id
error_stringPotential error string

◆ newTransactionID()

Int32 bt::UDPTrackerSocket::newTransactionID ( )

Compute a free transaction_id.

Returns
A free transaction_id

◆ scrapeReceived

void bt::UDPTrackerSocket::scrapeReceived ( Int32  tid,
const Uint8 *  buf,
Uint32  size 
)
signal

Emitted when a scrape message is received.

Parameters
tidThe transaction_id
bufThe data
sizeThe data size

◆ sendAnnounce()

void bt::UDPTrackerSocket::sendAnnounce ( Int32  tid,
const Uint8 *  data,
const net::Address addr 
)

Send an announce message. As a response to this, the announceReceived signal will be emitted, classes recieving this signal should check if the transaction_id is the same.

Parameters
tidThe transaction_id
dataThe data to send (connect input structure, in UDP Tracker specifaction)
addrThe address to send to

◆ sendConnect()

void bt::UDPTrackerSocket::sendConnect ( Int32  tid,
const net::Address addr 
)

Send a connect message. As a response to this, the connectReceived signal will be emitted, classes recieving this signal should check if the transaction_id is the same.

Parameters
tidThe transaction_id
addrThe address to send to

◆ sendScrape()

void bt::UDPTrackerSocket::sendScrape ( Int32  tid,
const Uint8 *  data,
const net::Address addr 
)

Send a scrape message. As a response to this, the scrapeReceived signal will be emitted, classes recieving this signal should check if the transaction_id is the same.

Parameters
tidThe transaction_id
dataThe data to send (connect input structure, in UDP Tracker specifaction)
addrThe address to send to

◆ setPort()

static void bt::UDPTrackerSocket::setPort ( Uint16  p)
static

Set the port ot use.

Parameters
pThe port

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