Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SrvTransMgr.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  * changes: Grzegorz Pluto
7  *
8  * released under GNU GPL v2 only licence
9  *
10  */
11 
12 #ifndef SRVTRANSMGR_H
13 #define SRVTRANSMGR_H
14 
15 #include <string>
16 #include <vector>
17 #include "SmartPtr.h"
18 #include "Container.h"
19 #include "Opt.h"
20 #include "SrvMsg.h"
21 #include "SrvIfaceMgr.h"
22 #include "SrvCfgIface.h"
23 #include "SrvAddrMgr.h"
24 
25 #define SrvTransMgr() (TSrvTransMgr::instance())
26 
28 {
29  friend std::ostream & operator<<(std::ostream &strum, TSrvTransMgr &x);
30  public:
31  static void instanceCreate(const std::string& config, int port);
32  static TSrvTransMgr &instance();
33 
34  bool openSocket(SPtr<TSrvCfgIface> confIface, int port);
35 
36  long getTimeout();
37  void relayMsg(SPtr<TSrvMsg> msg);
38 
45  bool unicastCheck(SPtr<TSrvMsg> msg);
46 
47  void doDuties();
48  void dump();
49 
50  bool isDone();
51  void shutdown();
52 
53 #if 0
54  SPtr<TSrvOptFQDN> addFQDN(int iface, SPtr<TSrvOptFQDN> requestFQDN, SPtr<TDUID> clntDuid,
55  SPtr<TIPv6Addr> clntAddr, std::string hint, bool doRealUpdate);
56  void removeFQDN(SPtr<TSrvCfgIface> ptrIface, SPtr<TAddrIA> ptrIA, SPtr<TFQDN> fqdn);
57 #endif
58 
59  bool sanitizeAddrDB();
60 
61  void removeExpired(std::vector<TSrvAddrMgr::TExpiredInfo>& addrLst,
62  std::vector<TSrvAddrMgr::TExpiredInfo>& tempAddrLst,
63  std::vector<TSrvAddrMgr::TExpiredInfo>& prefixLst);
64 
66  TIAType type);
67 
68  char * getCtrlAddr();
69  int getCtrlIface();
70 
71  int checkReconfigures();
72 
73  bool sendReconfigure(SPtr<TIPv6Addr> addr, int iface,
74  int msgType, SPtr<TDUID> ptrDUID);
75 
76  bool ClientInPool1(SPtr<TIPv6Addr> addr, int iface,bool PD);
77 
81  virtual void sendPacket(SPtr<TSrvMsg> msg);
82 
83  // not private, as we need to instantiate derived SrvTransMgr in tests
84  protected:
85  TSrvTransMgr(std::string xmlFile, int port);
86  virtual ~TSrvTransMgr();
87 
88  std::string XmlFile;
89  bool IsDone;
90 
91  int ctrlIface;
92  char ctrlAddr[48]; // @todo: WTF is that? It should be TIPv6Addr
93 
95 
96  int port_;
97 };
98 
99 
100 
101 #endif
102