globus_url.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef GLOBUS_URL_H
00018 #define GLOBUS_URL_H
00019 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 /* Supported URL Schemes */
00049 typedef enum
00050 {
00052     GLOBUS_URL_SCHEME_FTP=0,
00054     GLOBUS_URL_SCHEME_GSIFTP,
00056     GLOBUS_URL_SCHEME_HTTP,
00058     GLOBUS_URL_SCHEME_HTTPS,
00060     GLOBUS_URL_SCHEME_LDAP,
00062     GLOBUS_URL_SCHEME_FILE,
00064     GLOBUS_URL_SCHEME_X_NEXUS,
00066     GLOBUS_URL_SCHEME_X_GASS_CACHE,
00068     GLOBUS_URL_SCHEME_UNKNOWN,
00069     GLOBUS_URL_SCHEME_SSHFTP,
00071     GLOBUS_URL_NUM_SCHEMES
00072 } globus_url_scheme_t;
00073 
00074 /*
00075   Other schemes defined in RFCs but _not_ supported here are 
00076  'news', 'nntp', 'telnet', 'gopher', 'wais', 'mailto', and 'prospero'
00077 */
00078 
00087 typedef struct
00088 {
00090     char *scheme;
00091 
00093     globus_url_scheme_t scheme_type;
00094 
00095 
00096     /*
00097      * Other fields as seen in these known url schemes:
00098      *
00099      * ftp://[user[:password]@]host[:port]/[url_path]
00100      * gsiftp://[user[:password]@]host[:port]/[url_path]
00101      * http://host[:port]/url_path
00102      * x-nexus://host:port
00103      * x-gass-cache://url_path
00104      * ldap://host[:port]/dn?attributes?scope?filter
00105      * otherurl://host[:port]/url_path or
00106      * otherurl://url_specific_part
00107      */
00108 
00109     char *user;         
00110     char *password;     
00111     char *host;         
00113     unsigned short port;
00115     char *url_path;     
00117     char *dn;           
00119     char *attributes;   
00121     char *scope;        
00122     char *filter;       
00125     char *url_specific_part;
00130 } globus_url_t;
00131 
00132 /* Fill in the data structure pointed to by url */
00133 int globus_url_parse(const char *url_string, globus_url_t *url);
00134 
00135 /* Fill in the data structure pointed to by url */
00136 int globus_url_parse_rfc1738(const char *url_string, globus_url_t *url);
00137 
00138 /* Fill in the data structure pointed to by url */
00139 int globus_url_parse_loose(const char *url_string, globus_url_t *url);
00140 
00141 /* Destroy the fields of the data structure pointed to by url */
00142 int globus_url_destroy(globus_url_t *url);
00143 
00144 /* Create a copy of a globus_url_t structure */
00145 int globus_url_copy(globus_url_t * dest, const globus_url_t * src);
00146 
00147 /* Find out the URL scheme type */
00148 int globus_url_get_scheme(const char *url_string,
00149                           globus_url_scheme_t *scheme_type);
00150 
00151 
00152 void
00153 globus_url_string_hex_decode(
00154     char *                              s);
00155 
00156 char *
00157 globus_url_string_hex_encode(
00158     const char *                        s,
00159     const char *                        enc);
00160 
00161 /* Return conditions */
00162 #define GLOBUS_URL_SUCCESS 0
00163 #define GLOBUS_URL_ERROR_NULL_STRING -1
00164 #define GLOBUS_URL_ERROR_NULL_URL -2
00165 #define GLOBUS_URL_ERROR_BAD_SCHEME -3
00166 #define GLOBUS_URL_ERROR_BAD_USER -4
00167 #define GLOBUS_URL_ERROR_BAD_PASSWORD -5
00168 #define GLOBUS_URL_ERROR_BAD_HOST -6
00169 #define GLOBUS_URL_ERROR_BAD_PORT -7
00170 #define GLOBUS_URL_ERROR_BAD_PATH -8
00171 
00172 /* for ldap URLs */
00173 #define GLOBUS_URL_ERROR_BAD_DN -9
00174 #define GLOBUS_URL_ERROR_BAD_ATTRIBUTES -10
00175 #define GLOBUS_URL_ERROR_BAD_SCOPE -11
00176 #define GLOBUS_URL_ERROR_BAD_FILTER -12
00177 
00178 /* when malloc fails */
00179 #define GLOBUS_URL_ERROR_OUT_OF_MEMORY -13
00180 
00181 /* for nexus errors/former assertion failures */
00182 #define GLOBUS_URL_ERROR_INTERNAL_ERROR -14
00183 
00184 #define GLOBUS_URL_TRUE 1
00185 #define GLOBUS_URL_FALSE 0
00186 
00187 
00188 #ifdef __cplusplus
00189 }
00190 #endif
00191 
00192 #endif /* GLOBUS_URL_H */

Generated on 20 Jun 2015 for globus_common by  doxygen 1.4.7