~ubuntu-branches/ubuntu/trusty/globus-gram-client/trusty-proposed

« back to all changes in this revision

Viewing changes to .pc/globus-gram-client-doxygen.patch/globus_gram_client_attr.c

  • Committer: Bazaar Package Importer
  • Author(s): Mattias Ellert
  • Date: 2011-06-06 16:40:48 UTC
  • Revision ID: james.westby@ubuntu.com-20110606164048-4ihreraeyrcy6a0r
Tags: 10.4-3
* Fix doxygen markup
* Use system jquery script

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_gram_client_attr.h Attribute Functions
 
20
 *
 
21
 * CVS Information:
 
22
 *    $Source: /home/globdev/CVS/globus-packages/gram/client/source/globus_gram_client_attr.c,v $
 
23
 * $Date: 2009/11/19 02:01:59 $
 
24
 * $Revision: 1.5.20.1 $
 
25
 * $Author: bester $
 
26
 */
 
27
#endif
 
28
 
 
29
#include "globus_i_gram_client.h"
 
30
 
 
31
/**
 
32
 * @brief Initialize a GRAM client attribute
 
33
 * @ingroup globus_gram_client_attr
 
34
 *
 
35
 * @details
 
36
 * The @a globus_gram_client_attr_init() function creates a new opaque
 
37
 * structure that can be used to specify custom attributes for performing
 
38
 * GRAM client operations.
 
39
 * 
 
40
 * @param attr
 
41
 *     An output parameter which will be set to the newly initialized 
 
42
 *     attribute.
 
43
 *
 
44
 * @return
 
45
 *     Upon success, @a globus_gram_client_attr_init() modifies the @a attr
 
46
 *     parameter to point to a new GRAM client attribute and returns
 
47
 *     @a GLOBUS_SUCCESS. If an error occurs, @a globus_gram_client_attr_init()
 
48
 *     returns an integer error code and value of @a attr is undefined.
 
49
 *
 
50
 * @retval GLOBUS_SUCCESS
 
51
 *     Success
 
52
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
 
53
 *     Invalid attribute
 
54
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_MALLOC_FAILED
 
55
 *     Out of memory
 
56
 *
 
57
 * @see globus_gram_client_attr_destroy()
 
58
 */
 
59
int
 
60
globus_gram_client_attr_init(
 
61
    globus_gram_client_attr_t *     attr)
 
62
{
 
63
    globus_i_gram_client_attr_t *   iattr;
 
64
 
 
65
    if (attr == NULL)
 
66
    {
 
67
        return GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
 
68
    }
 
69
    iattr = globus_libc_calloc(1, sizeof(globus_i_gram_client_attr_t));
 
70
 
 
71
    if(iattr == NULL)
 
72
    {
 
73
        return GLOBUS_GRAM_PROTOCOL_ERROR_MALLOC_FAILED;
 
74
    }
 
75
    iattr->delegation_mode = GLOBUS_IO_SECURE_DELEGATION_MODE_LIMITED_PROXY;
 
76
 
 
77
    *attr = (void*) iattr;
 
78
 
 
79
    return GLOBUS_SUCCESS;
 
80
}
 
81
 
 
82
/**
 
83
 * @brief Destroy a GRAM client attribute
 
84
 * @ingroup globus_gram_client_attr
 
85
 *
 
86
 * @details
 
87
 * The @a globus_gram_client_attr_destroy() function destroys and frees
 
88
 * a GRAM client attribute. After this function returns, the value pointed
 
89
 * to by @a attr is no longer valid and must not be used.
 
90
 *
 
91
 * @param attr
 
92
 *     A pointer to the attribute to destroy. All data associated with
 
93
 *     the attribute will be freed and it will be an invalid attribute.
 
94
 *
 
95
 * @return
 
96
 *     Upon success, @a globus_gram_client_attr_destroy() destroys the 
 
97
 *     attribute pointed to by the @a attr parameter and sets it to an invalid
 
98
 *     state.  If an error occurs, @a globus_gram_client_attr_destroy()
 
99
 *     returns an integer error code and value of @a attr is unchanged.
 
100
 *
 
101
 * @retval GLOBUS_SUCCESS
 
102
 *     Success
 
103
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
 
104
 *     Invalid attribute
 
105
 *
 
106
 * @see globus_gram_client_attr_init()
 
107
 */
 
108
int
 
109
globus_gram_client_attr_destroy(
 
110
    globus_gram_client_attr_t *     attr)
 
111
{
 
112
    int                             rc = GLOBUS_SUCCESS;
 
113
    globus_i_gram_client_attr_t *   iattr;
 
114
 
 
115
    if (attr == NULL)
 
116
    {
 
117
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
 
118
        goto out;
 
119
    }
 
120
 
 
121
    iattr = (globus_i_gram_client_attr_t *) *attr;
 
122
    if (iattr == NULL)
 
123
    {
 
124
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
 
125
        goto out;
 
126
    }
 
127
 
 
128
    globus_libc_free(iattr);
 
129
    *attr = NULL;
 
130
 
 
131
out:
 
132
    return rc;
 
133
}
 
