~ubuntu-branches/ubuntu/vivid/globus-gss-assist/vivid

« back to all changes in this revision

Viewing changes to globus_i_gss_assist.h

  • Committer: Bazaar Package Importer
  • Author(s): Mattias Ellert
  • Date: 2009-04-18 20:17:33 UTC
  • Revision ID: james.westby@ubuntu.com-20090418201733-xl4r26mgda1shx4q
Tags: upstream-4.0
ImportĀ upstreamĀ versionĀ 4.0

Show diffs side-by-side

added added

removed removed

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