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