24 #include "version.hpp" 26 #include <boost/exception/get_error_info.hpp> 33 std::ostringstream errorMessage;
34 errorMessage << exception.what();
36 const char*
const* file = boost::get_error_info<boost::throw_file>(exception);
37 const int* line = boost::get_error_info<boost::throw_line>(exception);
38 const char*
const* func = boost::get_error_info<boost::throw_function>(exception);
40 errorMessage <<
" [from " << *file <<
":" << *line;
42 errorMessage <<
" in " << *func;
47 return errorMessage.str();
51 printUsage(std::ostream& os,
const std::string& programName)
53 os <<
"Usage: " << programName <<
" [OPTIONS...]\n" 56 <<
" -f <FILE> Path to configuration file\n" 57 <<
" -h Display this help message\n" 58 <<
" -V Display version information\n" 63 main(
int argc,
char** argv)
65 std::string programName(argv[0]);
66 std::string configFileName(
"nlsr.conf");
69 while ((opt = getopt(argc, argv,
"hf:V")) != -1) {
75 configFileName = optarg;
78 std::cout << NLSR_VERSION_BUILD_STRING << std::endl;
86 boost::asio::io_service ioService;
87 ndn::Face face(ioService);
93 std::cerr <<
"Error in configuration file processing" << std::endl;
105 catch (
const std::exception& e) {
A class to house all the configuration parameters for NLSR.
A wrapper class to instantiate and configure an NLSR object.
int main(int argc, char **argv)
static void printUsage(std::ostream &os, const std::string &programName)
static std::string getExtendedErrorMessage(const E &exception)
A class containing methods to parse an NLSR configuration file.
void run()
Instantiate, configure, and start the NLSR process.
bool processConfFile()
Load and parse the configuration file, then populate NLSR.
void writeLog()
Dump the current state of all attributes to the log.