f26a2c5e5c5bba001cae550b5efe1924f1607f47
[gssweb.git] / json_gssapi / test / command_mocks / InitSecContextMock.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 INITSECCONTEXTMOCK_H
9 #define INITSECCONTEXTMOCK_H
10
11 #include <gssapi.h>
12 #include <stdlib.h>
13 #include <iostream>
14
15 class InitSecContextMock
16 {
17 public:
18   static OM_uint32              retVal;
19   static OM_uint32              minor_status;
20   static gss_cred_id_t          claimant_cred_handle;
21   static gss_ctx_id_t           context_handle;
22   static gss_name_t             target_name;
23   static gss_OID                mech_type;
24   static OM_uint32              req_flags;
25   static OM_uint32              time_req;
26   static gss_channel_bindings_t input_chan_bindings;
27   static gss_buffer_desc        input_token;
28   static gss_OID                actual_mech_type;
29   static gss_buffer_desc        output_token;
30   static OM_uint32              ret_flags;
31   static OM_uint32              time_rec;
32   
33   static bool                   visited;
34   static bool                   invalidContextHandle;
35   
36   static void nullify(void **ptr)
37   {
38     if (!ptr)
39     {
40       std::cout << std::endl << "Nullify called with a void ** that is NULL at the top level" << std::endl;
41       return;
42     }
43     if (*ptr)
44     {
45       free(*ptr);
46       *ptr = NULL;
47     }
48   }
49
50   static void reset();
51 };
52
53 #endif // INITSECCONTEXTMOCK_H