Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SrvIfaceMgr.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: Petr Pisar <petr.pisar(at)atlas(dot)cz>
7  *
8  * released under GNU GPL v2 only licence
9  *
10  */
11 
12 #ifndef SRVIFACEMGR_H
13 #define SRVIFACEMGR_H
14 
15 #include "SmartPtr.h"
16 #include "IfaceMgr.h"
17 #include "Iface.h"
18 #include "SrvMsg.h"
19 
20 #define SrvIfaceMgr() (TSrvIfaceMgr::instance())
21 
22 class TSrvIfaceMgr :public TIfaceMgr {
23  public:
24  static void instanceCreate(const std::string& xmlDumpFile);
25  static TSrvIfaceMgr &instance();
26 
27  ~TSrvIfaceMgr();
28  friend std::ostream & operator <<(std::ostream & strum, TSrvIfaceMgr &x);
29 
30  SPtr<TSrvMsg> decodeMsg(int ifindex,
31  SPtr<TIPv6Addr> peer,
32  char * buf, int bufsize);
33 
35  SPtr<TIPv6Addr> peer,
36  char * buf, int bufsize);
37 
38  //bool setupRelay(std::string name, int ifindex, int underIfindex,
39  // SPtr<TSrvOptInterfaceID> interfaceID);
40  void dump();
41 
42  // --- transmission/reception methods ---
43  virtual bool send(int iface, char *msg, int size, SPtr<TIPv6Addr> addr, int port);
44  virtual int receive(unsigned long timeout, char* buf, int& bufsize,
45  SPtr<TIPv6Addr> peer, SPtr<TIPv6Addr> myaddr);
46 
47  // ---receives messages---
48  SPtr<TSrvMsg> select(unsigned long timeout);
49 
50  bool addFQDN(int iface, SPtr<TIPv6Addr> dnsAddr, SPtr<TIPv6Addr> addr,
51  const std::string& domainname);
52 
53  bool delFQDN(int iface, SPtr<TIPv6Addr> dnsAddr, SPtr<TIPv6Addr> addr,
54  const std::string& domainname);
55 
56  virtual void notifyScripts(const std::string& scriptName,
57  SPtr<TMsg> question, SPtr<TMsg> answer);
58 
59  void redetectIfaces();
60 
61 protected:
62  TSrvIfaceMgr(const std::string& xmlFile);
64 
65  std::string XmlFile;
66 };
67 
68 #endif
69