134
/* globus_gram_client_attr_destroy() */
 
135
 
 
136
/**
 
137
 * @brief Set a GRAM client attribute's security credential
 
138
 * @ingroup globus_gram_client_attr
 
139
 * 
 
140
 * @details
 
141
 * The @a globus_gram_client_attr_set_credential() function sets the 
 
142
 * value of the @b credential in an attribute to the GSSAPI credential
 
143
 * named by the @a credential parameter. This is done as a shallow copy, so 
 
144
 * the value of @a credential must not be freed until the attribute will
 
145
 * no longer be used.
 
146
 *
 
147
 * @param attr
 
148
 *     The attribute set to modify to use the credential named by the
 
149
 *     @a credential parameter.
 
150
 * @param credential
 
151
 *     The GSSAPI credential to use with the attribute named by the @a attr
 
152
 *     parameter. This may be @a GSS_C_NO_CREDENTIAL to set the attribute
 
153
 *     to use the default security credential.
 
154
 *
 
155
 * @return
 
156
 *     Upon success, @a globus_gram_client_attr_set_credential() modifies the
 
157
 *     the attribute pointed to by the @a attr parameter to use the credential
 
158
 *     specified by the @a credential parameter and returns @a GLOBUS_SUCCESS.
 
159
 *     If an error occurs, @a globus_gram_client_attr_set_credential()
 
160
 *     returns an integer error code and the attribute named by @a attr is
 
161
 *     unchanged.
 
162
 * 
 
163
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
 
164
 *     An invalid attribute set was passed to this function.
 
165
 *
 
166
 * @see globus_gram_client_attr_get_credential()
 
167
 */
 
168
int
 
169
globus_gram_client_attr_set_credential(
 
170
    globus_gram_client_attr_t           attr,
 
171
    gss_cred_id_t                       credential)
 
172
{
 
173
    int                                 rc = GLOBUS_SUCCESS;
 
174
    globus_i_gram_client_attr_t *       iattr;
 
175
 
 
176
    if (attr == NULL)
 
177
    {
 
178
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
 
179
        goto out;
 
180
    }
 
181
    iattr = (globus_i_gram_client_attr_t *) attr;
 
182
    iattr->credential = credential;
 
183
out:
 
184
    return rc;
 
185
}
 
186
/* globus_gram_client_attr_set_credential() */
 
187
 
 
188
/**
 
189
 * @brief Get a GRAM client attribute's security credential
 
190
 * @ingroup globus_gram_client_attr
 
191
 *
 
192
 * @details
 
193
 * The @a globus_gram_client_attr_get_credential() function gets the 
 
194
 * value of the @b credential in an attribute and modifies the @a credential
 
195
 * parameter to point to it. This is a shallow copy.
 
196
 *
 
197
 * @param attr
 
198
 *     The attribute set to query for its @a credential.
 
199
 * @param credential
 
200
 *     An output parameter that will be initialized to point to the GSSAPI
 
201
 *     credential which the @a attr is currently using.
 
202
 *
 
203
 * @return
 
204
 *     Upon success, @a globus_gram_client_attr_get_credential() modifies the
 
205
 *     the value pointed to by the @a credential parameter to be the same
 
206
 *     credential as that being used by the attribute named by the @a attr
 
207
 *     parameter and returns @a GLOBUS_SUCCESS.
 
208
 *     If an error occurs, @a globus_gram_client_attr_get_credential()
 
209
 *     returns an integer error code and the value pointed to by the
 
210
 *     @a credential parameter is undefined.
 
211
 *
 
212
 * @retval GLOBUS_SUCCESS
 
213
 *     Success
 
214
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
 
215
 *     Invalid attribute
 
216
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_NULL_PARAMETER
 
217
 *     Null parameter
 
218
 *
 
219
 * @see globus_gram_client_attr_set_credential()
 
220
 */
 
221
int
 
222
globus_gram_client_attr_get_credential(
 
223
    globus_gram_client_attr_t           attr,
 
224
    gss_cred_id_t *                     credential)
 
225
{
 
226
    int                                 rc = GLOBUS_SUCCESS;
 
227
    globus_i_gram_client_attr_t *       iattr;
 
228
 
 
229
    iattr = (globus_i_gram_client_attr_t *) attr;
 
230
 
 
231
    if (iattr == NULL)
 
232
    {
 
233
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
 
234
 
 
235
        goto out;
 
236
    }
 
237
    if (credential == NULL)
 
238
    {
 
239
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_NULL_PARAMETER;
 
240
 
 
241
        goto out;
 
242
    }
 
243
    *credential = iattr->credential;
 
244
 
 
245
out:
 
246
    return rc;
 
247
}
 
