00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 class TAddrMgr;
00027 #ifndef ADDRMGR_H
00028 #define ADDRMGR_H
00029
00030 #include <string>
00031 #include "SmartPtr.h"
00032 #include "Container.h"
00033 #include "AddrClient.h"
00034 #include "AddrIA.h"
00035
00036 #ifdef LIBXML2
00037 #include <libxml/xmlmemory.h>
00038 #include <libxml/parser.h>
00039
00040 #define ADDRDB_DTD (xmlChar*)"AddrMgr.dtd"
00041 #endif
00042
00043 class TAddrMgr
00044 {
00045 public:
00046 friend ostream & operator<<(ostream & strum,TAddrMgr &x);
00047 TAddrMgr(string addrdb, bool loadfile = false);
00048 virtual ~TAddrMgr();
00049
00050
00051 void addClient(SmartPtr<TAddrClient> x);
00052 void firstClient();
00053 SmartPtr<TAddrClient> getClient();
00054 SmartPtr<TAddrClient> getClient(SmartPtr<TDUID> duid);
00055 int countClient();
00056 bool delClient(SmartPtr<TDUID> duid);
00057
00058
00059 unsigned long getT1Timeout();
00060 unsigned long getT2Timeout();
00061 unsigned long getPrefTimeout();
00062 unsigned long getValidTimeout();
00063 unsigned long getAddrCount(SmartPtr<TDUID> duid, int iface);
00064
00065
00066 void dbLoad();
00067 void dump();
00068 bool isDone();
00069
00070 #ifdef LIBXML2
00071 xmlDocPtr xmlLoad(const char * filename);
00072 SmartPtr<TAddrAddr> parseAddrAddr(xmlDocPtr doc, xmlNodePtr xmlAddr, int depth);
00073 SmartPtr<TAddrIA> parseAddrIA(xmlDocPtr doc, xmlNodePtr xmlIA, int depth);
00074 SmartPtr<TAddrClient> parseAddrClient(xmlDocPtr doc, xmlNodePtr xmlClient, int depth);
00075 void parseAddrMgr(xmlDocPtr doc,int depth);
00076 #endif
00077
00078 protected:
00079 bool IsDone;
00080 TContainer< SmartPtr<TAddrClient> > ClntsLst;
00081 string XmlFile;
00082 };
00083
00084 #endif
00085