本文整理汇总了C++中ControlParameters::hasFaceId方法的典型用法代码示例。如果您正苦于以下问题:C++ ControlParameters::hasFaceId方法的具体用法?C++ ControlParameters::hasFaceId怎么用?C++ ControlParameters::hasFaceId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlParameters
的用法示例。
在下文中一共展示了ControlParameters::hasFaceId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendResponse
void
RibManager::unregisterEntry(const shared_ptr<const Interest>& request,
ControlParameters& params)
{
ndn::nfd::RibUnregisterCommand command;
// Passing all parameters gives error in validation,
// so passing only the required arguments.
ControlParameters parameters;
parameters.setName(params.getName());
if (params.hasFaceId()) {
parameters.setFaceId(params.getFaceId());
}
if (params.hasOrigin()) {
parameters.setOrigin(params.getOrigin());
}
if (!validateParameters(command, parameters)) {
NFD_LOG_DEBUG("unregister result: FAIL reason: malformed");
if (static_cast<bool>(request)) {
sendResponse(request->getName(), 400, "Malformed command");
}
return;
}
bool isSelfRegistration = (!parameters.hasFaceId() || parameters.getFaceId() == 0);
if (isSelfRegistration) {
shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = request->getTag<lp::IncomingFaceIdTag>();
if (incomingFaceIdTag == nullptr) {
sendResponse(request->getName(), 503,
"requested self-registration, but IncomingFaceId is unavailable");
return;
}
parameters.setFaceId(*incomingFaceIdTag);
}
// Respond since command is valid and authorized
sendSuccessResponse(request, parameters);
Route route;
route.faceId = parameters.getFaceId();
route.origin = parameters.getOrigin();
NFD_LOG_INFO("Removing route " << parameters.getName() << " nexthop=" << route.faceId
<< " origin=" << route.origin);
RibUpdate update;
update.setAction(RibUpdate::UNREGISTER)
.setName(parameters.getName())
.setRoute(route);
m_managedRib.beginApplyUpdate(update,
bind(&RibManager::onRibUpdateSuccess, this, update),
bind(&RibManager::onRibUpdateFailure, this, update, _1, _2));
}
示例2: sendResponse
void
FibManager::onValidatedFibRequest(const shared_ptr<const Interest>& request)
{
const Name& command = request->getName();
const Name::Component& verb = command[COMMAND_PREFIX.size()];
const Name::Component& parameterComponent = command[COMMAND_PREFIX.size() + 1];
SignedVerbDispatchTable::const_iterator verbProcessor = m_signedVerbDispatch.find(verb);
if (verbProcessor != m_signedVerbDispatch.end())
{
ControlParameters parameters;
if (!extractParameters(parameterComponent, parameters) || !parameters.hasFaceId())
{
NFD_LOG_DEBUG("command result: malformed verb: " << verb);
sendResponse(command, 400, "Malformed command");
return;
}
if (parameters.getFaceId() == 0)
{
parameters.setFaceId(request->getIncomingFaceId());
}
NFD_LOG_DEBUG("command result: processing verb: " << verb);
ControlResponse response;
(verbProcessor->second)(this, parameters, response);
sendResponse(command, response);
}
else
{
NFD_LOG_DEBUG("command result: unsupported verb: " << verb);
sendResponse(command, 501, "Unsupported command");
}
}
示例3:
void
FibRemoveNextHopCommand::applyDefaultsToRequest(ControlParameters& parameters) const
{
if (!parameters.hasFaceId()) {
parameters.setFaceId(0);
}
}
示例4: applyDefaultsToRequest
virtual void
applyDefaultsToRequest(ControlParameters& parameters) const
{
if (!parameters.hasFaceId()) {
parameters.setFaceId(0);
}
}
示例5:
void
FaceUpdateCommand::applyDefaultsToRequest(ControlParameters& parameters) const
{
if (!parameters.hasFaceId()) {
parameters.setFaceId(0);
}
}