PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Public Types | Public Member Functions | Public Attributes | List of all members
CMessageHeader Class Reference

Message header. More...

#include <protocol.h>

Public Types

enum  {
  COMMAND_SIZE = 12, MESSAGE_SIZE_SIZE = sizeof(int), CHECKSUM_SIZE = sizeof(int), MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE,
  CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE, HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE
}
 

Public Member Functions

 CMessageHeader ()
 
 CMessageHeader (const char *pszCommand, unsigned int nMessageSizeIn)
 
std::string GetCommand () const
 
bool IsValid () const
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action, int nType, int nVersion)
 

Public Attributes

 ADD_SERIALIZE_METHODS
 
char pchMessageStart [MESSAGE_START_SIZE]
 
char pchCommand [COMMAND_SIZE]
 
unsigned int nMessageSize
 
unsigned int nChecksum
 

Detailed Description

Message header.

(4) message start. (12) command. (4) size. (4) checksum.

Definition at line 29 of file protocol.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Todo:
: make private (improves encapsulation)
Enumerator
COMMAND_SIZE 
MESSAGE_SIZE_SIZE 
CHECKSUM_SIZE 
MESSAGE_SIZE_OFFSET 
CHECKSUM_OFFSET 
HEADER_SIZE 

Definition at line 51 of file protocol.h.

Constructor & Destructor Documentation

◆ CMessageHeader() [1/2]

CMessageHeader::CMessageHeader ( )

Definition at line 138 of file protocol.cpp.

Here is the call graph for this function:

◆ CMessageHeader() [2/2]

CMessageHeader::CMessageHeader ( const char *  pszCommand,
unsigned int  nMessageSizeIn 
)

Definition at line 146 of file protocol.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ GetCommand()

std::string CMessageHeader::GetCommand ( ) const

Definition at line 155 of file protocol.cpp.

Here is the call graph for this function:

◆ IsValid()

bool CMessageHeader::IsValid ( ) const

Definition at line 160 of file protocol.cpp.

Here is the call graph for this function:

◆ SerializationOp()

template<typename Stream , typename Operation >
void CMessageHeader::SerializationOp ( Stream &  s,
Operation  ser_action,
int  nType,
int  nVersion 
)
inline

Definition at line 41 of file protocol.h.

Member Data Documentation

◆ ADD_SERIALIZE_METHODS

CMessageHeader::ADD_SERIALIZE_METHODS

Definition at line 38 of file protocol.h.

◆ nChecksum

unsigned int CMessageHeader::nChecksum

Definition at line 63 of file protocol.h.

◆ nMessageSize

unsigned int CMessageHeader::nMessageSize

Definition at line 62 of file protocol.h.

◆ pchCommand

char CMessageHeader::pchCommand[COMMAND_SIZE]

Definition at line 61 of file protocol.h.

◆ pchMessageStart

char CMessageHeader::pchMessageStart[MESSAGE_START_SIZE]

Definition at line 60 of file protocol.h.


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