Feature #3112
closedpeek: set Link field
100%
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
Updated by Junxiao Shi about 9 years ago
- Blocks Feature #3074: Mobility with Link scenario added
Updated by Junxiao Shi about 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.
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
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.
Updated by Teng Liang over 8 years ago
- Status changed from In Progress to Code review
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
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.
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.
Updated by Junxiao Shi over 8 years ago
The assignee is responsible for testing the implementation.
Suggested test method:
- run NFD and register a route toward a remote host
- capture traffic with
tcpdump
- execute
ndnpeek
with--link-file
option - 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.
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.
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
- File producer-link.cpp producer-link.cpp added
- File link-generator.cpp link-generator.cpp added
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.
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.
Updated by Junxiao Shi over 8 years ago
- Related to Bug #3694: integ fails due to ndnpeek/ndnping syntax change added