956a0de98fbdb13606cf84dfbc4ab317a912823a
[gssweb.git] / json_gssapi / src / commands / GSSGetMic.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 GSSGETMIC_H
9 #define GSSGETMIC_H
10
11 #include "GSSCommand.h"
12 #include "datamodel/GSSBuffer.h"
13 #include <gssapi/gssapi.h>
14
15 typedef OM_uint32 (*gss_get_mic_type) (
16     OM_uint32 *,        /* minor_status */
17     gss_ctx_id_t,       /* context_handle */
18     gss_qop_t,          /* qop_req */
19     gss_buffer_t,       /* message_buffer */
20     gss_buffer_t);      /* message_token */
21
22 class GSSGetMic : public GSSCommand
23 {
24 public:
25     GSSGetMic( gss_get_mic_type fn = &gss_get_mic ) : function(fn) {};
26     GSSGetMic( JSONObject *params, gss_get_mic_type fn = &gss_get_mic);
27     ~GSSGetMic() {};
28     virtual void execute();
29     virtual JSONObject* toJSON();
30     
31     gss_get_mic_type getGSSFunction() const { return(function); }
32
33     // Setters
34     void setQopReq(gss_qop_t req) { this->qop_req = req; }
35     void setInputMessage ( GSSBuffer* input ) { inputMessage.setValue(input->toString()); };
36     void setContextHandle ( gss_ctx_id_t context_handle) { context = context_handle; }
37     
38     // Getters
39     gss_ctx_id_t getContextHandle() const { return(this->context); }
40     gss_qop_t    getQopReq() const { return(this->qop_req); }
41     GSSBuffer    getInputMessage() const { return(this->inputMessage); }
42     GSSBuffer    getOutputToken() const { return(this->outputToken); }
43   
44 private:
45     OM_uint32        retVal;
46     OM_uint32        minor_status;
47
48     gss_get_mic_type function;
49     gss_ctx_id_t     context;
50     gss_qop_t        qop_req;
51     GSSBuffer        inputMessage;
52     GSSBuffer        outputToken;
53     
54     bool loadParameters( JSONObject *params );
55 };
56
57 #endif // GSSGETMIC_H