mirror of
https://github.com/freifunk-gluon/packages.git
synced 2024-06-14 11:13:55 +02:00
2e54ac8e17
This fixes #157 and #158
40 lines
784 B
C
40 lines
784 B
C
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <json-c/json.h>
|
|
#include <respondd.h>
|
|
|
|
#include "airtime.h"
|
|
#include "ifaces.h"
|
|
|
|
static struct json_object *respondd_provider_statistics(void) {
|
|
struct json_object *result, *wireless;
|
|
struct iface_list *ifaces;
|
|
|
|
result = json_object_new_object();
|
|
if (!result)
|
|
return NULL;
|
|
|
|
wireless = json_object_new_array();
|
|
if (!wireless) {
|
|
json_object_put(result);
|
|
return NULL;
|
|
}
|
|
|
|
ifaces = get_ifaces();
|
|
while (ifaces != NULL) {
|
|
get_airtime(wireless, ifaces->ifx);
|
|
|
|
void *freeptr = ifaces;
|
|
ifaces = ifaces->next;
|
|
free(freeptr);
|
|
}
|
|
|
|
json_object_object_add(result, "wireless", wireless);
|
|
return result;
|
|
}
|
|
|
|
const struct respondd_provider_info respondd_providers[] = {
|
|
{"statistics", respondd_provider_statistics},
|
|
{0, 0},
|
|
};
|