Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ClntIfaceMgr.h
Go to the documentation of this file.
1 /*
2  * Dibbler - a portable DHCPv6
3  *
4  * authors: Tomasz Mrugalski <thomson@klub.com.pl>
5  * Marek Senderski <msend@o2.pl>
6  *
7  * released under GNU GPL v2 only licence
8  *
9  */
10 
11 #include <iostream>
12 
13 class TClntIfaceMgr;
14 class TClntMsg;
15 class TClntIfaceIface;
16 #ifndef CLNTIFACEMGR_H
17 #define CLNTIFACEMGR_H
18 
19 #include "SmartPtr.h"
20 #include "IfaceMgr.h"
21 #include "ClntCfgMgr.h"
22 #include "ClntAddrMgr.h"
23 #include "ClntTransMgr.h"
24 #include "ClntIfaceIface.h"
25 #include "IPv6Addr.h"
26 #include "ClntMsg.h"
27 #include "ScriptParams.h"
28 
29 #define ClntIfaceMgr() (TClntIfaceMgr::instance())
30 
31 class TClntIfaceMgr : public TIfaceMgr
32 {
33 public:
34  typedef enum {
39 
40 private:
41  TClntIfaceMgr(const std::string& xmlFile); // this is singleton
42 
43 public:
44  static void instanceCreate(const std::string& xmlFile);
45  static TClntIfaceMgr& instance();
46 
48  friend std::ostream & operator <<(std::ostream & strum, TClntIfaceMgr &x);
49  void dump();
50 
51  bool sendUnicast(int iface, char *msg, int size, SPtr<TIPv6Addr> addr);
52 
53  bool sendMulticast(int iface, char *msg, int msgsize);
54 
55  SPtr<TClntMsg> select(unsigned int timeout);
56 
57 #ifdef MOD_REMOTE_AUTOCONF
58  bool notifyRemoteScripts(SPtr<TIPv6Addr> receivedAddr, SPtr<TIPv6Addr> serverAddr, int ifindex);
59 #endif
60 
61  bool fqdnAdd(SPtr<TClntIfaceIface> iface, const std::string& domainname);
62  bool fqdnDel(SPtr<TClntIfaceIface> iface, SPtr<TAddrIA> ia, const std::string& domainname);
63 
64  bool addPrefix (int iface, SPtr<TIPv6Addr> prefix, int prefixLen,
65  unsigned int pref, unsigned int valid,
66  TNotifyScriptParams* params /*= NULL*/);
67  bool updatePrefix(int iface, SPtr<TIPv6Addr> prefix, int prefixLen,
68  unsigned int pref, unsigned int valid,
69  TNotifyScriptParams* params /*= NULL*/);
70  bool delPrefix (int iface, SPtr<TIPv6Addr> prefix, int prefixLen,
71  TNotifyScriptParams* params /*= NULL*/);
72 
73  // --- option related ---
74  void removeAllOpts();
75 
76  unsigned int getTimeout();
77 
78  bool doDuties();
79 
80  void redetectIfaces();
81 
82  int numBits(int i);
83 
84  SPtr<TIPv6Addr> calculateSubprefix(const SPtr<TIPv6Addr>& prefix, int prefixLen,
85  int numPrefixes, int i, int& subprefixLen);
86 
87  private:
88 
89  bool modifyPrefix(int iface, SPtr<TIPv6Addr> prefix, int prefixLen,
90  unsigned int pref, unsigned int valid, PrefixModifyMode mode,
91  TNotifyScriptParams* params /*= NULL*/);
92 
93  std::string XmlFile;
94 
96 };
97 
98 #endif
99