本文整理汇总了C++中ControlParameters::setLocalControlFeature方法的典型用法代码示例。如果您正苦于以下问题:C++ ControlParameters::setLocalControlFeature方法的具体用法?C++ ControlParameters::setLocalControlFeature怎么用?C++ ControlParameters::setLocalControlFeature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlParameters
的用法示例。
在下文中一共展示了ControlParameters::setLocalControlFeature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encodedParameters
BOOST_FIXTURE_TEST_CASE(LocalControlNextHopFaceId,
AuthorizedCommandFixture<LocalControlFixture>)
{
shared_ptr<LocalFace> dummy = make_shared<DummyLocalFace>();
BOOST_REQUIRE(dummy->isLocal());
FaceTableFixture::m_faceTable.add(dummy);
ControlParameters parameters;
parameters.setLocalControlFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
Block encodedParameters(parameters.wireEncode());
Name enable("/localhost/nfd/faces/enable-local-control");
enable.append(encodedParameters);
shared_ptr<Interest> enableCommand(make_shared<Interest>(enable));
enableCommand->setIncomingFaceId(dummy->getId());
generateCommand(*enableCommand);
TestFaceManagerCommon::m_face->onReceiveData +=
[this, enableCommand, encodedParameters] (const Data& response) {
this->validateControlResponse(response, enableCommand->getName(),
200, "Success", encodedParameters);
};
onValidatedFaceRequest(enableCommand);
BOOST_REQUIRE(didCallbackFire());
BOOST_REQUIRE(dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
BOOST_CHECK(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
TestFaceManagerCommon::m_face->onReceiveData.clear();
resetCallbackFired();
Name disable("/localhost/nfd/faces/disable-local-control");
disable.append(encodedParameters);
shared_ptr<Interest> disableCommand(make_shared<Interest>(disable));
disableCommand->setIncomingFaceId(dummy->getId());
generateCommand(*disableCommand);
TestFaceManagerCommon::m_face->onReceiveData +=
[this, disableCommand, encodedParameters] (const Data& response) {
this->validateControlResponse(response, disableCommand->getName(),
200, "Success", encodedParameters);
};
onValidatedFaceRequest(disableCommand);
BOOST_REQUIRE(didCallbackFire());
BOOST_REQUIRE(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID));
BOOST_CHECK(!dummy->isLocalControlHeaderEnabled(LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID));
}
示例2: encodedParameters
BOOST_FIXTURE_TEST_CASE(LocalControlNextHopFaceIdNonLocal,
AuthorizedCommandFixture<LocalControlFixture>)
{
shared_ptr<DummyFace> dummy = make_shared<DummyFace>();
BOOST_REQUIRE(!dummy->isLocal());
FaceTableFixture::m_faceTable.add(dummy);
ControlParameters parameters;
parameters.setLocalControlFeature(LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID);
Block encodedParameters(parameters.wireEncode());
Name enable("/localhost/nfd/faces/enable-local-control");
enable.append(encodedParameters);
shared_ptr<Interest> enableCommand(make_shared<Interest>(enable));
enableCommand->setIncomingFaceId(dummy->getId());
generateCommand(*enableCommand);
TestFaceManagerCommon::m_face->onReceiveData +=
bind(&LocalControlFixture::validateControlResponse, this, _1,
enableCommand->getName(), 412, "Face is non-local");
onValidatedFaceRequest(enableCommand);
BOOST_REQUIRE(didCallbackFire());
TestFaceManagerCommon::m_face->onReceiveData.clear();
resetCallbackFired();
Name disable("/localhost/nfd/faces/disable-local-control");
disable.append(encodedParameters);
shared_ptr<Interest> disableCommand(make_shared<Interest>(disable));
disableCommand->setIncomingFaceId(dummy->getId());
generateCommand(*disableCommand);
TestFaceManagerCommon::m_face->onReceiveData +=
bind(&LocalControlFixture::validateControlResponse, this, _1,
disableCommand->getName(), 412, "Face is non-local");
onValidatedFaceRequest(disableCommand);
BOOST_REQUIRE(didCallbackFire());
}