summaryrefslogtreecommitdiffabout
path: root/libical/src/libicalss/icalss.h
Unidiff
Diffstat (limited to 'libical/src/libicalss/icalss.h') (more/less context) (show whitespace changes)
-rw-r--r--libical/src/libicalss/icalss.h719
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,14 +1,18 @@
1#ifdef __cplusplus
2extern "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
@@ -26,48 +30,58 @@
26 30
27======================================================================*/ 31======================================================================*/
28 32
29#ifndef ICALGAUGE_H 33#ifndef ICALGAUGE_H
30#define ICALGAUGE_H 34#define ICALGAUGE_H
31 35
32typedef void icalgauge; 36/** @file icalgauge.h
37 * @brief Routines implementing a filter for ical components
38 */
39
40typedef struct icalgauge_impl icalgauge;
33 41
34icalgauge* icalgauge_new_from_sql(char* sql); 42icalgauge* icalgauge_new_from_sql(char* sql, int expand);
43
44int icalgauge_get_expand(icalgauge* gauge);
35 45
36void icalgauge_free(icalgauge* gauge); 46void icalgauge_free(icalgauge* gauge);
37 47
38char* icalgauge_as_sql(icalcomponent* gauge); 48char* icalgauge_as_sql(icalcomponent* gauge);
39 49
40void icalgauge_dump(icalcomponent* gauge); 50void 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 */
45int icalgauge_compare(icalgauge* g, icalcomponent* comp); 59int 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 */
49icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp); 63icalcomponent* 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
@@ -94,85 +108,207 @@ icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp);
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 114typedef struct icalset_impl icalset;
101#define mode_t int
102#endif
103
104
105
106typedef void icalset;
107 115
108typedef enum icalset_kind { 116typedef 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
122typedef 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
131struct 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 */
161int 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
175icalset* icalset_new(icalset_kind kind, const char* dsn, void* options);
116 176
117/* Create a specific derived type of set */
118icalset* icalset_new_file(const char* path); 177icalset* icalset_new_file(const char* path);
178icalset* icalset_new_file_reader(const char* path);
179icalset* icalset_new_file_writer(const char* path);
180
119icalset* icalset_new_dir(const char* path); 181icalset* icalset_new_dir(const char* path);
120icalset* icalset_new_heap(void); 182icalset* icalset_new_file_reader(const char* path);
121icalset* icalset_new_mysql(const char* path); 183icalset* icalset_new_file_writer(const char* path);
122/*icalset* icalset_new_cap(icalcstp* cstp);*/
123 184
124void icalset_free(icalset* set); 185void icalset_free(icalset* set);
125 186
126const char* icalset_path(icalset* set); 187const 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. **/
130void icalset_mark(icalset* set); 191void icalset_mark(icalset* set);
192
193/** Write changes to disk immediately */
131icalerrorenum icalset_commit(icalset* set); 194icalerrorenum icalset_commit(icalset* set);
132 195
133icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp); 196icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp);
134icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp); 197icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp);
135 198
136int icalset_count_components(icalset* set, 199int 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. */
141icalerrorenum icalset_select(icalset* set, icalcomponent* gauge); 204icalerrorenum icalset_select(icalset* set, icalgauge* gauge);
205
206/** Clears the gauge defined by icalset_select() */
142void icalset_clear_select(icalset* set); 207void icalset_clear_select(icalset* set);
143 208
144/* Get a component by uid */ 209/** Get a component by uid */
145icalcomponent* icalset_fetch(icalset* set, const char* uid); 210icalcomponent* icalset_fetch(icalset* set, const char* uid);
211
146int icalset_has_uid(icalset* set, const char* uid); 212int icalset_has_uid(icalset* set, const char* uid);
147icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *c); 213icalcomponent* 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. */
151icalerrorenum icalset_modify(icalset* set, icalcomponent *oldc, 217icalerrorenum 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
157icalcomponent* icalset_get_current_component(icalset* set); 223icalcomponent* icalset_get_current_component(icalset* set);
158icalcomponent* icalset_get_first_component(icalset* set); 224icalcomponent* icalset_get_first_component(icalset* set);
159icalcomponent* icalset_get_next_component(icalset* set); 225icalcomponent* icalset_get_next_component(icalset* set);
160 226
227/** External Iterator with gauge - for thread safety */
228extern icalsetiter icalsetiter_null;
229
230icalsetiter icalset_begin_component(icalset* set,
231 icalcomponent_kind kind, icalgauge* gauge);
232
233/** Default _next, _prior, _deref for subclasses that use single cluster */
234icalcomponent* icalsetiter_next(icalsetiter* i);
235icalcomponent* icalsetiter_prior(icalsetiter* i);
236icalcomponent* icalsetiter_deref(icalsetiter* i);
237
238/** for subclasses that use multiple clusters that require specialized cluster traversal */
239icalcomponent* icalsetiter_to_next(icalset* set, icalsetiter* i);
240icalcomponent* 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
276typedef struct icalcluster_impl icalcluster;
277
278icalcluster* icalcluster_new(const char *key, icalcomponent *data);
279icalcluster* icalcluster_new_clone(const icalcluster *cluster);
280
281void icalcluster_free(icalcluster *cluster);
282
283const char* icalcluster_key(icalcluster *cluster);
284int icalcluster_is_changed(icalcluster *cluster);
285void icalcluster_mark(icalcluster *cluster);
286void icalcluster_commit(icalcluster *cluster);
287
288icalcomponent* icalcluster_get_component(icalcluster* cluster);
289int icalcluster_count_components(icalcluster *cluster, icalcomponent_kind kind);
290icalerrorenum icalcluster_add_component(icalcluster* cluster,
291 icalcomponent* child);
292icalerrorenum icalcluster_remove_component(icalcluster* cluster,
293 icalcomponent* child);
294
295icalcomponent* icalcluster_get_current_component(icalcluster* cluster);
296icalcomponent* icalcluster_get_first_component(icalcluster* cluster);
297icalcomponent* 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
@@ -194,87 +330,113 @@ icalcomponent* icalset_get_next_component(icalset* set);
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
200extern int icalfileset_safe_saves; 336#ifdef WIN32
337#define mode_t int
338#endif
201 339
202typedef void icalfileset; 340extern int icalfileset_safe_saves;
203 341
342typedef struct icalfileset_impl icalfileset;
204 343
205/* icalfileset 344icalset* icalfileset_new(const char* path);
206 icalfilesetfile 345icalset* icalfileset_new_reader(const char* path);
207 icalfilesetdir 346icalset* icalfileset_new_writer(const char* path);
208*/
209 347
348icalset* icalfileset_init(icalset *set, const char *dsn, void* options);
210 349
211icalfileset* icalfileset_new(const char* path); 350icalfileset* icalfileset_new_from_cluster(const char* path, icalcluster *cluster);
212 351
213/* Like _new, but takes open() flags for opening the file */ 352icalcluster* icalfileset_produce_icalcluster(const char *path);
214icalfileset* icalfileset_new_open(const char* path,
215 int flags, mode_t mode);
216 353
217void icalfileset_free(icalfileset* cluster); 354void icalfileset_free(icalset* cluster);
218 355
219const char* icalfileset_path(icalfileset* cluster); 356const 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. */
223void icalfileset_mark(icalfileset* cluster); 360void icalfileset_mark(icalset* set);
224icalerrorenum icalfileset_commit(icalfileset* cluster); 361icalerrorenum icalfileset_commit(icalset* set);
225 362
226icalerrorenum icalfileset_add_component(icalfileset* cluster, 363icalerrorenum icalfileset_add_component(icalset* set,
227 icalcomponent* child); 364 icalcomponent* child);
228 365
229icalerrorenum icalfileset_remove_component(icalfileset* cluster, 366icalerrorenum icalfileset_remove_component(icalset* set,
230 icalcomponent* child); 367 icalcomponent* child);
231 368
232int icalfileset_count_components(icalfileset* cluster, 369int 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
237icalerrorenum icalfileset_select(icalfileset* store, icalgauge* gauge); 374 * that pass the gauge. _clear removes the gauge
238void icalfileset_clear(icalfileset* store); 375 */
376icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge);
239 377
240/* Get and search for a component by uid */ 378/** clear the gauge **/
241icalcomponent* icalfileset_fetch(icalfileset* cluster, const char* uid); 379void icalfileset_clear(icalset* set);
242int icalfileset_has_uid(icalfileset* cluster, const char* uid);
243icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *c);
244 380
381/** Get and search for a component by uid **/
382icalcomponent* icalfileset_fetch(icalset* set, const char* uid);
383int icalfileset_has_uid(icalset* set, const char* uid);
384icalcomponent* 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/**
248icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *oldcomp, 388 * Modify components according to the MODIFY method of CAP. Works on the
389 * currently selected components.
390 */
391icalerrorenum 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
254icalcomponent* icalfileset_get_current_component (icalfileset* cluster); 398icalcomponent* icalfileset_get_current_component (icalset* cluster);
255icalcomponent* icalfileset_get_first_component(icalfileset* cluster); 399icalcomponent* icalfileset_get_first_component(icalset* cluster);
256icalcomponent* icalfileset_get_next_component(icalfileset* cluster); 400icalcomponent* icalfileset_get_next_component(icalset* cluster);
257/* Return a reference to the internal component. You probably should 401
402/* External iterator for thread safety */
403icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
404icalcomponent * icalfilesetiter_to_next(icalset* set, icalsetiter *iter);
405icalcomponent* 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
260icalcomponent* icalfileset_get_component(icalfileset* cluster); 410icalcomponent* 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 */
417
418typedef 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;
261 424
425extern 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
@@ -296,66 +458,77 @@ icalcomponent* icalfileset_get_component(icalfileset* cluster);
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
302typedef void icaldirset; 464typedef struct icaldirset_impl icaldirset;
303 465
466icalset* icaldirset_new(const char* path);
304 467
305icaldirset* icaldirset_new(const char* path); 468icalset* icaldirset_new_reader(const char* path);
469icalset* icaldirset_new_writer(const char* path);
306 470
307void icaldirset_free(icaldirset* store);
308 471
309const char* icaldirset_path(icaldirset* store); 472icalset* icaldirset_init(icalset* set, const char *dsn, void *options);
473void icaldirset_free(icalset* set);
474
475const 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*/
313void icaldirset_mark(icaldirset* store); 479void icaldirset_mark(icalset* set);
314icalerrorenum icaldirset_commit(icaldirset* store); 480icalerrorenum icaldirset_commit(icalset* set);
315 481
316icalerrorenum icaldirset_add_component(icaldirset* store, icalcomponent* comp); 482icalerrorenum icaldirset_add_component(icalset* store, icalcomponent* comp);
317icalerrorenum icaldirset_remove_component(icaldirset* store, icalcomponent* comp); 483icalerrorenum icaldirset_remove_component(icalset* store, icalcomponent* comp);
318 484
319int icaldirset_count_components(icaldirset* store, 485int 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. */
324icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge); 490icalerrorenum icaldirset_select(icalset* store, icalgauge* gauge);
325void icaldirset_clear(icaldirset* store); 491void icaldirset_clear(icalset* store);
326 492
327/* Get a component by uid */ 493/* Get a component by uid */
328icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid); 494icalcomponent* icaldirset_fetch(icalset* store, const char* uid);
329int icaldirset_has_uid(icaldirset* store, const char* uid); 495int icaldirset_has_uid(icalset* store, const char* uid);
330icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c); 496icalcomponent* 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. */
334icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *oldc, 500icalerrorenum 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
340icalcomponent* icaldirset_get_current_component(icaldirset* store); 506icalcomponent* icaldirset_get_current_component(icalset* store);
341icalcomponent* icaldirset_get_first_component(icaldirset* store); 507icalcomponent* icaldirset_get_first_component(icalset* store);
342icalcomponent* icaldirset_get_next_component(icaldirset* store); 508icalcomponent* icaldirset_get_next_component(icalset* store);
509
510/* External iterator for thread safety */
511icalsetiter icaldirset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
512icalcomponent* icaldirsetiter_to_next(icalset* set, icalsetiter* i);
513icalcomponent* icaldirsetiter_to_prior(icalset* set, icalsetiter* i);
514
515typedef 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
@@ -380,13 +553,13 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store);
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
386typedef void icalcalendar; 559typedef struct icalcalendar_impl icalcalendar;
387 560
388icalcalendar* icalcalendar_new(char* dir); 561icalcalendar* icalcalendar_new(char* dir);
389 562
390void icalcalendar_free(icalcalendar* calendar); 563void icalcalendar_free(icalcalendar* calendar);
391 564
392int icalcalendar_lock(icalcalendar* calendar); 565int icalcalendar_lock(icalcalendar* calendar);
@@ -413,14 +586,12 @@ icalset* icalcalendar_get_freebusy(icalcalendar* calendar);
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
@@ -436,50 +607,18 @@ icalset* icalcalendar_get_freebusy(icalcalendar* calendar);
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 613icalproperty_xlicclass icalclassify(icalcomponent* c,icalcomponent* match,
443typedef 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
474ical_class icalclassify(icalcomponent* c,icalcomponent* match,
475 const char* user); 614 const char* user);
476 615
477icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp); 616icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp);
478 617
479char* icalclassify_class_to_string(ical_class iclass); 618char* 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
@@ -488,14 +627,12 @@ char* icalclassify_class_to_string(ical_class iclass);
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
@@ -510,44 +647,65 @@ char* icalclassify_class_to_string(ical_class iclass);
510 647
511 =========================================================================*/ 648 =========================================================================*/
512#ifndef ICALSPANLIST_H 649#ifndef ICALSPANLIST_H
513#define ICALSPANLIST_H 650#define ICALSPANLIST_H
514 651
515 652
516typedef void icalspanlist; 653/** @file icalspanlist.h
654 * @brief Code that supports collections of free/busy spans of time
655 */
656
657typedef 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 */
519icalspanlist* icalspanlist_new(icalset *set, 664icalspanlist* 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 */
523void icalspanlist_free(icalspanlist* spl); 670void icalspanlist_free(icalspanlist* spl);
524 671
672/* Unimplemented functions */
525icalcomponent* icalspanlist_make_free_list(icalspanlist* sl); 673icalcomponent* icalspanlist_make_free_list(icalspanlist* sl);
526icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl); 674icalcomponent* 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. */
529struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl, 677struct 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. */
531struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl, 680struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl,
532 struct icaltimetype t); 681 struct icaltimetype t);
533 682
534void icalspanlist_dump(icalspanlist* s); 683void icalspanlist_dump(icalspanlist* s);
535 684
685/** @brief Return a valid VFREEBUSY component for this span */
686icalcomponent *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 */
691int *icalspanlist_as_freebusy_matrix(icalspanlist* span, int delta_t);
692
693/** @brief Construct an icalspanlist from a VFREEBUSY component */
694icalspanlist *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
@@ -604,282 +762,9 @@ icalcomponent* icalmessage_new_error_reply(icalcomponent* c,
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 */
642enum 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 */
652typedef 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. */
671struct 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
681const char* icalcstp_command_to_string(icalcstp_command command);
682icalcstp_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
734typedef 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
746icalcstpc* icalcstpc_new();
747
748void icalcstpc_free(icalcstpc* cstpc);
749
750int icalcstpc_set_timeout(icalcstpc* cstp, int sec);
751
752
753/* Get the next string to send to the server */
754char* icalcstpc_next_output(icalcstpc* cstp, char* line);
755
756/* process the next string from the server */
757int 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 */
761icalcstpc_response icalcstpc_first_response(icalcstpc* cstp);
762icalcstpc_response icalcstpc_next_response(icalcstpc* cstp);
763
764/* Issue a command */
765icalerrorenum icalcstpc_abort(icalcstpc* cstp);
766icalerrorenum icalcstpc_authenticate(icalcstpc* cstp, char* mechanism,
767 char* init_data, char* f(char*) );
768icalerrorenum icalcstpc_capability(icalcstpc* cstp);
769icalerrorenum icalcstpc_calidexpand(icalcstpc* cstp,char* calid);
770icalerrorenum icalcstpc_continue(icalcstpc* cstp, unsigned int time);
771icalerrorenum icalcstpc_disconnect(icalcstpc* cstp);
772icalerrorenum icalcstpc_identify(icalcstpc* cstp, char* id);
773icalerrorenum icalcstpc_starttls(icalcstpc* cstp, char* command,
774 char* init_data, char* f(char*));
775icalerrorenum icalcstpc_senddata(icalcstpc* cstp, unsigned int time,
776 icalcomponent *comp);
777icalerrorenum icalcstpc_upnexpand(icalcstpc* cstp,char* calid);
778icalerrorenum 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
847typedef 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
854struct 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
873icalcstps* icalcstps_new(struct icalcstps_commandfp stubs);
874
875void icalcstps_free(icalcstps* cstp);
876
877int icalcstps_set_timeout(icalcstps* cstp, int sec);
878
879/* Get the next string to send to the client */
880char* icalcstps_next_output(icalcstps* cstp);
881
882/* process the next string from the client */
883int icalcstps_next_input(icalcstps* cstp);
884
885#endif /* ICALCSTPS */