# include <unistd.h>
#endif
-#include <shib/shib-threads.h>
#include <shib-target/shib-target.h>
+
+#include <xmltooling/util/NDC.h>
#include <log4cpp/Category.hh>
#include <sstream>
#include <dmalloc.h>
#endif
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
using namespace shibtarget;
+using namespace shibboleth;
+using namespace saml;
using namespace log4cpp;
+using namespace std;
#define PLUGIN_VER_MAJOR 3
#define PLUGIN_VER_MINOR 0
log4cpp::Category* log;
protected:
- ThreadKey* m_mysql;
+ xmltooling::ThreadKey* m_mysql;
const DOMElement* m_root; // can only use this during initialization
bool initialized;
MySQLBase::MySQLBase(const DOMElement* e) : m_root(e)
{
#ifdef _DEBUG
- saml::NDC ndc("MySQLBase");
+ xmltooling::NDC ndc("MySQLBase");
#endif
log = &(Category::getInstance("shibtarget.SessionCache.MySQL"));
- m_mysql = ThreadKey::create(&shib_mysql_destroy_handle);
+ m_mysql = xmltooling::ThreadKey::create(&shib_mysql_destroy_handle);
initialized = false;
mysqlInit(e,*log);
MYSQL* MySQLBase::getMYSQL()
{
#ifdef _DEBUG
- saml::NDC ndc("getMYSQL");
+ xmltooling::NDC ndc("getMYSQL");
#endif
// Do we already have a handle?
private:
bool m_storeAttributes;
ISessionCache* m_cache;
- CondWait* shutdown_wait;
+ xmltooling::CondWait* shutdown_wait;
bool shutdown;
- Thread* cleanup_thread;
+ xmltooling::Thread* cleanup_thread;
static void* cleanup_fcn(void*); // XXX Assumed an ShibMySQLCCache
};
ShibMySQLCCache::ShibMySQLCCache(const DOMElement* e) : MySQLBase(e), m_storeAttributes(false)
{
#ifdef _DEBUG
- saml::NDC ndc("ShibMySQLCCache");
+ xmltooling::NDC ndc("ShibMySQLCCache");
#endif
m_cache = dynamic_cast<ISessionCache*>(
throw SAMLException("Unable to register MySQL cache plugin as a cache store.");
}
- shutdown_wait = CondWait::create();
+ shutdown_wait = xmltooling::CondWait::create();
shutdown = false;
// Load our configuration details...
m_storeAttributes=true;
// Initialize the cleanup thread
- cleanup_thread = Thread::create(&cleanup_fcn, (void*)this);
+ cleanup_thread = xmltooling::Thread::create(&cleanup_fcn, (void*)this);
}
ShibMySQLCCache::~ShibMySQLCCache()
)
{
#ifdef _DEBUG
- saml::NDC ndc("onCreate");
+ xmltooling::NDC ndc("onCreate");
#endif
// Get XML data from entry. Default is not to return SAML objects.
)
{
#ifdef _DEBUG
- saml::NDC ndc("onRead");
+ xmltooling::NDC ndc("onRead");
#endif
log->debug("searching MySQL database...");
HRESULT ShibMySQLCCache::onRead(const char* key, time_t& accessed)
{
#ifdef _DEBUG
- saml::NDC ndc("onRead");
+ xmltooling::NDC ndc("onRead");
#endif
log->debug("reading last access time from MySQL database");
HRESULT ShibMySQLCCache::onRead(const char* key, string& tokens)
{
#ifdef _DEBUG
- saml::NDC ndc("onRead");
+ xmltooling::NDC ndc("onRead");
#endif
if (!m_storeAttributes)
HRESULT ShibMySQLCCache::onUpdate(const char* key, const char* tokens, time_t lastAccess)
{
#ifdef _DEBUG
- saml::NDC ndc("onUpdate");
+ xmltooling::NDC ndc("onUpdate");
#endif
ostringstream q;
HRESULT ShibMySQLCCache::onDelete(const char* key)
{
#ifdef _DEBUG
- saml::NDC ndc("onDelete");
+ xmltooling::NDC ndc("onDelete");
#endif
// Remove from the database
void ShibMySQLCCache::cleanup()
{
#ifdef _DEBUG
- saml::NDC ndc("cleanup");
+ xmltooling::NDC ndc("cleanup");
#endif
- Mutex* mutex = Mutex::create();
+ xmltooling::Mutex* mutex = xmltooling::Mutex::create();
int rerun_timer = 0;
int timeout_life = 0;
mutex->unlock();
delete mutex;
- Thread::exit(NULL);
+ xmltooling::Thread::exit(NULL);
}
void* ShibMySQLCCache::cleanup_fcn(void* cache_p)
{
ShibMySQLCCache* cache = (ShibMySQLCCache*)cache_p;
+#ifndef WIN32
// First, let's block all signals
- Thread::mask_all_signals();
+ xmltooling::Thread::mask_all_signals();
+#endif
// Now run the cleanup process.
cache->cleanup();
bool MySQLReplayCache::check(const char* str, time_t expires)
{
#ifdef _DEBUG
- saml::NDC ndc("check");
+ xmltooling::NDC ndc("check");
#endif
// Remove expired entries