sipxtacklib  Version 3.3
Public Member Functions | List of all members
SipContactDb Class Reference

#include <SipContactDb.h>

Public Member Functions

 SipContactDb ()
 
virtual ~SipContactDb ()
 
const bool addContact (SIPX_CONTACT_ADDRESS &contact)
 Inserts a contact into the contact table. More...
 
const bool updateContact (SIPX_CONTACT_ADDRESS &contact)
 Searches for a similar contact and the datebase and updates the address/port. More...
 
const bool deleteContact (const SIPX_CONTACT_ID id)
 Removes a contact record from the DB. More...
 
SIPX_CONTACT_ADDRESSfind (SIPX_CONTACT_ID id)
 Finds a contact in the DB, by SIPX_CONTACT_ID. More...
 
SIPX_CONTACT_ADDRESSfind (const UtlString szIpAddress, const int port, SIPX_CONTACT_TYPE type)
 Finds a contact in the DB, by IP address. More...
 
SIPX_CONTACT_ADDRESSfindByType (SIPX_CONTACT_TYPE type, SIPX_TRANSPORT_TYPE transportType, UtlString sCustomTransport="")
 Finds the first contact by a given contact type. More...
 
SIPX_TRANSPORT_TYPE findTransportType (const char *transportName)
 Return a transport type given the specified transport name. More...
 
SIPX_CONTACT_ADDRESSgetLocalContact (SIPX_CONTACT_ID id)
 
void getAll (SIPX_CONTACT_ADDRESS *contacts[], int &actualNum) const
 Populates a CONTACT_ADDRESS array with all of the contacts stored in this DB. More...
 
void getAllForAdapter (const SIPX_CONTACT_ADDRESS *contacts[], const char *szAdapter, int &actualNum, SIPX_CONTACT_TYPE typeFilter=CONTACT_ALL) const
 Populates a CONTACT_ADDRESS array with all of the contacts stored in this DB that match a particular adapter name. More...
 
const bool getRecordForAdapter (SIPX_CONTACT_ADDRESS &contact, const char *szAdapter, const SIPX_CONTACT_TYPE contactFilter) const
 
const bool getRecordForAdapter (SIPX_CONTACT_ADDRESS &contact, const char *szAdapter, const SIPX_CONTACT_TYPE contactFilter, const SIPX_TRANSPORT_TYPE transportFilter) const
 
void replicateForTransport (const SIPX_TRANSPORT_TYPE originalTransport, const SIPX_TRANSPORT_TYPE newTransport, const char *szTransport, const char *szRoutingID)
 
void removeForTransport (const SIPX_TRANSPORT_TYPE transport)
 
void dump (UtlString &output)
 
void enableTurn (bool bEnable)
 

Constructor & Destructor Documentation

~SipContactDb ( )
virtual

Member Function Documentation

const bool addContact ( SIPX_CONTACT_ADDRESS contact)

Inserts a contact into the contact table.

Fails if there is already an entry with the same port and IP address. If the ID of the incoming CONTACT_ADDRESS is less that 1, which it should be, then this method will assign a contact id.

Parameters
contactReference to a contact structure, which will be copied, and the copy will be added to the DB.
const bool updateContact ( SIPX_CONTACT_ADDRESS contact)

Searches for a similar contact and the datebase and updates the address/port.

Parameters
contactReference to a contact structure
const bool deleteContact ( const SIPX_CONTACT_ID  id)

Removes a contact record from the DB.

Parameters
idKey value (the contact id) used to find a matching record for deletion.

Finds a contact in the DB, by SIPX_CONTACT_ID.

Parameters
idThe SIPX_CONTACT_ID of the record to find.
SIPX_CONTACT_ADDRESS * find ( const UtlString  szIpAddress,
const int  port,
SIPX_CONTACT_TYPE  type 
)

Finds a contact in the DB, by IP address.

Parameters
idThe IP Address of the record to find.
SIPX_CONTACT_ADDRESS * findByType ( SIPX_CONTACT_TYPE  type,
SIPX_TRANSPORT_TYPE  transportType,
UtlString  sCustomTransport = "" 
)

Finds the first contact by a given contact type.

SIPX_TRANSPORT_TYPE findTransportType ( const char *  transportName)

Return a transport type given the specified transport name.

The name could be tls, tcp, udp, or a custom transport type.

SIPX_CONTACT_ADDRESS * getLocalContact ( SIPX_CONTACT_ID  id)
void getAll ( SIPX_CONTACT_ADDRESS contacts[],
int &  actualNum 
) const

Populates a CONTACT_ADDRESS array with all of the contacts stored in this DB.

Parameters
contactsPre-allocated array of CONTACT_ADDRESS pointers. Should be allocated using the MAX_IP_ADDRESSES for the size.
actualNumThe number of contacts.
void getAllForAdapter ( const SIPX_CONTACT_ADDRESS contacts[],
const char *  szAdapter,
int &  actualNum,
SIPX_CONTACT_TYPE  typeFilter = CONTACT_ALL 
) const

Populates a CONTACT_ADDRESS array with all of the contacts stored in this DB that match a particular adapter name.

Parameters
contactsPre-allocated array of CONTACT_ADDRESS pointers. Should be allocated using the MAX_IP_ADDRESSES for the size.
szAdapterAdapter name for which to look-up contacts.
actualNumThe number of contacts.
const bool getRecordForAdapter ( SIPX_CONTACT_ADDRESS contact,
const char *  szAdapter,
const SIPX_CONTACT_TYPE  contactFilter 
) const
const bool getRecordForAdapter ( SIPX_CONTACT_ADDRESS contact,
const char *  szAdapter,
const SIPX_CONTACT_TYPE  contactFilter,
const SIPX_TRANSPORT_TYPE  transportFilter 
) const
void replicateForTransport ( const SIPX_TRANSPORT_TYPE  originalTransport,
const SIPX_TRANSPORT_TYPE  newTransport,
const char *  szTransport,
const char *  szRoutingID 
)
void removeForTransport ( const SIPX_TRANSPORT_TYPE  transport)
void dump ( UtlString &  output)
void enableTurn ( bool  bEnable)

sipXtackLib home page