本文整理汇总了C++中PDRVNETSHAPER类的典型用法代码示例。如果您正苦于以下问题:C++ PDRVNETSHAPER类的具体用法?C++ PDRVNETSHAPER怎么用?C++ PDRVNETSHAPER使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PDRVNETSHAPER类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PDMBOTHCBDECL
/**
* @interface_method_impl{PDMINETWORKUP,pfnSetPromiscuousMode}
*/
PDMBOTHCBDECL(void) drvNetShaperUp_SetPromiscuousMode(PPDMINETWORKUP pInterface, bool fPromiscuous)
{
LogFlow(("drvNetShaperUp_SetPromiscuousMode: fPromiscuous=%d\n", fPromiscuous));
PDRVNETSHAPER pThis = RT_FROM_MEMBER(pInterface, DRVNETSHAPER, CTX_SUFF(INetworkUp));
if (pThis->CTX_SUFF(pIBelowNet))
pThis->CTX_SUFF(pIBelowNet)->pfnSetPromiscuousMode(pThis->CTX_SUFF(pIBelowNet), fPromiscuous);
}
示例2: PDMBOTHCBDECL
/**
* @interface_method_impl{PDMINETWORKUP,pfnAllocBuf}
*/
PDMBOTHCBDECL(int) drvNetShaperUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin,
PCPDMNETWORKGSO pGso, PPPDMSCATTERGATHER ppSgBuf)
{
PDRVNETSHAPER pThis = RT_FROM_MEMBER(pInterface, DRVNETSHAPER, CTX_SUFF(INetworkUp));
if (RT_UNLIKELY(!pThis->CTX_SUFF(pIBelowNet)))
return VERR_NET_DOWN;
//LogFlow(("drvNetShaperUp_AllocBuf: cb=%d\n", cbMin));
STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesRequested, cbMin);
STAM_REL_COUNTER_INC(&pThis->StatXmitPktsRequested);
#ifdef IN_RING3
if (!PDMR3NsAllocateBandwidth(&pThis->Filter, cbMin))
{
STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesDenied, cbMin);
STAM_REL_COUNTER_INC(&pThis->StatXmitPktsDenied);
return VERR_TRY_AGAIN;
}
#endif
#ifdef IN_RING0
if (!PDMR0NsAllocateBandwidth(&pThis->Filter, cbMin))
{
STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesDenied, cbMin);
STAM_REL_COUNTER_INC(&pThis->StatXmitPktsDenied);
return VERR_TRY_AGAIN;
}
#endif
STAM_REL_COUNTER_ADD(&pThis->StatXmitBytesGranted, cbMin);
STAM_REL_COUNTER_INC(&pThis->StatXmitPktsGranted);
//LogFlow(("drvNetShaperUp_AllocBuf: got cb=%d\n", cbMin));
return pThis->CTX_SUFF(pIBelowNet)->pfnAllocBuf(pThis->CTX_SUFF(pIBelowNet), cbMin, pGso, ppSgBuf);
}