本文整理汇总了C++中ControlParameters类的典型用法代码示例。如果您正苦于以下问题:C++ ControlParameters类的具体用法?C++ ControlParameters怎么用?C++ ControlParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ControlParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(ValidatedFaceRequestDestroyFace,
AuthorizedCommandFixture<ValidatedFaceRequestFixture>)
{
ControlParameters parameters;
parameters.setUri("tcp://127.0.0.1");
Block encodedParameters(parameters.wireEncode());
Name commandName("/localhost/nfd/faces");
commandName.append("destroy");
commandName.append(encodedParameters);
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
onValidatedFaceRequest(command);
BOOST_CHECK(didDestroyFaceFire());
}
示例2: redoPropagation
void
AutoPrefixPropagator::onRetryTimer(const ControlParameters& parameters,
const CommandOptions& options,
time::seconds retryWaitTime)
{
auto entryIt = m_propagatedEntries.find(parameters.getName());
BOOST_ASSERT(entryIt != m_propagatedEntries.end() && entryIt->second.isPropagateFail());
redoPropagation(entryIt, parameters, options, retryWaitTime);
}
示例3:
void
RibRegisterCommand::validateResponse(const ControlParameters& parameters) const
{
this->ControlCommand::validateResponse(parameters);
if (parameters.getFaceId() == INVALID_FACE_ID) {
BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid"));
}
}
示例4:
void
StrategyChoiceUnsetCommand::validateRequest(const ControlParameters& parameters) const
{
this->ControlCommand::validateRequest(parameters);
if (parameters.getName().size() == 0) {
BOOST_THROW_EXCEPTION(ArgumentError("Name must not be ndn:/"));
}
}
示例5: validateRequest
virtual void
validateRequest(const ControlParameters& parameters) const
{
this->ControlCommand::validateRequest(parameters);
if (parameters.getName().size() == 0) {
throw ArgumentError("Name must not be ndn:/");
}
}
示例6: NS_LOG_LOGIC
void
FibHelper::AddRoute(Ptr<Node> node, const Name& prefix, shared_ptr<Face> face, int32_t metric)
{
NS_LOG_LOGIC("[" << node->GetId() << "]$ route add " << prefix << " via " << face->getLocalUri()
<< " metric " << metric);
// Get L3Protocol object
Ptr<L3Protocol> L3protocol = node->GetObject<L3Protocol>();
// Get the forwarder instance
shared_ptr<nfd::Forwarder> m_forwarder = L3protocol->getForwarder();
ControlParameters parameters;
parameters.setName(prefix);
parameters.setFaceId(face->getId());
parameters.setCost(metric);
AddNextHop(parameters, node);
}
示例7: validateResponse
virtual void
validateResponse(const ControlParameters& parameters) const
{
this->ControlCommand::validateResponse(parameters);
if (parameters.getFaceId() == 0) {
throw ArgumentError("FaceId must not be zero");
}
}
示例8: NFD_LOG_TRACE
void
AutoPrefixPropagator::afterPropagateSucceed(const ControlParameters& parameters,
const CommandOptions& options,
const ndn::Scheduler::Event& refreshEvent)
{
NFD_LOG_TRACE("success to propagate " << parameters.getName());
auto entryIt = m_propagatedEntries.find(parameters.getName());
if (entryIt == m_propagatedEntries.end()) {
// propagation should be revoked if this entry has been erased (i.e., be in RELEASED state)
NFD_LOG_DEBUG("Already erased!");
ControlParameters newParameters = parameters;
return startRevocation(newParameters.unsetCost(), options, m_baseRetryWait);
}
// PROPAGATING --> PROPAGATED
BOOST_ASSERT(entryIt->second.isPropagating());
entryIt->second.succeed(scheduler::schedule(m_refreshInterval, refreshEvent));
}
示例9: startPropagation
void
AutoPrefixPropagator::afterRibInsert(const ControlParameters& parameters,
const CommandOptions& options)
{
BOOST_ASSERT(m_propagatedEntries.find(parameters.getName()) == m_propagatedEntries.end());
// keep valid entries although there is no connectivity to hub
auto& entry = m_propagatedEntries[parameters.getName()]
.setSigningIdentity(options.getSigningInfo().getSignerName());
if (!m_hasConnectedHub) {
NFD_LOG_INFO("no hub connected to propagate " << parameters.getName());
return;
}
// NEW --> PROPAGATING
entry.startPropagation();
startPropagation(parameters, options, m_baseRetryWait);
}
示例10: makeUpdateFaceResponse
static ControlParameters
makeUpdateFaceResponse(const Face& face)
{
ControlParameters params;
params.setFaceId(face.getId())
.setFacePersistency(face.getPersistency());
auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
if (linkService != nullptr) {
const auto& options = linkService->getOptions();
params.setBaseCongestionMarkingInterval(options.baseCongestionMarkingInterval)
.setDefaultCongestionThreshold(options.defaultCongestionThreshold)
.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, options.allowLocalFields, false)
.setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, options.reliabilityOptions.isEnabled, false)
.setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, options.allowCongestionMarking, false);
}
return params;
}
示例11: bind
void
Nfdc::faceDestroy()
{
ControlParameters parameters;
const std::string& faceName = m_commandLineArguments[0];
FaceIdFetcher::start(m_face, m_controller, faceName, false,
[this] (const uint32_t faceId) {
ControlParameters faceParameters;
faceParameters.setFaceId(faceId);
m_controller.start<FaceDestroyCommand>(faceParameters,
bind(&Nfdc::onSuccess, this, _1,
"Face destroy succeeded"),
bind(&Nfdc::onError, this, _1, _2,
"Face destroy failed"));
},
bind(&Nfdc::onObtainFaceIdFailure, this, _1));
}
示例12: bind
void
Nfdc::ribRegisterPrefix(const ControlParameters& faceCreateResult)
{
ControlParameters ribParameters;
ribParameters
.setName(m_name)
.setCost(m_cost)
.setFlags(m_flags)
.setOrigin(m_origin)
.setFaceId(faceCreateResult.getFaceId());
if (m_expires != DEFAULT_EXPIRATION_PERIOD)
ribParameters.setExpirationPeriod(m_expires);
m_controller.start<RibRegisterCommand>(ribParameters,
bind(&Nfdc::onSuccess, this, _1,
"Successful in name registration"),
bind(&Nfdc::onError, this, _1, _2,
"Failed in name registration"));
}
示例13:
Name
ControlCommand::getRequestName(const Name& commandPrefix,
const ControlParameters& parameters) const
{
this->validateRequest(parameters);
Name name = commandPrefix;
name.append(m_module).append(m_verb);
name.append(parameters.wireEncode());
return name;
}
示例14: setResponse
void
FibManager::addNextHop(ControlParameters& parameters,
ControlResponse& response)
{
ndn::nfd::FibAddNextHopCommand command;
if (!validateParameters(command, parameters))
{
NFD_LOG_DEBUG("add-nexthop result: FAIL reason: malformed");
setResponse(response, 400, "Malformed command");
return;
}
const Name& prefix = parameters.getName();
FaceId faceId = parameters.getFaceId();
uint64_t cost = parameters.getCost();
NFD_LOG_TRACE("add-nexthop prefix: " << prefix
<< " faceid: " << faceId
<< " cost: " << cost);
shared_ptr<Face> nextHopFace = m_getFace(faceId);
if (static_cast<bool>(nextHopFace))
{
shared_ptr<fib::Entry> entry = m_managedFib.insert(prefix).first;
entry->addNextHop(nextHopFace, cost);
NFD_LOG_DEBUG("add-nexthop result: OK"
<< " prefix:" << prefix
<< " faceid: " << faceId
<< " cost: " << cost);
setResponse(response, 200, "Success", parameters.wireEncode());
}
else
{
NFD_LOG_DEBUG("add-nexthop result: FAIL reason: unknown-faceid: " << faceId);
setResponse(response, 410, "Face not found");
}
}
示例15: BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(CreateFaceMissingUri, AuthorizedCommandFixture<FaceFixture>)
{
ControlParameters parameters;
Block encodedParameters(parameters.wireEncode());
Name commandName("/localhost/nfd/faces");
commandName.append("create");
commandName.append(encodedParameters);
shared_ptr<Interest> command(make_shared<Interest>(commandName));
generateCommand(*command);
getFace()->onReceiveData +=
bind(&FaceFixture::validateControlResponse, this, _1,
command->getName(), 400, "Malformed command");
createFace(*command, parameters);
BOOST_REQUIRE(didCallbackFire());
}