42caaafc586767985a86ba25046d34be9779ae7f
[moonshot-firefox.git] / nsMoonshotSessionState.h
1 #ifndef _nsMoonshotSessionState_h__
2 #define _nsMoonshotSessionState_h__
3
4 #include <nsISupportsUtils.h>
5 #include <gssapi.h>
6
7 typedef enum {
8     GSS_CTX_EMPTY,
9     GSS_CTX_IN_PROGRESS,
10     GSS_CTX_ESTABLISHED
11 } gss_state_t;
12
13 class NS_EXPORT
14 nsMoonshotSessionState : public nsISupports
15 {
16     public:
17         NS_DECL_ISUPPORTS
18
19         nsMoonshotSessionState() {
20             gss_ctx = GSS_C_NO_CONTEXT;
21             gss_state = GSS_CTX_EMPTY;
22             gss_cred = GSS_C_NO_CREDENTIAL;
23         }
24
25         virtual ~nsMoonshotSessionState() {
26             OM_uint32 min_stat;
27
28             if (gss_ctx != GSS_C_NO_CONTEXT)
29                 gss_delete_sec_context(&min_stat, &gss_ctx, GSS_C_NO_BUFFER);
30             if (gss_cred != GSS_C_NO_CREDENTIAL)
31                 gss_release_cred(&min_stat, &gss_cred);
32             gss_ctx = GSS_C_NO_CONTEXT;
33             gss_cred = GSS_C_NO_CREDENTIAL;
34             gss_state = GSS_CTX_EMPTY;
35         }
36
37         void Reset();
38
39         gss_state_t gss_state;
40         gss_cred_id_t gss_cred;
41         gss_ctx_id_t gss_ctx;
42 };
43
44 #endif