#include <NatTraversalAgent.h>

The uses two hooks to examine the traffic passing by. First, the AuthPlugin::authorizeAndModify() method is used to see all the requests that traverse the system. The implementation of that method is mainly responsible for allocating CallTracker objects to track new calls made in through the system. Second, the SipOutputProcessor::handleOutputMessage() is used to monitor all requests and responses exiting the system and notify the appropriate CallTracker so that they can analyze and modify them as required to facilitate NAT Traversal.
Public Member Functions | |
| virtual | ~NatTraversalAgent () |
| destructor | |
| virtual AuthResult | authorizeAndModify (const UtlString &id, const Url &requestUri, RouteState &routeState, const UtlString &method, AuthResult priorResult, SipMessage &request, bool bSpiralingRequest, UtlString &reason) |
| Called for any request - enforces the restrictions specified by authrules. | |
| virtual void | handleOutputMessage (SipMessage &message, const char *address, int port) |
| Called when SIP messages are about to be sent by proxy. | |
| virtual void | readConfig (OsConfigDb &configDb) |
| Read (or re-read) the authorization rules. | |
| virtual void | announceAssociatedSipRouter (SipRouter *sipRouter) |
| Used to announce the SIP Router instance that is logically associated with this Auth Plugin. Plugins that need to interact with their associated SIP Router can override this method and save the passed pointer for later use. | |
| virtual OsStatus | signal (intptr_t eventData) |
Protected Member Functions | |
| void | adjustViaForNatTraversal (SipMessage &message, const char *address, int port) |
| void | adjustRecordRouteForNatTraversal (SipMessage &message, const char *address, int port) |
| void | adjustReferToHeaderForNatTraversal (SipMessage &message, const char *address, int port) |
| bool | restoreOriginalContact (SipMessage &request) |
| CallTracker * | createCallTrackerAndAddToMap (const UtlString &callId, ssize_t trackerHandle) |
| CallTracker * | getCallTrackerForMessage (const SipMessage &sipMessage) |
| CallTracker * | getCallTrackerFromCallId (const UtlString &callId) |
Private Member Functions | |
| void | UndoChangesToRequestUri (SipMessage &message) |
| NatTraversalAgent (const UtlString &instanceName) | |
| Constructor - private so that only the factory can call it. | |
Private Attributes | |
| bool | mbNatTraversalFeatureEnabled |
| bool | mbOutputProcessorRegistrrationDone |
| UtlHashMap | mCallTrackersMap |
| NatTraversalRules | mNatTraversalRules |
| SipRouter * | mpSipRouter |
| OsRWMutex | mMessageProcessingMutex |
| MediaRelay * | mpMediaRelay |
| NatMaintainer * | mpNatMaintainer |
| OsTimer | mCleanupTimer |
| RegistrationDB * | mpRegistrationDB |
| bool | mbConnectedToRegistrationDB |
| ssize_t | mNextAvailableCallTrackerHandle |
Friends | |
| class | NatTraversalAgentTest |
| AuthPlugin * | getAuthPlugin (const UtlString &name) |
| Factory used by PluginHooks to dynamically link the plugin instance. | |
| ~NatTraversalAgent | ( | ) | [virtual] |
destructor
| NatTraversalAgent | ( | const UtlString & | instanceName | ) | [private] |
Constructor - private so that only the factory can call it.
constructor
| instanceName | the configured name for this plugin instance |
| AuthPlugin::AuthResult authorizeAndModify | ( | const UtlString & | id, | |
| const Url & | requestUri, | |||
| RouteState & | routeState, | |||
| const UtlString & | method, | |||
| AuthResult | priorResult, | |||
| SipMessage & | request, | |||
| bool | bSpiralingRequest, | |||
| UtlString & | reason | |||
| ) | [virtual] |
Called for any request - enforces the restrictions specified by authrules.
| id | The authenticated identity of the request originator, if any (the null string if not). This is in the form of a SIP uri identity value as used in the credentials database (user) without the scheme or any parameters. |
| requestUri | parsed target Uri |
| routeState | the state for this request. |
| method | the request method |
| priorResult | results from earlier plugins. |
| request | see AuthPlugin regarding modifying |
| bSpiralingRequest | request spiraling indication |
| reason | rejection reason |
Implements AuthPlugin.
| void handleOutputMessage | ( | SipMessage & | message, | |
| const char * | address, | |||
| int | port | |||
| ) | [virtual] |
| void readConfig | ( | OsConfigDb & | configDb | ) | [virtual] |
Read (or re-read) the authorization rules.
| configDb | a subhash of the individual configuration parameters for this instance of this plugin. |
Implements AuthPlugin.
| void announceAssociatedSipRouter | ( | SipRouter * | sipRouter | ) | [virtual] |
Used to announce the SIP Router instance that is logically associated with this Auth Plugin. Plugins that need to interact with their associated SIP Router can override this method and save the passed pointer for later use.
Reimplemented from AuthPlugin.
| OsStatus signal | ( | intptr_t | eventData | ) | [virtual] |
Implements OsNotification.
| void adjustViaForNatTraversal | ( | SipMessage & | message, | |
| const char * | address, | |||
| int | port | |||
| ) | [protected] |
| void adjustRecordRouteForNatTraversal | ( | SipMessage & | message, | |
| const char * | address, | |||
| int | port | |||
| ) | [protected] |
| void adjustReferToHeaderForNatTraversal | ( | SipMessage & | message, | |
| const char * | address, | |||
| int | port | |||
| ) | [protected] |
| bool restoreOriginalContact | ( | SipMessage & | request | ) | [protected] |
| CallTracker * createCallTrackerAndAddToMap | ( | const UtlString & | callId, | |
| ssize_t | trackerHandle | |||
| ) | [protected] |
| CallTracker * getCallTrackerForMessage | ( | const SipMessage & | sipMessage | ) | [protected] |
| CallTracker * getCallTrackerFromCallId | ( | const UtlString & | callId | ) | [protected] |
| void UndoChangesToRequestUri | ( | SipMessage & | message | ) | [private] |
friend class NatTraversalAgentTest [friend] |
| AuthPlugin* getAuthPlugin | ( | const UtlString & | name | ) | [friend] |
Factory used by PluginHooks to dynamically link the plugin instance.
bool mbNatTraversalFeatureEnabled [private] |
bool mbOutputProcessorRegistrrationDone [private] |
UtlHashMap mCallTrackersMap [private] |
NatTraversalRules mNatTraversalRules [private] |
SipRouter* mpSipRouter [private] |
OsRWMutex mMessageProcessingMutex [private] |
MediaRelay* mpMediaRelay [private] |
NatMaintainer* mpNatMaintainer [private] |
OsTimer mCleanupTimer [private] |
RegistrationDB* mpRegistrationDB [private] |
bool mbConnectedToRegistrationDB [private] |
ssize_t mNextAvailableCallTrackerHandle [private] |