summaryrefslogtreecommitdiffstats
path: root/watchlink/netlink_linkstatus.hh
diff options
context:
space:
mode:
Diffstat (limited to 'watchlink/netlink_linkstatus.hh')
-rw-r--r--watchlink/netlink_linkstatus.hh56
1 files changed, 56 insertions, 0 deletions
diff --git a/watchlink/netlink_linkstatus.hh b/watchlink/netlink_linkstatus.hh
new file mode 100644
index 00000000..b4eebbce
--- /dev/null
+++ b/watchlink/netlink_linkstatus.hh
@@ -0,0 +1,56 @@
+/*
+ * Module: netlink_linkstatus.hh
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+#ifndef __NETLINK_LINKSTATUS_HH__
+#define __NETLINK_LINKSTATUS_HH__
+
+#include <string>
+#include <map>
+#include "netlink_event.hh"
+#include "netlink_send.hh"
+
+class NetlinkLinkStatus
+{
+public:
+ typedef std::map<int,bool> IfaceStateColl;
+ typedef std::map<int,bool>::iterator IfaceStateIter;
+
+public:
+ NetlinkLinkStatus(int send_sock, const std::string &link_dir, bool debug);
+ ~NetlinkLinkStatus();
+
+ void
+ process(const NetlinkEvent &event);
+
+private:
+ int
+ process_up(const NetlinkEvent &event);
+
+ int
+ process_down(const NetlinkEvent &event);
+
+ int
+ process_going_up(const NetlinkEvent &event);
+
+ int
+ process_going_down(const NetlinkEvent &event);
+
+
+private:
+ NetlinkSend _nl_send;
+ int _send_sock;
+ std::string _link_dir;
+ bool _debug;
+
+ //keeps track of down messages where we've issued a
+ //request for addresses but haven't received msg yet.
+ IfaceStateColl _iface_state_coll;
+
+};
+
+#endif //__NETLINK_LINKSTATUS_HH__