Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

sfeventq.h File Reference

Go to the source code of this file.

Functions

void * sfeventq_event_alloc (void)
void sfeventq_reset (void)
int sfeventq_add (void *event)
int sfeventq_action (int(*action_func)(void *event, void *user), void *user)
int sfeventq_init (int max_nodes, int log_nodes, int event_size, int(*sort)(void *, void *))


Function Documentation

int sfeventq_action int(*)(void *event, void *user)  action_func,
void *  user
 

int sfeventq_add void *  event  ) 
 

Add this event to the queue using the supplied ordering function. If the queue is exhausted, then we compare the event to be added with the last event, and decide whether it is a higher priority than the last node.

Returns:
integer
Return values:
-1 add event failed
0 add event succeeded

Definition at line 270 of file sfeventq.c.

References s_SF_EVENTQ::cur_nodes, s_SF_EVENTQ_NODE::event, get_eventq_node(), s_SF_EVENTQ::head, s_SF_EVENTQ::last, s_SF_EVENTQ_NODE::next, NULL, s_SF_EVENTQ_NODE::prev, and s_SF_EVENTQ::sort.

Referenced by SnortEventqAdd().

void* sfeventq_event_alloc void   ) 
 

Allocate the memory for an event to add to the event queue. This function is meant to be called first, the event structure filled in, and then added to the queue. While you can allocate several times before adding to the queue, this is not recommended as you may get a NULL ptr if you allocate more than the max node number.

Returns:
void *
Return values:
NULL unable to allocate memory.
!NULL ptr to memory.

Definition at line 148 of file sfeventq.c.

References s_SF_EVENTQ::cur_events, s_SF_EVENTQ::event_mem, s_SF_EVENTQ::event_size, s_SF_EVENTQ::max_nodes, NULL, and s_SF_EVENTQ::reserve_event.

Referenced by SnortEventqAdd().

int sfeventq_init int  max_nodes,
int  log_nodes,
int  event_size,
int(*)(void *, void *)  sort
 

Initialize the event queue. Provide the max number of nodes that this queue will support, the number of top nodes to log in the queue, the size of the event structure that the user will fill in, and the function to determine where to insert the incoming events in the queue.

Returns:
integer
Return values:
-1 failure
0 success

Definition at line 102 of file sfeventq.c.

References s_SF_EVENTQ::cur_events, s_SF_EVENTQ::cur_nodes, s_SF_EVENTQ::event_mem, s_SF_EVENTQ::event_size, s_SF_EVENTQ::log_nodes, s_SF_EVENTQ::max_nodes, s_SF_EVENTQ::node_mem, s_SF_EVENTQ::reserve_event, and s_SF_EVENTQ::sort.

Referenced by SnortEventqInit().

void sfeventq_reset void   ) 
 

Resets the event queue. We also set the reserve event back to the last event in the queue.

Returns:
void

Definition at line 182 of file sfeventq.c.

References s_SF_EVENTQ::cur_events, s_SF_EVENTQ::cur_nodes, s_SF_EVENTQ::event_mem, s_SF_EVENTQ::event_size, s_SF_EVENTQ::head, s_SF_EVENTQ::max_nodes, NULL, and s_SF_EVENTQ::reserve_event.

Referenced by SnortEventqReset().


Generated on Sun May 14 14:51:26 2006 by  doxygen 1.4.2