initial code refactoring to prepare for adding dynamic interface support
[project/mdnsd.git] / interface.h
diff --git a/interface.h b/interface.h
new file mode 100644 (file)
index 0000000..fe709aa
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2014 John Crispin <blogic@openwrt.org>
+ * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MDNS_INTERFACE_H
+#define __MDNS_INTERFACE_H
+
+#include <sys/types.h>
+#include <sys/uio.h>
+
+#include <libubox/uloop.h>
+#include <libubox/vlist.h>
+
+extern struct vlist_tree interfaces;
+extern struct interface *cur_iface;
+
+struct interface {
+       struct vlist_node node;
+
+       const char *name;
+       struct uloop_fd fd;
+
+       int ifindex;
+       const char *ip;
+};
+
+int interface_add(const char *name);
+int interface_send_packet(struct interface *iface, struct iovec *iov, int iov_len);
+int interface_socket_setup(struct interface *iface);
+
+#endif