#include <packet.h>
Public Member Functions | |
void | ClearDatabase (unsigned int dbId) |
Builds a command packet for the CLEAR_DATABASE command code, placing the data in the send buffer. | |
void | GetDBDB () |
Builds a command packet for the GET_DBDB command code, placing the data in m_send. | |
void | GetRecordStateTable (unsigned int dbId) |
Builds a command packet in the send buffer for the GET_RECORD_STATE_TABLE command. | |
void | SetRecordFlags (unsigned int dbId, unsigned int stateTableIndex, uint8_t flag1) |
Builds a command packet in the send buffer for the SET_RECORD_FLAGS command code. | |
void | DeleteRecordByIndex (unsigned int dbId, unsigned int stateTableIndex) |
Builds a command packet in the send buffer for the DELETE_RECORD_BY_INDEX command code. | |
void | GetRecordByIndex (unsigned int dbId, unsigned int stateTableIndex) |
Builds a command packet in the send buffer for the GET_RECORD_BY_INDEX command code. | |
bool | SetRecordByIndex (unsigned int dbId, unsigned int stateTableIndex, Builder &build, const IConverter *ic) |
Builds a command packet in the m_send buffer for the SET_RECORD_BY_INDEX command code. | |
void | GetRecords (unsigned int dbId) |
Builds a command packet in the send buffer for the GET_RECORDS command code. | |
bool | SetRecord (unsigned int dbId, Builder &build, const IConverter *ic) |
Builds a command packet in the m_send buffer for the SET_RECORD command code. | |
unsigned int | DBOperation () const |
Returns the database operation code from the receive packet, assuming that receive contains a response packet. | |
bool | Parse (Parser &parser, const IConverter *ic) |
Parses the data in the receive buffer, and attempts to be smart about it, using the last send command as guidance for what to expect in the response. |
This class relies on 3 external objects: a Mode::Desktop object, a send Data buffer, and a receive data buffer. Socket and connection details are retrieved on a readonly basis from the Mode::Desktop object, but both send and receive buffers can be modified.
Note that the receive buffer may be modified during a packet send, and this DBPacket class provides API helpers to analyze the results.
Definition at line 119 of file packet.h.
void Barry::DBPacket::ClearDatabase | ( | unsigned int | dbId | ) |
Builds a command packet for the CLEAR_DATABASE command code, placing the data in the send buffer.
Definition at line 162 of file packet.cc.
References Barry::Mode::Desktop::GetDBCommand().
unsigned int Barry::DBPacket::DBOperation | ( | ) | const |
void Barry::DBPacket::DeleteRecordByIndex | ( | unsigned int | dbId, | |
unsigned int | stateTableIndex | |||
) |
Builds a command packet in the send buffer for the DELETE_RECORD_BY_INDEX command code.
Definition at line 267 of file packet.cc.
References Barry::Mode::Desktop::GetDBCommand().
Referenced by Barry::Mode::Desktop::DeleteRecord().
void Barry::DBPacket::GetDBDB | ( | ) |
Builds a command packet for the GET_DBDB command code, placing the data in m_send.
Definition at line 186 of file packet.cc.
References Barry::Mode::Desktop::GetDBCommand().
void Barry::DBPacket::GetRecordByIndex | ( | unsigned int | dbId, | |
unsigned int | stateTableIndex | |||
) |
Builds a command packet in the send buffer for the GET_RECORD_BY_INDEX command code.
Definition at line 293 of file packet.cc.
References Barry::Mode::Desktop::GetDBCommand().
Referenced by Barry::Mode::Desktop::GetRecord().
void Barry::DBPacket::GetRecords | ( | unsigned int | dbId | ) |
Builds a command packet in the send buffer for the GET_RECORDS command code.
Definition at line 360 of file packet.cc.
References Barry::Mode::Desktop::GetDBCommand().
Referenced by Barry::Mode::Desktop::LoadDatabase().
void Barry::DBPacket::GetRecordStateTable | ( | unsigned int | dbId | ) |
Builds a command packet in the send buffer for the GET_RECORD_STATE_TABLE command.
Definition at line 210 of file packet.cc.
References Barry::Mode::Desktop::GetDBCommand().
Referenced by Barry::Mode::Desktop::GetRecordStateTable().
bool Barry::DBPacket::Parse | ( | Parser & | parser, | |
const IConverter * | ic | |||
) |
Parses the data in the receive buffer, and attempts to be smart about it, using the last send command as guidance for what to expect in the response.
Definition at line 459 of file packet.cc.
References Barry::Parser::Clear(), Barry::Parser::ParseFields(), Barry::Parser::ParseHeader(), Barry::Parser::SetIds(), and Barry::Parser::Store().
Referenced by Barry::Mode::Desktop::GetRecord(), and Barry::Mode::Desktop::LoadDatabase().
bool Barry::DBPacket::SetRecord | ( | unsigned int | dbId, | |
Builder & | build, | |||
const IConverter * | ic | |||
) |
Builds a command packet in the m_send buffer for the SET_RECORD command code.
Definition at line 388 of file packet.cc.
References Barry::Builder::BuildFields(), Barry::Builder::BuildHeader(), Barry::Mode::Desktop::GetDBCommand(), Barry::Builder::GetRecType(), Barry::Builder::GetUniqueId(), and Barry::Builder::Retrieve().
Referenced by Barry::Mode::Desktop::AddRecord().
bool Barry::DBPacket::SetRecordByIndex | ( | unsigned int | dbId, | |
unsigned int | stateTableIndex, | |||
Builder & | build, | |||
const IConverter * | ic | |||
) |
Builds a command packet in the m_send buffer for the SET_RECORD_BY_INDEX command code.
Definition at line 322 of file packet.cc.
References Barry::Builder::BuildFields(), Barry::Mode::Desktop::GetDBCommand(), and Barry::Builder::Retrieve().
Referenced by Barry::Mode::Desktop::SetRecord().
void Barry::DBPacket::SetRecordFlags | ( | unsigned int | dbId, | |
unsigned int | stateTableIndex, | |||
uint8_t | flag1 | |||
) |
Builds a command packet in the send buffer for the SET_RECORD_FLAGS command code.
FIXME - this API call is incomplete, since there are unknown flags in the SetRecordFlags protocol packet. Currently it is only used to set all flags to zero.
Definition at line 238 of file packet.cc.
References Barry::Mode::Desktop::GetDBCommand().
Referenced by Barry::Mode::Desktop::ClearDirty().