SNMP statistic module, interprocess buffer. More...
#include "../../str.h"#include "../../locking.h"#include "snmpstats_globals.h"#include "hashTable.h"#include "../usrloc/ucontact.h"

Go to the source code of this file.
The SNMPStats module exposes user information through openserSIPRegUserTable, openserSIPContactTable, and openserSIPRegUserLookupTable. These tables are populated through callback mechanisms from the usrloc module. Unfortunately the NetSNMP table population code is very slow when dealing with large amounts of data. Because we don't want to experience a performance hit when registering users, we make use of the interprocess buffer. Specifically, instead of adding/removing users/contacts from the SNMP tables directly, the callbacks add an add/delete command to the interprocessBuffer.
When an snmp request is recieved by the SNMPStats sub-process, it will consume this interprocess buffer, adding and deleting users. When it is finished, it can service the SNMP request.
This doesn't remove the NetSNMP inefficiency of course, but it does move it to a non-critical path. Such an approach allows SNMP support with almost no overhead to the rest of the server.
Definition in file interprocess_buffer.h.
| void consumeInterprocessBuffer | ( | void | ) |
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 219 of file interprocess_buffer.c.
References executeInterprocessBufferCmd(), frontRegUserTableBuffer, and interprocessCBLock.

| void handleContactCallbacks | ( | ucontact_t * | contactInfo, | |
| int | type, | |||
| void * | param | |||
| ) |
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 147 of file interprocess_buffer.c.
References ucontact::aor, ucontact::c, contact, convertStrToCharString(), frontRegUserTableBuffer, interprocessCBLock, ucontact::next, and _str::s.

| int initInterprocessBuffers | ( | void | ) |
(Specifically, the user and contact tables)
Definition at line 85 of file interprocess_buffer.c.
References createHashTable(), frontRegUserTableBuffer, hashTable, and interprocessCBLock.
Referenced by mod_init().


| interprocessBuffer_t* frontRegUserTableBuffer |
Definition at line 67 of file interprocess_buffer.c.
Referenced by consumeInterprocessBuffer(), handleContactCallbacks(), and initInterprocessBuffers().
| hashSlot_t* hashTable |
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(), executeInterprocessBufferCmd(), and initInterprocessBuffers().
1.7.1