fastcgi++
Classes | Typedefs | Enumerations | Functions | Variables
Fastcgipp::Protocol Namespace Reference

Defines aspects of the FastCGI Protocol. More...

Classes

struct  FullId
 A full ID value for a FastCGI request. More...
class  Header
 Data structure used as the header for FastCGI records. More...
class  BeginRequest
 Data structure used as the body for FastCGI records with a RecordType of BEGIN_REQUEST. More...
class  UnknownType
 Data structure used as the body for FastCGI records with a RecordType of UNKNOWN_TYPE. More...
class  EndRequest
 Data structure used as the body for FastCGI records with a RecordType of END_REQUEST. More...
struct  ManagementReply
 Used for the reply of FastCGI management records of type GET_VALUES. More...

Typedefs

typedef uint16_t RequestId
 The request ID of a FastCGI request.

Enumerations

enum  RecordType {
  BEGIN_REQUEST = 1, ABORT_REQUEST = 2, END_REQUEST = 3, PARAMS = 4,
  IN = 5, OUT = 6, ERR = 7, DATA = 8,
  GET_VALUES = 9, GET_VALUES_RESULT = 10, UNKNOWN_TYPE = 11
}
 Defines the types of records within the FastCGI protocol. More...
enum  Role { RESPONDER = 1, AUTHORIZER = 2, FILTER = 3 }
 Defines the possible roles a FastCGI application may play. More...
enum  ProtocolStatus { REQUEST_COMPLETE = 0, CANT_MPX_CONN = 1, OVERLOADED = 2, UNKNOWN_ROLE = 3 }
 Possible statuses a request may declare when complete. More...

Functions

bool operator> (const FullId &x, const FullId &y)
 Compare between two FullId variables.
bool operator< (const FullId &x, const FullId &y)
 Compare between two FullId variables.
bool operator== (const FullId &x, const FullId &y)
 Compare between two FullId variables.
template<class T >
readBigEndian (T value)
 Read in a big endian value.
void processParamHeader (const char *data, size_t dataSize, const char *&name, size_t &nameSize, const char *&value, size_t &valueSize)
 Process the body of a FastCGI parameter record.

Variables

const char * recordTypeLabels [] = { "INVALID", "BEGIN_REQUEST", "ABORT_REQUEST", "END_REQUEST", "PARAMS", "IN", "OUT", "ERR", "DATA", "GET_VALUES", "GET_VALUES_RESULT", "UNKNOWN_TYPE" }
 Defines text labels for the RecordType values.
const int version = 1
 The version of the FastCGI protocol that this adheres to.
const int chunkSize = 8
 All FastCGI records will be a multiple of this many bytes.
ManagementReply< 14, 2, 8 > maxConnsReply
 Reply record that will be sent when asked the maximum allowed file descriptors open at a time.
ManagementReply< 13, 2, 1 > maxReqsReply
 Reply record that will be sent when asked the maximum allowed requests at a time.
ManagementReply< 15, 1, 8 > mpxsConnsReply
 Reply record that will be sent when asked if requests can be multiplexed over a single connections.

Detailed Description

Defines aspects of the FastCGI Protocol.

The Protocol namespace defines the data structures and constants used by the FastCGI protocol version 1. All data has been modelled after the official FastCGI protocol specification located at http://www.fastcgi.com/devkit/doc/fcgi-spec.html


Typedef Documentation

The request ID of a FastCGI request.

Definition at line 54 of file protocol.hpp.


Enumeration Type Documentation

Possible statuses a request may declare when complete.

Enumerator:
REQUEST_COMPLETE 
CANT_MPX_CONN 
OVERLOADED 
UNKNOWN_ROLE 

Definition at line 115 of file protocol.hpp.

Defines the types of records within the FastCGI protocol.

Enumerator:
BEGIN_REQUEST 
ABORT_REQUEST 
END_REQUEST 
PARAMS 
IN 
OUT 
ERR 
DATA 
GET_VALUES 
GET_VALUES_RESULT 
UNKNOWN_TYPE 

Definition at line 83 of file protocol.hpp.

Defines the possible roles a FastCGI application may play.

Enumerator:
RESPONDER 
AUTHORIZER 
FILTER 

Definition at line 112 of file protocol.hpp.


Function Documentation

