#include <ngadmin.h>
-#include <attr.h>
-#include <protocol.h>
+#include <nsdp/attr.h>
+#include <nsdp/protocol.h>
#include "lib.h"
#include "network.h"
-static const struct timeval default_timeout = {.tv_sec = 4, .tv_usec = 0};
+static const struct timespec default_timeout = {.tv_sec = 4, .tv_nsec = 0};
struct ngadmin* ngadmin_init (const char *iface)
/* allocate main structure */
nga = malloc(sizeof(struct ngadmin));
memset(nga, 0, sizeof(struct ngadmin));
+ nga->globalbroad = true;
strncpy(nga->iface, iface, IFNAMSIZ - 1);
}
nga->timeout = default_timeout;
- if (updateTimeout(nga) < 0) {
- free(nga);
- return NULL;
- }
return nga;
if (nga == NULL)
return ERR_INVARG;
- nga->globalbroad = value;
-
- return ERR_OK;
+ if (setBroadcastType(nga, value) == 0)
+ return ERR_OK;
+ else
+ return ERR_NET;
}
if (nga == NULL || tv == NULL)
return ERR_INVARG;
- nga->timeout = *tv;
- if (updateTimeout(nga) < 0)
- ret = ERR_NET;
-
+ nga->timeout.tv_sec = tv->tv_sec;
+ nga->timeout.tv_nsec = tv->tv_usec * 1000;
return ret;
}