Grid Community Toolkit  6.2.1541705016
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 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /* Supported URL Schemes */
49 typedef enum
50 {
69  GLOBUS_URL_SCHEME_SSHFTP,
73 
74 /*
75  Other schemes defined in RFCs but _not_ supported here are
76  'news', 'nntp', 'telnet', 'gopher', 'wais', 'mailto', and 'prospero'
77 */
78 
87 typedef struct
88 {
90  char *scheme;
91 
94 
95 
96  /*
97  * Other fields as seen in these known url schemes:
98  *
99  * ftp://[user[:password]@]host[:port]/[url_path]
100  * gsiftp://[user[:password]@]host[:port]/[url_path]
101  * http://host[:port]/url_path
102  * x-nexus://host:port
103  * x-gass-cache://url_path
104  * ldap://host[:port]/dn?attributes?scope?filter
105  * otherurl://host[:port]/url_path or
106  * otherurl://url_specific_part
107  */
108 
109  char *user;
110  char *password;
111  char *host;
113  unsigned short port;
115  char *url_path;
117  char *dn;
119  char *attributes;
121  char *scope;
122  char *filter;
130 } globus_url_t;
131 
132 /* Fill in the data structure pointed to by url */
133 int globus_url_parse(const char *url_string, globus_url_t *url);
134 
135 /* Fill in the data structure pointed to by url */
136 int globus_url_parse_rfc1738(const char *url_string, globus_url_t *url);
137 
138 /* Fill in the data structure pointed to by url */
139 int globus_url_parse_loose(const char *url_string, globus_url_t *url);
140 
141 /* Destroy the fields of the data structure pointed to by url */
143 
144 /* Create a copy of a globus_url_t structure */
145 int globus_url_copy(globus_url_t * dest, const globus_url_t * src);
146 
147 /* Find out the URL scheme type */
148 int globus_url_get_scheme(const char *url_string,
149  globus_url_scheme_t *scheme_type);
150 
151 
152 void
153 globus_url_string_hex_decode(
154  char * s);
155 
156 char *
157 globus_url_string_hex_encode(
158  const char * s,
159  const char * enc);
160 
161 /* Return conditions */
162 #define GLOBUS_URL_SUCCESS 0
163 #define GLOBUS_URL_ERROR_NULL_STRING -1
164 #define GLOBUS_URL_ERROR_NULL_URL -2
165 #define GLOBUS_URL_ERROR_BAD_SCHEME -3
166 #define GLOBUS_URL_ERROR_BAD_USER -4
167 #define GLOBUS_URL_ERROR_BAD_PASSWORD -5
168 #define GLOBUS_URL_ERROR_BAD_HOST -6
169 #define GLOBUS_URL_ERROR_BAD_PORT -7
170 #define GLOBUS_URL_ERROR_BAD_PATH -8
171 
172 /* for ldap URLs */
173 #define GLOBUS_URL_ERROR_BAD_DN -9
174 #define GLOBUS_URL_ERROR_BAD_ATTRIBUTES -10
175 #define GLOBUS_URL_ERROR_BAD_SCOPE -11
176 #define GLOBUS_URL_ERROR_BAD_FILTER -12
177 
178 /* when malloc fails */
179 #define GLOBUS_URL_ERROR_OUT_OF_MEMORY -13
180 
181 /* for nexus errors/former assertion failures */
182 #define GLOBUS_URL_ERROR_INTERNAL_ERROR -14
183 
184 #define GLOBUS_URL_TRUE 1
185 #define GLOBUS_URL_FALSE 0
186 
187 
188 #ifdef __cplusplus
189 }
190 #endif
191 
192 #endif /* GLOBUS_URL_H */
Definition: globus_url.h:58
char * url_specific_part
Definition: globus_url.h:125
char * scheme
Definition: globus_url.h:90
Parsed URLs.This structure contains the fields which were parsed from an string representation of an ...
Definition: globus_url.h:87
Definition: globus_url.h:62
Definition: globus_url.h:71
char * password
Definition: globus_url.h:110
Definition: globus_url.h:66
int globus_url_parse_rfc1738(const char *url_string, globus_url_t *url)
Definition: globus_url.c:364
char * dn
Definition: globus_url.h:117
int globus_url_get_scheme(const char *url_string, globus_url_scheme_t *scheme_type)
Definition: globus_url.c:2126
Definition: globus_url.h:56
unsigned short port
Definition: globus_url.h:113
char * attributes
Definition: globus_url.h:119
globus_url_scheme_t scheme_type
Definition: globus_url.h:93
int globus_url_destroy(globus_url_t *url)
Definition: globus_url.c:821
Definition: globus_url.h:60
Definition: globus_url.h:64
int globus_url_copy(globus_url_t *dest, 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:109
char * url_path
Definition: globus_url.h:115
char * host
Definition: globus_url.h:111
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:49
Definition: globus_url.h:52
char * scope
Definition: globus_url.h:121
char * filter
Definition: globus_url.h:122
Definition: globus_url.h:54
int globus_url_parse(const char *url_string, globus_url_t *url)
Definition: globus_url.c:130
Definition: globus_url.h:68