Exemplo n.º 1
0
static int
noit_console_eventer_timers(noit_console_closure_t ncct, int argc, char **argv,
                            noit_console_state_t *dstate, void *unused) {
  if(argc != 0) return -1;
  eventer_foreach_timedevent(noit_console_spit_event, ncct);
  return 0;
}
Exemplo n.º 2
0
static int
mtev_rest_eventer_timers(mtev_http_rest_closure_t *restc, int n, char **p) {
  const char *jsonstr;
  struct json_object *doc;
  doc = json_object_new_array();
  eventer_foreach_timedevent(json_spit_event, doc);

  mtev_http_response_ok(restc->http_ctx, "application/json");
  jsonstr = json_object_to_json_string(doc);
  mtev_http_response_append(restc->http_ctx, jsonstr, strlen(jsonstr));
  mtev_http_response_append(restc->http_ctx, "\n", 1);
  json_object_put(doc);
  mtev_http_response_end(restc->http_ctx);
  return 0;
}