IBR-DTNSuite  0.12
Win32LinkManager.h
Go to the documentation of this file.
1 /*
2  * Win32LinkManager.h
3  *
4  * Created on: 11.10.2012
5  * Author: morgenro
6  */
7 
8 #ifndef DEFAULTLINKMANAGER_H_
9 #define DEFAULTLINKMANAGER_H_
10 
13 #include "ibrcommon/net/vaddress.h"
15 #include <list>
16 #include <set>
17 
18 #include <winsock2.h>
19 #include <ddk/ntddndis.h>
20 #include <iphlpapi.h>
21 
22 namespace ibrcommon
23 {
25  {
26  public:
28  virtual ~Win32LinkManager();
29 
30  void up() throw();
31  void down() throw();
32 
33  const vinterface getInterface(int index) const;
34  const std::list<vaddress> getAddressList(const vinterface &iface, const std::string &scope = "");
35 
36  std::set<ibrcommon::vinterface> getInterfaces() const;
37 
38  virtual void addEventListener(const vinterface &iface, LinkManager::EventCallback *cb) throw ();
39  virtual void removeEventListener(const vinterface&, LinkManager::EventCallback*) throw ();
40  virtual void removeEventListener(LinkManager::EventCallback*) throw ();
41 
42  private:
43  void freeAdapterInfo(IP_ADAPTER_ADDRESSES *pAddresses) const;
44  IP_ADAPTER_ADDRESSES* getAdapterInfo() const;
45  vaddress getAddress(SOCKET_ADDRESS &address) const;
46 
47  LinkMonitor _lm;
48  };
49 } /* namespace ibrcommon */
50 #endif /* DEFAULTLINKMANAGER_H_ */