+ struct cmdline_args opts;
+ struct event_base *ev_base;
+ struct tr_socket_event tids_ev = {0};
+ struct tr_socket_event mon_ev = {0};
+ struct event *cfgwatch_ev;
+
+ time_t start_time = time(NULL); /* TODO move this? */
+
+ configure_signals();
+
+ /* we're going to be multithreaded, so disable null context tracking */
+ talloc_set_abort_fn(tr_abort);
+ talloc_disable_null_tracking();
+#if TALLOC_DEBUG_ENABLE
+ talloc_set_log_fn(tr_talloc_log);
+#endif /* TALLOC_DEBUG_ENABLE */
+ main_ctx=talloc_new(NULL);
+
+ /* Use standalone logging */
+ tr_log_open();
+
+ /***** parse command-line arguments *****/
+ /* set defaults */
+ opts.version_requested=0;
+ opts.config_dir=".";
+
+ /* parse the command line*/
+ argp_parse(&argp, argc, argv, 0, 0, &opts);
+
+ /* process options */
+ remove_trailing_slash(opts.config_dir);
+
+
+ /***** Print version info *****/
+ print_version_info();
+ if (opts.version_requested)
+ return 0; /* requested that we print version and exit */
+
+ /***** create a Trust Router instance *****/
+ if (NULL == (tr = tr_create(main_ctx))) {
+ tr_crit("Unable to create Trust Router instance, exiting.");
+ return 1;
+ }
+
+ /***** initialize the trust path query server instance *****/
+ if (NULL == (tr->tids = tids_new(tr))) {
+ tr_crit("Error initializing Trust Path Query Server instance.");
+ return 1;
+ }