2018-05-16 14:58:24 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <json-c/json.h>
|
|
|
|
#include <libbabelhelper/babelhelper.h>
|
|
|
|
#include "handle_neighbour.h"
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
struct json_object *neighbours;
|
|
|
|
|
|
|
|
printf("Content-type: text/event-stream\n\n");
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
struct babelhelper_ctx bhelper_ctx = {};
|
|
|
|
while (1) {
|
|
|
|
neighbours = json_object_new_object();
|
|
|
|
if (!neighbours)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bhelper_ctx.debug = false;
|
2019-08-14 13:16:36 +00:00
|
|
|
babelhelper_readbabeldata(&bhelper_ctx, "dump", (void*)neighbours, handle_neighbour);
|
2018-05-16 14:58:24 +00:00
|
|
|
|
|
|
|
printf("data: %s\n\n", json_object_to_json_string(neighbours));
|
|
|
|
fflush(stdout);
|
|
|
|
json_object_put(neighbours);
|
|
|
|
neighbours = NULL;
|
|
|
|
sleep(10);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|