Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_i_callout.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_I_CALLOUT_H
18 #define GLOBUS_I_CALLOUT_H
19 
20 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
21 
28 #include "globus_callout.h"
29 
30 /* DEBUG MACROS */
31 
32 #ifdef BUILD_DEBUG
33 
34 extern int globus_i_callout_debug_level;
35 extern FILE * globus_i_callout_debug_fstream;
36 
37 #define GLOBUS_I_CALLOUT_DEBUG(_LEVEL_) \
38  (globus_i_callout_debug_level >= (_LEVEL_))
39 
40 #define GLOBUS_I_CALLOUT_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
41  { \
42  if (GLOBUS_I_CALLOUT_DEBUG(_LEVEL_)) \
43  { \
44  globus_libc_fprintf _MESSAGE_; \
45  } \
46  }
47 
48 #define GLOBUS_I_CALLOUT_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
49  { \
50  if (GLOBUS_I_CALLOUT_DEBUG(_LEVEL_)) \
51  { \
52  char * _tmp_str_ = \
53  globus_common_create_nstring _MESSAGE_; \
54  globus_libc_fprintf(globus_i_callout_debug_fstream, \
55  _tmp_str_); \
56  globus_libc_free(_tmp_str_); \
57  } \
58  }
59 
60 #define GLOBUS_I_CALLOUT_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
61  { \
62  if (GLOBUS_I_CALLOUT_DEBUG(_LEVEL_)) \
63  { \
64  globus_libc_fprintf(globus_i_callout_debug_fstream, \
65  _MESSAGE_); \
66  } \
67  }
68 
69 #define GLOBUS_I_CALLOUT_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) \
70  { \
71  if (GLOBUS_I_CALLOUT_DEBUG(_LEVEL_)) \
72  { \
73  _OBJ_NAME_##_print_fp(globus_i_callout_debug_fstream, _OBJ_); \
74  } \
75  }
76 
77 #else
78 
79 #define GLOBUS_I_CALLOUT_DEBUG(_LEVEL_) 0
80 #define GLOBUS_I_CALLOUT_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
81 #define GLOBUS_I_CALLOUT_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
82 #define GLOBUS_I_CALLOUT_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
83 #define GLOBUS_I_CALLOUT_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) {}
84 
85 #endif
86 
87 #define GLOBUS_I_CALLOUT_DEBUG_ENTER \
88  GLOBUS_I_CALLOUT_DEBUG_FPRINTF( \
89  1, (globus_i_callout_debug_fstream, \
90  "%s entering\n", _function_name_))
91 
92 #define GLOBUS_I_CALLOUT_DEBUG_EXIT \
93  GLOBUS_I_CALLOUT_DEBUG_FPRINTF( \
94  2, (globus_i_callout_debug_fstream, \
95  "%s exiting\n", _function_name_))
96 
97 /* ERROR MACROS */
98 
99 #define GLOBUS_CALLOUT_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
100  { \
101  char * _tmp_str_ = \
102  globus_common_create_string _ERRSTR_; \
103  _RESULT_ = globus_i_callout_error_result(_ERRORTYPE_, \
104  __FILE__, \
105  _function_name_, \
106  __LINE__, \
107  _tmp_str_, \
108  NULL); \
109  globus_libc_free(_tmp_str_); \
110  }
111 
112 #define GLOBUS_CALLOUT_ERROR_CHAIN_RESULT(_TOP_RESULT_, _ERRORTYPE_) \
113  _TOP_RESULT_ = globus_i_callout_error_chain_result( \
114  _TOP_RESULT_, \
115  _ERRORTYPE_, \
116  __FILE__, \
117  _function_name_, \
118  __LINE__, \
119  NULL, \
120  NULL)
121 
122 
123 #define GLOBUS_CALLOUT_LONG_ERROR_RESULT(_RESULT_, \
124  _ERRORTYPE_, \
125  _ERRSTR_, \
126  _LONG_DESC_) \
127  { \
128  char * _tmp_str_ = \
129  globus_common_create_string _ERRSTR_; \
130  _RESULT_ = globus_i_callout_error_result(_ERRORTYPE_, \
131  __FILE__, \
132  _function_name_, \
133  __LINE__, \
134  _tmp_str_, \
135  _LONG_DESC_); \
136  globus_libc_free(_tmp_str_); \
137  }
138 
139 #define GLOBUS_CALLOUT_LONG_ERROR_CHAIN_RESULT(_TOP_RESULT_, \
140  _ERRORTYPE_, \
141  _LONG_DESC_) \
142  _TOP_RESULT_ = globus_i_callout_error_chain_result( \
143  _TOP_RESULT_, \
144  _ERRORTYPE_, \
145  __FILE__, \
146  _function_name_, \
147  __LINE__, \
148  NULL, \
149  _LONG_DESC_)
150 
151 #define GLOBUS_CALLOUT_MALLOC_ERROR(_RESULT_) \
152  { \
153  char * _tmp_str_ = \
154  globus_l_callout_error_strings[ \
155  GLOBUS_CALLOUT_ERROR_OUT_OF_MEMORY]; \
156  _RESULT_ = globus_error_put( \
157  globus_error_wrap_errno_error( \
158  GLOBUS_CALLOUT_MODULE, \
159  errno, \
160  GLOBUS_CALLOUT_ERROR_OUT_OF_MEMORY, \
161  __FILE__, \
162  _function_name_, \
163  __LINE__, \
164  "%s", \
165  _tmp_str_)); \
166  }
167 
168 #define GLOBUS_CALLOUT_ERRNO_ERROR_RESULT(_RESULT_, \
169  _ERRORTYPE_, _ERRORSTR_) \
170  { \
171  char * _tmp_str_ = \
172  globus_common_create_string _ERRORSTR_; \
173  _RESULT_ = globus_error_put( \
174  globus_error_wrap_errno_error( \
175  GLOBUS_CALLOUT_MODULE, \
176  errno, \
177  _ERRORTYPE_, \
178  __FILE__, \
179  _function_name_, \
180  __LINE__, \
181  "%s", \
182  _tmp_str_)); \
183  globus_libc_free(_tmp_str_); \
184  }
185 
186 extern char * globus_l_callout_error_strings[];
187 
189 globus_i_callout_error_result(
190  int error_type,
191  const char * filename,
192  const char * function_name,
193  int line_number,
194  const char * short_desc,
195  const char * long_desc);
196 
198 globus_i_callout_error_chain_result(
199  globus_result_t chain_result,
200  int error_type,
201  const char * filename,
202  const char * function_name,
203  int line_number,
204  const char * short_desc,
205  const char * long_desc);
206 
207 
215 typedef struct globus_i_callout_handle_s
216 {
217  globus_hashtable_t symbol_htable;
218  globus_hashtable_t library_htable;
219 }
220 globus_i_callout_handle_t;
221 
222 typedef struct globus_i_callout_data_s
223 {
224  char * type;
225  char * file;
226  char * symbol;
227  struct globus_i_callout_data_s * next;
228  char ** env_args;
229  int num_env_args;
230  globus_bool_t mandatory;
231 } globus_i_callout_data_t;
232 
233 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
234 
235 #endif /* GLOBUS_I_CALLOUT_H */
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
Globus Callout Infrastructure.
uint32_t globus_result_t
Definition: globus_types.h:99