https://redmine.named-data.net/https://redmine.named-data.net/favicon.ico?14759811232018-08-23T18:37:55ZNDN project issue tracking systemndn-cxx - Feature #4722: Block literalhttps://redmine.named-data.net/issues/4722?journal_id=239032018-08-23T18:37:55ZJunxiao Shi
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Code review</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p><a href="https://gerrit.named-data.net/#/c/ndn-cxx/+/4926">https://gerrit.named-data.net/#/c/ndn-cxx/+/4926</a> moves block literal operator and adds unit testing.</p>
ndn-cxx - Feature #4722: Block literalhttps://redmine.named-data.net/issues/4722?journal_id=239102018-08-24T13:14:00ZDavide Pesavento
<ul><li><strong>Status</strong> changed from <i>Code review</i> to <i>Closed</i></li></ul> ndn-cxx - Feature #4722: Block literalhttps://redmine.named-data.net/issues/4722?journal_id=254382019-06-09T23:46:07ZJu Pan
<ul></ul><p>A stupid question, how should I generate the input for _block operator? <br>
For <code>"0703 080141"_block,</code> How should I generate <strong>"0703 080141"</strong></p>
ndn-cxx - Feature #4722: Block literalhttps://redmine.named-data.net/issues/4722?journal_id=254392019-06-10T00:01:07ZJunxiao Shi
<ul></ul><blockquote>
<p>For <code>"0703 080141"_block,</code> How should I generate <strong>"0703 080141"</strong></p>
</blockquote>
<p>These are handwritten according to <a href="https://named-data.net/doc/NDN-packet-spec/current/" class="external">packet format</a>.</p>
<p>Every L2 developer should learn to read and write common packets in hexadecimal.</p>
ndn-cxx - Feature #4722: Block literalhttps://redmine.named-data.net/issues/4722?journal_id=254402019-06-10T06:35:44ZAlex Afanasyev
<ul></ul><p>Junxiao, please try to more considerate statements.</p>
<p>@Ju, as Junxiao mentioned, one way is to do it by hand. If you want to just fix encoding of a certain block, you can write a small for loop that will print out values to std::cout/cerr and then you copy/paste. We used to have such for loops (commented out) in some of the test cases, but not sure if we still have.</p>
ndn-cxx - Feature #4722: Block literalhttps://redmine.named-data.net/issues/4722?journal_id=254422019-06-10T16:11:38ZJu Pan
<ul></ul><p>Alex Afanasyev wrote:</p>
<blockquote>
<p>Junxiao, please try to more considerate statements.</p>
<p>@Ju, as Junxiao mentioned, one way is to do it by hand. If you want to just fix encoding of a certain block, you can write a small for loop that will print out values to std::cout/cerr and then you copy/paste. We used to have such for loops (commented out) in some of the test cases, but not sure if we still have.</p>
</blockquote>
<p>Hey Alex, thanks for the explanation. Yes, there is a for loop to generate the plain hex (now sure if you are talking about this one):</p>
<pre><code>for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
printf("0x%02x", *it);
}
</code></pre>
<p>but according to Juxiao's code review: </p>
<pre><code>There's a guideline about improving readability. Whether you use block literal or HEX, I need to see comments about TLV structure:
- label every TLV-TYPE
- indent nested TLV
</code></pre>
<p>It seems we still need to handwrite the encoding according to the packet format for the formatting. Not sure if I understand it correctly.</p>
ndn-cxx - Feature #4722: Block literalhttps://redmine.named-data.net/issues/4722?journal_id=254442019-06-11T10:24:08ZDavide Pesavento
<ul></ul><p>@Ju, I would suggest to manually edit the existing hex array. Just add the new field, adjust the length of affected TLVs, and that's it. And write the corresponding TLV type in a comment next to the element's hex representation, to make Junxiao happy.</p>
ndn-cxx - Feature #4722: Block literalhttps://redmine.named-data.net/issues/4722?journal_id=254592019-06-11T11:26:17ZJu Pan
<ul></ul><p>Davide Pesavento wrote:</p>
<blockquote>
<p>@Ju, I would suggest to manually edit the existing hex array. Just add the new field, adjust the length of affected TLVs, and that's it. And write the corresponding TLV type in a comment next to the element's hex representation, to make Junxiao happy.</p>
</blockquote>
<p>@Davide, thanks for the suggestion, I've changed the code.</p>