Project

General

Profile

Actions

Feature #3112

closed

peek: set Link field

Added by Junxiao Shi over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Start date:
Due date:
% Done:

100%

Estimated time:
3.00 h

Description

In ndnpeek, allow setting the Link field (#2587) on the outgoing Interest.

  • Add a command line option --link-file <file>, which specifies a file that contains a Link object.
  • When this option is specified, the file must be readable, and must be parsable as a Data element representing a Link. Otherwise, ndnpeek should exit with error.
  • The Link object is set as the Link field on the outgoing Interest.

manpage should be updated as part of this issue.


Files

producer-link.cpp (2.61 KB) producer-link.cpp A producer program which prints out predefined Link objects Teng Liang, 03/15/2016 02:18 PM
link-generator.cpp (2 KB) link-generator.cpp A program to generate Link objects Teng Liang, 03/15/2016 02:18 PM

Related issues 2 (0 open2 closed)

Related to NFD - Bug #3694: integ fails due to ndnpeek/ndnping syntax changeClosedEric Newberry08/01/2016

Actions
Blocks NFD - Feature #3074: Mobility with Link scenarioClosedEric Newberry

Actions
Actions #1

Updated by Junxiao Shi over 9 years ago

Actions #2

Updated by Junxiao Shi over 9 years ago

20150821 approves the design in Description.

Junxiao explains that:

  • The rationale of having only --link-file long option but no short option because this option is used infrequently, so a long option is more explicit.
  • Naming the option --link-file instead of --link keeps the possibility of defining --link-base64 <base64-encoded LINK object> in the future.
Actions #3

Updated by Teng Liang almost 9 years ago

  • Assignee set to Teng Liang
Actions #4

Updated by Teng Liang over 8 years ago

Implementation design:

Rewrite obtaining program options, using boost::program_options instead of optget, to support the long option --link-file <file>
Add a method setLink and two member variables m_hasLink (init. false), m_link (init. an empty Link object). To deal with the option --link-file <file>, setLink is invoked to convert the <file> into a Link object and store it in m_link. If the <file> is neither readable, nor parseable, ndnpeek will exist with error. Otherwise, m_hasLink is set to true.
Add one more condition in the method createInterestPacket. If m_hasLink is true, set m_link in the Interest link field

Actions #5

Updated by Junxiao Shi over 8 years ago

note-4 design looks good.

Actions #6

Updated by Teng Liang over 8 years ago

  • Status changed from New to In Progress
Actions #7

Updated by Junxiao Shi over 8 years ago

  • Estimated time changed from 1.50 h to 3.00 h

I'm increasing estimated time due to the need of switching from getopt to Boost.Program_options.

Actions #8

Updated by Teng Liang over 8 years ago

  • Status changed from In Progress to Code review
Actions #9

Updated by Junxiao Shi over 8 years ago

There's a dispute on how to arrange exit codes.

My suggestion is:

  • 0: OK
  • 1: generic error
  • 2: invalid arguments
  • 3: timeout
  • 4: Nack
Actions #10

Updated by Alex Afanasyev over 8 years ago

Can we stop "disputing" useless things? Whatever non zero output means some error. I have no opinion on codes (and no objection as well), as I don't foresee any single use of the check for a specific error code.

Actions #11

Updated by Junxiao Shi over 8 years ago

  • Status changed from Code review to In Progress
  • % Done changed from 0 to 50

http://gerrit.named-data.net/2755 is not the final Change so Status shouldn't be CodeReview.

Actions #12

Updated by Junxiao Shi over 8 years ago

The assignee is responsible for testing the implementation.

Suggested test method:

  1. run NFD and register a route toward a remote host
  2. capture traffic with tcpdump
  3. execute ndnpeek with --link-file option
  4. use NDN dissector for Wireshark to look as the pcap from step2, which should show a Link object attached to the Interest

Test report should be posted on this issue.

Actions #13

Updated by Teng Liang over 8 years ago

Test report:

A Link object file was generated with the name '/A/B/LINK' and the delegation set ({'/UA/A/B', 100}, {'/ASU/A/B', 10}).
A producer was listening to any Interests. Upon receiving an Interest, its attaching Link name with delegations' name/preference would be compared to those in 1.
ndnpeek with --link-file option was executed, and the Link object from 1 was attached.
The Interest received by the producer in 2 had the same Link object from 1.

Actions #14

Updated by Junxiao Shi over 8 years ago

How is the test in note-13 performed?

Any command line or code involved should be posted, so that the test can be repeated.

Updated by Teng Liang over 8 years ago

Put the two attached files in /ndn-cxx/examples and compile them with './waf'.

Run './build/examples/link-generator' to generate a Link object named '/A/B/LINK' with the delegation set ({'/UA/A/B', 100}, {'/ASU/A/B', 10}), which will be saved in the file tmp-link.txt.
Run './build/examples/producer-link', which will listen to any Interest and print out its Link attachment.
Run command 'ndnpeek --link-file tmp-link.txt /A/B'
producer-link will extract the Link object from the Interest and output its information, which is supposed to be the same as that in 1.

Actions #16

Updated by Junxiao Shi over 8 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 50 to 100

I confirm the test steps in note-15 are complete and can fulfill the purpose.

I did not run the tests myself.

Actions #17

Updated by Junxiao Shi over 8 years ago

  • Related to Bug #3694: integ fails due to ndnpeek/ndnping syntax change added
Actions

Also available in: Atom PDF