Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_i_gsi_authz.h
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
18 
24 #include "globus_common.h"
25 #include "globus_module.h"
26 #include "globus_callback.h"
28 #include "globus_gsi_authz.h"
29 #include "globus_error_string.h"
30 
31 /* DEBUG MACROS */
32 
33 #ifdef BUILD_DEBUG
34 
35 extern int globus_i_gsi_authz_debug_level;
36 extern FILE * globus_i_gsi_authz_debug_fstream;
37 
38 #define GLOBUS_I_GSI_AUTHZ_DEBUG(_LEVEL_) \
39  (globus_i_gsi_authz_debug_level >= (_LEVEL_))
40 
41 #define GLOBUS_I_GSI_AUTHZ_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
42  { \
43  if (GLOBUS_I_GSI_AUTHZ_DEBUG(_LEVEL_)) \
44  { \
45  globus_libc_fprintf _MESSAGE_; \
46  } \
47  }
48 
49 
50 #define GLOBUS_I_GSI_AUTHZ_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
51  { \
52  if (GLOBUS_I_GSI_AUTHZ_DEBUG(_LEVEL_)) \
53  { \
54  char * _tmp_str_ = \
55  globus_common_create_nstring _MESSAGE_; \
56  globus_libc_fprintf(globus_i_gsi_authz_debug_fstream, \
57  _tmp_str_); \
58  globus_libc_free(_tmp_str_); \
59  } \
60  }
61 
62 #define GLOBUS_I_GSI_AUTHZ_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
63  { \
64  if (GLOBUS_I_GSI_AUTHZ_DEBUG(_LEVEL_)) \
65  { \
66  globus_libc_fprintf(globus_i_gsi_authz_debug_fstream, _MESSAGE_); \
67  } \
68  }
69 
70 #define GLOBUS_I_GSI_AUTHZ_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) \
71  { \
72  if (GLOBUS_I_GSI_AUTHZ_DEBUG(_LEVEL_)) \
73  { \
74 pp _OBJ_NAME_##_print_fp(globus_i_gsi_authz_debug_fstream, _OBJ_); \
75  } \
76  }
77 
78 #else
79 
80 #define GLOBUS_I_GSI_AUTHZ_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
81 #define GLOBUS_I_GSI_AUTHZ_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
82 #define GLOBUS_I_GSI_AUTHZ_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
83 #define GLOBUS_I_GSI_AUTHZ_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) {}
84 
85 #endif
86 
87 #define GLOBUS_I_GSI_AUTHZ_DEBUG_ENTER \
88  GLOBUS_I_GSI_AUTHZ_DEBUG_FPRINTF( \
89  2, (globus_i_gsi_authz_debug_fstream, \
90  "%s entering\n", _function_name_))
91 
92 #define GLOBUS_I_GSI_AUTHZ_DEBUG_EXIT \
93  GLOBUS_I_GSI_AUTHZ_DEBUG_FPRINTF( \
94  2, (globus_i_gsi_authz_debug_fstream, \
95  "%s exiting\n", _function_name_))
96 
97 
98 
99 /* ERROR MACROS */
100 
101 extern char * globus_l_gsi_authz_error_strings[];
102 
103 #define GLOBUS_GSI_AUTH_HANDLE_MALLOC_ERROR(_LENGTH_) \
104  globus_error_put(globus_error_wrap_errno_error( \
105  GLOBUS_GSI_AUTHZ_MODULE, \
106  errno, \
107  GLOBUS_GSI_AUTHZ_ERROR_ERRNO, \
108  __FILE__, \
109  _function_name_, \
110  __LINE__, \
111  "Could not allocate enough memory: %d bytes", \
112  (_LENGTH_)))
113 
114 
115 #define GLOBUS_GSI_AUTHZ_ERROR_NULL_VALUE(_WHAT_) \
116  globus_error_put(globus_error_construct_error( \
117  GLOBUS_GSI_AUTHZ_MODULE, \
118  NULL, \
119  GLOBUS_GSI_AUTHZ_ERROR_BAD_PARAMETER, \
120  __FILE__, \
121  _function_name_, \
122  __LINE__, \
123  "%s %s is null", \
124  globus_l_gsi_authz_error_strings[GLOBUS_GSI_AUTHZ_ERROR_BAD_PARAMETER]\
125  , (_WHAT_)))
126 
127 #define GLOBUS_GSI_AUTHZ_ERROR_WITH_CALLOUT(_RESULT_) \
128  globus_error_put(globus_error_construct_error( \
129  GLOBUS_GSI_AUTHZ_MODULE, \
130  globus_error_get(_RESULT_), \
131  GLOBUS_GSI_AUTHZ_ERROR_CALLOUT, \
132  __FILE__, \
133  _function_name_, \
134  __LINE__, \
135  "%s", \
136  globus_l_gsi_authz_error_strings[GLOBUS_GSI_AUTHZ_ERROR_CALLOUT]))
137 
138 typedef struct globus_l_gsi_authz_cb_arg_s
139 {
140  globus_gsi_authz_handle_t handle;
141  void * arg;
142  globus_gsi_authz_cb_t callback;
143 } globus_l_gsi_authz_cb_arg_t;
144 
145 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
Error Object Containing a String.
Globus Callback API.
Reference Counting Module Activation and Deactivation.
GSI Authorization API.
Globus GSI Authorization Library Constants.
Headers common to all of Globus.