bool Fastcgipp::Protocol::operator< ( const FullId &  x,
const FullId &  y 
)
inline

Compare between two FullId variables.

This comparator casts the structures as 32 bit integers and compares them as such.

Definition at line 127 of file protocol.hpp.

References Fastcgipp::Protocol::FullId::fcgiId.

bool Fastcgipp::Protocol::operator== ( const FullId &  x,
const FullId &  y 
)
inline

Compare between two FullId variables.

This comparator casts the structures as 32 bit integers and compares them as such.

Definition at line 133 of file protocol.hpp.

References Fastcgipp::Protocol::FullId::fcgiId.

bool Fastcgipp::Protocol::operator> ( const FullId &  x,
const FullId &  y 
)
inline

Compare between two FullId variables.

This comparator casts the structures as 32 bit integers and compares them as such.

Definition at line 121 of file protocol.hpp.

References Fastcgipp::Protocol::FullId::fcgiId.

void Fastcgipp::Protocol::processParamHeader ( const char *  data,
size_t  dataSize,
const char *&  name,
size_t &  nameSize,
const char *&  value,
size_t &  valueSize 
)

Process the body of a FastCGI parameter record.

Takes the body of a FastCGI record of type PARAMETER and parses it. You end up with a pointer/size for both the name and value of the parameter.

Parameters:
[in]dataPointer to the record body
[in]dataSizeSize of data pointed to by data
[out]nameReference to a pointer that will be pointed to the first byte of the parameter name
[out]nameSizeReference to a value to will be given the size in bytes of the parameter name
[out]valueReference to a pointer that will be pointed to the first byte of the parameter value
[out]valueSizeReference to a value to will be given the size in bytes of the parameter value

Definition at line 24 of file protocol.cpp.

References readBigEndian().

Referenced by Fastcgipp::Http::Environment< charT >::fill(), and Fastcgipp::ManagerPar::localHandler().

template<class T >
T Fastcgipp::Protocol::readBigEndian ( value)

Read in a big endian value.

This function will read in a big endian value of type T. Should the system compiled for use big endian first, it simple returns the value passed to it. Should the system compiled for use little endian first, it will return a value with the endianess reversed.

Parameters:
valueValue with big endian first
Returns:
Value conforming to the endianess of the system

Definition at line 145 of file protocol.hpp.

Referenced by Fastcgipp::Protocol::Header::getContentLength(), Fastcgipp::Protocol::Header::getRequestId(), Fastcgipp::Protocol::BeginRequest::getRole(), Fastcgipp::Http::operator<<(), processParamHeader(), Fastcgipp::Protocol::EndRequest::setAppStatus(), Fastcgipp::Protocol::Header::setContentLength(), and Fastcgipp::Protocol::Header::setRequestId().


Variable Documentation

const int Fastcgipp::Protocol::chunkSize = 8

All FastCGI records will be a multiple of this many bytes.

Definition at line 109 of file protocol.hpp.

Referenced by Fastcgipp::FcgistreamSink::write().

Fastcgipp::Protocol::ManagementReply< 14, 2, 8 > Fastcgipp::Protocol::maxConnsReply

Reply record that will be sent when asked the maximum allowed file descriptors open at a time.

Referenced by Fastcgipp::ManagerPar::localHandler().

Fastcgipp::Protocol::ManagementReply< 13, 2, 1 > Fastcgipp::Protocol::maxReqsReply

Reply record that will be sent when asked the maximum allowed requests at a time.

Referenced by Fastcgipp::ManagerPar::localHandler().

Fastcgipp::Protocol::ManagementReply< 15, 1, 8 > Fastcgipp::Protocol::mpxsConnsReply

Reply record that will be sent when asked if requests can be multiplexed over a single connections.

Referenced by Fastcgipp::ManagerPar::localHandler().

const char * Fastcgipp::Protocol::recordTypeLabels = { "INVALID", "BEGIN_REQUEST", "ABORT_REQUEST", "END_REQUEST", "PARAMS", "IN", "OUT", "ERR", "DATA", "GET_VALUES", "GET_VALUES_RESULT", "UNKNOWN_TYPE" }

Defines text labels for the RecordType values.

Definition at line 47 of file protocol.cpp.

const int Fastcgipp::Protocol::version = 1