00001 /* 00002 * Dibbler - a portable DHCPv6 00003 * 00004 * authors: Tomasz Mrugalski <thomson@klub.com.pl> 00005 * Marek Senderski <msend@o2.pl> 00006 * 00007 * released under GNU GPL v2 or later licence 00008 * 00009 * $Id: ClntTransMgr.h,v 1.6 2004/12/07 00:45:41 thomson Exp $ 00010 * 00011 * $Log: ClntTransMgr.h,v $ 00012 * Revision 1.6 2004/12/07 00:45:41 thomson 00013 * Clnt managers creation unified and cleaned up. 00014 * 00015 * Revision 1.5 2004/12/04 23:45:40 thomson 00016 * Problem with client and server on the same Linux host fixed (bug #56) 00017 * 00018 * Revision 1.4 2004/09/07 15:37:44 thomson 00019 * Socket handling changes. 00020 * 00021 */ 00022 class TClntTransMgr; 00023 #ifndef CLNTTRANSMGR_H 00024 #define CLNTTRANSMGR_H 00025 #include <string> 00026 #include "ClntIfaceMgr.h" 00027 #include "ClntCfgIface.h" 00028 #include "Opt.h" 00029 #include "IPv6Addr.h" 00030 class TDHCPMsg; 00031 class TClntAddrMgr; 00032 class TMsg; 00033 class TClntConfMgr; 00034 00035 class TClntTransMgr 00036 { 00037 public: 00038 TClntTransMgr(SmartPtr<TClntIfaceMgr> ifaceMgr, 00039 SmartPtr<TClntAddrMgr> addrMgr, 00040 SmartPtr<TClntCfgMgr> cfgMgr, 00041 string config); 00042 ~TClntTransMgr(); 00043 void doDuties(); 00044 void relayMsg(SmartPtr<TMsg> msg); 00045 unsigned long getTimeout(); 00046 void stop(); 00047 void sendRequest(TContainer< SmartPtr<TOpt> > requestOptions, 00048 TContainer< SmartPtr<TMsg> > srvlist,int iface); 00049 void sendInfRequest(TContainer< SmartPtr<TOpt> > requestOptions, int iface); 00050 void sendRebind( TContainer<SmartPtr<TOpt> > ptrIA, int iface); 00051 void sendRelease(TContainer< SmartPtr<TAddrIA> > ptrIA); 00052 void shutdown(); 00053 bool isDone(); 00054 void setThat(SmartPtr<TClntTransMgr> that); 00055 00056 char * getCtrlAddr(); 00057 int getCtrlIface(); 00058 00059 protected: 00060 void removeExpired(); 00061 void checkDecline(); 00062 void checkConfirm(); 00063 void checkDB(); 00064 void checkRenew(); 00065 void checkRequest(); 00066 void checkSolicit(); 00067 void checkInfRequest(); 00068 00069 private: 00070 bool openLoopbackSocket(); 00071 bool openSocket(SmartPtr<TClntCfgIface> iface); 00072 00073 // managers 00074 SmartPtr<TClntCfgMgr> CfgMgr; 00075 SmartPtr<TClntIfaceMgr> IfaceMgr; 00076 SmartPtr<TClntAddrMgr> AddrMgr; 00077 SmartPtr<TClntTransMgr> That; 00078 00079 TContainer< SmartPtr<TMsg> > Transactions; 00080 bool IsDone; 00081 bool Shutdown; 00082 bool ConfirmEnabled; // should we send CONFIRM message? 00083 00084 bool BindReuse; // Bug #56. Shall we allow running client and server on the same machine? 00085 00086 int ctrlIface; 00087 char ctrlAddr[48]; 00088 }; 00089 #endif 00090 00091