本文整理汇总了C++中DataObjectRef::getRawMetadataAlloc方法的典型用法代码示例。如果您正苦于以下问题:C++ DataObjectRef::getRawMetadataAlloc方法的具体用法?C++ DataObjectRef::getRawMetadataAlloc怎么用?C++ DataObjectRef::getRawMetadataAlloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectRef
的用法示例。
在下文中一共展示了DataObjectRef::getRawMetadataAlloc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verifyDataObject
bool SecurityHelper::verifyDataObject(DataObjectRef& dObj, CertificateRef& cert) const
{
RSA *key;
// Cannot verify without signature
if (!dObj->getSignature()) {
HAGGLE_ERR("No signature in data object, cannot verify\n");
return false;
}
writeErrors("(not this): ");
key = cert->getPubKey();
if (RSA_verify(NID_sha1, dObj->getId(), sizeof(DataObjectId_t),
const_cast<unsigned char *>(dObj->getSignature()), dObj->getSignatureLength(), key) != 1) {
char *raw;
size_t len;
writeErrors("");
dObj->getRawMetadataAlloc((unsigned char **)&raw, &len);
if (raw) {
HAGGLE_DBG("Signature is invalid:\n%s\n", raw);
free(raw);
}
dObj->setSignatureStatus(DataObject::SIGNATURE_INVALID);
return false;
}
HAGGLE_DBG("Signature is valid\n");
dObj->setSignatureStatus(DataObject::SIGNATURE_VALID);
return true;
}
示例2: dumpTo
void DebugManager::dumpTo(SOCKET client_sock, DataStoreDump *dump)
{
size_t toSend = dump->getLen();
const char *data = dump->getData();
size_t i = 0;
i = skipXMLTag(data, toSend);
toSend -= i;
// Send the <?xml version="1.0"?> tag:
if (!sendString(client_sock, "<?xml version=\"1.0\"?>\n"))
return;
// Send the root tag:
if (!sendString(client_sock, "<HaggleInfo>"))
return;
// Send the data:
if (!sendBuffer(client_sock, &(data[i]), toSend))
return;
DataObjectRef dObj = kernel->getThisNode()->getDataObject(false);
unsigned char *buf;
size_t len;
if (dObj->getRawMetadataAlloc(&buf, &len)) {
i = skipXMLTag((char *)buf, len);
len -= i;
if (!sendString(client_sock, "<ThisNode>\n")) {
free(buf);
return;
}
if (!sendBuffer(client_sock, &(buf[i]), len)) {
free(buf);
return;
}
if (!sendString(client_sock, "</ThisNode>\n")) {
free(buf);
return;
}
free(buf);
}
/*
FIXME: With the new forwarding this thing is broken.
Manager *mgr = kernel->getManager((char *)"ForwardingManager");
if (mgr) {
ForwardingManager *fmgr = (ForwardingManager *) mgr;
DataObjectRef dObj = fmgr->getForwarder()->myMetricDO;
if (dObj) {
char *buf;
size_t len;
if (dObj->getRawMetadataAlloc(&buf, &len)) {
i = skipXMLTag(buf, len);
len -= i;
if (!sendString(client_sock, "<RoutingData>\n")) {
free(buf);
return;
}
if (!sendBuffer(client_sock, &(buf[i]), len)) {
free(buf);
return;
}
if (!sendString(client_sock, "</RoutingData>\n")) {
free(buf);
return;
}
free(buf);
}
}
}
*/
NodeRefList nl;
kernel->getNodeStore()->retrieveNeighbors(nl);
if (!nl.empty()) {
if (!sendString(client_sock, "<NeighborInfo>\n"))
return;
for (NodeRefList::iterator it = nl.begin(); it != nl.end(); it++) {
if (!sendString(client_sock, "<Neighbor>"))
return;
if (!sendString(client_sock, (*it)->getIdStr()))
return;
if (!sendString(client_sock, "</Neighbor>\n"))
return;
}
if (!sendString(client_sock, "</NeighborInfo>\n"))
return;
}
// Send the end of the root tag:
sendString(client_sock, "</HaggleInfo>");
}