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

scoreboard.h File Reference

implementation of a autorecovery scoreboard More...

#include "flowps.h"
#include "sfxhash.h"

Go to the source code of this file.

Defines

#define PSENTRY_NEW   0x0001
#define PSENTRY_SLIDING   0x0002

Functions

int scoreboard_init (SCOREBOARD *sbp, char *description, TRACKER_POSITION kind, unsigned int rows, int memcap)
int scoreboard_destroy (SCOREBOARD *sbp)
int scoreboard_add (SCOREBOARD *sbp, u_int32_t *address, SCORE_ENTRY **sepp)
int scoreboard_find (SCOREBOARD *sbp, u_int32_t *address, SCORE_ENTRY **sepp)
int scoreboard_remove (SCOREBOARD *sbp, u_int32_t *address)
int scoreboard_move (SCOREBOARD *dst, SCOREBOARD *src, u_int32_t *address)
int scoreboard_memcap (SCOREBOARD *sbp)
int scoreboard_row_count (SCOREBOARD *sbp)
int scoreboard_overhead_bytes (SCOREBOARD *sbp)
void scoreboard_stats (SCOREBOARD *sbp, int dumpall)


Detailed Description

implementation of a autorecovery scoreboard

Author:
Chris Green <cmg@sourcefire.com>
Date:
Thu Jun 5 09:46:58 2003
Right now, there are two tables and memory is shared between them both. In the future, they should really share the same memory pool and the free lists should have some method for figuring out which one a node belongs in.

Todo:
add a list of the last nodes I've talked to

Definition in file scoreboard.h.


Define Documentation

#define PSENTRY_NEW   0x0001
 

Definition at line 24 of file scoreboard.h.

#define PSENTRY_SLIDING   0x0002
 

Definition at line 25 of file scoreboard.h.


Function Documentation

int scoreboard_add SCOREBOARD sbp,
u_int32_t address,
SCORE_ENTRY **  sepp
 

Definition at line 89 of file scoreboard.c.

References FLOW_BADJUJU, FLOW_EINVALID, FLOW_ENOMEM, FLOW_ENULL, flow_printf(), FLOW_SUCCESS, _SCOREBOARD::ipv4_table, scoreboard_mru(), sfxhash_add(), SFXHASH_INTABLE, SFXHASH_NOMEM, and SFXHASH_OK.

Referenced by flowps_add_entry(), and scoreboard_move().

int scoreboard_destroy SCOREBOARD sbp  ) 
 

Definition at line 75 of file scoreboard.c.

References FLOW_ENULL, FLOW_SUCCESS, _SCOREBOARD::ipv4_table, NULL, and sfxhash_delete().

Referenced by flowps_destroy(), and flowps_init().

int scoreboard_find SCOREBOARD sbp,
u_int32_t address,
SCORE_ENTRY **  sepp
 

Definition at line 145 of file scoreboard.c.

References FLOW_ENULL, FLOW_NOTFOUND, FLOW_SUCCESS, _SCOREBOARD::ipv4_table, NULL, and sfxhash_find().

Referenced by flowps_find_entry(), and scoreboard_move().

int scoreboard_init SCOREBOARD sbp,
char *  description,
TRACKER_POSITION  kind,
unsigned int  rows,
int  memcap
 

Create a new scoreboard for tracking nodes.

Parameters:
sbp scoreboard to initialize
at_thr active talker thresholds
sc_thr scanner thresholds (may not be needed)
kind tracker location for this table
description table description
rows number of rows to populate the initial HASHTABLE() with
memcap bytes we can spend on this scoreboard
Returns:
FLOW_SUCCESS on success, else failure

Definition at line 28 of file scoreboard.c.

References _SCOREBOARD::description, FLOW_EINVALID, FLOW_ENOMEM, FLOW_ENULL, flow_printf(), FLOW_SUCCESS, _SCOREBOARD::ipv4_table, _SCOREBOARD::kind, memset, NULL, sb_init_entry(), scoreboard_anrfree(), scoreboard_usrfree(), SDESC_SIZE, sfxhash_new(), and snprintf.

Referenced by flowps_init().

int scoreboard_memcap SCOREBOARD sbp  ) 
 

get the memcap

Parameters:
sbp scoreboard ptr to return the memcap of
Returns:
memcap or -1

Definition at line 355 of file scoreboard.c.

References _SCOREBOARD::ipv4_table, _sfxhash::mc, MEMCAP::memcap, and NULL.

Referenced by FlowPSOutputConfig().

int scoreboard_move SCOREBOARD dst,
SCOREBOARD src,
u_int32_t address
 

Move a scoreboard entry from one table to the other

Todo:
This actually can probably be done faster with the rindex stuff and a SFXHASH_NODE interface.
Parameters:
dst where to move the address to
src where to move the address from
address the address to move
Returns:
FLOW_SUCCESS on success

Definition at line 172 of file scoreboard.c.

References FLOW_BADJUJU, FLOW_EINVALID, FLOW_ENULL, FLOW_NOTFOUND, FLOW_SUCCESS, _SCOREBOARD::kind, memcpy, _PS_SCORE_ENTRY::position, scoreboard_add(), scoreboard_find(), and scoreboard_remove().

Referenced by flowps_newflow_callback().

int scoreboard_overhead_bytes SCOREBOARD sbp  ) 
 

get the overhead # of bytes

Parameters:
sbp scoreboard ptr to return the memcap of
Returns:
nrows or -1

Definition at line 386 of file scoreboard.c.

References _SCOREBOARD::ipv4_table, NULL, and sfxhash_overhead_bytes().

Referenced by FlowPSOutputConfig().

int scoreboard_remove SCOREBOARD sbp,
u_int32_t address
 

Remove a node from the scoreboard

Parameters:
sbp scoreboard to modify
address address to remove
Returns:
FLOW_SUCCESS on success

Definition at line 130 of file scoreboard.c.

References FLOW_ENULL, FLOW_NOTFOUND, FLOW_SUCCESS, _SCOREBOARD::ipv4_table, and sfxhash_remove().

Referenced by scoreboard_move().

int scoreboard_row_count SCOREBOARD sbp  ) 
 

get the row count

Parameters:
sbp scoreboard ptr to return the memcap of
Returns:
nrows or -1

Definition at line 370 of file scoreboard.c.

References _SCOREBOARD::ipv4_table, _sfxhash::nrows, and NULL.

Referenced by FlowPSOutputConfig().

void scoreboard_stats SCOREBOARD sbp,
int  dumpall
 

Definition at line 232 of file scoreboard.c.

References calc_percent(), _SCOREBOARD::description, flow_printf(), _SCOREBOARD::ipv4_table, _sfxhash::mc, MEMCAP::memcap, scoreboard_dump(), sfxhash_anr_count(), sfxhash_count(), sfxhash_find_fail(), sfxhash_find_success(), sfxhash_find_total(), and sfxhash_overhead_bytes().

Referenced by flowps_stats().


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