Gnutella::Handshaking::RequestHeader Class Reference

#include <RequestHeader.h> [code]

Inherits Http::Header.

Inheritance diagram for Gnutella::Handshaking::RequestHeader:

Inheritance graph
[legend]
Collaboration diagram for Gnutella::Handshaking::RequestHeader:

Collaboration graph
[legend]
List of all members.

Detailed Description

Encapsulates a Gnutella CONNECT handshake header.

A typical Gnutella CONNECT handshake has the form:

    GNUTELLA CONNECT/<majorVersion>.<minorVersion>CRLF
    Handshake-Header1: header value 1 CRLF
    ...
    Handshake-HeaderN: header value N CRLF
    CRLF

Objects of this class are used in the HandshakeConnection class to facilitate header exchange during the handshaking phase of a Gnutella connection.

Refer to the Qt's documentation on QHttpHeader to get more information about how to set and get header values.

Todo:
Use a uniform notation for member variables. Decide on whether to use PrivateObject derived classes to store private data.

Definition at line 53 of file RequestHeader.h.

Public Member Functions

 RequestHeader (const RequestHeader &header)
 Copy constructor.
 RequestHeader (const QString &str)
 Constructor.
 RequestHeader (int majorVer=0, int minorVer=6)
 Constructor.
RequestHeaderoperator= (const RequestHeader &header)
 Assignment operator.
int majorVersion () const
 Gets the major protocol version.
int minorVersion () const
 Gets the minor protocol version.
QString toString () const
 Generates and returns the complete header as text.

Protected Member Functions

bool parseLine (const QString &line, int number)
 Parses a single header line.

Private Attributes

int majorVersion_
 The major version field.
int minorVersion_
 The minot version field.


Constructor & Destructor Documentation

RequestHeader::RequestHeader const RequestHeader header  ) 
 

Copy constructor.

Definition at line 59 of file RequestHeader.cpp.

RequestHeader::RequestHeader const QString &  str  ) 
 

Constructor.

Creates and initalizes an object by parsing the str. You can get the values of the parsed header fields by calling the corresponding functions from the base class HttpHeader.

See also:
HttpHeader::fieldValue(), QHpptHeader::fieldValues()

Definition at line 37 of file RequestHeader.cpp.

RequestHeader::RequestHeader int  majorVersion = 0,
int  minorVersion = 6
 

Constructor.

Creates and initialzes an object with majorVersion and minorVersion. To set some header field values call the corresonding functions of from the base class.

See also:
HttpHeader::setFieldValue(), HttpHeader::addFieldValue(), HttpHeader::addFieldValues()

Definition at line 52 of file RequestHeader.cpp.


Member Function Documentation

int Gnutella::Handshaking::RequestHeader::majorVersion  )  const [inline]
 

Gets the major protocol version.

Definition at line 61 of file RequestHeader.h.

int Gnutella::Handshaking::RequestHeader::minorVersion  )  const [inline]
 

Gets the minor protocol version.

Definition at line 62 of file RequestHeader.h.

RequestHeader & RequestHeader::operator= const RequestHeader header  ) 
 

Assignment operator.

Definition at line 67 of file RequestHeader.cpp.

bool RequestHeader::parseLine const QString &  line,
int  number
[protected, virtual]
 

Parses a single header line.

Parses a single header line. This is a virtual function overridden here to parse just the first line of the header differently than if it were pure HTTP, but not Gnutella. The other lines are parsed by the base class implementation.

See also:
QHttpHeader::parseLine()

Reimplemented from Http::Header.

Definition at line 84 of file RequestHeader.cpp.

QString RequestHeader::toString  )  const [virtual]
 

Generates and returns the complete header as text.

Returns:
A QString object containing the header.

Reimplemented from Http::Header.

Definition at line 107 of file RequestHeader.cpp.


Member Data Documentation

int Gnutella::Handshaking::RequestHeader::majorVersion_ [private]
 

The major version field.

Definition at line 70 of file RequestHeader.h.

int Gnutella::Handshaking::RequestHeader::minorVersion_ [private]
 

The minot version field.

Definition at line 71 of file RequestHeader.h.


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