Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / camel-url.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-url.h : utility functions to parse URLs */
3
4 /* 
5  * Authors:
6  *  Bertrand Guiheneuf <bertrand@helixcode.com>
7  *  Dan Winship <danw@ximian.com>
8  *
9  * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
10  *
11  * This program is free software; you can redistribute it and/or 
12  * modify it under the terms of version 2 of the GNU Lesser General Public 
13  * License as published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
23  * USA
24  */
25
26
27 #ifndef CAMEL_URL_H
28 #define CAMEL_URL_H 1
29
30 #include <glib.h>
31 #include <camel/camel-types.h>
32
33 G_BEGIN_DECLS
34
35 /* if this changes, remember to change camel_url_copy */
36 typedef struct _CamelURL {
37         char  *protocol;
38         char  *user;
39         char  *authmech;
40         char  *passwd;
41         char  *host;
42         int    port;
43         char  *path;
44         GData *params;
45         char  *query;
46         char  *fragment;
47 } CamelURL;
48
49 #define CAMEL_URL_HIDE_PASSWORD (1 << 0)
50 #define CAMEL_URL_HIDE_PARAMS   (1 << 1)
51 #define CAMEL_URL_HIDE_AUTH     (1 << 2)
52
53 #define CAMEL_URL_HIDE_ALL (CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS | CAMEL_URL_HIDE_AUTH)
54
55 CamelURL *camel_url_new_with_base (CamelURL *base, const char *url_string);
56 CamelURL *camel_url_new (const char *url_string, CamelException *ex);
57 char *camel_url_to_string (CamelURL *url, guint32 flags);
58 void camel_url_free (CamelURL *url);
59
60 char *camel_url_encode (const char *part, const char *escape_extra);
61 void camel_url_decode (char *part);
62 char *camel_url_decode_path (const char *path);
63
64 /* for editing url's */
65 void camel_url_set_protocol (CamelURL *url, const char *protocol);
66 void camel_url_set_user (CamelURL *url, const char *user);
67 void camel_url_set_authmech (CamelURL *url, const char *authmech);
68 void camel_url_set_passwd (CamelURL *url, const char *passwd);
69 void camel_url_set_host (CamelURL *url, const char *host);
70 void camel_url_set_port (CamelURL *url, int port);
71 void camel_url_set_path (CamelURL *url, const char *path);
72 void camel_url_set_param (CamelURL *url, const char *name, const char *value);
73 void camel_url_set_query (CamelURL *url, const char *query);
74 void camel_url_set_fragment (CamelURL *url, const char *fragment);
75
76 const char *camel_url_get_param (CamelURL *url, const char *name);
77
78 /* for putting url's into hash tables */
79 guint camel_url_hash (const void *v);
80 int camel_url_equal(const void *v, const void *v2);
81 CamelURL *camel_url_copy(const CamelURL *in);
82
83 G_END_DECLS
84
85 #endif /* URL_UTIL_H */