Data Structures | Typedefs | Functions

hashTable.h File Reference

SNMP statistic module, hash table. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

Typedefs

Functions


Detailed Description

This file describes several structure. In general, it was necessary to map between OpenSER's "aor" (Address of Record) and string indexing mechanisms, and the SNMPStats modules integer indexing scheme for users and contacts. While it would have been a more natural fit to use string indexes in the SNMPStats module, SNMP limitations precluded this.

aorToIndexStruct: maps an aor to:

The aorToIndexStruct also contains a numContacts counter. Each time a new contact is associated with the aor (user), the counter is incremented. Each time a contact is dissasociated (due to an expiration), the counter is decremented. When the counter reaches zero the structure will be deleted.

contactToIndexStruct: maps a contact name to:

Definition in file hashTable.h.


Typedef Documentation

(SNMPStats index). Since each user can have multiple contacts, the structure also has a 'contactIndex', and a reference to the contactToIndexStruct list.

(SNMPStats Index)


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:
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.

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:

int deleteHashRecord ( hashSlot_t *  theTable,
char *  aor,
int  hashTableSize 
)
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 
)

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.