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