Protocols::BitTorrent::Trackers::TrackerRequestUrlCreator Class Reference

#include <TrackerRequestUrlCreator.h> [code]

List of all members.


Detailed Description

Creates request URLs from tracker requests.

This class (it's createRequestUrl function) is used to create a request URL that could be then used in a HTTP request to a tracker. See createRequestUrl() for more info. Instance creation and copying is not allowed.

Definition at line 40 of file TrackerRequestUrlCreator.h.

Static Public Member Functions

static Uri createRequestUrl (const TrackerRequest &)
 Creates and returns a request URL from the selected trackerRequest.

Private Member Functions

 TrackerRequestUrlCreator ()
 ~TrackerRequestUrlCreator ()
 TrackerRequestUrlCreator (const TrackerRequestUrlCreator &)
TrackerRequestUrlCreatoroperator= (const TrackerRequestUrlCreator &)

Static Private Member Functions

static QByteArray eventToString (TrackerRequest::Event event)

Static Private Attributes

static const char * ParameterInfoHashName = "info_hash"
static const char * ParameterPeerIdName = "peer_id"
static const char * ParameterPortName = "port"
static const char * ParameterUploadedName = "uploaded"
static const char * ParameterDownloadedName = "downloaded"
static const char * ParameterLeftName = "left"
static const char * ParameterCompactName = "compact"
static const char * ParameterEventName = "event"
static const char * ParameterIpName = "ip"
static const char * ParameterNumWantName = "numwant"
static const char * ParameterKeyName = "key"
static const char * ParameterTrackerIdName = "trackerid"
static const char * CompactTrueValueString = "1"
 'True' value textual repr.
static const char * CompactFalseValueString = "0"
 'False' value textual repr.


Constructor & Destructor Documentation

Protocols::BitTorrent::Trackers::TrackerRequestUrlCreator::TrackerRequestUrlCreator  )  [private]
 

Protocols::BitTorrent::Trackers::TrackerRequestUrlCreator::~TrackerRequestUrlCreator  )  [private]
 

Protocols::BitTorrent::Trackers::TrackerRequestUrlCreator::TrackerRequestUrlCreator const TrackerRequestUrlCreator  )  [private]
 


Member Function Documentation

Uri TrackerRequestUrlCreator::createRequestUrl const TrackerRequest trackerRequest  )  [static]
 

Creates and returns a request URL from the selected trackerRequest.

Parameters:
trackerRequest Tracker request containing requested arguments.
Returns:
Request URL in a Uri object according to the selected trackerRequest.
Precondition:
trackerRequest must be valid. If not, invalid URL might be returned.
The URL will begin with the "announce URL" from the trackerRequest and other parameters are then added to this URL, using standard CGI methods (i.e. a '?' after the announce URL, followed by 'param=value' sequences separated by '&').

Because the specification doesn't mention the format of the 'compact' and the 'key' parameter, 'compact' will be either '1' (true) or '0' (false) and the 'key' will be a string.

Note:
All binary data in the URL will be properly escaped. This means any byte not in the set 0-9, a-z, A-Z, and "$-_.+!*'()," will be encoded using the "%nn" format, where nn is the hexadecimal value of the byte (see RFC 1738 for details).
If an exception gets thrown indirectly by the function, then no side effects will be produced on the environment. Thus, the function meets the strong guarantee of exception safety.

Definition at line 53 of file TrackerRequestUrlCreator.cpp.

QByteArray TrackerRequestUrlCreator::eventToString TrackerRequest::Event  event  )  [static, private]
 

Parameters:
event Tracker request announcement event to be converted.
Precondition:
event must be valid.

Definition at line 108 of file TrackerRequestUrlCreator.cpp.

TrackerRequestUrlCreator& Protocols::BitTorrent::Trackers::TrackerRequestUrlCreator::operator= const TrackerRequestUrlCreator  )  [private]
 


Member Data Documentation

const char * TrackerRequestUrlCreator::CompactFalseValueString = "0" [static, private]
 

'False' value textual repr.

Definition at line 64 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::CompactTrueValueString = "1" [static, private]
 

'True' value textual repr.

Definition at line 63 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterCompactName = "compact" [static, private]
 

Definition at line 56 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterDownloadedName = "downloaded" [static, private]
 

Definition at line 54 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterEventName = "event" [static, private]
 

Definition at line 57 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterInfoHashName = "info_hash" [static, private]
 

Definition at line 50 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterIpName = "ip" [static, private]
 

Definition at line 58 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterKeyName = "key" [static, private]
 

Definition at line 60 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterLeftName = "left" [static, private]
 

Definition at line 55 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterNumWantName = "numwant" [static, private]
 

Definition at line 59 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterPeerIdName = "peer_id" [static, private]
 

Definition at line 51 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterPortName = "port" [static, private]
 

Definition at line 52 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterTrackerIdName = "trackerid" [static, private]
 

Definition at line 61 of file TrackerRequestUrlCreator.h.

const char * TrackerRequestUrlCreator::ParameterUploadedName = "uploaded" [static, private]
 

Definition at line 53 of file TrackerRequestUrlCreator.h.


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