Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TSrvCfgMgr Class Reference

#include <SrvCfgMgr.h>

+ Inheritance diagram for TSrvCfgMgr:
+ Collaboration diagram for TSrvCfgMgr:

Public Member Functions

virtual ~TSrvCfgMgr ()
void addClntAddr (int iface, SPtr< TIPv6Addr > addr)
void addIface (SPtr< TSrvCfgIface > iface)
bool addrReserved (SPtr< TIPv6Addr > addr)
void addTAAddr (int iface)
void bulkLQAccept (bool enabled)
void bulkLQMaxConns (unsigned int maxConnections)
void bulkLQTcpPort (unsigned short portNumber)
void bulkLQTimeout (unsigned int timeout)
SPtr< TSrvCfgIfacecheckInactiveIfaces ()
long countAvailAddrs (SPtr< TDUID > clntDuid, SPtr< TIPv6Addr > clntAddr, int iface)
long countIface ()
bool decrPrefixCount (int iface, SPtr< TIPv6Addr > prefix)
void delClntAddr (int iface, SPtr< TIPv6Addr > addr)
void delTAAddr (int iface)
void dropUnicast (bool drop)
bool dropUnicast ()
void dump ()
void firstIface ()
int getAnyRelay ()
 return any relay (used with guess-mode on)
DigestTypesLst getAuthDigests ()
int getCacheSize ()
SPtr< TSrvCfgAddrClassgetClassByAddr (int iface, SPtr< TIPv6Addr > addr)
SPtr< TSrvCfgPDgetClassByPrefix (int iface, SPtr< TIPv6Addr > prefix)
SPtr< TIPv6AddrgetDDNSAddress (int iface)
uint32_t getDelayedAuthKeyID (const char *mapping_file, SPtr< TDUID > clientid)
enum DigestTypes getDigest ()
SPtr< TSrvCfgIfacegetIface ()
SPtr< TSrvCfgIfacegetIfaceByID (int iface)
SPtr< TSrvCfgIfacegetIfaceByName (const std::string &name)
ESrvIfaceIdOrder getInterfaceIDOrder ()
bool getPerformanceMode ()
SPtr< TIPv6AddrgetRandomAddr (SPtr< TDUID > duid, SPtr< TIPv6Addr > clntAddr, int iface)
bool getReconfigureSupport ()
int getRelayByInterfaceID (SPtr< TSrvOptInterfaceID > interfaceID)
 returns ifindex of an interface with specified interface-id
int getRelayByLinkAddr (SPtr< TIPv6Addr > addr)
 returns ifindex of an interface with matched address
std::string getScriptName ()
std::string getWorkdir ()
bool guessMode ()
int inactiveIfacesCnt ()
bool inactiveMode ()
void InClientClass (SPtr< TSrvMsg > msg)
bool incrPrefixCount (int iface, SPtr< TIPv6Addr > prefix)
bool isClntSupported (SPtr< TSrvMsg > msg)
bool isDone ()
void makeInactiveIface (int ifindex, bool inactive)
bool parseConfigFile (const std::string &cfgFile)
bool prefixReserved (SPtr< TIPv6Addr > prefix)
void removeReservedFromCache ()
 removes reserved entries from the cache
void setAuthDigests (const DigestTypesLst &digests)
void setCounters ()
void setDDNSAddress (SPtr< TIPv6Addr > ddnsAddress)
void setDefaults ()
bool setGlobalOptions (SPtr< TSrvParsGlobalOpt > opt)
void setPerformanceMode (bool mode)
void setReconfigureSupport (bool reconf)
void setScriptName (std::string scriptFile)
bool setupRelay (SPtr< TSrvCfgIface > cfgIface)
bool stateless ()
- Public Member Functions inherited from TCfgMgr
 TCfgMgr ()
virtual ~TCfgMgr ()
void addKey (SPtr< TSIGKey > key)
bool compareConfigs (const std::string &cfgFile, const std::string &oldCfgFile)
void copyFile (const std::string &cfgFile, const std::string &oldCfgFile)
uint8_t getAuthAlgorithm ()
bool getAuthDropUnauthenticated ()
AuthProtocols getAuthProtocol ()
std::string getAuthRealm ()
AuthReplay getAuthReplay ()
DNSUpdateProtocol getDDNSProtocol ()
unsigned int getDDNSTimeout ()
SPtr< TDUIDgetDUID ()
SPtr< TSIGKeygetKey ()
int getLogLevel ()
std::string getLogName ()
std::string getWorkDir ()
void setAuthAlgorithm (uint8_t algorithm)
void setAuthDropUnauthenticated (bool drop)
void setAuthProtocol (AuthProtocols proto)
void setAuthRealm (const std::string &realm)
void setAuthReplay (AuthReplay replay_detection_mode)
void setDDNSProtocol (DNSUpdateProtocol proto)
void setDDNSTimeout (unsigned int timeout)
void setWorkdir (std::string workdir)

