#include <packetbuffer.h>
Public Methods | |
PacketBufferHeader () | |
PacketBufferHeader (unsigned16 wCommand, unsigned16 wCookie) | |
void | makeNetworkReady (bool bOverrideFailsave=false) |
Convert header to network byte order (htonl). More... | |
void | makeHostReady (bool bOverrideFailsafe=false) |
Convert header from network byte order (ntohl). More... | |
unsigned8 * | getHeader () const |
Returns a pointer to the header data. More... | |
unsigned32 | getBufferSize () const |
Returns the current buffer size. More... | |
unsigned16 | getCookie () const |
Returns the cookie. More... | |
unsigned16 | getCmd () const |
Returns the command. More... | |
void | reset () |
Puts header to initial state. More... | |
bool | isValid () |
Verify this header has valid values. More... | |
bool | isNetworkReady () const |
Returns true if the header is in network byte order, false otherwise. More... | |
Static Public Methods | |
unsigned32 | getMaxPacketSize () |
Get the max allowed packet size. More... | |
unsigned32 | setMaxPacketSize (unsigned32) |
Set what the limit should be. More... | |
unsigned32 | getSize () |
Returns the actual size of the header. More... | |
Public Attributes | |
typeBufferSize | m_nBufferSize |
How much data is in this packet, not including the header. More... | |
typeCookie | m_wCookie |
Special constant value used to determin if the packet is valid. Not to be mistaken for cookies in browsers. More... | |
typeCommand | m_wCommand |
The command, or type of packet this is. More... | |
bool | m_bNetworkReady |
True when the header is in network byte order, false otherwise. More... | |
Static Public Attributes | |
unsigned32 | m_nMaxPacketSize = 1500000 |
How big the buffer is allowed to get. More... |
The header is what tells you what command/type of packet this is, and how big it is. The header is a vital part of the PacketBuffer class.
|
|
|
|
|
Returns the current buffer size.
|
|
Returns the command.
|
|
Returns the cookie.
|
|
Returns a pointer to the header data.
|
|
Get the max allowed packet size.
|
|
Returns the actual size of the header.
|
|
Returns true if the header is in network byte order, false otherwise.
|
|
Verify this header has valid values. Does some simple tests to see if this header is valid. First checks to see if the cookie is our constant cookie value of PacketBuffer::pkCookie. Then checks if the command is non-zero. Lastly, we check if the buffersize value is better then the max packet size. If all these pass, then we can assume that the header is probably safe. |
|
Convert header from network byte order (ntohl). Convert the header longs and shorts into host byte order.
|
|
Convert header to network byte order (htonl). Convert the header longs and shorts into network byte order blah blah blah.
|
|
Puts header to initial state. Make the header host-byte ordered, and reset the buffer size to zero. |
|
Set what the limit should be. Sets the max packet size to newSize. Does nothing to the actual packet buffer. This is just a number we use for reference. |
|
True when the header is in network byte order, false otherwise.
|
|
How much data is in this packet, not including the header.
|
|
How big the buffer is allowed to get.
|
|
The command, or type of packet this is.
|
|
Special constant value used to determin if the packet is valid. Not to be mistaken for cookies in browsers.
|