Config.cpp revision ab49680000495bbe6314f3add97e146a2a273b53
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync * XXX: license.
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync /** lease isn't commited */
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync /** Timestamp when lease commited. */
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync /** Period when lease is expired in secs. */
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync /** timestamp when lease was bound */
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync /* Period when binding is expired in secs. */
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync/* consts */
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsyncconst NullConfigEntity *g_NullConfig = new NullConfigEntity();
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsyncRootConfigEntity *g_RootConfig = new RootConfigEntity(std::string("ROOT"), 1200 /* 20 min. */);
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsyncconst ClientMatchCriteria *g_AnyClient = new AnyClientMatchCriteria();
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsyncstatic ConfigurationManager *g_ConfigurationManager = ConfigurationManager::getConfigurationManager();
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsyncstatic NetworkManager *g_NetworkManager = NetworkManager::getNetworkManager();
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsyncint BaseConfigEntity::match(Client& client, BaseConfigEntity **cfg)
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync int iMatch = (m_criteria && m_criteria->check(client)? m_MatchLevel: 0);
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync /* XXX: hack */
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync for (std::vector<BaseConfigEntity *>::iterator it = m_children.begin();
03532efdc331b598d3dedc8cc7477641c3b0dd12vboxsync/* Client */
if (!g_ConfigurationManager)
return g_ConfigurationManager;
int ConfigurationManager::extractRequestList(PCRTNETBOOTP pDhcpMsg, size_t cbDhcpMsg, RawOption& rawOpt)
return ConfigurationManager::findOption(RTNET_DHCP_OPT_PARAM_REQ_LIST, pDhcpMsg, cbDhcpMsg, rawOpt);
bool fDhcpValid = false;
++it)
return (*it);
return NULL;
ConfigurationManager::findOption(uint8_t uOption, PCRTNETBOOTP pDhcpMsg, size_t cbDhcpMsg, RawOption& opt)
return VERR_INVALID_PARAMETER;
return VERR_INVALID_PARAMETER;
bool fExtended = false;
cbLeft--;
pb++;
return VINF_SUCCESS;
return VERR_NOT_FOUND;
Lease *ConfigurationManager::allocateLease4Client(Client *client, PCRTNETBOOTP pDhcpMsg, size_t cbDhcpMsg)
hintAddress.u = 0;
if ( hintAddress.u
return please;
++u32)
return please;
return NULL;
return VINF_SUCCESS;
return VINF_SUCCESS;
++it)
if (ppLease)
static int id;
id++;
if (!LowerAddress.u)
if (!UpperAddress.u)
static int id;
id++;
switch(u8OptId)
case RTNET_DHCP_OPT_DNS:
case RTNET_DHCP_OPT_ROUTERS:
return VINF_SUCCESS;
switch(u8OptId)
case RTNET_DHCP_OPT_DNS:
case RTNET_DHCP_OPT_ROUTERS:
return VINF_SUCCESS;
switch(u8OptId)
case RTNET_DHCP_OPT_DNS:
return m_nameservers;
case RTNET_DHCP_OPT_ROUTERS:
return m_routers;
return m_empty;
switch (u8OptId)
return VINF_SUCCESS;
switch (u8OptId)
return m_domainName;
return m_noString;
return m_noString;
if (!g_NetworkManager)
return g_NetworkManager;
return VERR_INTERNAL_ERROR;
return VINF_SUCCESS;
int rc;
if (!(pDhcpMsg->bp_flags & RTNET_DHCP_FLAGS_NO_BROADCAST)) /** @todo need to see someone set this flag to check that it's correct. */
&m_OurMac,
&m_OurMac,
return VINF_SUCCESS;
int idxParam = 0;
case RTNET_DHCP_OPT_ROUTERS:
case RTNET_DHCP_OPT_DNS:
++it)
pAddresses++;
return VINF_SUCCESS;
AssertPtrReturn(m, false);
if (!m->fBinding)
> m->u32LeaseExpirationPeriod);
> m->u32BindExpirationPeriod);
if (m->fBinding)
return m->fBinding;
if (m->fBinding)
if (m->fBinding)
return m->u32BindExpirationPeriod;
return m->u32LeaseExpirationPeriod;
return m->m_address;
return m->pCfg;
return m->m_client;