Beispiel #1
0
/**
**  Cleanup the event queue.  
**
**  @return none
**
*/
void sfeventq_free(void)
{
    /* Clean out the events */
    sfeventq_reset();

    /*
    **  Free the memory for the nodes that were in use.
    */
    if (s_eventq.node_mem)
    {
        free(s_eventq.node_mem);
        s_eventq.node_mem = NULL;
    }

    if (s_eventq.event_mem)
    {
        free(s_eventq.event_mem);
        s_eventq.event_mem = NULL;
    }
}
Beispiel #2
0
void SnortEventqReset(void)
{
    sfeventq_reset(getEventQueue());
    reset_counts();
}
Beispiel #3
0
int main(int argc, char **argv)
{
    int  max_events;
    int  log_events;
    int  add_events;
    int *event;
    int  iCtr;

    if(argc < 4)
    {
        printf("-- Not enough args\n");
        return 1;
    }

    max_events = atoi(argv[1]);
    if(max_events <= 0)
    {
        printf("-- max_events invalid.\n");
        return 1;
    }

    log_events = atoi(argv[2]);
    if(log_events <= 0)
    {
        printf("-- log_events invalid.\n");
        return 1;
    }

    add_events = atoi(argv[3]);
    if(add_events <= 0)
    {
        printf("-- add_events invalid.\n");
        return 1;
    }

    if(max_events < log_events)
    {
        printf("-- log_events greater than max_events\n");
        return 1;
    }

    srandom(time(NULL));

    sfeventq_init(max_events, log_events, sizeof(int), mysort);

    do
    {
        printf("-- Event Queue Test --\n\n");

        for(iCtr = 0; iCtr < add_events; iCtr++)
        {
            event  = (int *)sfeventq_event_alloc();
            if(!event)
            {
                printf("-- event allocation failed\n");
                return 1;
            }

            *event = (int)(random()%3);

            sfeventq_add(event);
            printf("-- added %d\n", *event);
        }

        printf("\n-- Logging\n\n");

        if(sfeventq_action(myaction, NULL))
        {
            printf("-- There was a problem.\n");
            return 1;
        }

        sfeventq_reset();

    } while(getc(stdin) < 14);

    return 0;
}
void SnortEventqReset(void)
{
    sfeventq_reset();
    return;
}
Beispiel #5
0
void SnortEventqReset(void)
{
    sfeventq_reset(snort_conf->event_queue);
}
Beispiel #6
0
void SnortEventqReset(void)
{
    sfeventq_reset(snort_conf->event_queue[qIndex]);
    reset_counts();
}