this_file->serial = get_cfg_serial(jcfgs[ii]);
if (this_file->serial != TR_CFG_INVALID_SERIAL) {
- tr_notice("tr_parse_one_config_file: Attempting to load revision %"
+ tr_notice("tr_parse_config_files: Attempting to load revision %"
JSON_INTEGER_FORMAT
" of '%s'.",
this_file->serial,
this_file->name);
} else {
- tr_notice("tr_parse_one_config_file: Attempting to load '%s'.",
+ tr_notice("tr_parse_config_files: Attempting to load '%s'.",
this_file->name);
}
}
#include <syslog.h>
#include <sys/time.h>
#include <talloc.h>
-#include <gmodule.h>
+#include <glib.h>
#include <tr_comm.h>
#include <tr_rp.h>
#include <talloc.h>
-#include <gmodule.h>
+#include <glib.h>
#include <string.h>
#include <mon_internal.h>
#include <talloc.h>
-#include <gmodule.h>
+#include <glib.h>
#include <mon_internal.h>
-// Monitoring request message common code
+/* Monitoring request message common code */
/**
* Destructor used by talloc to ensure proper cleanup
#include <mon_internal.h>
-// Monitoring request decoders
+/* Monitoring request decoders */
/**
* Decode a single option
&opt) != MON_SUCCESS) {
return MON_NOPARSE;
}
- mon_req_add_option(req, opt.type);
+ if (MON_SUCCESS != mon_req_add_option(req, opt.type)){
+ return MON_NOPARSE;
+ }
}
return MON_SUCCESS;
}
#include <mon_internal.h>
-// Monitoring request encoders
+/* Monitoring request encoders */
/**
* Encode options array as a JSON array
* @param opts array of options
* @return reference to a JSON array of options
*/
-static json_t *mon_opts_decode(GArray *opts)
+static json_t *mon_opts_encode(GArray *opts)
{
json_t *array_json = json_array(); // the array of options
json_t *opt_json = NULL; // individual option JSON object
/* If we have options, add them to the object */
if (req->options->len > 0) {
- opts_json = mon_opts_decode(req->options);
+ opts_json = mon_opts_encode(req->options);
if (opts_json == NULL) {
json_decref(req_json);
return NULL;
#include <mon_internal.h>
-// Monitoring request message common code
+/* Monitoring response message common code */
/**
* Destructor used by talloc to ensure proper cleanup
#include <mon_internal.h>
-// Monitoring response decoder
+/* Monitoring response decoder */
/**
* Decode a JSON response
#include <mon_internal.h>
+/* Monitoring response encoder */
+
/* Helper for encoding. Adds a newly allocated JSON object to
* jobj. If the allocation or setting fails, returns NULL after
* cleaning up. */
/* Handlers for monitoring requests */
-#include <gmodule.h>
+#include <glib.h>
#include <tr_debug.h>
#include <mon_internal.h>
/* command-line option setup */
static void print_version_info(void)
{
- printf("Moonshot TR Monitoring Client %s\n\n", PACKAGE_VERSION);
+ printf("Moonshot Trust Router Monitoring Client %s\n\n", PACKAGE_VERSION);
}
const char *argp_program_bug_address=PACKAGE_BUGREPORT; /* bug reporting address */
/* doc strings */
-static const char doc[]=PACKAGE_NAME " - Moonshot TR Monitoring Client";
+static const char doc[]=PACKAGE_NAME " - Moonshot Trust Router Monitoring Client";
static const char arg_doc[]="<server> <port> <command> [<option> ...]"; /* string describing arguments, if any */
/* define the options here. Fields are:
tr_log_threshold(LOG_CRIT);
tr_console_threshold(LOG_WARNING);
- /* Create a MON client instance & the client DH */
+ /* Create a MON client instance */
monc = monc_new(main_ctx);
if (monc == NULL) {
printf("Error allocating client instance.\n");
goto cleanup;
}
-
- /* fill in the DH parameters */
- monc_set_dh(monc, tr_create_dh_params(NULL, 0));
- if (monc_get_dh(monc) == NULL) {
- printf("Error creating client DH params.\n");
- goto cleanup;
- }
-
/* Set-up MON connection */
if (0 != monc_open_connection(monc, opts.server, opts.port)) {
/* Handle error */
};
req = mon_req_new(main_ctx, opts.command);
- for (ii=0; ii < opts.n_options; ii++)
- mon_req_add_option(req, opts.options[ii]);
+ for (ii=0; ii < opts.n_options; ii++) {
+ if (MON_SUCCESS != mon_req_add_option(req, opts.options[ii])) {
+ printf("Error adding option '%s' to request. Request not sent.\n",
+ mon_opt_type_to_string(opts.options[ii]));
+ goto cleanup;
+ }
+
+ }
/* Send a MON request and get the response */
resp = monc_send_request(main_ctx, monc, req);
const char *argp_program_bug_address=PACKAGE_BUGREPORT; /* bug reporting address */
/* doc strings */
-static const char doc[]=PACKAGE_NAME " - TRP Client";
+static const char doc[]=PACKAGE_NAME " - Moonshot Trust Router TRP Client";
static const char arg_doc[]="<message> <server> [<port>]"; /* string describing arguments, if any */
/* define the options here. Fields are: