globus_gsi_sysconfig  8.5
globus_i_gsi_system_config.h
1 
2 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
10 #ifndef GLOBUS_I_GSI_SYSTEM_CONFIG_H
11 #define GLOBUS_I_GSI_SYSTEM_CONFIG_H
12 
13 #include "globus_common.h"
14 #include "globus_i_gsi_sysconfig_config.h"
17 
18 #define _GSSL(s) globus_common_i18n_get_string(\
19  GLOBUS_GSI_SYSCONFIG_MODULE,\
20  s)
21 
22 /* DEBUG MACROS */
23 
24 extern int globus_i_gsi_sysconfig_debug_level;
25 extern FILE * globus_i_gsi_sysconfig_debug_fstream;
26 
27 #ifdef BUILD_DEBUG
28 
29 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG(_LEVEL_) \
30  (globus_i_gsi_sysconfig_debug_level >= (_LEVEL_))
31 
32 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) \
33  { \
34  if (GLOBUS_I_GSI_SYSCONFIG_DEBUG(_LEVEL_)) \
35  { \
36  globus_libc_fprintf _MESSAGE_; \
37  } \
38  }
39 
40 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) \
41  { \
42  if (GLOBUS_I_GSI_SYSCONFIG_DEBUG(_LEVEL_)) \
43  { \
44  char * _tmp_str_ = \
45  globus_common_create_nstring _MESSAGE_; \
46  globus_libc_fprintf(globus_i_gsi_sysconfig_debug_fstream, \
47  _tmp_str_); \
48  globus_libc_free(_tmp_str_); \
49  } \
50  }
51 
52 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_PRINT(_LEVEL_, _MESSAGE_) \
53  { \
54  if (GLOBUS_I_GSI_SYSCONFIG_DEBUG(_LEVEL_)) \
55  { \
56  globus_libc_fprintf(globus_i_gsi_sysconfig_debug_fstream, \
57  _MESSAGE_); \
58  } \
59  }
60 
61 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_PRINT_OBJECT(_LEVEL_, _OBJ_NAME_, _OBJ_) \
62  { \
63  if (GLOBUS_I_GSI_SYSCONFIG_DEBUG(_LEVEL_)) \
64  { \
65  _OBJ_NAME_##_print_fp(globus_i_gsi_sysconfig_debug_fstream, \
66  _OBJ_); \
67  } \
68  }
69 
70 #else
71 
72 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_FPRINTF(_LEVEL_, _MESSAGE_) {}
73 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_FNPRINTF(_LEVEL_, _MESSAGE_) {}
74 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_PRINT(_LEVEL_, _MESSAGE_) {}
75 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_PRINT_OBJECT(_LEVEL_, \
76  _OBJ_NAME_, _OBJ_) {}
77 
78 #endif
79 
80 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_ENTER \
81  GLOBUS_I_GSI_SYSCONFIG_DEBUG_FPRINTF( \
82  1, (globus_i_gsi_sysconfig_debug_fstream, \
83  "%s entering\n", __func__))
84 
85 #define GLOBUS_I_GSI_SYSCONFIG_DEBUG_EXIT \
86  GLOBUS_I_GSI_SYSCONFIG_DEBUG_FPRINTF( \
87  2, (globus_i_gsi_sysconfig_debug_fstream, \
88  "%s exiting\n", __func__))
89 
90 /* ERROR MACROS */
91 
92 #define GLOBUS_GSI_SYSCONFIG_OPENSSL_ERROR_RESULT(_RESULT_, \
93  _ERRORTYPE_, \
94  _ERRSTR_) \
95  { \
96  char * _tmp_str_ = \
97  globus_common_create_string _ERRSTR_; \
98  _RESULT_ = globus_i_gsi_sysconfig_openssl_error_result(_ERRORTYPE_, \
99  __FILE__, \
100  __func__, \
101  __LINE__, \
102  _tmp_str_, \
103  NULL); \
104  globus_libc_free(_tmp_str_); \
105  }
106 
107 #define GLOBUS_GSI_SYSCONFIG_ERROR_RESULT(_RESULT_, _ERRORTYPE_, _ERRSTR_) \
108  { \
109  char * _tmp_str_ = \
110  globus_common_create_string _ERRSTR_; \
111  _RESULT_ = globus_i_gsi_sysconfig_error_result(_ERRORTYPE_, \
112  __FILE__, \
113  __func__, \
114  __LINE__, \
115  _tmp_str_, \
116  NULL); \
117  globus_libc_free(_tmp_str_); \
118  }
119 
120 #define GLOBUS_GSI_SYSCONFIG_ERROR_CHAIN_RESULT(_TOP_RESULT_, _ERRORTYPE_) \
121  _TOP_RESULT_ = globus_i_gsi_sysconfig_error_chain_result(_TOP_RESULT_, \
122  _ERRORTYPE_, \
123  __FILE__, \
124  __func__, \
125  __LINE__, \
126  NULL, \
127  NULL)
128 
129 #define GLOBUS_GSI_SYSCONFIG_OPENSSL_LONG_ERROR_RESULT(_RESULT_, \
130  _ERRORTYPE_, \
131  _ERRSTR_, \
132  _LONG_DESC_) \
133  { \
134  char * _tmp_str_ = \
135  globus_common_create_string _ERRSTR_; \
136  _RESULT_ = globus_i_gsi_sysconfig_openssl_error_result(_ERRORTYPE_, \
137  __FILE__, \
138  __func__, \
139  __LINE__, \
140  _tmp_str_, \
141  _LONG_DESC_); \
142  globus_libc_free(_tmp_str_); \
143  }
144 
145 #define GLOBUS_GSI_SYSCONFIG_LONG_ERROR_RESULT(_RESULT_, \
146  _ERRORTYPE_, \
147  _ERRSTR_, \
148  _LONG_DESC_) \
149  { \
150  char * _tmp_str_ = \
151  globus_common_create_string _ERRSTR_; \
152  _RESULT_ = globus_i_gsi_sysconfig_error_result(_ERRORTYPE_, \
153  __FILE__, \
154  __func__, \
155  __LINE__, \
156  _tmp_str_, \
157  _LONG_DESC_); \
158  globus_libc_free(_tmp_str_); \
159  }
160 
161 #define GLOBUS_GSI_SYSCONFIG_LONG_ERROR_CHAIN_RESULT(_TOP_RESULT_, \
162  _ERRORTYPE_, \
163  _LONG_DESC_) \
164  _TOP_RESULT_ = globus_i_gsi_sysconfig_error_chain_result(_TOP_RESULT_, \
165  _ERRORTYPE_, \
166  __FILE__, \
167  __func__, \
168  __LINE__, \
169  NULL, \
170  _LONG_DESC_)
171 
172 #define GLOBUS_GSI_SYSCONFIG_FILE_DOES_NOT_EXIST(_RESULT) \
173  (globus_error_match(globus_error_peek(_RESULT), \
174  GLOBUS_GSI_SYSCONFIG_MODULE, \
175  GLOBUS_GSI_SYSCONFIG_ERROR_FILE_DOES_NOT_EXIST) == \
176  GLOBUS_TRUE)
177 
178 #define GLOBUS_GSI_SYSCONFIG_FILE_HAS_BAD_PERMISSIONS(_RESULT) \
179  (globus_error_match(globus_error_peek(_RESULT), \
180  GLOBUS_GSI_SYSCONFIG_MODULE, \
181  GLOBUS_GSI_SYSCONFIG_ERROR_FILE_BAD_PERMISSIONS) == \
182  GLOBUS_TRUE)
183 
184 #define GLOBUS_GSI_SYSCONFIG_FILE_ZERO_LENGTH(_RESULT) \
185  (globus_error_match(globus_error_peek(_RESULT), \
186  GLOBUS_GSI_SYSCONFIG_MODULE, \
187  GLOBUS_GSI_SYSCONFIG_ERROR_FILE_ZERO_LENGTH) == \
188  GLOBUS_TRUE)
189 
190 extern char * globus_l_gsi_sysconfig_error_strings[];
191 extern char * globus_l_gsi_sysconfig_status_strings[];
192 
193 globus_result_t
194 globus_i_gsi_sysconfig_create_cert_dir_string(
195  char ** cert_dir,
196  char ** cert_dir_value,
197  const char * format,
198  ...);
199 
200 globus_result_t
201 globus_i_gsi_sysconfig_create_cert_string(
202  char ** cert_string,
203  char ** cert_string_value,
204  const char * format,
205  ...);
206 
207 globus_result_t
208 globus_i_gsi_sysconfig_create_key_string(
209  char ** key_string,
210  char ** key_string_value,
211  const char * format,
212  ...);
213 
214 globus_result_t
215 globus_i_gsi_sysconfig_error_chain_result(
216  globus_result_t chain_result,
217  int error_type,
218  const char * filename,
219  const char * function_name,
220  int line_number,
221  const char * short_desc,
222  const char * long_desc);
223 
224 globus_result_t
225 globus_i_gsi_sysconfig_error_result(
226  int error_type,
227  const char * filename,
228  const char * function_name,
229  int line_number,
230  const char * short_desc,
231  const char * long_desc);
232 
233 globus_result_t
234 globus_i_gsi_sysconfig_openssl_error_result(
235  int error_type,
236  const char * filename,
237  const char * function_name,
238  int line_number,
239  const char * short_desc,
240  const char * long_desc);
241 
242 
243 #endif /* GLOBUS_I_GSI_SYSTEM_CONFIG_H */
244 
245 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
Globus GSI System Config Library.
Globus GSI System Config Library.