248
 
 
249
/**
 
250
 * @brief Set a GRAM client attribute's delegation mode
 
251
 * @ingroup globus_gram_client_attr
 
252
 *
 
253
 * @details
 
254
 * The @a globus_gram_client_attr_set_delegation_mode() function sets the 
 
255
 * value of the @b delegation_mode in an attribute to the delegation mode
 
256
 * in the @a mode parameter.
 
257
 *
 
258
 * The GRAM client supports the following delegation modes:
 
259
 * - @b GLOBUS_IO_SECURE_DELEGATION_MODE_LIMITED_PROXY
 
260
 * - @b GLOBUS_IO_SECURE_DELEGATION_MODE_FULL_PROXY
 
261
 *
 
262
 * @param attr
 
263
 *     The attribute set to modify to use the delegation mode in the
 
264
 *     @a mode parameter.
 
265
 * @param mode
 
266
 *     The new value of the delegation mode.
 
267
 *
 
268
 * @return
 
269
 *     Upon success, @a globus_gram_client_attr_set_delegation_mode() modifies
 
270
 *     the the attribute named by the @a attr parameter to use the delegation
 
271
 *     mode in the @a mode parameter and returns GLOBUS_SUCCESS.
 
272
 *     If an error occurs, @a globus_gram_client_attr_set_delegation_mode()
 
273
 *     returns an integer error code and the @a delegation_mode attribute 
 
274
 *     value is unchanged.
 
275
 * 
 
276
 * @retval GLOBUS_SUCCESS
 
277
 *     Success
 
278
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
 
279
 *     Invalid attribute
 
280
 *
 
281
 * @see globus_gram_client_attr_get_delegation_mode()
 
282
 */
 
283
int
 
284
globus_gram_client_attr_set_delegation_mode(
 
285
    globus_gram_client_attr_t           attr,
 
286
    globus_io_secure_delegation_mode_t  mode)
 
287
{
 
288
    int                                 rc = GLOBUS_SUCCESS;
 
289
    globus_i_gram_client_attr_t *       iattr;
 
290
 
 
291
    if (attr == NULL)
 
292
    {
 
293
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
 
294
        goto out;
 
295
    }
 
296
    if (mode != GLOBUS_IO_SECURE_DELEGATION_MODE_LIMITED_PROXY &&
 
297
        mode != GLOBUS_IO_SECURE_DELEGATION_MODE_FULL_PROXY)
 
298
    {
 
299
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
 
300
        goto out;
 
301
    }
 
302
    iattr = (globus_i_gram_client_attr_t *) attr;
 
303
    iattr->delegation_mode = mode;
 
304
out:
 
305
    return rc;
 
306
}
 
307
 
 
308
/**
 
309
 * @brief Get a GRAM client attribute's security credential
 
310
 * @ingroup globus_gram_client_attr
 
311
 * 
 
312
 * @details
 
313
 * The @a globus_gram_client_attr_get_delegation_mode() function gets the 
 
314
 * value of the @b delegation_mode in an attribute and modifies the
 
315
 * @a mode parameter to point to its value.
 
316
 *
 
317
 * @param attr
 
318
 *     The attribute set to query for its @a delegation_mode.
 
319
 * @param mode
 
320
 *     An output parameter that will be set to point to the delegation mode
 
321
 *     which the @a attr is currently using.
 
322
 *
 
323
 * @return
 
324
 *     Upon success, @a globus_gram_client_attr_get_delegation_mode() modifies
 
325
 *     the the value pointed to by the @a mode parameter as described above
 
326
 *     and returns @a GLOBUS_SUCCESS.
 
327
 *     If an error occurs, @a globus_gram_client_attr_get_delegation_mode()
 
328
 *     returns an integer error code and the value pointed to by the
 
329
 *     @a mode parameter is undefined.
 
330
 *
 
331
 *
 
332
 *
 
333
 * @retval GLOBUS_SUCCESS
 
334
 *     Success
 
335
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
 
336
 *     Invalid attribute
 
337
 * @retval GLOBUS_GRAM_PROTOCOL_ERROR_NULL_PARAMETER
 
338
 *     Null parameter
 
339
 *
 
340
 * @see globus_gram_client_attr_get_delegation_mode()
 
341
 */
 
342
int
 
343
globus_gram_client_attr_get_delegation_mode(
 
344
    globus_gram_client_attr_t           attr,
 
345
    globus_io_secure_delegation_mode_t *mode)
 
346
{
 
347
    int                                 rc = GLOBUS_SUCCESS;
 
348
    globus_i_gram_client_attr_t *       iattr;
 
349
 
 
350
    iattr = (globus_i_gram_client_attr_t *) attr;
 
351
 
 
352
    if (iattr == NULL)
 
353
    {
 
354
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
 
355
 
 
356
        goto out;
 
357
    }
 
358
    if (mode == NULL)
 
359
    {
 
360
        rc = GLOBUS_GRAM_PROTOCOL_ERROR_NULL_PARAMETER;
 
361
 
 
362
        goto out;
 
363
    }
 
364
    *mode = iattr->delegation_mode;
 
365
 
 
366
out:
 
367
    return rc;
 
368
}
 
369
/* globus_gram_client_attr_get_delegation_mode() */