First shot of the state class
authorDaniel Kouril <kouril@ics.muni.cz>
Wed, 30 Mar 2011 00:37:56 +0000 (20:37 -0400)
committerDaniel Kouril <kouril@ics.muni.cz>
Wed, 30 Mar 2011 00:37:56 +0000 (20:37 -0400)
Makefile.in
nsMoonshotSessionState.cpp [new file with mode: 0644]
nsMoonshotSessionState.h [new file with mode: 0644]

index 4d36ebb..e8199ac 100644 (file)
@@ -63,6 +63,7 @@ REQUIRES      = \
 
 CPPSRCS                = \
                nsHttpMoonshot.cpp \
 
 CPPSRCS                = \
                nsHttpMoonshot.cpp \
+               nsMoonshotSessionState.cpp \
                nsHttpMoonshotModule.cpp \
                $(NULL)
 
                nsHttpMoonshotModule.cpp \
                $(NULL)
 
diff --git a/nsMoonshotSessionState.cpp b/nsMoonshotSessionState.cpp
new file mode 100644 (file)
index 0000000..20b325d
--- /dev/null
@@ -0,0 +1,36 @@
+#include "nsMoonshotSessionState.h"
+
+nsMoonshotSessionState::nsMoonshotSessionState()
+{
+    gss_ctx = GSS_C_NO_CONTEXT;
+    gss_state = GSS_CTX_EMPTY;
+    gss_cred = GSS_C_NO_CREDENTIAL;
+}
+
+nsMoonshotSessionState::~nsMoonshotSessionState()
+{
+    OM_uint32 min_stat;
+
+    if (gss_ctx != GSS_C_NO_CONTEXT)
+       gss_delete_sec_context(&min_stat, &gss_ctx, GSS_C_NO_BUFFER);
+
+    if (gss_cred != GSS_C_NO_CREDENTIAL)
+       gss_release_cred(&min_stat, &gss_ctx);
+
+    gss_ctx = GSS_C_NO_CONTEXT;
+    gss_cred = GSS_C_NO_CREDENTIAL;
+    gss_state = GSS_CTX_EMPTY;
+}
+
+void
+nsMoonshotSessionState::Reset()
+{
+    OM_uint32 min_stat;
+
+    if (gss_ctx != GSS_C_NO_CONTEXT)
+       gss_delete_sec_context(&min_stat, &gss_ctx, GSS_C_NO_BUFFER);
+    gss_ctx = GSS_C_NO_CONTEXT;
+    gss_state = GSS_CTX_EMPTY;
+}
+
+NS_IMPL_ISUPPORTS0(nsMoonshotSessionState)
diff --git a/nsMoonshotSessionState.h b/nsMoonshotSessionState.h
new file mode 100644 (file)
index 0000000..c29ef1b
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef _nsMoonshotSessionState_h__
+#define _nsMoonshotSessionState_h__
+
+#include <gssapi.h>
+
+class nsMoonshotSessionState : public nsISupports
+{
+    public:
+       NS_DECL_ISUPPORTS;
+
+       nsMoonshotSessionState();
+       virtual ~nsMoonshotSessionState();
+       NS_IMETHOD Reset();
+
+       enum {
+           GSS_CTX_EMPTY,
+           GSS_CTX_IN_PROGRESS,
+           GSS_CTX_ESTABLISHED
+       } gss_state;
+
+       gss_cred_id_t gss_cred;
+
+    private:
+}
+
+#endif