Task #2496
closedRedesign initialization of nfd/nrd
100%
Description
Right now, all initialization of both nfd and nrd is done inside daemon/main.cpp
and rib/main.cpp
.
In NS-3 and Android environments, it is necessary to manually initialize and start forwarder without use of main function at all (e.g., in both cases there is no command line and there is no config file to parse).
This task is to separate generic initialization of nfd and nrd into separate compilation modules and keep in main.cpp only logic necessary for command line.
Unrelated, but something to consider. getopt uses a global state for argument parsing. This makes main() function non-reentrant. This is not any kind of a problem in normal case, but was something causing problems within android environment.
Should we consider adding "reset" of getopt state, e.g.,
::optind = 1;
::optreset = 1;