Diffstat (limited to 'libical/src/libicalss/icalss.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libicalss/icalss.h | 719 |
1 files changed, 302 insertions, 417 deletions
diff --git a/libical/src/libicalss/icalss.h b/libical/src/libicalss/icalss.h index cd07919..8930e11 100644 --- a/libical/src/libicalss/icalss.h +++ b/libical/src/libicalss/icalss.h | |||
@@ -1,563 +1,721 @@ | |||
1 | #ifdef __cplusplus | ||
2 | extern "C" { | ||
3 | #endif | ||
4 | /* | ||
5 | $Id$ | ||
6 | */ | ||
1 | /* -*- Mode: C -*- */ | 7 | /* -*- Mode: C -*- */ |
2 | /*====================================================================== | 8 | /*====================================================================== |
3 | FILE: icalgauge.h | 9 | FILE: icalgauge.h |
4 | CREATOR: eric 23 December 1999 | 10 | CREATOR: eric 23 December 1999 |
5 | 11 | ||
6 | 12 | ||
7 | $Id$ | ||
8 | $Locker$ | ||
9 | 13 | ||
10 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 14 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
11 | 15 | ||
12 | This program is free software; you can redistribute it and/or modify | 16 | This program is free software; you can redistribute it and/or modify |
13 | it under the terms of either: | 17 | it under the terms of either: |
14 | 18 | ||
15 | The LGPL as published by the Free Software Foundation, version | 19 | The LGPL as published by the Free Software Foundation, version |
16 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 20 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
17 | 21 | ||
18 | Or: | 22 | Or: |
19 | 23 | ||
20 | The Mozilla Public License Version 1.0. You may obtain a copy of | 24 | The Mozilla Public License Version 1.0. You may obtain a copy of |
21 | the License at http://www.mozilla.org/MPL/ | 25 | the License at http://www.mozilla.org/MPL/ |
22 | 26 | ||
23 | The Original Code is eric. The Initial Developer of the Original | 27 | The Original Code is eric. The Initial Developer of the Original |
24 | Code is Eric Busboom | 28 | Code is Eric Busboom |
25 | 29 | ||
26 | 30 | ||
27 | ======================================================================*/ | 31 | ======================================================================*/ |
28 | 32 | ||
29 | #ifndef ICALGAUGE_H | 33 | #ifndef ICALGAUGE_H |
30 | #define ICALGAUGE_H | 34 | #define ICALGAUGE_H |
31 | 35 | ||
32 | typedef void icalgauge; | 36 | /** @file icalgauge.h |
37 | * @brief Routines implementing a filter for ical components | ||
38 | */ | ||
33 | 39 | ||
34 | icalgauge* icalgauge_new_from_sql(char* sql); | 40 | typedef struct icalgauge_impl icalgauge; |
41 | |||
42 | icalgauge* icalgauge_new_from_sql(char* sql, int expand); | ||
43 | |||
44 | int icalgauge_get_expand(icalgauge* gauge); | ||
35 | 45 | ||
36 | void icalgauge_free(icalgauge* gauge); | 46 | void icalgauge_free(icalgauge* gauge); |
37 | 47 | ||
38 | char* icalgauge_as_sql(icalcomponent* gauge); | 48 | char* icalgauge_as_sql(icalcomponent* gauge); |
39 | 49 | ||
40 | void icalgauge_dump(icalcomponent* gauge); | 50 | void icalgauge_dump(icalgauge* gauge); |
51 | |||
41 | 52 | ||
42 | /* Return true is comp matches the gauge. The component must be in | 53 | /** @brief Return true if comp matches the gauge. |
43 | cannonical form -- a VCALENDAR with one VEVENT, VTODO or VJOURNAL | 54 | * |
44 | sub component */ | 55 | * The component must be in |
56 | * cannonical form -- a VCALENDAR with one VEVENT, VTODO or VJOURNAL | ||
57 | * sub component | ||
58 | */ | ||
45 | int icalgauge_compare(icalgauge* g, icalcomponent* comp); | 59 | int icalgauge_compare(icalgauge* g, icalcomponent* comp); |
46 | 60 | ||
47 | /* Clone the component, but only return the properties specified in | 61 | /** Clone the component, but only return the properties |
48 | the gauge */ | 62 | * specified in the gauge */ |
49 | icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp); | 63 | icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp); |
50 | 64 | ||
51 | #endif /* ICALGAUGE_H*/ | 65 | #endif /* ICALGAUGE_H*/ |
52 | /* -*- Mode: C -*- */ | 66 | /* -*- Mode: C -*- */ |
53 | /*====================================================================== | 67 | /** |
54 | FILE: icalset.h | 68 | @file icalset.h |
55 | CREATOR: eric 28 November 1999 | 69 | @author eric 28 November 1999 |
56 | |||
57 | 70 | ||
58 | Icalset is the "base class" for representations of a collection of | 71 | Icalset is the "base class" for representations of a collection of |
59 | iCal components. Derived classes (actually delegatees) include: | 72 | iCal components. Derived classes (actually delegatees) include: |
60 | 73 | ||
61 | icalfileset Store componetns in a single file | 74 | icalfileset Store components in a single file |
62 | icaldirset Store components in multiple files in a directory | 75 | icaldirset Store components in multiple files in a directory |
76 | icalbdbset Store components in a Berkeley DB File | ||
63 | icalheapset Store components on the heap | 77 | icalheapset Store components on the heap |
64 | icalmysqlset Store components in a mysql database. | 78 | icalmysqlset Store components in a mysql database. |
79 | **/ | ||
65 | 80 | ||
66 | $Id$ | 81 | /* |
67 | $Locker$ | ||
68 | 82 | ||
69 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 83 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
70 | 84 | ||
71 | This program is free software; you can redistribute it and/or modify | 85 | This program is free software; you can redistribute it and/or modify |
72 | it under the terms of either: | 86 | it under the terms of either: |
73 | 87 | ||
74 | The LGPL as published by the Free Software Foundation, version | 88 | The LGPL as published by the Free Software Foundation, version |
75 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 89 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
76 | 90 | ||
77 | Or: | 91 | Or: |
78 | 92 | ||
79 | The Mozilla Public License Version 1.0. You may obtain a copy of | 93 | The Mozilla Public License Version 1.0. You may obtain a copy of |
80 | the License at http://www.mozilla.org/MPL/ | 94 | the License at http://www.mozilla.org/MPL/ |
81 | 95 | ||
82 | The Original Code is eric. The Initial Developer of the Original | 96 | The Original Code is eric. The Initial Developer of the Original |
83 | Code is Eric Busboom | 97 | Code is Eric Busboom |
84 | 98 | ||
85 | 99 | ||
86 | ======================================================================*/ | 100 | ======================================================================*/ |
87 | 101 | ||
88 | #ifndef ICALSET_H | 102 | #ifndef ICALSET_H |
89 | #define ICALSET_H | 103 | #define ICALSET_H |
90 | 104 | ||
91 | #include <limits.h> /* For PATH_MAX */ | 105 | #include <limits.h> /* For PATH_MAX */ |
92 | 106 | ||
93 | #ifdef PATH_MAX | 107 | #ifdef PATH_MAX |
94 | #define ICAL_PATH_MAX PATH_MAX | 108 | #define ICAL_PATH_MAX PATH_MAX |
95 | #else | 109 | #else |
96 | #define ICAL_PATH_MAX 1024 | 110 | #define ICAL_PATH_MAX 1024 |
97 | #endif | 111 | #endif |
98 | 112 | ||
99 | 113 | ||
100 | #ifdef _WIN32 | 114 | typedef struct icalset_impl icalset; |
101 | #define mode_t int | ||
102 | #endif | ||
103 | |||
104 | |||
105 | |||
106 | typedef void icalset; | ||
107 | 115 | ||
108 | typedef enum icalset_kind { | 116 | typedef enum icalset_kind { |
109 | ICAL_FILE_SET, | 117 | ICAL_FILE_SET, |
110 | ICAL_DIR_SET, | 118 | ICAL_DIR_SET, |
111 | ICAL_HEAP_SET, | 119 | ICAL_BDB_SET |
112 | ICAL_MYSQL_SET, | ||
113 | ICAL_CAP_SET | ||
114 | } icalset_kind; | 120 | } icalset_kind; |
115 | 121 | ||
122 | typedef struct icalsetiter | ||
123 | { | ||
124 | icalcompiter iter; /* icalcomponent_kind, pvl_elem iter */ | ||
125 | icalgauge* gauge; | ||
126 | icalrecur_iterator* ritr; /*the last iterator*/ | ||
127 | icalcomponent* last_component; /*the pending recurring component to be processed */ | ||
128 | const char* tzid; /* the calendar's timezone id */ | ||
129 | } icalsetiter; | ||
130 | |||
131 | struct icalset_impl { | ||
132 | icalset_kind kind; | ||
133 | int size; | ||
134 | char *dsn; | ||
135 | icalset* (*init)(icalset* set, const char *dsn, void *options); | ||
136 | void (*free)(icalset* set); | ||
137 | const char* (*path)(icalset* set); | ||
138 | void (*mark)(icalset* set); | ||
139 | icalerrorenum (*commit)(icalset* set); | ||
140 | icalerrorenum (*add_component)(icalset* set, icalcomponent* comp); | ||
141 | icalerrorenum (*remove_component)(icalset* set, icalcomponent* comp); | ||
142 | int (*count_components)(icalset* set, | ||
143 | icalcomponent_kind kind); | ||
144 | icalerrorenum (*select)(icalset* set, icalgauge* gauge); | ||
145 | void (*clear)(icalset* set); | ||
146 | icalcomponent* (*fetch)(icalset* set, const char* uid); | ||
147 | icalcomponent* (*fetch_match)(icalset* set, icalcomponent *comp); | ||
148 | int (*has_uid)(icalset* set, const char* uid); | ||
149 | icalerrorenum (*modify)(icalset* set, icalcomponent *old, | ||
150 | icalcomponent *newc); | ||
151 | icalcomponent* (*get_current_component)(icalset* set); | ||
152 | icalcomponent* (*get_first_component)(icalset* set); | ||
153 | icalcomponent* (*get_next_component)(icalset* set); | ||
154 | icalsetiter (*icalset_begin_component)(icalset* set, | ||
155 | icalcomponent_kind kind, icalgauge* gauge); | ||
156 | icalcomponent* (*icalsetiter_to_next)(icalset* set, icalsetiter* i); | ||
157 | icalcomponent* (*icalsetiter_to_prior)(icalset* set, icalsetiter* i); | ||
158 | }; | ||
159 | |||
160 | /** @brief Register a new derived class */ | ||
161 | int icalset_register_class(icalset *set); | ||
162 | |||
163 | |||
164 | /** @brief Generic icalset constructor | ||
165 | * | ||
166 | * @param kind The type of icalset to create | ||
167 | * @param dsn Data Source Name - usually a pathname or DB handle | ||
168 | * @param options Any implementation specific options | ||
169 | * | ||
170 | * @return A valid icalset reference or NULL if error. | ||
171 | * | ||
172 | * This creates any of the icalset types available. | ||
173 | */ | ||
174 | |||
175 | icalset* icalset_new(icalset_kind kind, const char* dsn, void* options); | ||
116 | 176 | ||
117 | /* Create a specific derived type of set */ | ||
118 | icalset* icalset_new_file(const char* path); | 177 | icalset* icalset_new_file(const char* path); |
178 | icalset* icalset_new_file_reader(const char* path); | ||
179 | icalset* icalset_new_file_writer(const char* path); | ||
180 | |||
119 | icalset* icalset_new_dir(const char* path); | 181 | icalset* icalset_new_dir(const char* path); |
120 | icalset* icalset_new_heap(void); | 182 | icalset* icalset_new_file_reader(const char* path); |
121 | icalset* icalset_new_mysql(const char* path); | 183 | icalset* icalset_new_file_writer(const char* path); |
122 | /*icalset* icalset_new_cap(icalcstp* cstp);*/ | ||
123 | 184 | ||
124 | void icalset_free(icalset* set); | 185 | void icalset_free(icalset* set); |
125 | 186 | ||
126 | const char* icalset_path(icalset* set); | 187 | const char* icalset_path(icalset* set); |
127 | 188 | ||
128 | /* Mark the cluster as changed, so it will be written to disk when it | 189 | /** Mark the cluster as changed, so it will be written to disk when it |
129 | is freed. Commit writes to disk immediately*/ | 190 | is freed. **/ |
130 | void icalset_mark(icalset* set); | 191 | void icalset_mark(icalset* set); |
192 | |||
193 | /** Write changes to disk immediately */ | ||
131 | icalerrorenum icalset_commit(icalset* set); | 194 | icalerrorenum icalset_commit(icalset* set); |
132 | 195 | ||
133 | icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp); | 196 | icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp); |
134 | icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp); | 197 | icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp); |
135 | 198 | ||
136 | int icalset_count_components(icalset* set, | 199 | int icalset_count_components(icalset* set, |
137 | icalcomponent_kind kind); | 200 | icalcomponent_kind kind); |
138 | 201 | ||
139 | /* Restrict the component returned by icalset_first, _next to those | 202 | /** Restrict the component returned by icalset_first, _next to those |
140 | that pass the gauge. _clear removes the gauge. */ | 203 | that pass the gauge. */ |
141 | icalerrorenum icalset_select(icalset* set, icalcomponent* gauge); | 204 | icalerrorenum icalset_select(icalset* set, icalgauge* gauge); |
205 | |||
206 | /** Clears the gauge defined by icalset_select() */ | ||
142 | void icalset_clear_select(icalset* set); | 207 | void icalset_clear_select(icalset* set); |
143 | 208 | ||
144 | /* Get a component by uid */ | 209 | /** Get a component by uid */ |
145 | icalcomponent* icalset_fetch(icalset* set, const char* uid); | 210 | icalcomponent* icalset_fetch(icalset* set, const char* uid); |
211 | |||
146 | int icalset_has_uid(icalset* set, const char* uid); | 212 | int icalset_has_uid(icalset* set, const char* uid); |
147 | icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *c); | 213 | icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *c); |
148 | 214 | ||
149 | /* Modify components according to the MODIFY method of CAP. Works on | 215 | /** Modify components according to the MODIFY method of CAP. Works on |
150 | the currently selected components. */ | 216 | the currently selected components. */ |
151 | icalerrorenum icalset_modify(icalset* set, icalcomponent *oldc, | 217 | icalerrorenum icalset_modify(icalset* set, icalcomponent *oldc, |
152 | icalcomponent *newc); | 218 | icalcomponent *newc); |
153 | 219 | ||
154 | /* Iterate through the components. If a guage has been defined, these | 220 | /** Iterate through the components. If a guage has been defined, these |
155 | will skip over components that do not pass the gauge */ | 221 | will skip over components that do not pass the gauge */ |
156 | 222 | ||
157 | icalcomponent* icalset_get_current_component(icalset* set); | 223 | icalcomponent* icalset_get_current_component(icalset* set); |
158 | icalcomponent* icalset_get_first_component(icalset* set); | 224 | icalcomponent* icalset_get_first_component(icalset* set); |
159 | icalcomponent* icalset_get_next_component(icalset* set); | 225 | icalcomponent* icalset_get_next_component(icalset* set); |
160 | 226 | ||
227 | /** External Iterator with gauge - for thread safety */ | ||
228 | extern icalsetiter icalsetiter_null; | ||
229 | |||
230 | icalsetiter icalset_begin_component(icalset* set, | ||
231 | icalcomponent_kind kind, icalgauge* gauge); | ||
232 | |||
233 | /** Default _next, _prior, _deref for subclasses that use single cluster */ | ||
234 | icalcomponent* icalsetiter_next(icalsetiter* i); | ||
235 | icalcomponent* icalsetiter_prior(icalsetiter* i); | ||
236 | icalcomponent* icalsetiter_deref(icalsetiter* i); | ||
237 | |||
238 | /** for subclasses that use multiple clusters that require specialized cluster traversal */ | ||
239 | icalcomponent* icalsetiter_to_next(icalset* set, icalsetiter* i); | ||
240 | icalcomponent* icalsetiter_to_prior(icalset* set, icalsetiter* i); | ||
241 | |||
161 | #endif /* !ICALSET_H */ | 242 | #endif /* !ICALSET_H */ |
162 | 243 | ||
163 | 244 | ||
164 | 245 | ||
165 | /* -*- Mode: C -*- */ | 246 | /* -*- Mode: C -*- */ |
166 | /*====================================================================== | 247 | /*====================================================================== |
248 | FILE: icalcluster.h | ||
249 | CREATOR: eric 23 December 1999 | ||
250 | |||
251 | |||
252 | |||
253 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
254 | |||
255 | This program is free software; you can redistribute it and/or modify | ||
256 | it under the terms of either: | ||
257 | |||
258 | The LGPL as published by the Free Software Foundation, version | ||
259 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
260 | |||
261 | Or: | ||
262 | |||
263 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
264 | the License at http://www.mozilla.org/MPL/ | ||
265 | |||
266 | The Original Code is eric. The Initial Developer of the Original | ||
267 | Code is Eric Busboom | ||
268 | |||
269 | |||
270 | ======================================================================*/ | ||
271 | |||
272 | #ifndef ICALCLUSTER_H | ||
273 | #define ICALCLUSTER_H | ||
274 | |||
275 | |||
276 | typedef struct icalcluster_impl icalcluster; | ||
277 | |||
278 | icalcluster* icalcluster_new(const char *key, icalcomponent *data); | ||
279 | icalcluster* icalcluster_new_clone(const icalcluster *cluster); | ||
280 | |||
281 | void icalcluster_free(icalcluster *cluster); | ||
282 | |||
283 | const char* icalcluster_key(icalcluster *cluster); | ||
284 | int icalcluster_is_changed(icalcluster *cluster); | ||
285 | void icalcluster_mark(icalcluster *cluster); | ||
286 | void icalcluster_commit(icalcluster *cluster); | ||
287 | |||
288 | icalcomponent* icalcluster_get_component(icalcluster* cluster); | ||
289 | int icalcluster_count_components(icalcluster *cluster, icalcomponent_kind kind); | ||
290 | icalerrorenum icalcluster_add_component(icalcluster* cluster, | ||
291 | icalcomponent* child); | ||
292 | icalerrorenum icalcluster_remove_component(icalcluster* cluster, | ||
293 | icalcomponent* child); | ||
294 | |||
295 | icalcomponent* icalcluster_get_current_component(icalcluster* cluster); | ||
296 | icalcomponent* icalcluster_get_first_component(icalcluster* cluster); | ||
297 | icalcomponent* icalcluster_get_next_component(icalcluster* cluster); | ||
298 | |||
299 | #endif /* !ICALCLUSTER_H */ | ||
300 | |||
301 | |||
302 | |||
303 | /* -*- Mode: C -*- */ | ||
304 | /*====================================================================== | ||
167 | FILE: icalfileset.h | 305 | FILE: icalfileset.h |
168 | CREATOR: eric 23 December 1999 | 306 | CREATOR: eric 23 December 1999 |
169 | 307 | ||
170 | 308 | ||
171 | $Id$ | ||
172 | $Locker$ | ||
173 | 309 | ||
174 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 310 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
175 | 311 | ||
176 | This program is free software; you can redistribute it and/or modify | 312 | This program is free software; you can redistribute it and/or modify |
177 | it under the terms of either: | 313 | it under the terms of either: |
178 | 314 | ||
179 | The LGPL as published by the Free Software Foundation, version | 315 | The LGPL as published by the Free Software Foundation, version |
180 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 316 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
181 | 317 | ||
182 | Or: | 318 | Or: |
183 | 319 | ||
184 | The Mozilla Public License Version 1.0. You may obtain a copy of | 320 | The Mozilla Public License Version 1.0. You may obtain a copy of |
185 | the License at http://www.mozilla.org/MPL/ | 321 | the License at http://www.mozilla.org/MPL/ |
186 | 322 | ||
187 | The Original Code is eric. The Initial Developer of the Original | 323 | The Original Code is eric. The Initial Developer of the Original |
188 | Code is Eric Busboom | 324 | Code is Eric Busboom |
189 | 325 | ||
190 | 326 | ||
191 | ======================================================================*/ | 327 | ======================================================================*/ |
192 | 328 | ||
193 | #ifndef ICALFILESET_H | 329 | #ifndef ICALFILESET_H |
194 | #define ICALFILESET_H | 330 | #define ICALFILESET_H |
195 | 331 | ||
196 | #include <sys/types.h> /* For open() flags and mode */ | 332 | #include <sys/types.h> /* For open() flags and mode */ |
197 | #include <sys/stat.h> /* For open() flags and mode */ | 333 | #include <sys/stat.h> /* For open() flags and mode */ |
198 | #include <fcntl.h> /* For open() flags and mode */ | 334 | #include <fcntl.h> /* For open() flags and mode */ |
199 | 335 | ||
200 | extern int icalfileset_safe_saves; | 336 | #ifdef WIN32 |
337 | #define mode_t int | ||
338 | #endif | ||
201 | 339 | ||
202 | typedef void icalfileset; | 340 | extern int icalfileset_safe_saves; |
203 | 341 | ||
342 | typedef struct icalfileset_impl icalfileset; | ||
204 | 343 | ||
205 | /* icalfileset | 344 | icalset* icalfileset_new(const char* path); |
206 | icalfilesetfile | 345 | icalset* icalfileset_new_reader(const char* path); |
207 | icalfilesetdir | 346 | icalset* icalfileset_new_writer(const char* path); |
208 | */ | ||
209 | 347 | ||
348 | icalset* icalfileset_init(icalset *set, const char *dsn, void* options); | ||
210 | 349 | ||
211 | icalfileset* icalfileset_new(const char* path); | 350 | icalfileset* icalfileset_new_from_cluster(const char* path, icalcluster *cluster); |
212 | 351 | ||
213 | /* Like _new, but takes open() flags for opening the file */ | 352 | icalcluster* icalfileset_produce_icalcluster(const char *path); |
214 | icalfileset* icalfileset_new_open(const char* path, | ||
215 | int flags, mode_t mode); | ||
216 | 353 | ||
217 | void icalfileset_free(icalfileset* cluster); | 354 | void icalfileset_free(icalset* cluster); |
218 | 355 | ||
219 | const char* icalfileset_path(icalfileset* cluster); | 356 | const char* icalfileset_path(icalset* cluster); |
220 | 357 | ||
221 | /* Mark the cluster as changed, so it will be written to disk when it | 358 | /* Mark the cluster as changed, so it will be written to disk when it |
222 | is freed. Commit writes to disk immediately. */ | 359 | is freed. Commit writes to disk immediately. */ |
223 | void icalfileset_mark(icalfileset* cluster); | 360 | void icalfileset_mark(icalset* set); |
224 | icalerrorenum icalfileset_commit(icalfileset* cluster); | 361 | icalerrorenum icalfileset_commit(icalset* set); |
225 | 362 | ||
226 | icalerrorenum icalfileset_add_component(icalfileset* cluster, | 363 | icalerrorenum icalfileset_add_component(icalset* set, |
227 | icalcomponent* child); | 364 | icalcomponent* child); |
228 | 365 | ||
229 | icalerrorenum icalfileset_remove_component(icalfileset* cluster, | 366 | icalerrorenum icalfileset_remove_component(icalset* set, |
230 | icalcomponent* child); | 367 | icalcomponent* child); |
231 | 368 | ||
232 | int icalfileset_count_components(icalfileset* cluster, | 369 | int icalfileset_count_components(icalset* set, |
233 | icalcomponent_kind kind); | 370 | icalcomponent_kind kind); |
234 | 371 | ||
235 | /* Restrict the component returned by icalfileset_first, _next to those | 372 | /** |
236 | that pass the gauge. _clear removes the gauge */ | 373 | * Restrict the component returned by icalfileset_first, _next to those |
237 | icalerrorenum icalfileset_select(icalfileset* store, icalgauge* gauge); | 374 | * that pass the gauge. _clear removes the gauge |
238 | void icalfileset_clear(icalfileset* store); | 375 | */ |
376 | icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge); | ||
239 | 377 | ||
240 | /* Get and search for a component by uid */ | 378 | /** clear the gauge **/ |
241 | icalcomponent* icalfileset_fetch(icalfileset* cluster, const char* uid); | 379 | void icalfileset_clear(icalset* set); |
242 | int icalfileset_has_uid(icalfileset* cluster, const char* uid); | ||
243 | icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *c); | ||
244 | 380 | ||
381 | /** Get and search for a component by uid **/ | ||
382 | icalcomponent* icalfileset_fetch(icalset* set, const char* uid); | ||
383 | int icalfileset_has_uid(icalset* set, const char* uid); | ||
384 | icalcomponent* icalfileset_fetch_match(icalset* set, icalcomponent *c); | ||
245 | 385 | ||
246 | /* Modify components according to the MODIFY method of CAP. Works on | 386 | |
247 | the currently selected components. */ | 387 | /** |
248 | icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *oldcomp, | 388 | * Modify components according to the MODIFY method of CAP. Works on the |
389 | * currently selected components. | ||
390 | */ | ||
391 | icalerrorenum icalfileset_modify(icalset* set, | ||
392 | icalcomponent *oldcomp, | ||
249 | icalcomponent *newcomp); | 393 | icalcomponent *newcomp); |
250 | 394 | ||
251 | /* Iterate through components. If a guage has been defined, these | 395 | /* Iterate through components. If a gauge has been defined, these |
252 | will skip over components that do not pass the gauge */ | 396 | will skip over components that do not pass the gauge */ |
253 | 397 | ||
254 | icalcomponent* icalfileset_get_current_component (icalfileset* cluster); | 398 | icalcomponent* icalfileset_get_current_component (icalset* cluster); |
255 | icalcomponent* icalfileset_get_first_component(icalfileset* cluster); | 399 | icalcomponent* icalfileset_get_first_component(icalset* cluster); |
256 | icalcomponent* icalfileset_get_next_component(icalfileset* cluster); | 400 | icalcomponent* icalfileset_get_next_component(icalset* cluster); |
257 | /* Return a reference to the internal component. You probably should | 401 | |
402 | /* External iterator for thread safety */ | ||
403 | icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge); | ||
404 | icalcomponent * icalfilesetiter_to_next(icalset* set, icalsetiter *iter); | ||
405 | icalcomponent* icalfileset_form_a_matched_recurrence_component(icalsetiter* itr); | ||
406 | |||
407 | /** Return a reference to the internal component. You probably should | ||
258 | not be using this. */ | 408 | not be using this. */ |
259 | 409 | ||
260 | icalcomponent* icalfileset_get_component(icalfileset* cluster); | 410 | icalcomponent* icalfileset_get_component(icalset* cluster); |
411 | |||
412 | /** | ||
413 | * @brief options for opening an icalfileset. | ||
414 | * | ||
415 | * These options should be passed to the icalset_new() function | ||
416 | */ | ||
261 | 417 | ||
418 | typedef struct icalfileset_options { | ||
419 | int flags; /**< flags for open() O_RDONLY, etc */ | ||
420 | mode_t mode; /**< file mode */ | ||
421 | int safe_saves;/**< to lock or not */ | ||
422 | icalcluster *cluster;/**< use this cluster to initialize data */ | ||
423 | } icalfileset_options; | ||
424 | |||
425 | extern icalfileset_options icalfileset_options_default; | ||
262 | 426 | ||
263 | #endif /* !ICALFILESET_H */ | 427 | #endif /* !ICALFILESET_H */ |
264 | 428 | ||
265 | 429 | ||
266 | 430 | ||
267 | /* -*- Mode: C -*- */ | 431 | /* -*- Mode: C -*- */ |
268 | /*====================================================================== | 432 | /*====================================================================== |
269 | FILE: icaldirset.h | 433 | FILE: icaldirset.h |
270 | CREATOR: eric 28 November 1999 | 434 | CREATOR: eric 28 November 1999 |
271 | 435 | ||
272 | 436 | ||
273 | $Id$ | ||
274 | $Locker$ | ||
275 | 437 | ||
276 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 438 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
277 | 439 | ||
278 | This program is free software; you can redistribute it and/or modify | 440 | This program is free software; you can redistribute it and/or modify |
279 | it under the terms of either: | 441 | it under the terms of either: |
280 | 442 | ||
281 | The LGPL as published by the Free Software Foundation, version | 443 | The LGPL as published by the Free Software Foundation, version |
282 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 444 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
283 | 445 | ||
284 | Or: | 446 | Or: |
285 | 447 | ||
286 | The Mozilla Public License Version 1.0. You may obtain a copy of | 448 | The Mozilla Public License Version 1.0. You may obtain a copy of |
287 | the License at http://www.mozilla.org/MPL/ | 449 | the License at http://www.mozilla.org/MPL/ |
288 | 450 | ||
289 | The Original Code is eric. The Initial Developer of the Original | 451 | The Original Code is eric. The Initial Developer of the Original |
290 | Code is Eric Busboom | 452 | Code is Eric Busboom |
291 | 453 | ||
292 | 454 | ||
293 | ======================================================================*/ | 455 | ======================================================================*/ |
294 | 456 | ||
295 | #ifndef ICALDIRSET_H | 457 | #ifndef ICALDIRSET_H |
296 | #define ICALDIRSET_H | 458 | #define ICALDIRSET_H |
297 | 459 | ||
298 | 460 | ||
299 | /* icaldirset Routines for storing, fetching, and searching for ical | 461 | /* icaldirset Routines for storing, fetching, and searching for ical |
300 | * objects in a database */ | 462 | * objects in a database */ |
301 | 463 | ||
302 | typedef void icaldirset; | 464 | typedef struct icaldirset_impl icaldirset; |
303 | 465 | ||
466 | icalset* icaldirset_new(const char* path); | ||
304 | 467 | ||
305 | icaldirset* icaldirset_new(const char* path); | 468 | icalset* icaldirset_new_reader(const char* path); |
469 | icalset* icaldirset_new_writer(const char* path); | ||
306 | 470 | ||
307 | void icaldirset_free(icaldirset* store); | ||
308 | 471 | ||
309 | const char* icaldirset_path(icaldirset* store); | 472 | icalset* icaldirset_init(icalset* set, const char *dsn, void *options); |
473 | void icaldirset_free(icalset* set); | ||
474 | |||
475 | const char* icaldirset_path(icalset* set); | ||
310 | 476 | ||
311 | /* Mark the cluster as changed, so it will be written to disk when it | 477 | /* Mark the cluster as changed, so it will be written to disk when it |
312 | is freed. Commit writes to disk immediately*/ | 478 | is freed. Commit writes to disk immediately*/ |
313 | void icaldirset_mark(icaldirset* store); | 479 | void icaldirset_mark(icalset* set); |
314 | icalerrorenum icaldirset_commit(icaldirset* store); | 480 | icalerrorenum icaldirset_commit(icalset* set); |
315 | 481 | ||
316 | icalerrorenum icaldirset_add_component(icaldirset* store, icalcomponent* comp); | 482 | icalerrorenum icaldirset_add_component(icalset* store, icalcomponent* comp); |
317 | icalerrorenum icaldirset_remove_component(icaldirset* store, icalcomponent* comp); | 483 | icalerrorenum icaldirset_remove_component(icalset* store, icalcomponent* comp); |
318 | 484 | ||
319 | int icaldirset_count_components(icaldirset* store, | 485 | int icaldirset_count_components(icalset* store, |
320 | icalcomponent_kind kind); | 486 | icalcomponent_kind kind); |
321 | 487 | ||
322 | /* Restrict the component returned by icaldirset_first, _next to those | 488 | /* Restrict the component returned by icaldirset_first, _next to those |
323 | that pass the gauge. _clear removes the gauge. */ | 489 | that pass the gauge. _clear removes the gauge. */ |
324 | icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge); | 490 | icalerrorenum icaldirset_select(icalset* store, icalgauge* gauge); |
325 | void icaldirset_clear(icaldirset* store); | 491 | void icaldirset_clear(icalset* store); |
326 | 492 | ||
327 | /* Get a component by uid */ | 493 | /* Get a component by uid */ |
328 | icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid); | 494 | icalcomponent* icaldirset_fetch(icalset* store, const char* uid); |
329 | int icaldirset_has_uid(icaldirset* store, const char* uid); | 495 | int icaldirset_has_uid(icalset* store, const char* uid); |
330 | icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c); | 496 | icalcomponent* icaldirset_fetch_match(icalset* set, icalcomponent *c); |
331 | 497 | ||
332 | /* Modify components according to the MODIFY method of CAP. Works on | 498 | /* Modify components according to the MODIFY method of CAP. Works on |
333 | the currently selected components. */ | 499 | the currently selected components. */ |
334 | icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *oldc, | 500 | icalerrorenum icaldirset_modify(icalset* store, icalcomponent *oldc, |
335 | icalcomponent *newc); | 501 | icalcomponent *newc); |
336 | 502 | ||
337 | /* Iterate through the components. If a guage has been defined, these | 503 | /* Iterate through the components. If a gauge has been defined, these |
338 | will skip over components that do not pass the gauge */ | 504 | will skip over components that do not pass the gauge */ |
339 | 505 | ||
340 | icalcomponent* icaldirset_get_current_component(icaldirset* store); | 506 | icalcomponent* icaldirset_get_current_component(icalset* store); |
341 | icalcomponent* icaldirset_get_first_component(icaldirset* store); | 507 | icalcomponent* icaldirset_get_first_component(icalset* store); |
342 | icalcomponent* icaldirset_get_next_component(icaldirset* store); | 508 | icalcomponent* icaldirset_get_next_component(icalset* store); |
509 | |||
510 | /* External iterator for thread safety */ | ||
511 | icalsetiter icaldirset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge); | ||
512 | icalcomponent* icaldirsetiter_to_next(icalset* set, icalsetiter* i); | ||
513 | icalcomponent* icaldirsetiter_to_prior(icalset* set, icalsetiter* i); | ||
514 | |||
515 | typedef struct icaldirset_options { | ||
516 | int flags; /**< flags corresponding to the open() system call O_RDWR, etc. */ | ||
517 | } icaldirset_options; | ||
343 | 518 | ||
344 | #endif /* !ICALDIRSET_H */ | 519 | #endif /* !ICALDIRSET_H */ |
345 | 520 | ||
346 | 521 | ||
347 | 522 | ||
348 | /* -*- Mode: C -*- */ | 523 | /* -*- Mode: C -*- */ |
349 | /*====================================================================== | 524 | /*====================================================================== |
350 | FILE: icalcalendar.h | 525 | FILE: icalcalendar.h |
351 | CREATOR: eric 23 December 1999 | 526 | CREATOR: eric 23 December 1999 |
352 | 527 | ||
353 | 528 | ||
354 | $Id$ | ||
355 | $Locker$ | ||
356 | 529 | ||
357 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 530 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
358 | 531 | ||
359 | This program is free software; you can redistribute it and/or modify | 532 | This program is free software; you can redistribute it and/or modify |
360 | it under the terms of either: | 533 | it under the terms of either: |
361 | 534 | ||
362 | The LGPL as published by the Free Software Foundation, version | 535 | The LGPL as published by the Free Software Foundation, version |
363 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 536 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
364 | 537 | ||
365 | Or: | 538 | Or: |
366 | 539 | ||
367 | The Mozilla Public License Version 1.0. You may obtain a copy of | 540 | The Mozilla Public License Version 1.0. You may obtain a copy of |
368 | the License at http://www.mozilla.org/MPL/ | 541 | the License at http://www.mozilla.org/MPL/ |
369 | 542 | ||
370 | The Original Code is eric. The Initial Developer of the Original | 543 | The Original Code is eric. The Initial Developer of the Original |
371 | Code is Eric Busboom | 544 | Code is Eric Busboom |
372 | 545 | ||
373 | 546 | ||
374 | ======================================================================*/ | 547 | ======================================================================*/ |
375 | 548 | ||
376 | #ifndef ICALCALENDAR_H | 549 | #ifndef ICALCALENDAR_H |
377 | #define ICALCALENDAR_H | 550 | #define ICALCALENDAR_H |
378 | 551 | ||
379 | 552 | ||
380 | /* icalcalendar | 553 | /* icalcalendar |
381 | * Routines for storing calendar data in a file system. The calendar | 554 | * Routines for storing calendar data in a file system. The calendar |
382 | * has two icaldirsets, one for incoming components and one for booked | 555 | * has two icaldirsets, one for incoming components and one for booked |
383 | * components. It also has interfaces to access the free/busy list | 556 | * components. It also has interfaces to access the free/busy list |
384 | * and a list of calendar properties */ | 557 | * and a list of calendar properties */ |
385 | 558 | ||
386 | typedef void icalcalendar; | 559 | typedef struct icalcalendar_impl icalcalendar; |
387 | 560 | ||
388 | icalcalendar* icalcalendar_new(char* dir); | 561 | icalcalendar* icalcalendar_new(char* dir); |
389 | 562 | ||
390 | void icalcalendar_free(icalcalendar* calendar); | 563 | void icalcalendar_free(icalcalendar* calendar); |
391 | 564 | ||
392 | int icalcalendar_lock(icalcalendar* calendar); | 565 | int icalcalendar_lock(icalcalendar* calendar); |
393 | 566 | ||
394 | int icalcalendar_unlock(icalcalendar* calendar); | 567 | int icalcalendar_unlock(icalcalendar* calendar); |
395 | 568 | ||
396 | int icalcalendar_islocked(icalcalendar* calendar); | 569 | int icalcalendar_islocked(icalcalendar* calendar); |
397 | 570 | ||
398 | int icalcalendar_ownlock(icalcalendar* calendar); | 571 | int icalcalendar_ownlock(icalcalendar* calendar); |
399 | 572 | ||
400 | icalset* icalcalendar_get_booked(icalcalendar* calendar); | 573 | icalset* icalcalendar_get_booked(icalcalendar* calendar); |
401 | 574 | ||
402 | icalset* icalcalendar_get_incoming(icalcalendar* calendar); | 575 | icalset* icalcalendar_get_incoming(icalcalendar* calendar); |
403 | 576 | ||
404 | icalset* icalcalendar_get_properties(icalcalendar* calendar); | 577 | icalset* icalcalendar_get_properties(icalcalendar* calendar); |
405 | 578 | ||
406 | icalset* icalcalendar_get_freebusy(icalcalendar* calendar); | 579 | icalset* icalcalendar_get_freebusy(icalcalendar* calendar); |
407 | 580 | ||
408 | 581 | ||
409 | #endif /* !ICALCALENDAR_H */ | 582 | #endif /* !ICALCALENDAR_H */ |
410 | 583 | ||
411 | 584 | ||
412 | 585 | ||
413 | /* -*- Mode: C -*- */ | 586 | /* -*- Mode: C -*- */ |
414 | /*====================================================================== | 587 | /*====================================================================== |
415 | FILE: icalclassify.h | 588 | FILE: icalclassify.h |
416 | CREATOR: eric 21 Aug 2000 | 589 | CREATOR: eric 21 Aug 2000 |
417 | 590 | ||
418 | 591 | ||
419 | $Id$ | ||
420 | $Locker$ | ||
421 | 592 | ||
422 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 593 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
423 | 594 | ||
424 | This program is free software; you can redistribute it and/or modify | 595 | This program is free software; you can redistribute it and/or modify |
425 | it under the terms of either: | 596 | it under the terms of either: |
426 | 597 | ||
427 | The LGPL as published by the Free Software Foundation, version | 598 | The LGPL as published by the Free Software Foundation, version |
428 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 599 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
429 | 600 | ||
430 | Or: | 601 | Or: |
431 | 602 | ||
432 | The Mozilla Public License Version 1.0. You may obtain a copy of | 603 | The Mozilla Public License Version 1.0. You may obtain a copy of |
433 | the License at http://www.mozilla.org/MPL/ | 604 | the License at http://www.mozilla.org/MPL/ |
434 | 605 | ||
435 | 606 | ||
436 | =========================================================================*/ | 607 | =========================================================================*/ |
437 | 608 | ||
438 | #ifndef ICALCLASSIFY_H | 609 | #ifndef ICALCLASSIFY_H |
439 | #define ICALCLASSIFY_H | 610 | #define ICALCLASSIFY_H |
440 | 611 | ||
441 | 612 | ||
442 | 613 | icalproperty_xlicclass icalclassify(icalcomponent* c,icalcomponent* match, | |
443 | typedef enum icalclass { | ||
444 | ICAL_NO_CLASS, | ||
445 | ICAL_PUBLISH_NEW_CLASS, | ||
446 | ICAL_PUBLISH_UPDATE_CLASS, | ||
447 | ICAL_PUBLISH_FREEBUSY_CLASS, | ||
448 | ICAL_REQUEST_NEW_CLASS, | ||
449 | ICAL_REQUEST_UPDATE_CLASS, | ||
450 | ICAL_REQUEST_RESCHEDULE_CLASS, | ||
451 | ICAL_REQUEST_DELEGATE_CLASS, | ||
452 | ICAL_REQUEST_NEW_ORGANIZER_CLASS, | ||
453 | ICAL_REQUEST_FORWARD_CLASS, | ||
454 | ICAL_REQUEST_STATUS_CLASS, | ||
455 | ICAL_REQUEST_FREEBUSY_CLASS, | ||
456 | ICAL_REPLY_ACCEPT_CLASS, | ||
457 | ICAL_REPLY_DECLINE_CLASS, | ||
458 | ICAL_REPLY_DELEGATE_CLASS, | ||
459 | ICAL_REPLY_CRASHER_ACCEPT_CLASS, | ||
460 | ICAL_REPLY_CRASHER_DECLINE_CLASS, | ||
461 | ICAL_ADD_INSTANCE_CLASS, | ||
462 | ICAL_CANCEL_EVENT_CLASS, | ||
463 | ICAL_CANCEL_INSTANCE_CLASS, | ||
464 | ICAL_CANCEL_ALL_CLASS, | ||
465 | ICAL_REFRESH_CLASS, | ||
466 | ICAL_COUNTER_CLASS, | ||
467 | ICAL_DECLINECOUNTER_CLASS, | ||
468 | ICAL_MALFORMED_CLASS, | ||
469 | ICAL_OBSOLETE_CLASS, /* 21 */ | ||
470 | ICAL_MISSEQUENCED_CLASS, /* 22 */ | ||
471 | ICAL_UNKNOWN_CLASS /* 23 */ | ||
472 | } ical_class; | ||
473 | |||
474 | ical_class icalclassify(icalcomponent* c,icalcomponent* match, | ||
475 | const char* user); | 614 | const char* user); |
476 | 615 | ||
477 | icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp); | 616 | icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp); |
478 | 617 | ||
479 | char* icalclassify_class_to_string(ical_class iclass); | 618 | char* icalclassify_class_to_string(icalproperty_xlicclass c); |
480 | 619 | ||
481 | 620 | ||
482 | #endif /* ICALCLASSIFY_H*/ | 621 | #endif /* ICALCLASSIFY_H*/ |
483 | 622 | ||
484 | 623 | ||
485 | 624 | ||
486 | 625 | ||
487 | 626 | ||
488 | /* -*- Mode: C -*- */ | 627 | /* -*- Mode: C -*- */ |
489 | /*====================================================================== | 628 | /*====================================================================== |
490 | FILE: icalspanlist.h | 629 | FILE: icalspanlist.h |
491 | CREATOR: eric 21 Aug 2000 | 630 | CREATOR: eric 21 Aug 2000 |
492 | 631 | ||
493 | 632 | ||
494 | $Id$ | ||
495 | $Locker$ | ||
496 | 633 | ||
497 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 634 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
498 | 635 | ||
499 | This program is free software; you can redistribute it and/or modify | 636 | This program is free software; you can redistribute it and/or modify |
500 | it under the terms of either: | 637 | it under the terms of either: |
501 | 638 | ||
502 | The LGPL as published by the Free Software Foundation, version | 639 | The LGPL as published by the Free Software Foundation, version |
503 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 640 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
504 | 641 | ||
505 | Or: | 642 | Or: |
506 | 643 | ||
507 | The Mozilla Public License Version 1.0. You may obtain a copy of | 644 | The Mozilla Public License Version 1.0. You may obtain a copy of |
508 | the License at http://www.mozilla.org/MPL/ | 645 | the License at http://www.mozilla.org/MPL/ |
509 | 646 | ||
510 | 647 | ||
511 | =========================================================================*/ | 648 | =========================================================================*/ |
512 | #ifndef ICALSPANLIST_H | 649 | #ifndef ICALSPANLIST_H |
513 | #define ICALSPANLIST_H | 650 | #define ICALSPANLIST_H |
514 | 651 | ||
515 | 652 | ||
516 | typedef void icalspanlist; | 653 | /** @file icalspanlist.h |
654 | * @brief Code that supports collections of free/busy spans of time | ||
655 | */ | ||
656 | |||
657 | typedef struct icalspanlist_impl icalspanlist; | ||
658 | |||
659 | |||
660 | /** @brief Constructor | ||
661 | * Make a free list from a set of component. Start and end should be in UTC | ||
662 | */ | ||
517 | 663 | ||
518 | /* Make a free list from a set of component. Start and end should be in UTC */ | ||
519 | icalspanlist* icalspanlist_new(icalset *set, | 664 | icalspanlist* icalspanlist_new(icalset *set, |
520 | struct icaltimetype start, | 665 | struct icaltimetype start, |
521 | struct icaltimetype end); | 666 | struct icaltimetype end); |
522 | 667 | ||
668 | /** @brief Destructor | ||
669 | */ | ||
523 | void icalspanlist_free(icalspanlist* spl); | 670 | void icalspanlist_free(icalspanlist* spl); |
524 | 671 | ||
672 | /* Unimplemented functions */ | ||
525 | icalcomponent* icalspanlist_make_free_list(icalspanlist* sl); | 673 | icalcomponent* icalspanlist_make_free_list(icalspanlist* sl); |
526 | icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl); | 674 | icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl); |
527 | 675 | ||
528 | /* Get first free or busy time after time t. all times are in UTC */ | 676 | /** Get first next free time after time t. all times are in UTC. */ |
529 | struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl, | 677 | struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl, |
530 | struct icaltimetype t); | 678 | struct icaltimetype t); |
679 | /** Get first next busy time after time t. all times are in UTC. */ | ||
531 | struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl, | 680 | struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl, |
532 | struct icaltimetype t); | 681 | struct icaltimetype t); |
533 | 682 | ||
534 | void icalspanlist_dump(icalspanlist* s); | 683 | void icalspanlist_dump(icalspanlist* s); |
535 | 684 | ||
685 | /** @brief Return a valid VFREEBUSY component for this span */ | ||
686 | icalcomponent *icalspanlist_as_vfreebusy(icalspanlist* s_in, | ||
687 | const char* organizer, | ||
688 | const char* attendee); | ||
689 | |||
690 | /** @brief Return an integer matrix of total events per delta_t timespan */ | ||
691 | int *icalspanlist_as_freebusy_matrix(icalspanlist* span, int delta_t); | ||
692 | |||
693 | /** @brief Construct an icalspanlist from a VFREEBUSY component */ | ||
694 | icalspanlist *icalspanlist_from_vfreebusy(icalcomponent* c); | ||
695 | |||
536 | #endif | 696 | #endif |
537 | 697 | ||
538 | 698 | ||
539 | 699 | ||
540 | /* -*- Mode: C -*- */ | 700 | /* -*- Mode: C -*- */ |
541 | /*====================================================================== | 701 | /*====================================================================== |
542 | FILE: icalmessage.h | 702 | FILE: icalmessage.h |
543 | CREATOR: eric 07 Nov 2000 | 703 | CREATOR: eric 07 Nov 2000 |
544 | 704 | ||
545 | 705 | ||
546 | $Id$ | ||
547 | $Locker$ | ||
548 | 706 | ||
549 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | 707 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org |
550 | 708 | ||
551 | This program is free software; you can redistribute it and/or modify | 709 | This program is free software; you can redistribute it and/or modify |
552 | it under the terms of either: | 710 | it under the terms of either: |
553 | 711 | ||
554 | The LGPL as published by the Free Software Foundation, version | 712 | The LGPL as published by the Free Software Foundation, version |
555 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | 713 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html |
556 | 714 | ||
557 | Or: | 715 | Or: |
558 | 716 | ||
559 | The Mozilla Public License Version 1.0. You may obtain a copy of | 717 | The Mozilla Public License Version 1.0. You may obtain a copy of |
560 | the License at http://www.mozilla.org/MPL/ | 718 | the License at http://www.mozilla.org/MPL/ |
561 | 719 | ||
562 | 720 | ||
563 | =========================================================================*/ | 721 | =========================================================================*/ |
@@ -594,292 +752,19 @@ icalcomponent* icalmessage_new_cancel_event(icalcomponent* c, | |||
594 | icalcomponent* icalmessage_new_cancel_instance(icalcomponent* c, | 752 | icalcomponent* icalmessage_new_cancel_instance(icalcomponent* c, |
595 | const char* user, | 753 | const char* user, |
596 | const char* msg); | 754 | const char* msg); |
597 | icalcomponent* icalmessage_new_cancel_all(icalcomponent* c, | 755 | icalcomponent* icalmessage_new_cancel_all(icalcomponent* c, |
598 | const char* user, | 756 | const char* user, |
599 | const char* msg); | 757 | const char* msg); |
600 | 758 | ||
601 | 759 | ||
602 | icalcomponent* icalmessage_new_error_reply(icalcomponent* c, | 760 | icalcomponent* icalmessage_new_error_reply(icalcomponent* c, |
603 | const char* user, | 761 | const char* user, |
604 | const char* msg, | 762 | const char* msg, |
605 | const char* debug, | 763 | const char* debug, |
606 | icalrequeststatus rs); | 764 | icalrequeststatus rs); |
607 | 765 | ||
608 | 766 | ||
609 | #endif /* ICALMESSAGE_H*/ | 767 | #endif /* ICALMESSAGE_H*/ |
610 | /* -*- Mode: C -*- */ | 768 | #ifdef __cplusplus |
611 | /*====================================================================== | ||
612 | FILE: icalcstp.h | ||
613 | CREATOR: eric 20 April 1999 | ||
614 | |||
615 | $Id$ | ||
616 | |||
617 | |||
618 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
619 | |||
620 | This program is free software; you can redistribute it and/or modify | ||
621 | it under the terms of either: | ||
622 | |||
623 | The LGPL as published by the Free Software Foundation, version | ||
624 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
625 | |||
626 | Or: | ||
627 | |||
628 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
629 | the License at http://www.mozilla.org/MPL/ | ||
630 | |||
631 | The original code is icalcstp.h | ||
632 | |||
633 | ======================================================================*/ | ||
634 | |||
635 | |||
636 | #ifndef ICALCSTP_H | ||
637 | #define ICALCSTP_H | ||
638 | |||
639 | |||
640 | |||
641 | /* Connection state, from the state machine in RFC2445 */ | ||
642 | enum cstps_state { | ||
643 | NO_STATE, | ||
644 | CONNECTED, | ||
645 | AUTHENTICATED, | ||
646 | IDENTIFIED, | ||
647 | DISCONNECTED, | ||
648 | RECEIVE | ||
649 | }; | ||
650 | |||
651 | /* CSTP Commands that a client can issue to a server */ | ||
652 | typedef enum icalcstp_command { | ||
653 | ICAL_ABORT_COMMAND, | ||
654 | ICAL_AUTHENTICATE_COMMAND, | ||
655 | ICAL_CAPABILITY_COMMAND, | ||
656 | ICAL_CONTINUE_COMMAND, | ||
657 | ICAL_CALIDEXPAND_COMMAND, | ||
658 | ICAL_IDENTIFY_COMMAND, | ||
659 | ICAL_DISCONNECT_COMMAND, | ||
660 | ICAL_SENDDATA_COMMAND, | ||
661 | ICAL_STARTTLS_COMMAND, | ||
662 | ICAL_UPNEXPAND_COMMAND, | ||
663 | ICAL_COMPLETE_COMMAND, | ||
664 | ICAL_UNKNOWN_COMMAND | ||
665 | } icalcstp_command; | ||
666 | |||
667 | |||
668 | |||
669 | /* A statement is a combination of command or response code and a | ||
670 | component that the server and client exchage with each other. */ | ||
671 | struct icalcstp_statement { | ||
672 | icalcstp_command command; | ||
673 | char* str_data; /* If non-NUll use as arguments to command */ | ||
674 | int int_data; /* If non-NULL use as arguments to command */ | ||
675 | |||
676 | icalrequeststatus code; | ||
677 | |||
678 | icalcomponent* data; | ||
679 | }; | 769 | }; |
680 | 770 | #endif | |
681 | const char* icalcstp_command_to_string(icalcstp_command command); | ||
682 | icalcstp_command icalcstp_string_to_command(const char* str); | ||
683 | |||
684 | #endif /* !ICALCSTP_H */ | ||
685 | |||
686 | |||
687 | |||
688 | /* -*- Mode: C -*- */ | ||
689 | /*====================================================================== | ||
690 | FILE: icalcstpclient.h | ||
691 | CREATOR: eric 4 Feb 01 | ||
692 | |||
693 | $Id$ | ||
694 | |||
695 | |||
696 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
697 | |||
698 | This program is free software; you can redistribute it and/or modify | ||
699 | it under the terms of either: | ||
700 | |||
701 | The LGPL as published by the Free Software Foundation, version | ||
702 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
703 | |||
704 | Or: | ||
705 | |||
706 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
707 | the License at http://www.mozilla.org/MPL/ | ||
708 | |||
709 | The original code is icalcstp.h | ||
710 | |||
711 | ======================================================================*/ | ||
712 | |||
713 | |||
714 | #ifndef ICALCSTPC_H | ||
715 | #define ICALCSTPC_H | ||
716 | |||
717 | |||
718 | /********************** Client (Sender) Interfaces **************************/ | ||
719 | |||
720 | /* How to use: | ||
721 | |||
722 | 1) Construct a new icalcstpc | ||
723 | 2) Issue a command by calling one of the command routines. | ||
724 | 3) Repeat until both call icalcstpc_next_output and | ||
725 | icalcstpc_next_input return 0: | ||
726 | 3a) Call icalcstpc_next_output. Send string to server. | ||
727 | 3b) Get string from server, & give to icalcstp_next_input() | ||
728 | 4) Iterate with icalcstpc_first_response & icalcstp_next_response to | ||
729 | get the servers responses | ||
730 | 5) Repeat at #2 | ||
731 | */ | ||
732 | |||
733 | |||
734 | typedef void icalcstpc; | ||
735 | |||
736 | /* Response code sent by the server. */ | ||
737 | typedef struct icalcstpc_response { | ||
738 | icalrequeststatus code; | ||
739 | char *arg; /* These strings are owned by libical */ | ||
740 | char *debug_text; | ||
741 | char *more_text; | ||
742 | void* result; | ||
743 | } icalcstpc_response; | ||
744 | |||
745 | |||
746 | icalcstpc* icalcstpc_new(); | ||
747 | |||
748 | void icalcstpc_free(icalcstpc* cstpc); | ||
749 | |||
750 | int icalcstpc_set_timeout(icalcstpc* cstp, int sec); | ||
751 | |||
752 | |||
753 | /* Get the next string to send to the server */ | ||
754 | char* icalcstpc_next_output(icalcstpc* cstp, char* line); | ||
755 | |||
756 | /* process the next string from the server */ | ||
757 | int icalcstpc_next_input(icalcstpc* cstp, char * line); | ||
758 | |||
759 | /* After icalcstpc_next_input returns a 0, there are responses | ||
760 | ready. use these to get them */ | ||
761 | icalcstpc_response icalcstpc_first_response(icalcstpc* cstp); | ||
762 | icalcstpc_response icalcstpc_next_response(icalcstpc* cstp); | ||
763 | |||
764 | /* Issue a command */ | ||
765 | icalerrorenum icalcstpc_abort(icalcstpc* cstp); | ||
766 | icalerrorenum icalcstpc_authenticate(icalcstpc* cstp, char* mechanism, | ||
767 | char* init_data, char* f(char*) ); | ||
768 | icalerrorenum icalcstpc_capability(icalcstpc* cstp); | ||
769 | icalerrorenum icalcstpc_calidexpand(icalcstpc* cstp,char* calid); | ||
770 | icalerrorenum icalcstpc_continue(icalcstpc* cstp, unsigned int time); | ||
771 | icalerrorenum icalcstpc_disconnect(icalcstpc* cstp); | ||
772 | icalerrorenum icalcstpc_identify(icalcstpc* cstp, char* id); | ||
773 | icalerrorenum icalcstpc_starttls(icalcstpc* cstp, char* command, | ||
774 | char* init_data, char* f(char*)); | ||
775 | icalerrorenum icalcstpc_senddata(icalcstpc* cstp, unsigned int time, | ||
776 | icalcomponent *comp); | ||
777 | icalerrorenum icalcstpc_upnexpand(icalcstpc* cstp,char* calid); | ||
778 | icalerrorenum icalcstpc_sendata(icalcstpc* cstp, unsigned int time, | ||
779 | icalcomponent *comp); | ||
780 | |||
781 | |||
782 | #endif /* !ICALCSTPC_H */ | ||
783 | |||
784 | |||
785 | |||
786 | /* -*- Mode: C -*- */ | ||
787 | /*====================================================================== | ||
788 | FILE: icalcstpserver.h | ||
789 | CREATOR: eric 13 Feb 01 | ||
790 | |||
791 | $Id$ | ||
792 | |||
793 | |||
794 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
795 | |||
796 | This program is free software; you can redistribute it and/or modify | ||
797 | it under the terms of either: | ||
798 | |||
799 | The LGPL as published by the Free Software Foundation, version | ||
800 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
801 | |||
802 | Or: | ||
803 | |||
804 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
805 | the License at http://www.mozilla.org/MPL/ | ||
806 | |||
807 | The original code is icalcstp.h | ||
808 | |||
809 | ======================================================================*/ | ||
810 | |||
811 | |||
812 | #ifndef ICALCSTPS_H | ||
813 | #define ICALCSTPS_H | ||
814 | |||
815 | |||
816 | |||
817 | /********************** Server (Reciever) Interfaces *************************/ | ||
818 | |||
819 | /* On the server side, the caller will recieve data from the incoming | ||
820 | socket and pass it to icalcstps_next_input. The caller then takes | ||
821 | the return from icalcstps_next_outpu and sends it out through the | ||
822 | socket. This gives the caller a point of control. If the cstp code | ||
823 | connected to the socket itself, it would be hard for the caller to | ||
824 | do anything else after the cstp code was started. | ||
825 | |||
826 | All of the server and client command routines will generate | ||
827 | response codes. On the server side, these responses will be turned | ||
828 | into text and sent to the client. On the client side, the reponse | ||
829 | is the one sent from the server. | ||
830 | |||
831 | Since each command can return multiple responses, the responses are | ||
832 | stored in the icalcstps object and are accesses by | ||
833 | icalcstps_first_response() and icalcstps_next_response() | ||
834 | |||
835 | How to use: | ||
836 | |||
837 | 1) Construct a new icalcstps, bound to your code via stubs | ||
838 | 2) Repeat forever: | ||
839 | 2a) Get string from client & give to icalcstps_next_input() | ||
840 | 2b) Repeat until icalcstp_next_output returns 0: | ||
841 | 2b1) Call icalcstps_next_output. | ||
842 | 2b2) Send string to client. | ||
843 | */ | ||
844 | |||
845 | |||
846 | |||
847 | typedef void icalcstps; | ||
848 | |||
849 | /* Pointers to the rountines that | ||
850 | icalcstps_process_incoming will call when it recognizes a CSTP | ||
851 | command in the data. BTW, the CONTINUE command is named 'cont' | ||
852 | because 'continue' is a C keyword */ | ||
853 | |||
854 | struct icalcstps_commandfp { | ||
855 | icalerrorenum (*abort)(icalcstps* cstp); | ||
856 | icalerrorenum (*authenticate)(icalcstps* cstp, char* mechanism, | ||
857 | char* data); | ||
858 | icalerrorenum (*calidexpand)(icalcstps* cstp, char* calid); | ||
859 | icalerrorenum (*capability)(icalcstps* cstp); | ||
860 | icalerrorenum (*cont)(icalcstps* cstp, unsigned int time); | ||
861 | icalerrorenum (*identify)(icalcstps* cstp, char* id); | ||
862 | icalerrorenum (*disconnect)(icalcstps* cstp); | ||
863 | icalerrorenum (*sendata)(icalcstps* cstp, unsigned int time, | ||
864 | icalcomponent *comp); | ||
865 | icalerrorenum (*starttls)(icalcstps* cstp, char* command, | ||
866 | char* data); | ||
867 | icalerrorenum (*upnexpand)(icalcstps* cstp, char* upn); | ||
868 | icalerrorenum (*unknown)(icalcstps* cstp, char* command, char* data); | ||
869 | }; | ||
870 | |||
871 | |||
872 | |||
873 | icalcstps* icalcstps_new(struct icalcstps_commandfp stubs); | ||
874 | |||
875 | void icalcstps_free(icalcstps* cstp); | ||
876 | |||
877 | int icalcstps_set_timeout(icalcstps* cstp, int sec); | ||
878 | |||
879 | /* Get the next string to send to the client */ | ||
880 | char* icalcstps_next_output(icalcstps* cstp); | ||
881 | |||
882 | /* process the next string from the client */ | ||
883 | int icalcstps_next_input(icalcstps* cstp); | ||
884 | |||
885 | #endif /* ICALCSTPS */ | ||