Functions

hashTable.c File Reference

SNMP statistic module, hash table. More...

#include <stdlib.h>
#include <string.h>
#include "hashTable.h"
#include "../../dprint.h"
#include "../../mem/mem.h"
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "snmpSIPRegUserTable.h"
Include dependency graph for hashTable.c:

Go to the source code of this file.

Functions


Detailed Description

For an overview of its structures, please see hashTable.h

Potential Performance Improvements: Pass the length of the aor strings around everywhere, so we don't have to calculate it ourselves.

Definition in file hashTable.c.


Function Documentation

int calculateHashSlot ( char *  theString,
int  hashTableSize 
)

The index is calculated by summing up all the characters specified with theString, and using the hashTableSize as the modulus.

Definition at line 60 of file hashTable.c.

Referenced by deleteUser(), findHashRecord(), and insertHashRecord().

Here is the caller graph for this function:

aorToIndexStruct_t* createHashRecord ( int  userIndex,
char *  aor 
)

The structure is used to map between the "aor" (OpenSER's way of indexing users/contacts), and the SNMPStats user and contact integer indexes.

NOTE: that this record does not make a copy of aor, but instead points directly to the parameter. Therefore make sure that aor is not on the stack, and is not going to disappear before this record is deleted.

Definition at line 250 of file hashTable.c.

hashSlot_t* createHashTable ( int  size  ) 

The table will contain mappings between OpenSER's "aor" user/contact indexing scheme, and SNMPStats integer indexing scheme

Definition at line 110 of file hashTable.c.

References hashTable.

Referenced by initInterprocessBuffers().

Here is the caller graph for this function:

void deleteUser ( hashSlot_t *  theTable,
char *  aor,
int  hashTableSize 
)

If an entry is found then:

  • Its numContacts counter will be decremented.
  • If its numContacts counter reaches zero, then the entry will be removed from the hash table.

Definition at line 168 of file hashTable.c.

References calculateHashSlot().

Referenced by executeInterprocessBufferCmd().

Here is the call graph for this function:

Here is the caller graph for this function:

aorToIndexStruct_t* findHashRecord ( hashSlot_t *  theTable,
char *  aor,
int  size 
)

If a match is found, then an aorToIndextStruct_t structure is returned.

This function is called to discover the map between OpenSER's "aor" (Address of Records) indexing scheme, and the SNMPStats modules integer indexing scheme for its contact/user data.

Returns: the aorToIndexStruct_t mapping structure if a match was found, or NULL otherwise.

Definition at line 84 of file hashTable.c.

References calculateHashSlot().

Referenced by executeInterprocessBufferCmd().

Here is the call graph for this function:

Here is the caller graph for this function:

void insertHashRecord ( hashSlot_t *  theTable,
aorToIndexStruct_t theRecord,
int  size 
)

Inserts theRecord into an appropriate place in theTable, when size is given.

Definition at line 130 of file hashTable.c.

References calculateHashSlot().

Here is the call graph for this function:

void printHashSlot ( hashSlot_t *  theTable,
int  index 
)

Prints off an entire hash slot.

Definition at line 278 of file hashTable.c.