コード例 #1
0
ファイル: ippair-bit.c プロジェクト: AmesianX/suricata
static int IPPairBitTest03 (void)
{
    int ret = 0;

    IPPairInitConfig(TRUE);
    IPPair *h = IPPairAlloc();
    if (h == NULL)
        goto end;

    IPPairBitAdd(h, 0, 30);

    XBit *fb = IPPairBitGet(h,0);
    if (fb == NULL) {
        printf("fb == NULL although it was just added: ");
        goto end;
    }

    IPPairBitRemove(h, 0);

    fb = IPPairBitGet(h,0);
    if (fb != NULL) {
        printf("fb != NULL although it was just removed: ");
        goto end;
    } else {
        ret = 1;
    }

    IPPairFree(h);
end:
    IPPairCleanup();
    return ret;
}
コード例 #2
0
ファイル: ippair-bit.c プロジェクト: AmesianX/suricata
static int IPPairBitTest11 (void)
{
    int ret = 0;

    IPPairInitConfig(TRUE);
    IPPair *h = IPPairAlloc();
    if (h == NULL)
        goto end;

    IPPairBitAdd(h, 0,90);
    IPPairBitAdd(h, 1,90);
    IPPairBitAdd(h, 2,90);
    IPPairBitAdd(h, 3,90);

    XBit *fb = IPPairBitGet(h,3);
    if (fb == NULL)
        goto end;

    IPPairBitRemove(h,3);

    fb = IPPairBitGet(h,3);
    if (fb != NULL) {
        printf("fb != NULL even though it was removed: ");
        goto end;
    }

    ret = 1;
    IPPairFree(h);
end:
    IPPairCleanup();
    return ret;
}
コード例 #3
0
ファイル: ippair-bit.c プロジェクト: AmesianX/suricata
static int IPPairBitTest02 (void)
{
    int ret = 0;

    IPPairInitConfig(TRUE);
    IPPair *h = IPPairAlloc();
    if (h == NULL)
        goto end;

    XBit *fb = IPPairBitGet(h,0);
    if (fb == NULL)
        ret = 1;

    IPPairFree(h);
end:
    IPPairCleanup();
    return ret;
}
コード例 #4
0
ファイル: detect-xbits.c プロジェクト: H5eye/suricata
static void XBitsTestShutdown(void)
{
    HostCleanup();
    IPPairCleanup();
    StorageCleanup();
}