Reducing header overuse, non-inlining selected methods (CPPOST-35).
authorScott Cantor <cantor.2@osu.edu>
Wed, 14 Oct 2009 01:51:46 +0000 (01:51 +0000)
committerScott Cantor <cantor.2@osu.edu>
Wed, 14 Oct 2009 01:51:46 +0000 (01:51 +0000)
16 files changed:
isapi_shib/isapi_shib.cpp
nsapi_shib/nsapi_shib.cpp
shibsp/AbstractSPRequest.cpp
shibsp/AbstractSPRequest.h
shibsp/SPConfig.cpp
shibsp/SPConfig.h
shibsp/SessionCache.h
shibsp/TransactionLog.h
shibsp/attribute/Attribute.cpp
shibsp/attribute/Attribute.h
shibsp/attribute/resolver/AttributeExtractor.h
shibsp/attribute/resolver/AttributeResolver.h
shibsp/attribute/resolver/ResolutionContext.h
shibsp/impl/StorageServiceSessionCache.cpp
shibsp/remoting/ddf.h
shibsp/remoting/impl/ddf.cpp

index 2a1130d..dd571f7 100644 (file)
 #define _CRT_SECURE_NO_DEPRECATE 1
 #define _CRT_RAND_S
 
+#include <shibsp/exceptions.h>
 #include <shibsp/AbstractSPRequest.h>
 #include <shibsp/SPConfig.h>
 #include <shibsp/ServiceProvider.h>
+
+#include <set>
+#include <sstream>
+#include <fstream>
+#include <stdexcept>
+#include <process.h>
 #include <xmltooling/unicode.h>
 #include <xmltooling/XMLToolingConfig.h>
 #include <xmltooling/util/NDC.h>
 #include <xercesc/util/Base64.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
 
-#include <set>
-#include <sstream>
-#include <fstream>
-#include <stdexcept>
-#include <process.h>
-
 #include <windows.h>
 #include <httpfilt.h>
 #include <httpext.h>
index 2d90a83..b18e914 100644 (file)
 # define _CRT_RAND_S
 #endif
 
+#include <shibsp/exceptions.h>
 #include <shibsp/AbstractSPRequest.h>
 #include <shibsp/RequestMapper.h>
 #include <shibsp/SPConfig.h>
 #include <shibsp/ServiceProvider.h>
-#include <xmltooling/XMLToolingConfig.h>
-#include <xmltooling/util/NDC.h>
-#include <xmltooling/util/Threads.h>
-#include <xmltooling/util/XMLConstants.h>
-#include <xmltooling/util/XMLHelper.h>
-#include <xercesc/util/XMLUniDefs.hpp>
 
 #include <set>
 #include <memory>
 #include <fstream>
 #include <sstream>
 #include <stdexcept>
+#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/util/NDC.h>
+#include <xmltooling/util/Threads.h>
+#include <xmltooling/util/XMLConstants.h>
+#include <xmltooling/util/XMLHelper.h>
+#include <xercesc/util/XMLUniDefs.hpp>
 
 #ifdef WIN32
 # include <process.h>
index 78b2ae9..7f880ba 100644 (file)
  */
 
 #include "internal.h"
+#include "exceptions.h"
 #include "AbstractSPRequest.h"
 #include "Application.h"
 #include "ServiceProvider.h"
 #include "SessionCache.h"
+#include "util/CGIParser.h"
 
 using namespace shibsp;
 using namespace opensaml;
index eed7516..318f68c 100644 (file)
 /**
  * @file shibsp/AbstractSPRequest.h
  * 
- * Abstract base for SPRequest implementations  
+ * Abstract base for SPRequest implementations.
  */
 
 #ifndef __shibsp_abstreq_h__
 #define __shibsp_abstreq_h__
 
-#include <shibsp/exceptions.h>
 #include <shibsp/SPRequest.h>
