Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_i_gss_assist.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 
19 #ifndef GLOBUS_I_GSS_ASSIST_H
20 #define GLOBUS_I_GSS_ASSIST_H
21 
28 #include "globus_gss_assist.h"
29 #include "globus_common.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* DEBUG MACROS */
36 
37 extern int globus_i_gsi_gss_assist_debug_level;
38 extern FILE * globus_i_gsi_gss_assist_debug_fstream;
39 
40 extern globus_mutex_t globus_i_gsi_gss_assist_mutex;
41 
42 #ifdef BUILD_DEBUG
43 
44 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG(_LEVEL_) \
45  (globus_i_gsi_gss_assist_debug_level >= (_LEVEL_))
46 
47 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
48  { \
49  if (GLOBUS_I_GSI_GSS_ASSIST_DEBUG(_LEVEL_)) \
50  { \
51  globus_libc_fprintf _MESSAGE_; \
52  } \
53  }
54 
55 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
56  { \
57  if (GLOBUS_I_GSI_GSS_ASSIST_DEBUG(_LEVEL_)) \
58  { \
59  char * _tmp_str_ = \
60  globus_common_create_nstring _MESSAGE_; \
61  globus_libc_fprintf(globus_i_gsi_gss_assist_debug_fstream, \
62  "%s", _tmp_str_); \
63  globus_libc_free(_tmp_str_); \
64  } \
65  }
66 
67 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
68  { \
69  if (GLOBUS_I_GSI_GSS_ASSIST_DEBUG(_LEVEL_)) \
70  { \
71  globus_libc_fprintf(globus_i_gsi_gss_assist_debug_fstream, \
72  _MESSAGE_); \
73  } \
74  }
75 
76 #else
77 
78 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG(_LEVEL_) 0
79 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
80 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
81 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG_PRINT(_LEVEL, _MESSAGE_) {}
82 
83 #endif
84 
85 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG_ENTER \
86  GLOBUS_I_GSI_GSS_ASSIST_DEBUG_FPRINTF( \
87  2, (globus_i_gsi_gss_assist_debug_fstream, \
88  "%s entering\n", _function_name_))
89 
90 #define GLOBUS_I_GSI_GSS_ASSIST_DEBUG_EXIT \
91  GLOBUS_I_GSI_GSS_ASSIST_DEBUG_FPRINTF( \
92  2, (globus_i_gsi_gss_assist_debug_fstream, \
93  "%s exiting\n", _function_name_))
94 
95 /* ERROR MACROS */
96 
97 #define GLOBUS_GSI_GSS_ASSIST_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
98  { \
99  char * _tmp_str_ = \
100  globus_common_create_string _ERRSTR_; \
101  _RESULT_ = globus_i_gsi_gss_assist_error_result(_ERRORTYPE_, \
102  __FILE__, \
103  _function_name_, \
104  __LINE__, \
105  _tmp_str_, \
106  NULL); \
107  globus_libc_free(_tmp_str_); \
108  }
109 
110 #define GLOBUS_GSI_GSS_ASSIST_ERROR_CHAIN_RESULT(_TOP_RESULT_, _ERRORTYPE_) \
111  _TOP_RESULT_ = globus_i_gsi_gss_assist_error_chain_result(_TOP_RESULT_, \
112  _ERRORTYPE_, \
113  __FILE__, \
114  _function_name_, \
115  __LINE__, \
116  NULL, \
117  NULL)
118 
119 #define GLOBUS_GSI_GSS_ASSIST_LONG_ERROR_RESULT(_RESULT_, \
120  _ERRORTYPE_, \
121  _ERRSTR_, \
122  _LONG_DESC_) \
123  { \
124  char * _tmp_str_ = \
125  globus_common_create_string _ERRSTR_; \
126  _RESULT_ = globus_i_gsi_gss_assist_error_result(_ERRORTYPE_, \
127  __FILE__, \
128  _function_name_, \
129  __LINE__, \
130  _tmp_str_, \
131  _LONG_DESC_); \
132  globus_libc_free(_tmp_str_); \
133  }
134 
135 #define GLOBUS_GSI_GSS_ASSIST_LONG_ERROR_CHAIN_RESULT(_TOP_RESULT_, \
136  _ERRORTYPE_, \
137  _LONG_DESC_) \
138  _TOP_RESULT_ = globus_i_gsi_gss_assist_error_chain_result(_TOP_RESULT_, \
139  _ERRORTYPE_, \
140  __FILE__, \
141  _function_name_, \
142  __LINE__, \
143  NULL, \
144  _LONG_DESC_)
145 
146 
147 
148 extern char * globus_l_gsi_gss_assist_error_strings[];
149 
151 globus_i_gsi_gss_assist_error_result(
152  int error_type,
153  const char * filename,
154  const char * function_name,
155  int line_number,
156  const char * short_desc,
157  const char * long_desc);
158 
160 globus_i_gsi_gss_assist_error_chain_result(
161  globus_result_t chain_result,
162  int error_type,
163  const char * filename,
164  const char * function_name,
165  int line_number,
166  const char * short_desc,
167  const char * long_desc);
168 
169 #ifdef __cplusplus
170 }
171 #endif
172 
173 #endif /* GLOBUS_I_GSS_ASSIST_H */
174 
175 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
GSS Assist Header.
Mutex.
Definition: globus_thread.h:107
Headers common to all of Globus.
uint32_t globus_result_t
Definition: globus_types.h:99