/*
- * Copyright (c) 2009, 2010 Nicira Networks.
+ * Copyright (c) 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <errno.h>
#include <poll.h>
+#include <stdlib.h>
#include "coverage.h"
#include "netlink.h"
return rtn;
}
+/* Destroys 'rtn' by freeing any memory it has reserved and closing any sockets
+ * it has opened. */
+void
+rtnetlink_destroy(struct rtnetlink *rtn)
+{
+ if (rtn) {
+ nl_sock_destroy(rtn->notify_sock);
+ free(rtn);
+ }
+}
+
/* Registers 'cb' to be called with auxiliary data 'aux' with change
* notifications. The notifier is stored in 'notifier', which the caller must
* not modify or free.
struct rtnetlink *rtnetlink_create(int multicast_group,
rtnetlink_parse_func *,
void *change);
+void rtnetlink_destroy(struct rtnetlink *rtn);
int rtnetlink_notifier_register(struct rtnetlink *,
struct rtnetlink_notifier *,
rtnetlink_notify_func *, void *aux);