-#include <shibsp/util/CGIParser.h>
 
 namespace shibsp {
     
+    class SHIBSP_API CGIParser;
+
 #if defined (_MSC_VER)
     #pragma warning( push )
     #pragma warning( disable : 4251 )
@@ -49,7 +49,7 @@ namespace shibsp {
         
         /**
          * Stores a normalized request URI to ensure it contains no %-encoded characters
-         * or other undesirable artifacts, such as ;jsessionid appendage.
+         * or other undesirable artifacts.
          *
          * @param uri   the request URI as obtained from the client
          */
@@ -58,6 +58,7 @@ namespace shibsp {
     public:
         virtual ~AbstractSPRequest();
 
+        // Virtual function overrides.
         const ServiceProvider& getServiceProvider() const;
         RequestMapper::Settings getRequestSettings() const;
         const Application& getApplication() const;
index 8c1fa44..c5c8d4e 100644 (file)
@@ -41,6 +41,7 @@
 #include "ServiceProvider.h"
 #include "SessionCache.h"
 #include "SPConfig.h"
+#include "TransactionLog.h"
 #include "attribute/Attribute.h"
 #include "handler/SessionInitiator.h"
 #include "remoting/ListenerService.h"
@@ -64,6 +65,7 @@
 #include <xmltooling/util/ParserPool.h>
 #include <xmltooling/util/PathResolver.h>
 #include <xmltooling/util/TemplateEngine.h>
+#include <xmltooling/util/Threads.h>
 #include <xmltooling/util/XMLHelper.h>
 
 using namespace shibsp;
@@ -96,12 +98,52 @@ SPConfig& SPConfig::getConfig()
     return g_config;
 }
 
+SPConfig::SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(NULL),
+#ifndef SHIBSP_LITE
+    m_artifactResolver(NULL),
+#endif
+    m_features(0), m_configDoc(NULL)
+{
+}
+
+SPConfig::~SPConfig()
+{
+}
+
+void SPConfig::setFeatures(unsigned long enabled)
+{
+    m_features = enabled;
+}
+
+bool SPConfig::isEnabled(components_t feature)
+{
+    return (m_features & feature)>0;
+}
+
+ServiceProvider* SPConfig::getServiceProvider() const
+{
+    return m_serviceProvider;
+}
+
 void SPConfig::setServiceProvider(ServiceProvider* serviceProvider)
 {
     delete m_serviceProvider;
     m_serviceProvider = serviceProvider;
 }
 
+#ifndef SHIBSP_LITE
+void SPConfig::setArtifactResolver(MessageDecoder::ArtifactResolver* artifactResolver)
+{
+    delete m_artifactResolver;
+    m_artifactResolver = artifactResolver;
+}
+
+const MessageDecoder::ArtifactResolver* SPConfig::getArtifactResolver() const
+{
+    return m_artifactResolver;
+}
+#endif
+
 bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
 {
 #ifdef _DEBUG
@@ -342,3 +384,23 @@ bool SPConfig::instantiate(const char* config, bool rethrow)
     }
     return false;
 }
+
+TransactionLog::TransactionLog() : log(logging::Category::getInstance(SHIBSP_TX_LOGCAT)), m_lock(Mutex::create())
+{
+}
+
+TransactionLog::~TransactionLog()
+{
+    delete m_lock;
+}
+
+Lockable* TransactionLog::lock()
+{
+    m_lock->lock();
+    return this;
+}
+
+void TransactionLog::unlock()
+{
+    m_lock->unlock();
+}
index c9985a9..3764eda 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <shibsp/base.h>
 
+#include <string>
 #ifndef SHIBSP_LITE
 # include <saml/binding/MessageDecoder.h>
 # include <saml/binding/MessageEncoder.h>
@@ -68,14 +69,9 @@ namespace shibsp {
     {
         MAKE_NONCOPYABLE(SPConfig);
     public:
-        SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(NULL),
-#ifndef SHIBSP_LITE
-            m_artifactResolver(NULL),
-#endif
-            m_features(0), m_configDoc(NULL) {
-        }
+        SPConfig();
 
-        virtual ~SPConfig() {}
+        virtual ~SPConfig();
 
         /**
          * Returns the global configuration object for the library.
@@ -108,9 +104,7 @@ namespace shibsp {
          *
          * @param enabled   bitmask of component constants
          */
-        void setFeatures(unsigned long enabled) {
-            m_features = enabled;
-        }
+        void setFeatures(unsigned long enabled);
 
         /**
          * Test whether a subsystem is enabled.
@@ -118,9 +112,7 @@ namespace shibsp {
          * @param feature   subsystem/component to test
          * @return true iff feature is enabled
          */
-        bool isEnabled(components_t feature) {
-            return (m_features & feature)>0;
-        }
+        bool isEnabled(components_t feature);
 
         /**
          * Initializes library
@@ -156,9 +148,7 @@ namespace shibsp {
          *
          * @return  global ServiceProvider or NULL
          */
-        ServiceProvider* getServiceProvider() const {
-            return m_serviceProvider;
-        }
+        ServiceProvider* getServiceProvider() const;
 
         /**
          * Instantiates and installs a ServiceProvider instance based on an XML configuration string
@@ -179,19 +169,14 @@ namespace shibsp {
          *
          * @param artifactResolver   new ArtifactResolver instance to store
          */
-        void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver) {
-            delete m_artifactResolver;
-            m_artifactResolver = artifactResolver;
-        }
+        void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver);
 
         /**
          * Returns the global ArtifactResolver instance.
          *
          * @return  global ArtifactResolver or NULL
          */
-        const opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const {
-            return m_artifactResolver;
-        }
+        const opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const;
 #endif
 
         /** Separator for serialized values of multi-valued attributes. */
index b69e065..38fa126 100644 (file)
 
 #include <shibsp/base.h>
 
+#include <map>
+#include <set>
+#include <string>
 #include <vector>
+#include <ctime>
 #include <xmltooling/Lockable.h>
 
 namespace xmltooling {
index 64ba2bc..96461c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 Internet2
+ *  Copyright 2001-2009 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <shibsp/base.h>
 #include <xmltooling/logging.h>
 #include <xmltooling/Lockable.h>
-#include <xmltooling/util/Threads.h>
 
-namespace shibsp {
+namespace xmltooling {
+    class XMLTOOL_API Mutex;
+};
 
+namespace shibsp {
     /**
      * Interface to a synchronized logging object.
      * 
@@ -39,22 +41,13 @@ namespace shibsp {
     {
         MAKE_NONCOPYABLE(TransactionLog);
     public:
-        TransactionLog()
-            : log(xmltooling::logging::Category::getInstance(SHIBSP_TX_LOGCAT)), m_lock(xmltooling::Mutex::create()) {
-        }
+        TransactionLog();
 
-        virtual ~TransactionLog() {
-            delete m_lock;
-        }
+        virtual ~TransactionLog();
         
-        xmltooling::Lockable* lock() {
-            m_lock->lock();
-            return this;
-        }
+        xmltooling::Lockable* lock();
 
-        void unlock() {
-            m_lock->unlock();
-        }
+        void unlock();
 
         /** Logging object. */
         xmltooling::logging::Category& log;
index a6a0c65..70bff1f 100644 (file)
@@ -141,6 +141,10 @@ void Attribute::deregisterFactories()
     m_factoryMap.clear();
 }
 
+Attribute::Attribute(const vector<string>& ids) : m_id(ids), m_caseSensitive(true), m_internal(false)
+{
+}
+
 Attribute::Attribute(DDF& in) : m_caseSensitive(in["case_insensitive"].isnull()), m_internal(!in["internal"].isnull())
 {
     const char* id = in.first().name();
index a9886f4..39dae79 100644 (file)
@@ -58,8 +58,7 @@ namespace shibsp {
          *
          * @param ids   array with primary identifier in first position, followed by any aliases
          */
-        Attribute(const std::vector<std::string>& ids) : m_id(ids), m_caseSensitive(true), m_internal(false) {
-        }
+        Attribute(const std::vector<std::string>& ids);
 
         /**
          * Constructs based on a remoted Attribute.
index faa8bf2..9e4f217 100644 (file)
 #define __shibsp_extractor_h__
 
 #include <shibsp/base.h>
+
+#include <string>
+#include <vector>
 #include <xmltooling/Lockable.h>
 
+namespace xmltooling {
+    class XMLTOOL_API XMLObject;
+};
+
 namespace opensaml {
     namespace saml2md {
         class SAML_API RoleDescriptor;
index 6123eb9..bcf0232 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <shibsp/base.h>
 
+#include <string>
+#include <vector>
 #include <xmltooling/Lockable.h>
 
 namespace opensaml {
index 022e2dc..6eab48a 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <shibsp/base.h>
 
+#include <vector>
+
 namespace opensaml {
     class SAML_API Assertion;
 };
index fa018bb..16cf5e5 100644 (file)
@@ -44,6 +44,7 @@
 #include <xmltooling/util/DateTime.h>
 #include <xmltooling/util/NDC.h>
 #include <xmltooling/util/ParserPool.h>
+#include <xmltooling/util/Threads.h>
 #include <xmltooling/util/XMLHelper.h>
 #include <xercesc/util/XMLUniDefs.hpp>
 
index b361ec0..abcc045 100644 (file)
@@ -42,7 +42,7 @@ namespace shibsp {
     public:
         /// @cond OFF
         // constructors
-        DDF() : m_handle(NULL) {}
+        DDF();
         DDF(const char* n);
         DDF(const char* n, const char* val, bool safe=true);
         DDF(const char* n, long val);
@@ -77,13 +77,9 @@ namespace shibsp {
     
         // destructive node conversion methods
         DDF& empty();
-        DDF& string(const char* val) {
-            return string(const_cast<char*>(val), true);
-        }
-        DDF& unsafe_string(const char* val) {
-            return string(const_cast<char*>(val), true, false);
-        }
         DDF& string(char* val, bool copyit=true, bool safe=true);
+        DDF& string(const char* val);
+        DDF& unsafe_string(const char* val);
         DDF& string(long val);
         DDF& string(double val);
         DDF& integer(long val);
@@ -110,7 +106,7 @@ namespace shibsp {
         
         // indexed operators
         DDF operator[](unsigned long index) const;
-        DDF operator[](const char* path) const { return getmember(path); }
+        DDF operator[](const char* path) const;
     
         // named member access/creation
         DDF addmember(const char* path);
index ae44d4f..d134c5a 100644 (file)
@@ -119,6 +119,10 @@ struct shibsp::ddf_body_t {
 
 // library implementation
 
+DDF::DDF() : m_handle(NULL)
+{
+}
+
 DDF::DDF(const char* n)
 {
     m_handle=new(nothrow) ddf_body_t;
@@ -365,6 +369,16 @@ DDF& DDF::string(char* val, bool copyit, bool safe)
     return *this;
 }
 
+DDF& DDF::string(const char* val)
+{
+    return string(const_cast<char*>(val), true);
+}
+
+DDF& DDF::unsafe_string(const char* val)
+{
+    return string(const_cast<char*>(val), true, false);
+}
+
 DDF& DDF::string(long val)
 {
     char buf[20];
@@ -600,6 +614,11 @@ DDF DDF::previous()
     return p;
 }
 
+DDF DDF::operator[](const char* path) const
+{
+    return getmember(path);
+}
+
 DDF DDF::operator[](unsigned long index) const
 {
     DDF d;