Static Public Member Functions

static TSrvCfgMgrinstance ()
static void instanceCreate (const std::string &cfgFile, const std::string &xmlDumpFile)

Public Attributes

SPtr< KeyListAuthKeys

Protected Member Functions

 TSrvCfgMgr (const std::string &cfgFile, const std::string &xmlFile)
bool matchParsedSystemInterfaces (SrvParser *parser)
bool validateClass (SPtr< TSrvCfgIface > ptrIface, SPtr< TSrvCfgAddrClass > ptrClass)
bool validateConfig ()
bool validateIface (SPtr< TSrvCfgIface > ptrIface)
- Protected Member Functions inherited from TCfgMgr
bool generateDUID (const std::string &duidFile, char *mac, int macLen, int macType)
bool loadDUID (const std::string &filename)
 loads DUID from a file.
bool setDUID (const std::string &duidFile, TIfaceMgr &ifaceMgr)

Protected Attributes

unsigned int AuthKeyGenNonceLen
unsigned int AuthLifetime
bool BulkLQAccept
unsigned int BulkLQMaxConns
unsigned short BulkLQTcpPort
unsigned int BulkLQTimeout
int CacheSize
TContainer< SPtr
< TSrvCfgClientClass > > 
ClientClassLst
DigestTypesLst DigestTypesLst_
bool DropUnicast_
SPtr< TIPv6AddrFqdnDdnsAddress
bool GuessMode
TContainer< SPtr< TSrvCfgIface > > InactiveLst
bool InactiveMode
ESrvIfaceIdOrder InterfaceIDOrder
bool IsDone
bool PerformanceMode_
bool Reconfigure_
 specifies whether the server should support reconfigure or not
std::string ScriptName
TContainer< SPtr< TSrvCfgIface > > SrvCfgIfaceLst
bool Stateless
std::string XmlFile
- Protected Attributes inherited from TCfgMgr
uint8_t AuthAlgorithm_
bool AuthDropUnauthenticated_
AuthProtocols AuthProtocol_
std::string AuthRealm_
AuthReplay AuthReplay_
DNSUpdateProtocol DdnsProto
unsigned int DDNSTimeout_
SPtr< TDUIDDUID
SPtr< TDUIDDUIDEnterpriseID
int DUIDEnterpriseNumber
EDUIDType DUIDType
bool IsDone
TSIGKeyList Keys_
int LogLevel
std::string LogName
std::string Workdir

Static Protected Attributes

static TSrvCfgMgrInstance = 0
static int NextRelayID = RELAY_MIN_IFINDEX

Friends

std::ostream & operator<< (std::ostream &strum, TSrvCfgMgr &x)

Additional Inherited Members

- Public Types inherited from TCfgMgr
enum  DNSUpdateProtocol { DNSUPDATE_TCP, DNSUPDATE_UDP, DNSUPDATE_ANY }

Constructor & Destructor Documentation

TSrvCfgMgr::~TSrvCfgMgr ( )
virtual
TSrvCfgMgr::TSrvCfgMgr ( const std::string &  cfgFile,
const std::string &  xmlFile 
)
protected

Member Function Documentation

void TSrvCfgMgr::addClntAddr ( int  iface,
SPtr< TIPv6Addr addr 
)
void TSrvCfgMgr::addIface ( SPtr< TSrvCfgIface iface)
bool TSrvCfgMgr::addrReserved ( SPtr< TIPv6Addr addr)

checks if an address is reserved (checks all interfaces)

Parameters
addr
Returns
true if reserved, false otherwise
void TSrvCfgMgr::addTAAddr ( int  iface)
void TSrvCfgMgr::bulkLQAccept ( bool  enabled)
void TSrvCfgMgr::bulkLQMaxConns ( unsigned int  maxConnections)
void TSrvCfgMgr::bulkLQTcpPort ( unsigned short  portNumber)
void TSrvCfgMgr::bulkLQTimeout ( unsigned int  timeout)
SPtr< TSrvCfgIface > TSrvCfgMgr::checkInactiveIfaces ( )

Tryies to find interface in list of inactive interfaces which becames ready. In positive case such an interface is moved back into standard list. Only first matching interface is processed.

Returns
Interface that becomes ready and has been moved out of inactive list. If no such interface exists, 0 will be returned.
long TSrvCfgMgr::countAvailAddrs ( SPtr< TDUID clntDuid,
SPtr< TIPv6Addr clntAddr,
int  iface 
)

