ac291173d71815aa0c9efc6a6bded11ee6aca216
[gssweb.git] / json_gssapi / src / GSSUnwrap.h
1 /*
2  * Copyright (c) 2014 <copyright holder> <email>
3  *
4  * For license details, see the LICENSE file in the root of this project.
5  *
6  */
7
8 #ifndef GSSUNWRAP_H
9 #define GSSUNWRAP_H
10
11 #include "GSSCommand.h"
12 #include "datamodel/GSSBuffer.h"
13 #include <gssapi/gssapi.h>
14
15 typedef OM_uint32 (*gss_unwrap_type) (
16     OM_uint32 *,        /* minor_status */
17     gss_ctx_id_t,       /* context_handle */
18     gss_buffer_t,       /* input_message_buffer */
19     gss_buffer_t,       /* output_message_buffer */
20     int *,              /* conf_state */
21     gss_qop_t *);       /* qop_state */
22
23
24 class GSSUnwrap :  GSSCommand
25 {
26 public:
27     GSSUnwrap( gss_unwrap_type fn = &gss_unwrap ) : function(fn) {};
28     GSSUnwrap( JSONObject *params, gss_unwrap_type fn = &gss_unwrap);
29     
30     gss_unwrap_type getGSSFunction() { return(function); }
31     void setContextHandle ( gss_ctx_id_t context_handle ) { context = context_handle; }
32     void setInputMessage ( GSSBuffer* input ) { inputMessage.setValue(input->toString()); };
33     
34     gss_qop_t getQopState() const { return(qop_state); }
35     int getConfState() const { return(conf_state); }
36     GSSBuffer getInputMessage() const { return(inputMessage); }
37     GSSBuffer getOutputMessage() const { return(outputMessage); }
38
39     virtual void execute();  
40     virtual JSONObject* toJSON();
41     
42 private:
43     gss_unwrap_type function;
44     OM_uint32 retVal;
45     OM_uint32 minor_status;
46     gss_ctx_id_t context;
47     gss_qop_t qop_state;
48     int conf_state;
49     
50     GSSBuffer inputMessage;
51     GSSBuffer outputMessage;
52     
53     bool loadParameters(JSONObject *params);
54 };
55
56 #endif // GSSUNWRAP_H