Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_i_gass_cache_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
18 
24 #ifndef GLOBUS_I_GASS_CACHE_CONFIG_H
25 #define GLOBUS_I_GASS_CACHE_CONFIG_H
26 
27 #include "globus_hashtable.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define GLOBUS_L_ERROR_CONFIG_FILE_NOT_FOUND -200
34 #define GLOBUS_L_ERROR_CONFIG_FILE_READ -201
35 #define GLOBUS_L_ERROR_CONFIG_FILE_PARSE_ERROR -202
36 
37 /* config structure definition */
38 typedef struct globus_l_gass_cache_config_s
39 {
40  char* buf; /* buffer that holds the config file */
41  globus_hashtable_t table; /* parsed config entries (hashtable) */
42 } globus_l_gass_cache_config_t;
43 
44 /*
45  * globus_l_gass_cache_config_init()
46  *
47  * Inits the config structure by reading from a file.
48  *
49  * Parameters:
50  * - directory the GASS cache directory
51  * - config the config structure
52  *
53  * Returns:
54  * - GLOBUS_SUCCESS upon success
55  */
56 int
57 globus_l_gass_cache_config_init(char* file,
58  globus_l_gass_cache_config_t *config);
59 
60 
61 /*
62  * globus_l_gass_cache_config_destroy()
63  *
64  * Destroys the config structure
65  *
66  * Parameters:
67  * - config the config structure
68  *
69  * Returns:
70  */
71 int
72 globus_l_gass_cache_config_destroy(globus_l_gass_cache_config_t *config);
73 
74 /*
75  * globus_l_gass_cache_config_get()
76  *
77  * Retrieves a config entry
78  *
79  * Parameters:
80  * - config the config structure
81  * - key the config parameter
82  *
83  * Returns:
84  * the value associated with 'key', or GLOBUS_NULL
85  */
86 char*
87 globus_l_gass_cache_config_get(globus_l_gass_cache_config_t *config,
88  char* key);
89 
90 
91 /*
92  * globus_l_gass_cache_config_get()
93  *
94  * Defines a new config entry
95  *
96  * Parameters:
97  * - config the config structure
98  * - key the config parameter
99  * - value the config parameter value
100  *
101  * Returns:
102  */
103 int
104 globus_l_gass_cache_config_set(globus_l_gass_cache_config_t *config,
105  char *key,
106  char *value);
107 
108 
109 /*
110  * globus_l_gass_cache_config_save()
111  *
112  * Saves the configuration to a file. NOTE: Any comments in the file
113  * will be lost!
114  *
115  * Parameters:
116  * - config the config structure
117  * - file the file to write to
118  * - overwrite if TRUE, will overwrite existing file
119  *
120  * Returns:
121  */
122 int
123 globus_l_gass_cache_config_save(globus_l_gass_cache_config_t *config,
124  char *file,
125  globus_bool_t *overwrite);
126 
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* GLOBUS_I_GASS_CACHE_CONFIG_H */
133 
134 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
Hash Table.