本文整理汇总了C++中PacketBuffer::add方法的典型用法代码示例。如果您正苦于以下问题:C++ PacketBuffer::add方法的具体用法?C++ PacketBuffer::add怎么用?C++ PacketBuffer::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketBuffer
的用法示例。
在下文中一共展示了PacketBuffer::add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendProcessClosedEvent
/**
* Sends a process closed debug event to BinNavi.
*
* @param dbg The debug event to be sent.
*
* @return A NaviError code that describes whether the operation was successful
* or not.
**/
NaviError BaseConnection::sendProcessClosedEvent(const DBGEVT *) const {
const unsigned int NUMBER_OF_ARGUMENTS = 0;
PacketBuffer buffer;
buffer.add(createPacketHeader(resp_process_closed, 0, NUMBER_OF_ARGUMENTS));
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE, "Error: Couldn't send debug event");
return sendResult;
}
return NaviErrors::SUCCESS;
}
示例2: sendSimpleReply
/**
* Sends a simple reply to BinNavi.
*
* @param command The type of the reply.
*
* @return A NaviError code that describes whether the operation was successful
* or not.
**/
NaviError BaseConnection::sendSimpleReply(const commandtype_t command,
unsigned int id) const {
const unsigned int NUMBER_OF_ARGUMENTS = 0;
PacketBuffer buffer;
buffer.add(createPacketHeader(command, id, NUMBER_OF_ARGUMENTS));
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE, "Error: Couldn't send simple reply message");
return sendResult;
}
return NaviErrors::SUCCESS;
}
示例3: sendRegistersReply
/**
* Sends a reply to a register values request to BinNavi.
*
* @param id The message ID of the reply.
* @param regString The register data string.
*
* @return A NaviError code that describes whether the operation was
* successful or not.
**/
NaviError BaseConnection::sendRegistersReply(commandtype_t type,
unsigned int id,
const std::string &str) const {
const unsigned int NUMBER_OF_ARGUMENTS = 1;
PacketBuffer buffer;
buffer.add(createPacketHeader(type, id, NUMBER_OF_ARGUMENTS));
addStringArgument(buffer, str);
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE, "Error: Couldn't send registers reply message");
return sendResult;
}
return NaviErrors::SUCCESS;
}
示例4: addAddressArgument
/**
* Sends a reply to a memory data request to BinNavi.
*
* @param id The message ID of the reply.
* @param address The address from the original memory request.
* @param memrange The memory data.
*
* @return A NaviError code that describes whether the operation was
* successful or not.
**/
NaviError
BaseConnection::sendMemoryReply(unsigned int id, CPUADDRESS address,
const MemoryContainer &memrange) const {
const unsigned int NUMBER_OF_ARGUMENTS = 2;
PacketBuffer buffer;
buffer.add(createPacketHeader(resp_read_memory, id, NUMBER_OF_ARGUMENTS));
addAddressArgument(buffer, address);
addStringArgument(buffer, memrange);
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE, "Error: Couldn't send memory reply message");
return sendResult;
}
return NaviErrors::SUCCESS;
}
示例5: sendIntegersReply
/**
* Sends a debug reply with a variable number of integer arguments and the
* given command and packet ID to BinNavi.
*
* @param command The type of the reply.
* @param id The message ID of the reply.
* @param values The integer arguments to send to BinNavi.
* @param nrvalues The number of integer arguments to send to BinNavi.
*
* @return A NaviError code that describes whether the operation was
* successful or not.
**/
NaviError BaseConnection::sendIntegersReply(const commandtype_t command,
unsigned int id,
unsigned int *values,
unsigned int nrvalues) const {
PacketBuffer buffer;
buffer.add(createPacketHeader(command, id, nrvalues));
for (unsigned int i = 0; i < nrvalues; i++) {
addIntegerArgument(buffer, values[i]);
}
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE, "Error: Couldn't send integer reply message");
return sendResult;
}
return NaviErrors::SUCCESS;
}
示例6: sendIntegerIntegerAddressReply
/**
* Sends a debug reply with two integer arguments and one address argument and
* the given command and packet ID
* to BinNavi.
*
* @param command The type of the reply.
* @param id The message ID of the reply.
* @param value1 The first integer value to send.
* @param value2 The second integer value to send.
* @param address The address value to send.
*
* @return A NaviError code that describes whether the operation was
* successful or not.
**/
NaviError BaseConnection::sendIntegerIntegerAddressReply(
const commandtype_t command, unsigned int id, unsigned int value1,
unsigned int value2, CPUADDRESS address) const {
const unsigned int NUMBER_OF_ARGUMENTS = 3;
PacketBuffer buffer;
buffer.add(createPacketHeader(command, id, NUMBER_OF_ARGUMENTS));
addIntegerArgument(buffer, value1);
addIntegerArgument(buffer, value2);
addAddressArgument(buffer, address);
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE,
"Error: Couldn't send integer integer address reply message");
return sendResult;
}
return NaviErrors::SUCCESS;
}
示例7: sendAddressesReply
/**
* Sends a debug reply with a variable number of address arguments and the
* given command and packet ID to BinNavi.
*
* @param command The type of the reply.
* @param id The message ID of the reply.
* @param addresses The address arguments to send to BinNavi.
* @param nraddresses The number of address arguments to send to BinNavi.
*
* @return A NaviError code that describes whether the operation was
* successful or not.
**/
NaviError BaseConnection::sendAddressesReply(const commandtype_t command,
unsigned int id,
const CPUADDRESS *addresses,
unsigned int nraddresses) const {
PacketBuffer buffer;
buffer.add(createPacketHeader(command, id, nraddresses));
for (unsigned int i = 0; i < nraddresses; ++i) {
addAddressArgument(buffer, addresses[i]);
}
msglog->log(LOG_ALL, "%d", nraddresses);
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE, "Error: Couldn't send address reply message");
return sendResult;
}
return NaviErrors::SUCCESS;
}
示例8: addIntegerArgument
/**
* Sends a reply to an event that suspended the process to BinNavi.
*
* @param command The type of the reply.
* @param id The message ID of the reply.
* @param info Object that provides information about the event.
*
* @return A NaviError code that describes whether the operation was successful
* or not.
**/
NaviError
BaseConnection::sendSuspendedReply(const commandtype_t command, unsigned int id,
const InformationProvider &info) const {
if (info.getRegisterString().size() == 0) {
return NaviErrors::SUCCESS;
}
const unsigned int NUMBER_OF_ARGUMENTS = 3;
PacketBuffer buffer;
buffer.add(createPacketHeader(command, id, NUMBER_OF_ARGUMENTS));
addIntegerArgument(buffer, info.getTid());
addAddressArgument(buffer, info.getAddress(0));
addStringArgument(buffer, info.getRegisterString());
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE, "Error: Couldn't send suspended reply message");
return sendResult;
}
return NaviErrors::SUCCESS;
}
示例9: sendBreakpointsReply
/**
* Sends a debug reply that indicates what breakpoints were correctly set and
* which ones were not.
*
* @param command The type of the reply.
* @param id The message ID of the reply.
* @param result Vector that contains the error codes for the individual
* breakpoints. 0 = breakpoint was set.
*
* @return A NaviError code that describes whether the operation was
* successful or not.
**/
NaviError BaseConnection::sendBreakpointsReply(
const commandtype_t command, unsigned int id,
const std::vector<std::pair<CPUADDRESS, unsigned int>> &results) const {
const unsigned int NUMBER_OF_ARGUMENTS = 1 + 2 * results.size();
PacketBuffer buffer;
buffer.add(createPacketHeader(command, id, NUMBER_OF_ARGUMENTS));
addIntegerArgument(buffer, results.size());
for (const auto &breakpoint : results) {
addAddressArgument(buffer, breakpoint.first);
addIntegerArgument(buffer, breakpoint.second);
}
NaviError sendResult = send(buffer.data(), buffer.size());
if (sendResult) {
msglog->log(LOG_VERBOSE,
"Error: Couldn't send integer address reply message");
return sendResult;
}
return NaviErrors::SUCCESS;
}