mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
Add umdns call
This commit is contained in:
parent
e4c5feb40e
commit
b58e852333
2 changed files with 27 additions and 0 deletions
|
@ -26,4 +26,6 @@ void *kick_clients_thread(void *arg);
|
|||
|
||||
char *hostapd_dir_glob;
|
||||
|
||||
int ubus_call_umdns();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -362,6 +362,8 @@ int dawn_init_ubus(const char *ubus_socket, char *hostapd_dir) {
|
|||
|
||||
subscribe_to_hostapd_interfaces(hostapd_dir);
|
||||
|
||||
ubus_call_umdns();
|
||||
|
||||
uloop_run();
|
||||
|
||||
close_socket();
|
||||
|
@ -591,4 +593,27 @@ void del_client_interface(uint32_t id, const uint8_t *client_addr, uint32_t reas
|
|||
|
||||
int timeout = 1;
|
||||
ubus_invoke(ctx_clients, id, "del_client", b.head, NULL, NULL, timeout * 1000);
|
||||
}
|
||||
|
||||
static void ubus_umdns_cb(struct ubus_request *req, int type, struct blob_attr *msg) {
|
||||
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
char *str = blobmsg_format_json(msg, true);
|
||||
printf("UMDNS:\n%s", str);
|
||||
}
|
||||
|
||||
|
||||
int ubus_call_umdns()
|
||||
{
|
||||
u_int32_t id;
|
||||
if (ubus_lookup_id(ctx, "umdns", &id)) {
|
||||
fprintf(stderr, "Failed to look up test object for %s\n", "umdns");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int timeout = 1;
|
||||
ubus_invoke(ctx_clients, id, "browse", NULL, ubus_umdns_cb, NULL, timeout * 1000);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue