/* Ouput Geolocation data and the IP's hostname. */ static void print_json_host_items (GJSON * json, GHolderItem * item, GPercTotals totals, int size, int iisp) { (void) totals; /* print geolocation fields */ if (size > 0 && item->sub_list != NULL) print_json_host_geo (json, item->sub_list, iisp); /* print list of user agents */ if (conf.list_agents) process_host_agents (json, item, iisp); }
static void print_json_host_data (FILE * fp, GHolder * h, int processed) { GMetrics *nmetrics; char *sep = char_repeat (2, '\t'); int i; fprintf (fp, "\t\"%s\": [\n", module_to_id (h->module)); for (i = 0; i < h->idx; i++) { set_data_metrics (h->items[i].metrics, &nmetrics, processed); fprintf (fp, "%s{\n", sep); print_json_block (fp, nmetrics, sep); print_json_host_geo (fp, h->items[i].sub_list, sep); fprintf (fp, (i != h->idx - 1) ? "\n%s},\n" : "\n%s}\n", sep); free (nmetrics); } fprintf (fp, "\t]"); free (sep); }