#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "interprocess_buffer.h"
#include "openserSIPContactTable.h"
#include "openserSIPRegUserTable.h"
#include "hashTable.h"
#include "utilities.h"
#include "../usrloc/ul_callback.h"

Go to the source code of this file.
Functions | |
| void | consumeInterprocessBuffer (void) |
| static void | executeInterprocessBufferCmd (interprocessBuffer_t *currentBuffer) |
| void | freeInterprocessBuffer (void) |
| void | handleContactCallbacks (ucontact_t *contactInfo, int type, void *param) |
| int | initInterprocessBuffers (void) |
Variables | |
| interprocessBuffer_t * | endRegUserTableBuffer |
| interprocessBuffer_t * | frontRegUserTableBuffer |
| hashSlot_t * | hashTable |
| gen_lock_t * | interprocessCBLock |
This file implements the interprocess buffer, used for marshalling data exchange from the usrloc module to the openserSIPRegUserTable, openserSIPContactTable, and indirectly the openserSIPRegUserLookupTable.
Details on why the interprocess buffer is needed can be found in the comments at the top of interprocess_buffer.h
Definition in file interprocess_buffer.c.
| void consumeInterprocessBuffer | ( | void | ) |
Interprocess Buffer consumption Function. This function will iterate over every element of the interprocess buffer, and add or remove the specified contacts and users. Whether the contacts are added or removed is dependent on if the original element was added as a result of a UL_CONTACT_INSERT or UL_CONTACT_EXPIRE callback.
The function will free any memory occupied by the interprocess buffer.
Definition at line 208 of file interprocess_buffer.c.
References executeInterprocessBufferCmd(), interprocessCBLock, interprocessBuffer::next, NULL, shm_free, interprocessBuffer::stringContact, and interprocessBuffer::stringName.
Referenced by openserSIPContactTable_get_value(), openserSIPRegUserLookupTable_set_action(), and openserSIPRegUserTable_get_value().
| static void executeInterprocessBufferCmd | ( | interprocessBuffer_t * | currentBuffer | ) | [static] |
This function takes an element of the interprocess buffer passed to it, and handles populating the respective user and contact tables with its contained data.
Definition at line 257 of file interprocess_buffer.c.
References interprocessBuffer::callbackType, aorToIndexStruct::contactIndex, interprocessBuffer::contactInfo, aorToIndexStruct::contactList, createContactRow(), deleteContactRecord(), deleteContactRow(), deleteUser(), findHashRecord(), HASH_SIZE, insertContactRecord(), LM_ERR, NULL, interprocessBuffer::stringContact, interprocessBuffer::stringName, UL_CONTACT_EXPIRE, UL_CONTACT_INSERT, updateUser(), and aorToIndexStruct::userIndex.
Referenced by consumeInterprocessBuffer().
| void freeInterprocessBuffer | ( | void | ) |
Definition at line 350 of file interprocess_buffer.c.
References LM_DBG, interprocessBuffer::next, NULL, shm_free, interprocessBuffer::stringContact, and interprocessBuffer::stringName.
Referenced by mod_destroy().
| void handleContactCallbacks | ( | ucontact_t * | contactInfo, | |
| int | type, | |||
| void * | param | |||
| ) |
USRLOC Callback Handler:
This function should be registered to receive callbacks from the usrloc module. It can be called for any of the callbacks listed in ul_callback.h. The callback type will be passed in 'type', and the contact the callback applies to will be supplied in 'contactInfo. This information will be copied into the interprocess buffer. The interprocess buffer will be consumed at a later time, when consumeInterprocessBuffer() is called.
This callback is thread safe with respect to the consumeInterprocessBuffer() function. Specifically, the interprocess buffer should not be corrupted by any race conditions between this function and the consumeInterprocessBuffer() function.
Definition at line 136 of file interprocess_buffer.c.
References ucontact::aor, ucontact::c, interprocessBuffer::callbackType, interprocessBuffer::contactInfo, convertStrToCharString(), interprocessCBLock, LM_ERR, interprocessBuffer::next, NULL, _str::s, shm_malloc(), interprocessBuffer::stringContact, and interprocessBuffer::stringName.
Referenced by registerForUSRLOCCallbacks().
| int initInterprocessBuffers | ( | void | ) |
Initialize shared memory used to buffer communication between the usrloc module and the SNMPStats module. (Specifically, the user and contact tables)
Definition at line 85 of file interprocess_buffer.c.
References createHashTable(), HASH_SIZE, interprocessCBLock, LM_ERR, NULL, shm_free, and shm_malloc().
Referenced by mod_init().
Definition at line 68 of file interprocess_buffer.c.
All interprocess communication is stored between these two declarations.
Definition at line 67 of file interprocess_buffer.c.
The hash table:
1) maps all aor's to snmp's UserIndex for help in deleting SNMP Rows.
2) maps a given aor to a contact list.
Definition at line 64 of file interprocess_buffer.c.
Referenced by createHashTable(), openserSIPRegUserLookupTable_set_action(), and updateUser().
| gen_lock_t* interprocessCBLock |
This is to protect the potential racecondition in which a command is added to the buffer while it is being consumed
Definition at line 72 of file interprocess_buffer.c.
Referenced by consumeInterprocessBuffer(), handleContactCallbacks(), and initInterprocessBuffers().
1.5.6