ccnx: Fixing order of formatting Selectors into ccnb
C-library expects a specific order of fields... apparently
Change-Id: Ic0fc53130242e4e786a0399eb96ba7231841f97b
diff --git a/ccnx/ccnx-selectors.cpp b/ccnx/ccnx-selectors.cpp
index 3ce6144..4e9b440 100644
--- a/ccnx/ccnx-selectors.cpp
+++ b/ccnx/ccnx-selectors.cpp
@@ -100,16 +100,25 @@
boost::throw_exception(InterestSelectorException() << error_info_str("MaxSuffixComps = " + boost::lexical_cast<string>(m_maxSuffixComps) + " is smaller than MinSuffixComps = " + boost::lexical_cast<string>(m_minSuffixComps)));
}
- if (m_maxSuffixComps > 0)
- {
- ccnb_tagged_putf(cbuf, CCN_DTAG_MaxSuffixComponents, "%d", m_maxSuffixComps);
- }
-
if (m_minSuffixComps > 0)
{
ccnb_tagged_putf(cbuf, CCN_DTAG_MinSuffixComponents, "%d", m_minSuffixComps);
}
+ if (m_maxSuffixComps > 0)
+ {
+ ccnb_tagged_putf(cbuf, CCN_DTAG_MaxSuffixComponents, "%d", m_maxSuffixComps);
+ }
+
+ // publisher digest
+
+ // exclude
+
+ if (m_childSelector != DEFAULT)
+ {
+ ccnb_tagged_putf(cbuf, CCN_DTAG_ChildSelector, "%d", (int)m_childSelector);
+ }
+
if (m_answerOriginKind != AOK_DEFAULT)
{
// it was not using "ccnb_tagged_putf" in ccnx c code, no idea why
@@ -140,12 +149,6 @@
ccnb_append_tagged_blob(cbuf, CCN_DTAG_InterestLifetime, buf, sizeof(buf));
}
- if (m_childSelector != DEFAULT)
- {
- ccnb_tagged_putf(cbuf, CCN_DTAG_ChildSelector, "%d", m_childSelector);
- }
-
-
ccn_charbuf_append_closer(cbuf); // </Interest>
return ptr;
diff --git a/test/test-ccnx-wrapper.cc b/test/test-ccnx-wrapper.cc
index 06535fc..5389702 100644
--- a/test/test-ccnx-wrapper.cc
+++ b/test/test-ccnx-wrapper.cc
@@ -106,6 +106,8 @@
BOOST_AUTO_TEST_CASE (BlaCcnxWrapperTest)
{
+ INIT_LOGGERS ();
+
setup();
Name prefix1("/c1");
Name prefix2("/c2");
@@ -135,7 +137,9 @@
Closure closure (bind(dataCallback, _1, _2), bind(timeout, _1, _2, _3));
Selectors selectors;
- selectors.interestLifetime(1);
+ selectors
+ .interestLifetime(1)
+ .childSelector(Selectors::RIGHT);
string n1 = "/random/01";
c1->sendInterest(Name(n1), closure, selectors);