Functions | Variables

interprocess_buffer.c File Reference

SNMP statistic module, interprocess buffer. More...

#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 "snmpSIPContactTable.h"
#include "snmpSIPRegUserTable.h"
#include "hashTable.h"
#include "utilities.h"
#include "../usrloc/ul_callback.h"
Include dependency graph for interprocess_buffer.c:

Go to the source code of this file.

Functions

Variables


Detailed Description

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.


Function Documentation

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.

Note:
This function is believed to be thread safe. Specifically, it protects corruption of the interprocess buffer through the interprocessCBLock. This ensures no corruption of the buffer by race conditions. The lock has been designed to be occupied for as short a period as possible, so as to prevent long waits. Specifically, once we start consumption of the list, other processes are free to continue even before we are done. This is made possible by simply changing the head of the interprocess buffer, and then releasing the lock.

Definition at line 219 of file interprocess_buffer.c.

References executeInterprocessBufferCmd(), frontRegUserTableBuffer, and interprocessCBLock.

Here is the call graph for this function:

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.

Here is the call graph for this function:

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

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

interprocessBuffer_t* frontRegUserTableBuffer = NULL
hashSlot_t* hashTable = NULL

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