returns how many addresses can be assigned to this client? factors used:

  • iface-max-lease
  • clntSupported()
  • class-max-lease in each class
  • assignedCount in each class
Parameters
clntDuid
clntAddr
iface
Returns
return value <= clnt-max-lease <= iface-max-lease
Todo:
: long long long int (128bit) could come in handy
long TSrvCfgMgr::countIface ( )
bool TSrvCfgMgr::decrPrefixCount ( int  ifindex,
SPtr< TIPv6Addr prefix 
)

@ decreases prefix usage count (i.e. decreases prefix-pool usage by one) Actual prefix is also deleted in AddrMgr.

Parameters
ifindexinterface index
prefixprefix to be deleted
Returns
true is deletion was successful
void TSrvCfgMgr::delClntAddr ( int  iface,
SPtr< TIPv6Addr addr 
)
void TSrvCfgMgr::delTAAddr ( int  iface)
void TSrvCfgMgr::dropUnicast ( bool  drop)
bool TSrvCfgMgr::dropUnicast ( )
void TSrvCfgMgr::dump ( )
void TSrvCfgMgr::firstIface ( )
int TSrvCfgMgr::getAnyRelay ( )

return any relay (used with guess-mode on)

Returns
interface index of the first relay (or -1 if there are no relays)
DigestTypesLst TSrvCfgMgr::getAuthDigests ( )
int TSrvCfgMgr::getCacheSize ( )

returns size (in bytes of the configured cache size

Returns
SPtr< TSrvCfgAddrClass > TSrvCfgMgr::getClassByAddr ( int  iface,
SPtr< TIPv6Addr addr 
)

return class, which address belongs to

Parameters
iface
addr
Returns
pointer to the class (or 0, if no suitable class found)
SPtr< TSrvCfgPD > TSrvCfgMgr::getClassByPrefix ( int  iface,
SPtr< TIPv6Addr addr 
)

get a class, which prefix belongs to

Parameters
iface
addr
Returns
class (or 0 if no class is found)
SPtr< TIPv6Addr > TSrvCfgMgr::getDDNSAddress ( int  iface)

Returns DNS server address suitable for DNS Update

Parameters
ifaceinterface index
Returns
DNS address (or NULL)
uint32_t TSrvCfgMgr::getDelayedAuthKeyID ( const char *  mapping_file,
SPtr< TDUID clientid 
)

returns key-id that should be used for a given client-id

Parameters
clientidclient identifier
Returns
Key ID to be used (or 0)
enum DigestTypes TSrvCfgMgr::getDigest ( )
SPtr< TSrvCfgIface > TSrvCfgMgr::getIface ( )
SPtr< TSrvCfgIface > TSrvCfgMgr::getIfaceByID ( int  iface)
SPtr< TSrvCfgIface > TSrvCfgMgr::getIfaceByName ( const std::string &  name)
ESrvIfaceIdOrder TSrvCfgMgr::getInterfaceIDOrder ( )
bool TSrvCfgMgr::getPerformanceMode ( )
SPtr< TIPv6Addr > TSrvCfgMgr::getRandomAddr ( SPtr< TDUID duid,
SPtr< TIPv6Addr clntAddr,
int  iface 
)
Todo:
: get addrs from first address only
bool TSrvCfgMgr::getReconfigureSupport ( )

returns where reconfigure should be supported or not

Returns
true if supported
int TSrvCfgMgr::getRelayByInterfaceID ( SPtr< TSrvOptInterfaceID interfaceID)

returns ifindex of an interface with specified interface-id

Parameters
interfaceIDpointer to TSrvOptInterfaceID
Returns
interface index (or -1 if not found)
int TSrvCfgMgr::getRelayByLinkAddr ( SPtr< TIPv6Addr addr)

returns ifindex of an interface with matched address

Parameters
addraddress to be matched
Returns
interface index (or -1 if not found)
std::string TSrvCfgMgr::getScriptName ( )
inline
std::string TSrvCfgMgr::getWorkdir ( )
bool TSrvCfgMgr::guessMode ( )
int TSrvCfgMgr::inactiveIfacesCnt ( )

Returns number of inactive interfaces

bool TSrvCfgMgr::inactiveMode ( )
void TSrvCfgMgr::InClientClass ( SPtr< TSrvMsg msg)
Todo:
: Fix this! We check if message is from accepted client, but don't do anything with that info
bool TSrvCfgMgr::incrPrefixCount ( int  iface,
SPtr< TIPv6Addr prefix 
)
TSrvCfgMgr & TSrvCfgMgr::instance ( )
static
void TSrvCfgMgr::instanceCreate ( const std::string &  cfgFile,
const std::string &  xmlDumpFile 
)
static
bool TSrvCfgMgr::isClntSupported ( SPtr< TSrvMsg msg)

Checks if a given client is supported

Parameters
msgmessage sent by client
Returns
true if supported, false otherwise
Todo:
: reject-client and accept-only does not work in stateless mode
bool TSrvCfgMgr::isDone ( )
void TSrvCfgMgr::makeInactiveIface ( int  ifindex,
bool  inactive 
)

Moves interface identified by ifindex between SrvCfgIfaceLst and InactiveLst.

Parameters
ifindexIndex of the moving interface
inactivetrue for makeing inactive, false for makeing active
bool TSrvCfgMgr::matchParsedSystemInterfaces ( SrvParser parser)
protected
Todo:
: Client's class uses setIface{Name,ID}(). We should unite the
bool TSrvCfgMgr::parseConfigFile ( const std::string &  cfgFile)
bool TSrvCfgMgr::prefixReserved ( SPtr< TIPv6Addr prefix)

checks if a prefix is reserved (checks all interfaces)

Parameters
prefixprefix to be checked
Returns
true if reserved, false otherwise
void TSrvCfgMgr::removeReservedFromCache ( )

removes reserved entries from the cache

void TSrvCfgMgr::setAuthDigests ( const DigestTypesLst &  types)
Todo:
move this to CfgMgr and unify with TClntCfgMgr::setAuthAcceptMethods
void TSrvCfgMgr::setCounters ( )

sets pool usage counters (used during bringup, after AddrDB is loaded from file)

void TSrvCfgMgr::setDDNSAddress ( SPtr< TIPv6Addr ddnsAddress)

Sets DNS server address suitable for DNS Update

Parameters
ddnsAddressDNS server address
void TSrvCfgMgr::setDefaults ( )
bool TSrvCfgMgr::setGlobalOptions ( SPtr< TSrvParsGlobalOpt opt)
void TSrvCfgMgr::setPerformanceMode ( bool  mode)
void TSrvCfgMgr::setReconfigureSupport ( bool  reconf)

sets whether the reconfigure should be supported or not

Parameters
reconftells whether reconfigure should be supported
void TSrvCfgMgr::setScriptName ( std::string  scriptFile)
inline
bool TSrvCfgMgr::setupRelay ( SPtr< TSrvCfgIface cfgIface)
bool TSrvCfgMgr::stateless ( )
bool TSrvCfgMgr::validateClass ( SPtr< TSrvCfgIface ptrIface,
SPtr< TSrvCfgAddrClass ptrClass 
)
protected
bool TSrvCfgMgr::validateConfig ( )
protected
bool TSrvCfgMgr::validateIface ( SPtr< TSrvCfgIface ptrIface)
protected

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  strum,
TSrvCfgMgr x 
)
friend

