Previous topicNext topic
Help > XEngine_HelpComponents > HelpComponents_WBlackList > WBlackList_IPV6Addr >
WBlackList_IPV6Addr_Init

函数

WBlackList_IPV6Addr_Init

功能

初始化黑名单处理函数

语法

BOOL WBlackList_IPV6Addr_Init(XNETHANDLE *pxhNet)

参数

函数功能:初始化黑名单处理函数
 参数.一:pxhNet
  In/Out:Out
  类型:网络句柄
  可空:N
  意思:导出句柄

返回值

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

备注

 

示例

int Test_IPV6BlackList()
{
    XNETHANDLE xhNet;
    LPCTSTR lpszStartAddr1 = _T("FF01:0:0:0:1:0:0:1");
    LPCTSTR lpszStartAddr2 = _T("FF01:0:0:0:0:0:2:1");
    LPCTSTR lpszEndAddr2 = _T("FF01:0:0:0:0:0:2:222");
    LPCTSTR lpszExist1 = _T("FF01:0:0:0:0:0:-1:1");
    LPCTSTR lpszExist2 = _T("FF01:0:0:0:0:0:3:1101");

    if (!WBlackList_IPV6Addr_Init(&xhNet))
    {
        return -1;
    }
    WBlackList_IPV6Addr_Add(xhNet, lpszStartAddr1);
    WBlackList_IPV6Addr_Add(xhNet, lpszStartAddr2, lpszEndAddr2, FALSE);
    WBlackList_IPV6Addr_Add(xhNet, lpszExist1, lpszExist2, FALSE);
    WBlackList_IPV6Addr_Add(xhNet, "FF01:0:0:0:0:0:0:1", "FF01:0:0:0:0:0:0:FF", FALSE);

    int nListCount = 0;
    BLACKLIST_IPV6ADDR** ppSt_BlackList;
    WBlackList_IPV6Addr_GetList(xhNet, &ppSt_BlackList, &nListCount);
    for (int i = 0; i < nListCount; i++)
    {
        printf("%s -> %s\n", ppSt_BlackList[i]->tszAddrStart, ppSt_BlackList[i]->tszAddrEnd);
    }

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

    WBlackList_IPV6Addr_AddWhite(xhNet, lpszStartAddr1);
    if (WBlackList_IPV6Addr_IsExistBlack(xhNet, lpszStartAddr1))
    {
        printf("找到\n");
    }
    else
    {
        printf("没找到\n");
    }
    WBlackList_IPV6Addr_Destory(xhNet);
    return 0;
}