Previous topicNext topic
Help > XEngine_HelpComponents > HelpComponents_WBlackList > WBlackList_DomainAddr >
WBlackList_Domain_Init

函数

WBlackList_Domain_Init

功能

初始化黑名单处理函数

语法

BOOL WBlackList_Domain_Init(XNETHANDLE *pxhNet)

参数

 参数.一:pxhNet
  In/Out:Out
  类型:网络句柄
  可空:N
  意思:导出句柄

返回值

类型:逻辑型
意思:是否成功

备注

 

示例

int Test_DomainBlackList()
{
    XNETHANDLE xhNet;
    LPCTSTR lpszDomain1 = _T("http://www.xyry.org");
    LPCTSTR lpszDomain2 = _T("*.*.cctv.org");
    LPCTSTR lpszDomain3 = _T("http://*.cctv.org/1.html");
    LPCTSTR lpszDomain4 = _T("*.*.*.cctv.org");
    LPCTSTR lpszDomain5 = _T("*.app.cctv.org");
    LPCTSTR lpszDomainExist = _T("app.cctv.org");

    if (!WBlackList_Domain_Init(&xhNet))
    {
        return -1;
    }
    WBlackList_Domain_Add(xhNet, lpszDomain1);
    WBlackList_Domain_Add(xhNet, lpszDomain2);
    WBlackList_Domain_Add(xhNet, lpszDomain3);
    WBlackList_Domain_Add(xhNet, lpszDomain4);
    WBlackList_Domain_Add(xhNet, lpszDomain5);

    int nBlackCount = 0;
    CHAR **ppszListBlack;
    WBlackList_Domain_GetList(xhNet, &ppszListBlack, &nBlackCount);
    for (int i = 0; i < nBlackCount; i++)
    {
        printf("%s\n", ppszListBlack[i]);
    }

    if (WBlackList_Domain_IsExistBlack(xhNet, lpszDomainExist))
    {
        printf("找到\n");
    }
    else
    {
        printf("没找到\n");
    }

    WBlackList_Domain_AddWhite(xhNet, lpszDomainExist);
    if (WBlackList_Domain_IsExistBlack(xhNet, lpszDomainExist))
    {
        printf("找到\n");
    }
    else
    {
        printf("没找到\n");
    }
    WBlackList_Domain_Destory(xhNet);
    return 0;
}