rearranging the commands into their own directory
[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     
48 private:
49     gss_wrap_type function;
50     int conf_req;
51     gss_ctx_id_t context;
52     gss_qop_t qop_req;
53     GSSBuffer inputMessage;
54     GSSBuffer outputMessage;
55     
56   
57     OM_uint32 retVal;
58     OM_uint32 minor_status;
59     int conf_state;
60
61     bool loadParameters(JSONObject *params);
62 };
63
64 #endif // GSSWRAP_H