camel-url

camel-url

Synopsis




                    CamelURL;
#define             CAMEL_URL_HIDE_PASSWORD
#define             CAMEL_URL_HIDE_PARAMS
#define             CAMEL_URL_HIDE_AUTH
#define             CAMEL_URL_HIDE_ALL
CamelURL*           camel_url_new_with_base             (CamelURL *base,
                                                         const char *url_string);
CamelURL*           camel_url_new                       (const char *url_string,
                                                         CamelException *ex);
char*               camel_url_to_string                 (CamelURL *url,
                                                         guint32 flags);
void                camel_url_free                      (CamelURL *url);
char*               camel_url_encode                    (const char *part,
                                                         const char *escape_extra);
void                camel_url_decode                    (char *part);
char*               camel_url_decode_path               (const char *path);
void                camel_url_set_protocol              (CamelURL *url,
                                                         const char *protocol);
void                camel_url_set_user                  (CamelURL *url,
                                                         const char *user);
void                camel_url_set_authmech              (CamelURL *url,
                                                         const char *authmech);
void                camel_url_set_passwd                (CamelURL *url,
                                                         const char *passwd);
void                camel_url_set_host                  (CamelURL *url,
                                                         const char *host);
void                camel_url_set_port                  (CamelURL *url,
                                                         int port);
void                camel_url_set_path                  (CamelURL *url,
                                                         const char *path);
void                camel_url_set_param                 (CamelURL *url,
                                                         const char *name,
                                                         const char *value);
void                camel_url_set_query                 (CamelURL *url,
                                                         const char *query);
void                camel_url_set_fragment              (CamelURL *url,
                                                         const char *fragment);
const char*         camel_url_get_param                 (CamelURL *url,
                                                         const char *name);
guint               camel_url_hash                      (const void *v);
int                 camel_url_equal                     (const void *v,
                                                         const void *v2);
CamelURL*           camel_url_copy                      (const CamelURL *in);

Description

Details

CamelURL

typedef struct {
	char  *protocol;
	char  *user;
	char  *authmech;
	char  *passwd;
	char  *host;
	int    port;
	char  *path;
	GData *params;
	char  *query;
	char  *fragment;
} CamelURL;


CAMEL_URL_HIDE_PASSWORD

#define CAMEL_URL_HIDE_PASSWORD	(1 << 0)


CAMEL_URL_HIDE_PARAMS

#define CAMEL_URL_HIDE_PARAMS	(1 << 1)


CAMEL_URL_HIDE_AUTH

#define CAMEL_URL_HIDE_AUTH	(1 << 2)


CAMEL_URL_HIDE_ALL

#define CAMEL_URL_HIDE_ALL (CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS | CAMEL_URL_HIDE_AUTH)


camel_url_new_with_base ()

CamelURL*           camel_url_new_with_base             (CamelURL *base,
                                                         const char *url_string);

Parses url_string relative to base.

base :

a base URL

url_string :

the URL

Returns :

a parsed CamelURL

camel_url_new ()

CamelURL*           camel_url_new                       (const char *url_string,
                                                         CamelException *ex);

Parses an absolute URL.

url_string :

a URL string

ex :

a CamelException

Returns :

a CamelURL if it can be parsed, or NULL otherwise

camel_url_to_string ()

char*               camel_url_to_string                 (CamelURL *url,
                                                         guint32 flags);

Flatten a CamelURL into a string.

url :

a CamelURL

flags :

additional translation options

Returns :

a string representing url, which the caller must free

camel_url_free ()

void                camel_url_free                      (CamelURL *url);

Frees url.

url :

a CamelURL

camel_url_encode ()

char*               camel_url_encode                    (const char *part,
                                                         const char *escape_extra);

This -encodes the given URL part and returns the escaped version in allocated memory, which the caller must free when it is done.

part :

a URL part

escape_extra :

additional characters beyond " \"%#<>{}|\^[]`" to escape (or NULL)

Returns :

the encoded string

camel_url_decode ()

void                camel_url_decode                    (char *part);

-decodes the passed-in URL *in place*. The decoded version is never longer than the encoded version, so there does not need to be any additional space at the end of the string.

part :

a URL part

camel_url_decode_path ()

char*               camel_url_decode_path               (const char *path);

path :

Returns :


camel_url_set_protocol ()

void                camel_url_set_protocol              (CamelURL *url,
                                                         const char *protocol);

Set the protocol of a CamelURL.

url :

a CamelURL

protocol :

protocol schema

camel_url_set_user ()

void                camel_url_set_user                  (CamelURL *url,
                                                         const char *user);

Set the user of a CamelURL.

url :

a CamelURL

user :

username

camel_url_set_authmech ()

void                camel_url_set_authmech              (CamelURL *url,
                                                         const char *authmech);

Set the authmech of a CamelURL.

url :

a CamelURL

authmech :

authentication mechanism

camel_url_set_passwd ()

void                camel_url_set_passwd                (CamelURL *url,
                                                         const char *passwd);

Set the password of a CamelURL.

url :

a CamelURL

passwd :

password

camel_url_set_host ()

void                camel_url_set_host                  (CamelURL *url,
                                                         const char *host);

Set the hostname of a CamelURL.

url :

a CamelURL

host :

hostname

camel_url_set_port ()

void                camel_url_set_port                  (CamelURL *url,
                                                         int port);

Set the port on a CamelURL.

url :

a CamelURL

port :

port

camel_url_set_path ()

void                camel_url_set_path                  (CamelURL *url,
                                                         const char *path);

Set the path component of a CamelURL.

url :

a CamelURL

path :

path

camel_url_set_param ()

void                camel_url_set_param                 (CamelURL *url,
                                                         const char *name,
                                                         const char *value);

Set a param on the CamelURL.

url :

a CamelURL

name :

name of the param to set

value :

value of the param to set

camel_url_set_query ()

void                camel_url_set_query                 (CamelURL *url,
                                                         const char *query);

Set the query of a CamelURL.

url :

a CamelURL

query :

url query

camel_url_set_fragment ()

void                camel_url_set_fragment              (CamelURL *url,
                                                         const char *fragment);

Set the fragment of a CamelURL.

url :

a CamelURL

fragment :

url fragment

camel_url_get_param ()

const char*         camel_url_get_param                 (CamelURL *url,
                                                         const char *name);

Get the value of the specified param on the URL.

url :

a CamelURL

name :

name of the param

Returns :

the value of a param if found or NULL otherwise

camel_url_hash ()

guint               camel_url_hash                      (const void *v);

v :

Returns :


camel_url_equal ()

int                 camel_url_equal                     (const void *v,
                                                         const void *v2);

v :

v2 :

Returns :


camel_url_copy ()

CamelURL*           camel_url_copy                      (const CamelURL *in);

Copy a CamelURL.

in :

a CamelURL to copy

Returns :

a duplicate copy of in