Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IfaceMgr.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 class TIfaceMgr;
12 #ifndef IFACEMGR_H
13 #define IFACEMGR_H
14 
15 #include "SmartPtr.h"
16 #include "Container.h"
17 #include "ScriptParams.h"
18 
19 #include "Iface.h"
20 
21 class TMsg;
22 class TOpt;
23 
24 class TIfaceMgr {
25  public:
26  friend std::ostream & operator <<(std::ostream & strum, TIfaceMgr &x);
27 
28  TIfaceMgr(const std::string& xmlFile, bool getIfaces);
29 
30  // ---Iface related---
31  void firstIface();
33  SPtr<TIfaceIface> getIfaceByName(const std::string& name);
35  virtual SPtr<TIfaceIface> getIfaceBySocket(int fd);
36  int countIface();
37 
38  // ---other---
39  int select(unsigned long time, char *buf, int &bufsize, SPtr<TIPv6Addr> peer,
40  SPtr<TIPv6Addr> myaddr);
41  std::string printMac(char * mac, int macLen);
42  void dump();
43  bool isDone();
44 
45  virtual void notifyScripts(const std::string& scriptName, SPtr<TMsg> question,
46  SPtr<TMsg> answer);
47  virtual void notifyScripts(const std::string& scriptName, SPtr<TMsg> question,
48  SPtr<TMsg> answer, TNotifyScriptParams& params);
49  virtual void notifyScript(const std::string& scriptName, std::string action,
50  TNotifyScriptParams& params);
51 
52  virtual void closeSockets();
53 
54  virtual ~TIfaceMgr();
55 
56  protected:
57  virtual void optionToEnv(TNotifyScriptParams& params, SPtr<TOpt> opt, std::string txtPrefix );
58 
59  std::string XmlFile;
60  TContainer< SPtr<TIfaceIface> > IfaceLst; //Interface list
61  bool IsDone;
62 };
63 
64 #endif
65