本文整理汇总了C++中ConfigurationManager::expireLease4Client方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigurationManager::expireLease4Client方法的具体用法?C++ ConfigurationManager::expireLease4Client怎么用?C++ ConfigurationManager::expireLease4Client使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigurationManager
的用法示例。
在下文中一共展示了ConfigurationManager::expireLease4Client方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleDhcpReqRequest
/**
* The client is requesting an offer.
*
* @returns true.
*
* @param pDhcpMsg The message.
* @param cb The message size.
*/
bool NetworkManager::handleDhcpReqRequest(PCRTNETBOOTP pDhcpMsg, size_t cb)
{
ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
/* 1. find client */
Client client = confManager->getClientByDhcpPacket(pDhcpMsg, cb);
/* 2. find bound lease */
Lease l = client.lease();
if (l != Lease::NullLease)
{
if (l.isExpired())
{
/* send client to INIT state */
Client c(client);
nak(client, pDhcpMsg->bp_xid);
confManager->expireLease4Client(c);
return true;
}
else {
/* XXX: Validate request */
RawOption opt;
RT_ZERO(opt);
Client c(client);
int rc = confManager->commitLease4Client(c);
AssertRCReturn(rc, false);
rc = ConfigurationManager::extractRequestList(pDhcpMsg, cb, opt);
AssertRCReturn(rc, false);
ack(client, pDhcpMsg->bp_xid, opt.au8RawOpt, opt.cbRawOpt);
}
}
else
{
nak(client, pDhcpMsg->bp_xid);
}
return true;
}