Member Data Documentation

unsigned int TSrvCfgMgr::AuthKeyGenNonceLen
protected
SPtr<KeyList> TSrvCfgMgr::AuthKeys
unsigned int TSrvCfgMgr::AuthLifetime
protected
bool TSrvCfgMgr::BulkLQAccept
protected
unsigned int TSrvCfgMgr::BulkLQMaxConns
protected
unsigned short TSrvCfgMgr::BulkLQTcpPort
protected
unsigned int TSrvCfgMgr::BulkLQTimeout
protected
int TSrvCfgMgr::CacheSize
protected
TContainer< SPtr<TSrvCfgClientClass> > TSrvCfgMgr::ClientClassLst
protected
DigestTypesLst TSrvCfgMgr::DigestTypesLst_
protected
bool TSrvCfgMgr::DropUnicast_
protected
SPtr<TIPv6Addr> TSrvCfgMgr::FqdnDdnsAddress
protected
bool TSrvCfgMgr::GuessMode
protected
TContainer< SPtr<TSrvCfgIface> > TSrvCfgMgr::InactiveLst
protected
bool TSrvCfgMgr::InactiveMode
protected
TSrvCfgMgr * TSrvCfgMgr::Instance = 0
staticprotected
ESrvIfaceIdOrder TSrvCfgMgr::InterfaceIDOrder
protected
bool TSrvCfgMgr::IsDone
protected
int TSrvCfgMgr::NextRelayID = RELAY_MIN_IFINDEX
staticprotected
bool TSrvCfgMgr::PerformanceMode_
protected
bool TSrvCfgMgr::Reconfigure_
protected

specifies whether the server should support reconfigure or not

std::string TSrvCfgMgr::ScriptName
protected
TContainer< SPtr<TSrvCfgIface> > TSrvCfgMgr::SrvCfgIfaceLst
protected
bool TSrvCfgMgr::Stateless
protected
std::string TSrvCfgMgr::XmlFile
protected

The documentation for this class was generated from the following files: