SNMP statistic module, hash table. More...

Go to the source code of this file.
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 struct aorToIndexStruct aorToIndexStruct_t |
(SNMPStats index). Since each user can have multiple contacts, the structure also has a 'contactIndex', and a reference to the contactToIndexStruct list.
| typedef struct contactToIndexStruct contactToIndexStruct_t |
(SNMPStats Index)
| 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().

| 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.
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().

| int deleteHashRecord | ( | hashSlot_t * | theTable, | |
| char * | aor, | |||
| int | hashTableSize | |||
| ) |
| void deleteUser | ( | hashSlot_t * | theTable, | |
| char * | aor, | |||
| int | hashTableSize | |||
| ) |
If an entry is found then:
Definition at line 168 of file hashTable.c.
References calculateHashSlot().
Referenced by executeInterprocessBufferCmd().


| 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().


| void insertHashRecord | ( | hashSlot_t * | theTable, | |
| aorToIndexStruct_t * | theRecord, | |||
| int | size | |||
| ) |
Definition at line 130 of file hashTable.c.
References calculateHashSlot().

| void printHashSlot | ( | hashSlot_t * | theTable, | |
| int | index | |||
| ) |
Prints off an entire hash slot.
Definition at line 278 of file hashTable.c.
1.7.1