Commit an overly-large chunk of work.
[gssweb.git] / json_gssapi / src / commands / GSSWrap.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 GSSWRAP_H
9 #define GSSWRAP_H
10
11 #include <gssapi.h>
12
13 #include "GSSCommand.h"
14 #include "datamodel/GSSBuffer.h"
15
16 typedef OM_uint32 (*gss_wrap_type) (
17     OM_uint32 *,        /* minor_status */
18     gss_ctx_id_t,       /* context_handle */
19     int,                /* conf_req_flag */
20     gss_qop_t,          /* qop_req */
21     gss_buffer_t,       /* input_message_buffer */
22     int *,              /* conf_state */
23     gss_buffer_t);      /* output_message_buffer */
24
25
26 class GSSWrap :  GSSCommand
27 {
28 public:
29     GSSWrap( gss_wrap_type fn = &gss_wrap ) : function(fn) {};
30     GSSWrap( JSONObject *params, gss_wrap_type fn = &gss_wrap);
31     ~GSSWrap();
32     virtual void execute();
33     virtual JSONObject* toJSON();
34     
35     gss_wrap_type getGSSFunction() const { return(function); }
36     
37     void setConfReq(int conf_req_flag) { conf_req = conf_req_flag; }
38     void setContextHandle ( gss_ctx_id_t context_handle ) { context = context_handle; }
39     void setQopReq ( int arg1 ) { qop_req = arg1; }
40     void setInputMessage ( GSSBuffer* input ) { inputMessage.setValue(input->toString()); };
41     
42     int getConfState () const { return(conf_state); }
43     GSSBuffer getOutputMessage () const { return(outputMessage); }
44     int getConfReq() const { return(conf_req); }
45     gss_qop_t getQopReq() const { return(qop_req); }
46     GSSBuffer getInputMessage () const { return(inputMessage); }
47     gss_ctx_id_t getContext() const { return(context); }
48     
49 private:
50     gss_wrap_type function;
51     int conf_req;
52     gss_ctx_id_t context;
53     gss_qop_t qop_req;
54     GSSBuffer inputMessage;
55     GSSBuffer outputMessage;
56     
57   
58     OM_uint32 retVal;
59     OM_uint32 minor_status;
60     int conf_state;
61
62     bool loadParameters(JSONObject *params);
63 };
64
65 #endif // GSSWRAP_H