[asterisk-scf-commits] asterisk-scf/release/sip.git branch "authexten" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Feb 7 16:44:01 CST 2011
branch "authexten" has been created
at 5a0a9a73584c42a5f188f3a1436512ccb6a01bbe (commit)
- Log -----------------------------------------------------------------
commit 5a0a9a73584c42a5f188f3a1436512ccb6a01bbe
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Feb 7 16:05:34 2011 -0600
Allow the PJSipManager to propagate auth hooks to individual modules.
Next step is to get the PJSipManager to register with the service
locator.
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 22b5955..8baa8b4 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -13,24 +13,55 @@
* the GNU General Public License Version 2. See the LICENSE.txt file
* at the top of the source tree.
*/
+
+#include <IceUtil/UUID.h>
#include <AsteriskSCF/logger.h>
#include "PJSipManager.h"
using namespace AsteriskSCF::System::Logging;
+using namespace AsteriskSCF::System::Hook::V1;
+using namespace AsteriskSCF::SIP::ExtensionPoint::V1;
namespace
{
Logger lg = getLoggerFactory().getLogger("AsteriskSCF.SipSessionManager");
}
-
namespace AsteriskSCF
{
namespace SipSessionManager
{
+PJSipManagerAuthExtensionPoint::PJSipManagerAuthExtensionPoint(PJSipSessionModule *sessionModule,
+ PJSipLoggingModule *loggingModule) : mSessionModule(sessionModule), mLoggingModule(loggingModule)
+{
+}
+
+HookId PJSipManagerAuthExtensionPoint::addAuthHook(
+ const AuthHookPrx &hook,
+ const RequestTypeSeq &requestTypes)
+{
+ HookId id;
+ id.id = IceUtil::generateUUID();
+ mSessionModule->addAuthHook(std::make_pair(id, hook));
+ mLoggingModule->addAuthHook(std::make_pair(id, hook));
+ return id;
+}
+
+void PJSipManagerAuthExtensionPoint::removeAuthHook(const HookId &id)
+{
+ mSessionModule->removeAuthHook(id);
+ mLoggingModule->removeAuthHook(id);
+}
+
+void PJSipManagerAuthExtensionPoint::clearAuthHooks()
+{
+ mSessionModule->clearAuthHooks();
+ mLoggingModule->clearAuthHooks();
+}
+
static void *monitorThread(void *endpt)
{
pjsip_endpoint *endpoint = static_cast<pjsip_endpoint *> (endpt);
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index f71a345..0502cbb 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -41,9 +41,15 @@ namespace SipSessionManager
class PJSipManagerAuthExtensionPoint : public AsteriskSCF::SIP::ExtensionPoint::V1::AuthExtensionPoint
{
public:
- virtual AsteriskSCF::System::Hook::V1::HookId addAuthHook(const AsteriskSCF::SIP::ExtensionPoint::V1::AuthHookPrx &hook, const AsteriskSCF::SIP::ExtensionPoint::V1::RequestTypeSeq &requestTypes);
+ PJSipManagerAuthExtensionPoint(PJSipSessionModule *sessionModule, PJSipLoggingModule *loggingModule);
+ virtual AsteriskSCF::System::Hook::V1::HookId addAuthHook(
+ const AsteriskSCF::SIP::ExtensionPoint::V1::AuthHookPrx &hook,
+ const AsteriskSCF::SIP::ExtensionPoint::V1::RequestTypeSeq &requestTypes);
virtual void removeAuthHook(const AsteriskSCF::System::Hook::V1::HookId &id);
virtual void clearAuthHooks();
+private:
+ PJSipSessionModule *mSessionModule;
+ PJSipLoggingModule *mLoggingModule;
};
typedef IceUtil::Handle<PJSipManagerAuthExtensionPoint> PJSipManagerAuthExtensionPointPtr;
diff --git a/src/PJSipModule.h b/src/PJSipModule.h
index aa2d75b..6860e46 100644
--- a/src/PJSipModule.h
+++ b/src/PJSipModule.h
@@ -55,6 +55,10 @@ public:
{
mAuthHooks.erase(id);
}
+ void clearAuthHooks()
+ {
+ mAuthHooks.clear();
+ }
protected:
PJSipModule() { }
virtual ~PJSipModule() { }
commit acac1d74989f8aa6c28e9a9ef1b0ccb85197e30d
Merge: 81ddb56 7217fe2
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Feb 7 15:43:20 2011 -0600
Merge branch 'master' into authexten
commit 81ddb566141c01bece3cdb115aaef0727fcc1558
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Feb 7 14:33:45 2011 -0600
Add some initial infrastructure regarding Authentication hooks.
I'm noticing some really really dumb code I wrote as I go back over
the PJSipManager so I'm going to correct that in master and merge
that into this branch.
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index 3db7875..56d91cb 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -26,6 +26,8 @@
#include <boost/shared_ptr.hpp>
#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/SIP/SIPExtensionPointIf.h>
+#include <AsteriskSCF/System/Hook/HookIf.h>
#include "PJSipSessionModule.h"
#include "PJSipLoggingModule.h"
@@ -36,6 +38,16 @@ namespace AsteriskSCF
namespace SipSessionManager
{
+class PJSipManagerAuthExtensionPoint : public AsteriskSCF::SIP::ExtensionPoint::V1::AuthExtensionPoint
+{
+public:
+ virtual AsteriskSCF::System::Hook::V1::HookId addAuthHook(const AsteriskSCF::SIP::ExtensionPoint::V1::AuthHookPrx &hook, const AsteriskSCF::SIP::ExtensionPoint::V1::RequestTypeSeq &requestTypes);
+ virtual void removeAuthHook(const AsteriskSCF::System::Hook::V1::HookId &id);
+ virtual void clearAuthHooks();
+};
+
+typedef IceUtil::Handle<PJSipManagerAuthExtensionPoint> PJSipManagerAuthExtensionPointPtr;
+
/**
* This class is responsible for providing
* access to the pjsip_endpt for the Asterisk
@@ -90,6 +102,7 @@ private:
pj_caching_pool mCachingPool;
pj_pool_t *mMemoryPool;
pjsip_transport *mUdpTransport;
+ PJSipManagerAuthExtensionPointPtr auth;
bool setTransports(pjsip_endpoint *endpoint, Ice::PropertiesPtr props);
};
diff --git a/src/PJSipModule.h b/src/PJSipModule.h
index df38f5a..aa2d75b 100644
--- a/src/PJSipModule.h
+++ b/src/PJSipModule.h
@@ -23,6 +23,8 @@
#include <pjlib.h>
#include <SipStateReplicationIf.h>
+#include <AsteriskSCF/System/Hook/HookIf.h>
+#include <AsteriskSCF/SIP/SIPExtensionPointIf.h>
namespace AsteriskSCF
{
@@ -45,10 +47,19 @@ public:
virtual pj_status_t on_tx_response(pjsip_tx_data *tdata) = 0;
virtual void on_tsx_state(pjsip_transaction *tsx, pjsip_event *event) = 0;
pjsip_module &getModule() { return mModule; };
+ void addAuthHook(std::pair<AsteriskSCF::System::Hook::V1::HookId, AsteriskSCF::SIP::ExtensionPoint::V1::AuthHookPrx> hook)
+ {
+ mAuthHooks.insert(hook);
+ }
+ void removeAuthHook(AsteriskSCF::System::Hook::V1::HookId id)
+ {
+ mAuthHooks.erase(id);
+ }
protected:
PJSipModule() { }
virtual ~PJSipModule() { }
pjsip_module mModule;
+ std::map<AsteriskSCF::System::Hook::V1::HookId, AsteriskSCF::SIP::ExtensionPoint::V1::AuthHookPrx> mAuthHooks;
private:
const std::string mName;
};
-----------------------------------------------------------------------
--
asterisk-scf/release/sip.git
More information about the asterisk-scf-commits
mailing list