本文整理汇总了C++中payload函数的典型用法代码示例。如果您正苦于以下问题:C++ payload函数的具体用法?C++ payload怎么用?C++ payload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了payload函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: payload
bool AddInterfaceEC::parsePayload(connector::EditingCommandData* ecd)
{
// addLink(baseID, documentID, compositeId, xmlLink)
unsigned int argsLength = 0;
std::string payload ((const char *)ecd->getPayload(), (size_t)ecd->getPayloadSize());
std::vector<std::string>* tokens = util::split(payload, ",");
int token_cnt = tokens->size();
if (token_cnt > 3) {
baseId = (*tokens)[0];
argsLength += baseId.length();
documentId = (*tokens)[1];
argsLength += documentId.length();
nodeId = (*tokens)[2];
argsLength += nodeId.length();
argsLength += 3; //por las comas
xmlInterface = payload.substr(argsLength, payload.length() - argsLength);
delete tokens;
return true;
} else {
delete tokens;
return false;
}
}
示例2: payload
/*!
Returns the encoding of the contents.
*/
QNdefNfcTextRecord::Encoding QNdefNfcTextRecord::encoding() const
{
if (payload().isEmpty())
return Utf8;
QByteArray p = payload();
quint8 status = p.at(0);
bool utf16 = status & 0x80;
if (utf16)
return Utf16;
else
return Utf8;
}
示例3: exe_trace
static char exe_trace(fdja_value *node, fdja_value *exe)
{
fdja_value *pl = payload(exe);
fdja_value *trace = fdja_l(pl, "trace");
if (trace == NULL) trace = fdja_set(pl, "trace", fdja_array_malloc());
fdja_value *atts = attributes(node, exe);
if (atts->child == NULL)
{
fdja_value *ret = fdja_l(exe, "payload.ret");
fdja_push(trace, ret ? fdja_clone(ret) : fdja_v("null"));
}
else if (atts->child && atts->child->sibling == NULL)
{
fdja_push(trace, fdja_lc(atts, "_0"));
}
else
{
fdja_push(trace, shrink_atts(atts));
}
fdja_free(atts);
return 'v'; // over
}
示例4: lagTestFinished
void AddressTester::onConnected()
{
timer.stop();
emit lagTestFinished(time.msecsTo(QTime::currentTime()));
if (testingConnectivity) {
Encryptor encryptor(encryptionMethod, encryptionPassword);
/*
* A http request to Google to test connectivity
* The payload is dumped from
* `curl http://www.google.com --socks5 127.0.0.1:1080`
*
* TODO: find a better way to check connectivity
*/
std::string dest =
Common::packAddress(Address("www.google.com", 80));
static const QByteArray expected = QByteArray::fromHex(
"474554202f20485454502f312e310d0a486f73743a"
"207777772e676f6f676c652e636f6d0d0a55736572"
"2d4167656e743a206375726c2f372e34332e300d0a"
"4163636570743a202a2f2a0d0a0d0a");
std::string payload(expected.data(), expected.length());
std::string toWrite = encryptor.encrypt(dest + payload);
socket.write(toWrite.data(), toWrite.size());
} else {
socket.abort();
}
}
示例5: pathandquery_social_subpath
pplx::task<xbox_live_result<xbox_social_relationship_result>>
social_service_impl::get_social_relationships(
_In_ const string_t& xboxUserId,
_In_ xbox_social_relationship_filter filter,
_In_ unsigned int startIndex,
_In_ unsigned int maxItems
)
{
bool includeViewFilter = (filter != xbox_social_relationship_filter::all);
string_t pathAndQuery = pathandquery_social_subpath(
xboxUserId,
includeViewFilter,
xbox_social_relationship_filter_to_string(filter),
startIndex,
maxItems
);
std::shared_ptr<http_call> httpCall = xbox::services::system::xbox_system_factory::get_factory()->create_http_call(
m_xboxLiveContextSettings,
_T("GET"),
utils::create_xboxlive_endpoint(_T("social"), m_appConfig),
pathAndQuery,
xbox_live_api::get_social_relationships
);
auto userContext = m_userContext;
auto xboxLiveContextSettings = m_xboxLiveContextSettings;
auto appConfig = m_appConfig;
std::shared_ptr<social_service_impl> thisShared = shared_from_this();
auto task = httpCall->get_response_with_auth(m_userContext)
.then([thisShared, userContext, xboxLiveContextSettings, appConfig, startIndex, filter](std::shared_ptr<http_call_response> response)
{
auto result = xbox_social_relationship_result::_Deserialize(response->response_body_json());
auto& socialRelationship = result.payload();
uint32_t itemSize = static_cast<uint32_t>(socialRelationship.items().size());
if (itemSize > 0)
{
unsigned continuationSkip = startIndex + itemSize;
// Initialize the request params for get_next()
socialRelationship._Init_next_page_info(
thisShared,
filter,
continuationSkip
);
}
return utils::generate_xbox_live_result<xbox_social_relationship_result>(
result,
response
);
});
return utils::create_exception_free_task<xbox_social_relationship_result>(
task
);
}
示例6: _main
void _main()
{
Handle fileHandle = 0x0;
Result ret = 0x0;
u32 compressed_size = 0x0;
u8* compressed_buffer = LINEAR_BUFFER;
// load payload.bin from savegame
ret = _FSUSER_OpenFileDirectly(fsHandle, &fileHandle, 0x0, 0x00000004, PATH_EMPTY, "", 1, PATH_CHAR, "/payload.bin", 13, 0x1, 0x0);
if(ret)*(u32*)ret = 0xdead0001;
ret = _FSUSER_ReadFile(&fileHandle, &compressed_size, 0x0, compressed_buffer, 0xA000);
if(ret)*(u32*)ret = 0xdead0002;
u8* decompressed_buffer = &compressed_buffer[(compressed_size + 0xfff) & ~0xfff];
u32 decompressed_size = lzss_get_decompressed_size(compressed_buffer, compressed_size);
// decompress payload
ret = lzss_decompress(compressed_buffer, compressed_size, decompressed_buffer, decompressed_size);
// copy payload to text
ret = _GSPGPU_FlushDataCache(gspHandle, 0xFFFF8001, (u32*)decompressed_buffer, decompressed_size);
ret = gspwn((void*)(IRON_CODE_LINEAR_BASE + 0x00101000 - 0x00100000), decompressed_buffer, (decompressed_size + 0x1f) & ~0x1f);
svc_sleepThread(300*1000*1000);
// ghetto dcache invalidation
// don't judge me
int i, j;//, k;
// for(k=0; k<0x2; k++)
for(j=0; j<0x4; j++)
for(i=0; i<0x01000000/0x4; i+=0x4)
LINEAR_BUFFER[i+j]^=0xDEADBABE;
// put framebuffers in linear mem so they're writable
u8* top_framebuffer = &LINEAR_BUFFER[0x00100000];
u8* low_framebuffer = &top_framebuffer[0x00046500];
_GSPGPU_SetBufferSwap(*gspHandle, 0, (GSP_FramebufferInfo){0, (u32*)top_framebuffer, (u32*)top_framebuffer, 240 * 3, (1<<8)|(1<<6)|1, 0, 0});
_GSPGPU_SetBufferSwap(*gspHandle, 1, (GSP_FramebufferInfo){0, (u32*)low_framebuffer, (u32*)low_framebuffer, 240 * 3, 1, 0, 0});
// un-init DSP so killing Ironfall will work
_DSP_UnloadComponent(dspHandle);
_DSP_RegisterInterruptEvents(dspHandle, 0x0, 0x2, 0x2);
// run payload
{
void (*payload)(u32* paramlk, u32* stack_pointer) = (void*)0x00101000;
u32* paramblk = (u32*)LINEAR_BUFFER;
paramblk[0x1c >> 2] = IRON_GSPGPU_GXCMD4;
paramblk[0x20 >> 2] = IRON_GSPGPU_FLUSHDATACACHE_WRAPPER;
paramblk[0x48 >> 2] = 0x8d; // flags
paramblk[0x58 >> 2] = IRON_GSPGPU_HANDLE;
paramblk[0x64 >> 2] = 0x08010000;
payload(paramblk, (u32*)(0x10000000 - 4));
}
*(u32*)ret = 0xdead0008;
}
示例7: test_reuse_helper
inline void test_reuse_helper(Encoder encoder, Decoder decoder)
{
std::vector<uint8_t> payload(encoder->payload_size());
std::vector<uint8_t> data_in = random_vector(encoder->block_size());
sak::mutable_storage storage_in = sak::storage(data_in);
encoder->set_symbols(storage_in);
// Set the encoder non-systematic
if(kodo::is_systematic_encoder(encoder))
kodo::set_systematic_off(encoder);
while( !decoder->is_complete() )
{
uint32_t payload_used = encoder->encode( &payload[0] );
EXPECT_TRUE(payload_used <= encoder->payload_size());
decoder->decode( &payload[0] );
}
std::vector<uint8_t> data_out(decoder->block_size(), '\0');
decoder->copy_symbols(sak::storage(data_out));
EXPECT_TRUE(std::equal(data_out.begin(),
data_out.end(),
data_in.begin()));
}
示例8: initializeData
/*!
\brief Deletes any details currently stored in the Smart Poster
and re-initializes them by parsing the contents of the payload.
*/
void NdefNfcSpRecord::parseRecords()
{
initializeData();
QNdefMessage message = QNdefMessage::fromByteArray(payload());
qDebug() << "Sp Record Count: " << message.count();
foreach (const QNdefRecord &record, message) {
qDebug() << "Sp Record type: " << QString(record.type());
qDebug() << "Sp Type name: " << record.typeNameFormat();
// URI
if (record.isRecordType<QNdefNfcUriRecord>()) {
if (recordUri) { delete recordUri; recordUri = NULL; }
recordUri = new QNdefNfcUriRecord(record);
qDebug() << "Sp URI: " << recordUri->uri().toString();
}
// Title
else if (record.isRecordType<QNdefNfcTextRecord>()) {
QNdefNfcTextRecord* recordTitle = new QNdefNfcTextRecord(record);
addTitle(*recordTitle);
if (!recordTitleList.isEmpty()) {
qDebug() << "Sp Title: " << recordTitleList.last().text();
}
}
// Image
else if (record.typeNameFormat() == QNdefRecord::Mime &&
record.type().startsWith("image/")) {
if (recordImage) { delete recordImage; recordImage = NULL; }
recordImage = new NdefNfcMimeImageRecord(record);
qDebug() << "Sp Image: " << recordImage->format();
}
// Action
else if (record.typeNameFormat() == QNdefRecord::NfcRtd &&
QString(record.type()) == "act") {
if (recordAction) { delete recordAction; recordAction = NULL; }
recordAction = new NdefNfcActRecord(record);
qDebug() << "Sp Action: " << action();
}
// Size
else if (record.typeNameFormat() == QNdefRecord::NfcRtd &&
QString(record.type()) == "s") {
if (recordSize) { delete recordSize; recordSize = NULL; }
recordSize = new NdefNfcSizeRecord(record);
qDebug() << "Sp Size: " << size();
}
// Type
else if (record.typeNameFormat() == QNdefRecord::NfcRtd &&
QString(record.type()) == "t") {
if (recordType) { delete recordType; recordType = NULL; }
recordType = new NdefNfcTypeRecord(record);
qDebug() << "Sp Type: " << type();
}
else
{
// This class handles all records defined in the Smart Poster
// specification, so this case should never happen for a valid
// Smart Poster record in the current version.
qDebug() << "Sp: Don't know how to handle this record";
}
}
示例9:
void
device_presence_change_subscription::on_subscription_created(
_In_ uint32_t id,
_In_ const web::json::value& data
)
{
real_time_activity_subscription::on_subscription_created(id, data);
xbox_live_result<device_presence_change_event_args> devicePresenceChangeArgs;
if (!data.is_null())
{
auto initialPresenceRecord = presence_record::_Deserialize(data);
if (!initialPresenceRecord.err())
{
if (m_devicePresenceChangeHandler != nullptr)
{
for (const auto& deviceRecord : initialPresenceRecord.payload().presence_device_records())
{
auto deviceType = deviceRecord.device_type();
m_devicePresenceChangeHandler(
device_presence_change_event_args(
m_xboxUserId,
deviceType,
true
)
);
}
}
}
else
{
if (m_subscriptionErrorHandler != nullptr)
{
m_subscriptionErrorHandler(
xbox::services::real_time_activity::real_time_activity_subscription_error_event_args(
*this,
xbox_live_error_code::json_error,
"JSON Deserialization Failure"
)
);
}
}
}
else
{
if (m_subscriptionErrorHandler != nullptr)
{
m_subscriptionErrorHandler(
xbox::services::real_time_activity::real_time_activity_subscription_error_event_args(
*this,
xbox_live_error_code::json_error,
"JSON Not Found"
)
);
}
}
}
示例10: src
QByteArray UBPacket::packetize(void) {
QByteArray src(((char*)(&m_srcID)), sizeof(m_srcID));
QByteArray des(((char*)(&m_desID)), sizeof(m_desID));
QByteArray payload(m_payload);
return src + des + payload;
}
示例11: payload
Collection<ByteArray> NotSpans::getPayload() {
Collection<ByteArray> result;
if (includeSpans->isPayloadAvailable()) {
Collection<ByteArray> payload(includeSpans->getPayload());
result = Collection<ByteArray>::newInstance(payload.begin(), payload.end());
}
return result;
}
示例12: MQTTMessageArrived
int MQTTMessageArrived(void* context, char* topicName, int topicLength, MQTTClient_message* message)
{
std::vector<char> payload((char*)message->payload, (char*)message->payload + message->payloadlen);
MQTTClient_freeMessage(&message);
MQTTClient_free(topicName);
GD::mqtt->messageReceived(payload);
return 1;
}
示例13: CommandTraceFunction
void DeleteActivitiesCommand::GetActivityList()
{
CommandTraceFunction();
MojObject payload(MojObject::TypeObject);
m_client.SendRequest(m_activityListSlot, "com.palm.activitymanager", "list", payload);
}
示例14: addr
int logClient::process(ACE_CString* s){
ACE_SOCK_Stream logger;
ACE_SOCK_Connector connector;
ACE_INET_Addr addr(9876, "127.0.0.1");
if(connector.connect(logger, addr) == -1){
ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("%p \n"), ACE_TEXT("open")), -1);
}
ACE_Log_Record record(LM_DEBUG,
ACE_OS::time ((time_t *) 0),
ACE_OS::getpid());
record.msg_data(s.c_str());
const size_t max_payload_size =
4
+ 8
+ 4
+ 4
+ ACE_Log_Record::MAXLOGMSGLEN
+ ACE_CDR::MAX_ALIGNMENT;
ACE_OutputCDR payload(max_payload_size);
payload<< record;
ACE_CDR::ULong length =
ACE_Utils::truncate_cast<ACE_CDR::ULong> (payload.total_length());
ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + 8);
header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER);
header << ACE_CDR::ULong(length);
iovec iov[2];
iov[0].iov_base = header.begin() -> rd_ptr();
iov[0].iov_len = 8;
iov[1].iov_base = payload.begin() -> rd_ptr();
iov[1].iov_len = length;
if (logger.sendv_n(iov, 2) == -1)
ACE_ERROR_RETURN((LM_ERROR,"%p\n","send"), -1);
/*
*/
ACE_Message_Block* header_p;
auto_ptr<ACE_Message_Block> header(header_p);
ACE_CDR::mb_align(header.get());
ACE_Message_Block* payload_p;
ssize_t count = logger.recv_n(header->wr_ptr(),8);
switch(count){
default:
case -1:
case 0:
case 8:
break;
}
header->wr_ptr(8);
}
示例15: ntohs
void presentation_message::check_format() const
{
if (length() < MIN_BODY_LENGTH)
{
throw std::runtime_error("bad message length");
}
uint16_t sig_len = ntohs(buffer_tools::get<uint16_t>(payload(), 0));
if (sig_len == 0)
{
throw std::runtime_error("invalid sig_len");
}
cert_type sig_cert = cert_type::from_der(payload() + sizeof(uint16_t), sig_len);
if (length() < MIN_BODY_LENGTH + sig_len)
{
throw std::runtime_error("sig_len value mismatch");
}
uint16_t enc_len = ntohs(buffer_tools::get<uint16_t>(payload(), sizeof(uint16_t) + sig_len));
if (enc_len == 0)
{
if (length() != MIN_BODY_LENGTH + sig_len)
{
throw std::runtime_error("unexpected data after null enc_len");
}
}
else
{
cert_type enc_cert = cert_type::from_der(payload() + MIN_BODY_LENGTH + sig_len, enc_len);
if (cryptoplus::x509::compare(sig_cert.subject(), enc_cert.subject()) != 0)
{
throw std::runtime_error("certificate subject name do not match");
}
if (cryptoplus::x509::compare(sig_cert.issuer(), enc_cert.issuer()) != 0)
{
throw std::runtime_error("certificate issuer name do not match");
}
}
}