globus_common 18.13
Loading...
Searching...
No Matches
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
24
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/* Supported URL Schemes */
74
75/*
76 Other schemes defined in RFCs but _not_ supported here are
77 'news', 'nntp', 'telnet', 'gopher', 'wais', 'mailto', and 'prospero'
78*/
79
88typedef 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;
122 char *scope;
123 char *filter;
125
132
133/* Fill in the data structure pointed to by url */
134int globus_url_parse(const char *url_string, globus_url_t *url);
135
136/* Fill in the data structure pointed to by url */
137int globus_url_parse_rfc1738(const char *url_string, globus_url_t *url);
138
139/* Fill in the data structure pointed to by url */
140int 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 */
146int globus_url_copy(globus_url_t * dest, const globus_url_t * src);
147
148/* Find out the URL scheme type */
149int globus_url_get_scheme(const char *url_string,
150 globus_url_scheme_t *scheme_type);
151
152
153void
154globus_url_string_hex_decode(
155 char * s);
156
157char *
158globus_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 */
int globus_url_parse_loose(const char *url_string, globus_url_t *url)
Definition globus_url.c:616
int globus_url_get_scheme(const char *url_string, globus_url_scheme_t *scheme_type)
Definition globus_url.c:2126
int globus_url_parse(const char *url_string, globus_url_t *url)
Definition globus_url.c:130
int globus_url_copy(globus_url_t *dest, const globus_url_t *src)
Definition globus_url.c:2204
globus_url_scheme_t
URL Schemes.
Definition globus_url.h:51
int globus_url_destroy(globus_url_t *url)
Definition globus_url.c:821
int globus_url_parse_rfc1738(const char *url_string, globus_url_t *url)
Definition globus_url.c:364
@ GLOBUS_URL_SCHEME_FILE
Definition globus_url.h:63
@ GLOBUS_URL_NUM_SCHEMES
Definition globus_url.h:72
@ GLOBUS_URL_SCHEME_GSIFTP
Definition globus_url.h:55
@ GLOBUS_URL_SCHEME_X_NEXUS
Definition globus_url.h:65
@ GLOBUS_URL_SCHEME_HTTP
Definition globus_url.h:57
@ GLOBUS_URL_SCHEME_LDAP
Definition globus_url.h:61
@ GLOBUS_URL_SCHEME_FTP
Definition globus_url.h:53
@ GLOBUS_URL_SCHEME_HTTPS
Definition globus_url.h:59
@ GLOBUS_URL_SCHEME_UNKNOWN
Definition globus_url.h:69
@ GLOBUS_URL_SCHEME_X_GASS_CACHE
Definition globus_url.h:67
Parsed URLs.
Definition globus_url.h:89
unsigned short port
Definition globus_url.h:114
char * url_path
Definition globus_url.h:116
char * attributes
Definition globus_url.h:120
char * url_specific_part
Definition globus_url.h:126
char * host
Definition globus_url.h:112
char * dn
Definition globus_url.h:118
char * user
Definition globus_url.h:110
char * password
Definition globus_url.h:111
char * scope
Definition globus_url.h:122
char * scheme
Definition globus_url.h:91
globus_url_scheme_t scheme_type
Definition globus_url.h:94
char * filter
Definition globus_url.h:123