Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_url.h
Go to the documentation of this file.
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_URL_H
18 #define GLOBUS_URL_H
19 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /* Supported URL Schemes */
50 typedef enum
51 {
70  GLOBUS_URL_SCHEME_SSHFTP,
74 
75 /*
76  Other schemes defined in RFCs but _not_ supported here are
77  'news', 'nntp', 'telnet', 'gopher', 'wais', 'mailto', and 'prospero'
78 */
79 
88 typedef struct
89 {
91  char *scheme;
92 
95 
96 
97  /*
98  * Other fields as seen in these known url schemes:
99  *
100  * ftp://[user[:password]@]host[:port]/[url_path]
101  * gsiftp://[user[:password]@]host[:port]/[url_path]
102  * http://host[:port]/url_path
103  * x-nexus://host:port
104  * x-gass-cache://url_path
105  * ldap://host[:port]/dn?attributes?scope?filter
106  * otherurl://host[:port]/url_path or
107  * otherurl://url_specific_part
108  */
109 
110  char *user;
111  char *password;
112  char *host;
114  unsigned short port;
116  char *url_path;
118  char *dn;
120  char *attributes;
122  char *scope;
123  char *filter;
131 } globus_url_t;
132 
133 /* Fill in the data structure pointed to by url */
134 int globus_url_parse(const char *url_string, globus_url_t *url);
135 
136 /* Fill in the data structure pointed to by url */
137 int globus_url_parse_rfc1738(const char *url_string, globus_url_t *url);
138 
139 /* Fill in the data structure pointed to by url */
140 int globus_url_parse_loose(const char *url_string, globus_url_t *url);
141 
142 /* Destroy the fields of the data structure pointed to by url */
144 
145 /* Create a copy of a globus_url_t structure */
146 int globus_url_copy(globus_url_t * dest, const globus_url_t * src);
147 
148 /* Find out the URL scheme type */
149 int globus_url_get_scheme(const char *url_string,
150  globus_url_scheme_t *scheme_type);
151 
152 
153 void
154 globus_url_string_hex_decode(
155  char * s);
156 
157 char *
158 globus_url_string_hex_encode(
159  const char * s,
160  const char * enc);
161 
162 /* Return conditions */
163 #define GLOBUS_URL_SUCCESS 0
164 #define GLOBUS_URL_ERROR_NULL_STRING -1
165 #define GLOBUS_URL_ERROR_NULL_URL -2
166 #define GLOBUS_URL_ERROR_BAD_SCHEME -3
167 #define GLOBUS_URL_ERROR_BAD_USER -4
168 #define GLOBUS_URL_ERROR_BAD_PASSWORD -5
169 #define GLOBUS_URL_ERROR_BAD_HOST -6
170 #define GLOBUS_URL_ERROR_BAD_PORT -7
171 #define GLOBUS_URL_ERROR_BAD_PATH -8
172 
173 /* for ldap URLs */
174 #define GLOBUS_URL_ERROR_BAD_DN -9
175 #define GLOBUS_URL_ERROR_BAD_ATTRIBUTES -10
176 #define GLOBUS_URL_ERROR_BAD_SCOPE -11
177 #define GLOBUS_URL_ERROR_BAD_FILTER -12
178 
179 /* when malloc fails */
180 #define GLOBUS_URL_ERROR_OUT_OF_MEMORY -13
181 
182 /* for nexus errors/former assertion failures */
183 #define GLOBUS_URL_ERROR_INTERNAL_ERROR -14
184 
185 #define GLOBUS_URL_TRUE 1
186 #define GLOBUS_URL_FALSE 0
187 
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 
193 #endif /* GLOBUS_URL_H */
Definition: globus_url.h:59
char * url_specific_part
Definition: globus_url.h:126
char * scheme
Definition: globus_url.h:91
Parsed URLs.This structure contains the fields which were parsed from an string representation of an ...
Definition: globus_url.h:88
Definition: globus_url.h:63
Definition: globus_url.h:72
char * password
Definition: globus_url.h:111
Definition: globus_url.h:67
int globus_url_parse_rfc1738(const char *url_string, globus_url_t *url)
Definition: globus_url.c:364
char * dn
Definition: globus_url.h:118
int globus_url_get_scheme(const char *url_string, globus_url_scheme_t *scheme_type)
Definition: globus_url.c:2126
Definition: globus_url.h:57
unsigned short port
Definition: globus_url.h:114
char * attributes
Definition: globus_url.h:120
globus_url_scheme_t scheme_type
Definition: globus_url.h:94
int globus_url_destroy(globus_url_t *url)
Definition: globus_url.c:821
Definition: globus_url.h:61
Definition: globus_url.h:65
int globus_url_copy(globus_url_t *dst, const globus_url_t *src)
Definition: globus_url.c:2204
int globus_url_parse_loose(const char *url_string, globus_url_t *url)
Definition: globus_url.c:616
char * user
Definition: globus_url.h:110
char * url_path
Definition: globus_url.h:116
char * host
Definition: globus_url.h:112
globus_url_scheme_t
URL Schemes.The Globus URL library supports a set of URL schemes (protocols). This enumeration can be...
Definition: globus_url.h:50
Definition: globus_url.h:53
char * scope
Definition: globus_url.h:122
char * filter
Definition: globus_url.h:123
Definition: globus_url.h:55
int globus_url_parse(const char *url_string, globus_url_t *url)
Definition: globus_url.c:130
Definition: globus_url.h:69