1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ |
---|
2 | /* gnome-vfs-uri.h - URI handling for the GNOME Virtual File System. |
---|
3 | |
---|
4 | Copyright (C) 1999 Free Software Foundation |
---|
5 | |
---|
6 | The Gnome Library is free software; you can redistribute it and/or |
---|
7 | modify it under the terms of the GNU Library General Public License as |
---|
8 | published by the Free Software Foundation; either version 2 of the |
---|
9 | License, or (at your option) any later version. |
---|
10 | |
---|
11 | The Gnome Library is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | Library General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU Library General Public |
---|
17 | License along with the Gnome Library; see the file COPYING.LIB. If not, |
---|
18 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
19 | Boston, MA 02111-1307, USA. |
---|
20 | |
---|
21 | Author: Ettore Perazzoli <ettore@comm2000.it> |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef GNOME_VFS_URI_H |
---|
25 | #define GNOME_VFS_URI_H |
---|
26 | |
---|
27 | #include <glib.h> |
---|
28 | |
---|
29 | /* This describes a URI element. */ |
---|
30 | typedef struct GnomeVFSURI { |
---|
31 | /* Reference count. */ |
---|
32 | guint ref_count; |
---|
33 | |
---|
34 | /* Text for the element: eg. some/path/name. */ |
---|
35 | gchar *text; |
---|
36 | |
---|
37 | /* Text for uri fragment: eg, #anchor */ |
---|
38 | gchar *fragment_id; |
---|
39 | |
---|
40 | /* Method string: eg. `gzip', `tar', `http'. This is necessary as |
---|
41 | one GnomeVFSMethod can be used for different method strings |
---|
42 | (e.g. extfs handles zip, rar, zoo and several other ones). */ |
---|
43 | gchar *method_string; |
---|
44 | |
---|
45 | /* VFS method to access the element. */ |
---|
46 | struct GnomeVFSMethod *method; |
---|
47 | |
---|
48 | /* Pointer to the parent element, or NULL for toplevel elements. */ |
---|
49 | struct GnomeVFSURI *parent; |
---|
50 | } GnomeVFSURI; |
---|
51 | |
---|
52 | /* This is the toplevel URI element. A toplevel method implementations should |
---|
53 | cast the `GnomeVFSURI' argument to this type to get the additional host/auth |
---|
54 | information. If any of the elements is 0, it is unspecified. */ |
---|
55 | typedef struct { |
---|
56 | /* Base object. */ |
---|
57 | GnomeVFSURI uri; |
---|
58 | |
---|
59 | /* Server location information. */ |
---|
60 | gchar *host_name; |
---|
61 | guint host_port; |
---|
62 | |
---|
63 | /* Authorization information. */ |
---|
64 | gchar *user_name; |
---|
65 | gchar *password; |
---|
66 | |
---|
67 | /* The parent URN, if it exists */ |
---|
68 | gchar *urn; |
---|
69 | } GnomeVFSToplevelURI; |
---|
70 | |
---|
71 | |
---|
72 | /* This is used for hiding information when transforming the GnomeVFSURI into a |
---|
73 | string. */ |
---|
74 | typedef enum { |
---|
75 | GNOME_VFS_URI_HIDE_NONE = 0, |
---|
76 | GNOME_VFS_URI_HIDE_USER_NAME = 1 << 0, |
---|
77 | GNOME_VFS_URI_HIDE_PASSWORD = 1 << 1, |
---|
78 | GNOME_VFS_URI_HIDE_HOST_NAME = 1 << 2, |
---|
79 | GNOME_VFS_URI_HIDE_HOST_PORT = 1 << 3, |
---|
80 | GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD = 1 << 4, |
---|
81 | GNOME_VFS_URI_HIDE_FRAGMENT_IDENTIFIER = 1 << 8 |
---|
82 | } GnomeVFSURIHideOptions; |
---|
83 | |
---|
84 | |
---|
85 | /* CONSTANTS */ |
---|
86 | #define GNOME_VFS_URI_MAGIC_CHR '#' |
---|
87 | #define GNOME_VFS_URI_MAGIC_STR "#" |
---|
88 | |
---|
89 | #define GNOME_VFS_URI_PATH_CHR '/' |
---|
90 | #define GNOME_VFS_URI_PATH_STR "/" |
---|
91 | |
---|
92 | /* FUNCTIONS */ |
---|
93 | GnomeVFSURI *gnome_vfs_uri_new (const gchar *text_uri); |
---|
94 | GnomeVFSURI *gnome_vfs_uri_resolve_relative (const GnomeVFSURI *base, |
---|
95 | const char *relative_reference); |
---|
96 | GnomeVFSURI *gnome_vfs_uri_ref (GnomeVFSURI *uri); |
---|
97 | void gnome_vfs_uri_unref (GnomeVFSURI *uri); |
---|
98 | |
---|
99 | GnomeVFSURI *gnome_vfs_uri_append_string (const GnomeVFSURI *uri, |
---|
100 | const char *path); |
---|
101 | GnomeVFSURI *gnome_vfs_uri_append_path (const GnomeVFSURI *uri, |
---|
102 | const char *path); |
---|
103 | GnomeVFSURI *gnome_vfs_uri_append_file_name (const GnomeVFSURI *uri, |
---|
104 | const char *filename); |
---|
105 | char *gnome_vfs_uri_to_string (const GnomeVFSURI *uri, |
---|
106 | GnomeVFSURIHideOptions hide_options); |
---|
107 | GnomeVFSURI *gnome_vfs_uri_dup (const GnomeVFSURI *uri); |
---|
108 | gboolean gnome_vfs_uri_is_local (const GnomeVFSURI *uri); |
---|
109 | gboolean gnome_vfs_uri_has_parent (const GnomeVFSURI *uri); |
---|
110 | GnomeVFSURI *gnome_vfs_uri_get_parent (const GnomeVFSURI *uri); |
---|
111 | |
---|
112 | GnomeVFSToplevelURI *gnome_vfs_uri_get_toplevel (const GnomeVFSURI *uri); |
---|
113 | |
---|
114 | const char *gnome_vfs_uri_get_host_name (const GnomeVFSURI *uri); |
---|
115 | const char *gnome_vfs_uri_get_scheme (const GnomeVFSURI *uri); |
---|
116 | guint gnome_vfs_uri_get_host_port (const GnomeVFSURI *uri); |
---|
117 | const char *gnome_vfs_uri_get_user_name (const GnomeVFSURI *uri); |
---|
118 | const char *gnome_vfs_uri_get_password (const GnomeVFSURI *uri); |
---|
119 | |
---|
120 | void gnome_vfs_uri_set_host_name (GnomeVFSURI *uri, |
---|
121 | const char *host_name); |
---|
122 | void gnome_vfs_uri_set_host_port (GnomeVFSURI *uri, |
---|
123 | guint host_port); |
---|
124 | void gnome_vfs_uri_set_user_name (GnomeVFSURI *uri, |
---|
125 | const char *user_name); |
---|
126 | void gnome_vfs_uri_set_password (GnomeVFSURI *uri, |
---|
127 | const char *password); |
---|
128 | |
---|
129 | gboolean gnome_vfs_uri_equal (const GnomeVFSURI *a, |
---|
130 | const GnomeVFSURI *b); |
---|
131 | |
---|
132 | gboolean gnome_vfs_uri_is_parent (const GnomeVFSURI *parent, |
---|
133 | const GnomeVFSURI *item, |
---|
134 | gboolean recursive); |
---|
135 | |
---|
136 | const char *gnome_vfs_uri_get_path (const GnomeVFSURI *uri); |
---|
137 | const char *gnome_vfs_uri_get_basename (const GnomeVFSURI *uri); |
---|
138 | const char *gnome_vfs_uri_get_fragment_identifier (const GnomeVFSURI *uri); |
---|
139 | char *gnome_vfs_uri_extract_dirname (const GnomeVFSURI *uri); |
---|
140 | char *gnome_vfs_uri_extract_short_name (const GnomeVFSURI *uri); |
---|
141 | char *gnome_vfs_uri_extract_short_path_name (const GnomeVFSURI *uri); |
---|
142 | |
---|
143 | gint gnome_vfs_uri_hequal (gconstpointer a, |
---|
144 | gconstpointer b); |
---|
145 | guint gnome_vfs_uri_hash (gconstpointer p); |
---|
146 | |
---|
147 | GList *gnome_vfs_uri_list_ref (GList *list); |
---|
148 | GList *gnome_vfs_uri_list_unref (GList *list); |
---|
149 | GList *gnome_vfs_uri_list_copy (GList *list); |
---|
150 | void gnome_vfs_uri_list_free (GList *list); |
---|
151 | |
---|
152 | #endif /* GNOME_VFS_URI_H */ |
---|