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;
}