+struct SSLConfig : public refcountbase
+{
+ gnutls_certificate_credentials_t x509_cred;
+ std::vector<gnutls_x509_crt_t> x509_certs;
+ gnutls_x509_privkey_t x509_key;
+ gnutls_dh_params_t dh_params;
+#ifdef GNUTLS_NEW_PRIO_API
+ gnutls_priority_t priority;
+#endif
+
+ SSLConfig()
+ : x509_cred(NULL)
+ , x509_key(NULL)
+ , dh_params(NULL)
+#ifdef GNUTLS_NEW_PRIO_API
+ , priority(NULL)
+#endif
+ {
+ }
+
+ ~SSLConfig()
+ {
+ ServerInstance->Logs->Log("m_ssl_gnutls", DEBUG, "Destroying SSLConfig %p", (void*)this);
+
+ if (x509_cred)
+ gnutls_certificate_free_credentials(x509_cred);
+
+ for (unsigned int i = 0; i < x509_certs.size(); i++)
+ gnutls_x509_crt_deinit(x509_certs[i]);
+
+ if (x509_key)
+ gnutls_x509_privkey_deinit(x509_key);
+
+ if (dh_params)
+ gnutls_dh_params_deinit(dh_params);
+
+#ifdef GNUTLS_NEW_PRIO_API
+ if (priority)
+ gnutls_priority_deinit(priority);
+#endif
+ }
+};
+
+static reference<SSLConfig> currconf;
+
+static SSLConfig* GetSessionConfig(gnutls_session_t session);
+