mirror of
https://github.com/SunnyQjm/MIRCertificationManager.git
synced 2026-06-15 14:04:55 +08:00
add: 添加下发和撤销证书测试
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Created by mingj on 2020/6/2.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <ndn-cxx/interest.hpp>
|
||||
#include <ndn-cxx/face.hpp>
|
||||
#include <ndn-cxx/data.hpp>
|
||||
#include "utils/FileUtils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ndn;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 3) {
|
||||
cout << "Usage : " << argv[0] << " -f <json file path> " << endl;
|
||||
return -1;
|
||||
}
|
||||
Interest::setDefaultCanBePrefix(true);
|
||||
string jsonStr = FileUtils::readFile2String(argv[2]);;
|
||||
ndn::Face face;
|
||||
ndn::Interest interest("/localmanager/mircertification");
|
||||
interest.setMustBeFresh(true);
|
||||
interest.setApplicationParameters((uint8_t *) jsonStr.c_str(), jsonStr.size());
|
||||
face.expressInterest(interest, [=](const Interest &interest1, const Data &data) {
|
||||
// onData
|
||||
const auto &content = data.getContent();
|
||||
string result((const char *) content.value(), content.value_size());
|
||||
cout << "receive: " << endl << result << endl;
|
||||
}, [=](const Interest &interest1, const lp::Nack &nack) {
|
||||
// onNack
|
||||
cerr << "onNack: " << interest1.toUri() << endl << "reason: " << nack.getReason() << endl;
|
||||
}, [=](const Interest &interest1) {
|
||||
// onTimeout
|
||||
cerr << "onTimeout: " << interest1.toUri() << endl;
|
||||
});
|
||||
|
||||
face.processEvents();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user