Protocols::Kad::Packets::PeerInfoPacket< type > Class Template Reference

#include <PeerInfoPacket.h> [code]

Inherits Protocols::Kad::Packets::Packet.

Inheritance diagram for Protocols::Kad::Packets::PeerInfoPacket< type >:

Inheritance graph
[legend]
Collaboration diagram for Protocols::Kad::Packets::PeerInfoPacket< type >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<PacketType type>
class Protocols::Kad::Packets::PeerInfoPacket< type >

A packet which contains information of a peer.

This template class is used by several packets whose payload consists of a peer information. The only template argument is a PacketType value. These packets will never be compressed, so they will always have ProtocolType equal to KadProtocol.

Definition at line 41 of file PeerInfoPacket.h.

Public Member Functions

virtual QString name () const
 Returns the name of the Kad packet type.
virtual PeerInfoPacketcopy () const
 Implements the virtual copy constructor.
 PeerInfoPacket ()
 Default constructor.

Protected Types

enum  Constants { PayloadLength = 25 }

Protected Member Functions

virtual void readPayload (BinaryReader &)
 Reads the payload fields from a BinaryReader object.
virtual void writePayload (BinaryWriter &) const
 Writes the payload fields in a BinaryWriter.
 Q_DECLARE_SHARED_DATA (Data)

Static Private Attributes

static const QString name_
 Needed by name(). Each template specialization must define a value.

Classes

class  Data
 PeerInfoPacket's private data. More...


Member Enumeration Documentation

template<PacketType type>
enum Protocols::Kad::Packets::PeerInfoPacket::Constants [protected]
 

Enumerator:
PayloadLength 

Definition at line 53 of file PeerInfoPacket.h.


Constructor & Destructor Documentation

template<PacketType type>
Protocols::Kad::Packets::PeerInfoPacket< type >::PeerInfoPacket  ) 
 

Default constructor.

Simply calls the ctor of the base by passing a newly created object of the base's private data Data and the packet type, which is the template argu- ment value.

Definition at line 106 of file PeerInfoPacket.h.


Member Function Documentation

template<PacketType type>
PeerInfoPacket< type > * Protocols::Kad::Packets::PeerInfoPacket< type >::copy  )  const [virtual]
 

Implements the virtual copy constructor.

Implements Protocols::Kad::Packets::Packet.

Definition at line 94 of file PeerInfoPacket.h.

template<PacketType type>
QString Protocols::Kad::Packets::PeerInfoPacket< type >::name  )  const [virtual]
 

Returns the name of the Kad packet type.

Returns:
the value of the static member name_. Each template instantiation must define its own value of name_.

Implements Protocols::Kad::Packets::Packet.

Definition at line 87 of file PeerInfoPacket.h.

template<PacketType type>
Protocols::Kad::Packets::PeerInfoPacket< type >::Q_DECLARE_SHARED_DATA Data   )  [protected]
 

template<PacketType type>
void Protocols::Kad::Packets::PeerInfoPacket< type >::readPayload BinaryReader &  reader  )  [protected, virtual]
 

Reads the payload fields from a BinaryReader object.

Reads all the fields which form the peer information.

Todo:
How should I read a 128 bits number? I guess it should be inside Binary readers and writers... but that wouldn't be very clean.

Implements Protocols::Kad::Packets::Packet.

Definition at line 119 of file PeerInfoPacket.h.

template<PacketType type>
void Protocols::Kad::Packets::PeerInfoPacket< type >::writePayload BinaryWriter &   )  const [protected, virtual]
 

Writes the payload fields in a BinaryWriter.

Implements Protocols::Kad::Packets::Packet.

Definition at line 133 of file PeerInfoPacket.h.


Member Data Documentation

template<PacketType type>
const QString Protocols::Kad::Packets::BootstrapReq::name_ [static, private]
 

Needed by name(). Each template specialization must define a value.

Definition at line 78 of file PeerInfoPacket.h.


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