Task #1995
closednfdc: accept FaceUri in all commands
100%
Description
Change nfdc
to use Face Query Operation, so that it can accept FaceUri in place of FaceId in all commands.
Note: FaceUri must be canonized before passing as a query filter.
Updated by Junxiao Shi about 10 years ago
- Blocked by Task #1909: nfdc: ensure FaceUri is in canonical form added
Updated by Junxiao Shi about 10 years ago
- Blocked by Task #1993: Face query operation added
Updated by Chengyu Fan about 10 years ago
I don't get why nfdc needs Face Query Operation?
Do you mean nfd-status?
Updated by Junxiao Shi about 10 years ago
nfdc unregister /example udp://router.example.com
is processed as:
- canonize
udp://router.example.com
- Use face query operation to find the FaceId
- Unregister that FaceId for
/example
prefix
Updated by Chengyu Fan almost 10 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 30
Updated by Chengyu Fan almost 10 years ago
I have a FATAL error when run nfd-start on OS X Yosemite.
Below is the error output, does anyone know how to solve it?
1416938168.921410 INFO: [StrategyChoice] setDefaultStrategy /localhost/nfd/strategy/best-route/%FD%02
1416938168.921826 INFO: [InternalFace] registering callback for /localhost/nfd/fib
1416938168.921937 INFO: [InternalFace] registering callback for /localhost/nfd/faces
1416938168.922108 INFO: [InternalFace] registering callback for /localhost/nfd/strategy-choice
1416938168.922251 INFO: [InternalFace] registering callback for /localhost/nfd/status
1416938168.922383 INFO: [FaceTable] Added face id=1 remote=internal:// local=internal://
1416938170.733959 FATAL: [NFD] Unrecognized option "listen" in "unix" section
1416938170.916780 INFO: [RibManager] Listening on: /localhost/nfd/rib
1416938170.963689 INFO: [RibManager] Start monitoring face create/destroy events
1416938170.983865 FATAL: [NRD] error while connecting to the forwarder (No such file or directory)
Updated by Junxiao Shi almost 10 years ago
1416938170.733959 FATAL: [NFD] Unrecognized option "listen" in "unix" section
Configuration file format has been changed in commit dbcb1a119245d1ecb56e72ea35b57b95e119c12e.
Please delete custom configuration file, and recreate it from the sample.
Updated by Chengyu Fan almost 10 years ago
Thanks @Junxiao, it solves the issue.
Updated by Chengyu Fan almost 10 years ago
- Status changed from In Progress to Code review
- % Done changed from 30 to 100
Updated by Junxiao Shi almost 10 years ago
There are lots of code duplication in uploaded commit e1e5a85933f3f72096cc70a98100a4cae4fffbb6
.
Suggestions:
class ObtainFaceId
{
public:
typedef std::function<void(uint32_t)> SuccessCallback;
typedef std::function<void(std::string)> FailureCallback;
/** \brief obtain FaceId from input
* \param input user input, either FaceId or FaceUri
* \param allowCreate whether creating face is allowed
*/
static void
start(const std::string& input, bool allowCreate,
SuccessCallback onSucceed,
FailureCallback onFail);
}
The procedure is:
- try parse input as FaceId, if input is FaceId, succeed with parsed FaceId
- try parse input as FaceUri, if input is not FaceUri, fail
- canonize faceUri
- if canonization fails, fail
- query for face
- if query succeeds and finds a face, succeed with found FaceId
- create face
- if face creation succeeds, succeed with created FaceId
- fail
ObtainFaceId::start
static method is the entrypoint to this procedure.
This method should create a ObtainFaceId
instance, and assign necessary arguments onto the instance as members.
Subsequent steps are declared as instance methods on ObtainFaceId
class.
Since arguments are stored as instance members, it's unnecessary to pass many variable with std::bind
.
When we have ObtainFaceId::start
function, Nfdc
class needs only one method per sub-command in most cases.
That method:
- get FaceId-or-FaceUri from command line as a string (but don't pass it)
- invoke
ObtainFaceId::start
function - in the success callback (written as a lambda expression), perform the next steps.
Updated by Junxiao Shi almost 10 years ago
- Status changed from Code review to Closed