Diffstat (limited to 'libical/src/libicalss/icalss.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libicalss/icalss.h | 885 |
1 files changed, 885 insertions, 0 deletions
diff --git a/libical/src/libicalss/icalss.h b/libical/src/libicalss/icalss.h new file mode 100644 index 0000000..cd07919 --- a/dev/null +++ b/libical/src/libicalss/icalss.h | |||
@@ -0,0 +1,885 @@ | |||
1 | /* -*- Mode: C -*- */ | ||
2 | /*====================================================================== | ||
3 | FILE: icalgauge.h | ||
4 | CREATOR: eric 23 December 1999 | ||
5 | |||
6 | |||
7 | $Id$ | ||
8 | $Locker$ | ||
9 | |||
10 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
11 | |||
12 | This program is free software; you can redistribute it and/or modify | ||
13 | it under the terms of either: | ||
14 | |||
15 | The LGPL as published by the Free Software Foundation, version | ||
16 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
17 | |||
18 | Or: | ||
19 | |||
20 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
21 | the License at http://www.mozilla.org/MPL/ | ||
22 | |||
23 | The Original Code is eric. The Initial Developer of the Original | ||
24 | Code is Eric Busboom | ||
25 | |||
26 | |||
27 | ======================================================================*/ | ||
28 | |||
29 | #ifndef ICALGAUGE_H | ||
30 | #define ICALGAUGE_H | ||
31 | |||
32 | typedef void icalgauge; | ||
33 | |||
34 | icalgauge* icalgauge_new_from_sql(char* sql); | ||
35 | |||
36 | void icalgauge_free(icalgauge* gauge); | ||
37 | |||
38 | char* icalgauge_as_sql(icalcomponent* gauge); | ||
39 | |||
40 | void icalgauge_dump(icalcomponent* gauge); | ||
41 | |||
42 | /* Return true is comp matches the gauge. The component must be in | ||
43 | cannonical form -- a VCALENDAR with one VEVENT, VTODO or VJOURNAL | ||
44 | sub component */ | ||
45 | int icalgauge_compare(icalgauge* g, icalcomponent* comp); | ||
46 | |||
47 | /* Clone the component, but only return the properties specified in | ||
48 | the gauge */ | ||
49 | icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp); | ||
50 | |||
51 | #endif /* ICALGAUGE_H*/ | ||
52 | /* -*- Mode: C -*- */ | ||
53 | /*====================================================================== | ||
54 | FILE: icalset.h | ||
55 | CREATOR: eric 28 November 1999 | ||
56 | |||
57 | |||
58 | Icalset is the "base class" for representations of a collection of | ||
59 | iCal components. Derived classes (actually delegatees) include: | ||
60 | |||
61 | icalfileset Store componetns in a single file | ||
62 | icaldirset Store components in multiple files in a directory | ||
63 | icalheapset Store components on the heap | ||
64 | icalmysqlset Store components in a mysql database. | ||
65 | |||
66 | $Id$ | ||
67 | $Locker$ | ||
68 | |||
69 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
70 | |||
71 | This program is free software; you can redistribute it and/or modify | ||
72 | it under the terms of either: | ||
73 | |||
74 | The LGPL as published by the Free Software Foundation, version | ||
75 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
76 | |||
77 | Or: | ||
78 | |||
79 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
80 | the License at http://www.mozilla.org/MPL/ | ||
81 | |||
82 | The Original Code is eric. The Initial Developer of the Original | ||
83 | Code is Eric Busboom | ||
84 | |||
85 | |||
86 | ======================================================================*/ | ||
87 | |||
88 | #ifndef ICALSET_H | ||
89 | #define ICALSET_H | ||
90 | |||
91 | #include <limits.h> /* For PATH_MAX */ | ||
92 | |||
93 | #ifdef PATH_MAX | ||
94 | #define ICAL_PATH_MAX PATH_MAX | ||
95 | #else | ||
96 | #define ICAL_PATH_MAX 1024 | ||
97 | #endif | ||
98 | |||
99 | |||
100 | #ifdef _WIN32 | ||
101 | #define mode_t int | ||
102 | #endif | ||
103 | |||
104 | |||
105 | |||
106 | typedef void icalset; | ||
107 | |||
108 | typedef enum icalset_kind { | ||
109 | ICAL_FILE_SET, | ||
110 | ICAL_DIR_SET, | ||
111 | ICAL_HEAP_SET, | ||
112 | ICAL_MYSQL_SET, | ||
113 | ICAL_CAP_SET | ||
114 | } icalset_kind; | ||
115 | |||
116 | |||
117 | /* Create a specific derived type of set */ | ||
118 | icalset* icalset_new_file(const char* path); | ||
119 | icalset* icalset_new_dir(const char* path); | ||
120 | icalset* icalset_new_heap(void); | ||
121 | icalset* icalset_new_mysql(const char* path); | ||
122 | /*icalset* icalset_new_cap(icalcstp* cstp);*/ | ||
123 | |||
124 | void icalset_free(icalset* set); | ||
125 | |||
126 | const char* icalset_path(icalset* set); | ||
127 | |||
128 | /* Mark the cluster as changed, so it will be written to disk when it | ||
129 | is freed. Commit writes to disk immediately*/ | ||
130 | void icalset_mark(icalset* set); | ||
131 | icalerrorenum icalset_commit(icalset* set); | ||
132 | |||
133 | icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp); | ||
134 | icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp); | ||
135 | |||
136 | int icalset_count_components(icalset* set, | ||
137 | icalcomponent_kind kind); | ||
138 | |||
139 | /* Restrict the component returned by icalset_first, _next to those | ||
140 | that pass the gauge. _clear removes the gauge. */ | ||
141 | icalerrorenum icalset_select(icalset* set, icalcomponent* gauge); | ||
142 | void icalset_clear_select(icalset* set); | ||
143 | |||
144 | /* Get a component by uid */ | ||
145 | icalcomponent* icalset_fetch(icalset* set, const char* uid); | ||
146 | int icalset_has_uid(icalset* set, const char* uid); | ||
147 | icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *c); | ||
148 | |||
149 | /* Modify components according to the MODIFY method of CAP. Works on | ||
150 | the currently selected components. */ | ||
151 | icalerrorenum icalset_modify(icalset* set, icalcomponent *oldc, | ||
152 | icalcomponent *newc); | ||
153 | |||
154 | /* Iterate through the components. If a guage has been defined, these | ||
155 | will skip over components that do not pass the gauge */ | ||
156 | |||
157 | icalcomponent* icalset_get_current_component(icalset* set); | ||
158 | icalcomponent* icalset_get_first_component(icalset* set); | ||
159 | icalcomponent* icalset_get_next_component(icalset* set); | ||
160 | |||
161 | #endif /* !ICALSET_H */ | ||
162 | |||
163 | |||
164 | |||
165 | /* -*- Mode: C -*- */ | ||
166 | /*====================================================================== | ||
167 | FILE: icalfileset.h | ||
168 | CREATOR: eric 23 December 1999 | ||
169 | |||
170 | |||
171 | $Id$ | ||
172 | $Locker$ | ||
173 | |||
174 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
175 | |||
176 | This program is free software; you can redistribute it and/or modify | ||
177 | it under the terms of either: | ||
178 | |||
179 | The LGPL as published by the Free Software Foundation, version | ||
180 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
181 | |||
182 | Or: | ||
183 | |||
184 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
185 | the License at http://www.mozilla.org/MPL/ | ||
186 | |||
187 | The Original Code is eric. The Initial Developer of the Original | ||
188 | Code is Eric Busboom | ||
189 | |||
190 | |||
191 | ======================================================================*/ | ||
192 | |||
193 | #ifndef ICALFILESET_H | ||
194 | #define ICALFILESET_H | ||
195 | |||
196 | #include <sys/types.h> /* For open() flags and mode */ | ||
197 | #include <sys/stat.h> /* For open() flags and mode */ | ||
198 | #include <fcntl.h> /* For open() flags and mode */ | ||
199 | |||
200 | extern int icalfileset_safe_saves; | ||
201 | |||
202 | typedef void icalfileset; | ||
203 | |||
204 | |||
205 | /* icalfileset | ||
206 | icalfilesetfile | ||
207 | icalfilesetdir | ||
208 | */ | ||
209 | |||
210 | |||
211 | icalfileset* icalfileset_new(const char* path); | ||
212 | |||
213 | /* Like _new, but takes open() flags for opening the file */ | ||
214 | icalfileset* icalfileset_new_open(const char* path, | ||
215 | int flags, mode_t mode); | ||
216 | |||
217 | void icalfileset_free(icalfileset* cluster); | ||
218 | |||
219 | const char* icalfileset_path(icalfileset* cluster); | ||
220 | |||
221 | /* Mark the cluster as changed, so it will be written to disk when it | ||
222 | is freed. Commit writes to disk immediately. */ | ||
223 | void icalfileset_mark(icalfileset* cluster); | ||
224 | icalerrorenum icalfileset_commit(icalfileset* cluster); | ||
225 | |||
226 | icalerrorenum icalfileset_add_component(icalfileset* cluster, | ||
227 | icalcomponent* child); | ||
228 | |||
229 | icalerrorenum icalfileset_remove_component(icalfileset* cluster, | ||
230 | icalcomponent* child); | ||
231 | |||
232 | int icalfileset_count_components(icalfileset* cluster, | ||
233 | icalcomponent_kind kind); | ||
234 | |||
235 | /* Restrict the component returned by icalfileset_first, _next to those | ||
236 | that pass the gauge. _clear removes the gauge */ | ||
237 | icalerrorenum icalfileset_select(icalfileset* store, icalgauge* gauge); | ||
238 | void icalfileset_clear(icalfileset* store); | ||
239 | |||
240 | /* Get and search for a component by uid */ | ||
241 | icalcomponent* icalfileset_fetch(icalfileset* cluster, const char* uid); | ||
242 | int icalfileset_has_uid(icalfileset* cluster, const char* uid); | ||
243 | icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *c); | ||
244 | |||
245 | |||
246 | /* Modify components according to the MODIFY method of CAP. Works on | ||
247 | the currently selected components. */ | ||
248 | icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *oldcomp, | ||
249 | icalcomponent *newcomp); | ||
250 | |||
251 | /* Iterate through components. If a guage has been defined, these | ||
252 | will skip over components that do not pass the gauge */ | ||
253 | |||
254 | icalcomponent* icalfileset_get_current_component (icalfileset* cluster); | ||
255 | icalcomponent* icalfileset_get_first_component(icalfileset* cluster); | ||
256 | icalcomponent* icalfileset_get_next_component(icalfileset* cluster); | ||
257 | /* Return a reference to the internal component. You probably should | ||
258 | not be using this. */ | ||
259 | |||
260 | icalcomponent* icalfileset_get_component(icalfileset* cluster); | ||
261 | |||
262 | |||
263 | #endif /* !ICALFILESET_H */ | ||
264 | |||
265 | |||
266 | |||
267 | /* -*- Mode: C -*- */ | ||
268 | /*====================================================================== | ||
269 | FILE: icaldirset.h | ||
270 | CREATOR: eric 28 November 1999 | ||
271 | |||
272 | |||
273 | $Id$ | ||
274 | $Locker$ | ||
275 | |||
276 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
277 | |||
278 | This program is free software; you can redistribute it and/or modify | ||
279 | it under the terms of either: | ||
280 | |||
281 | The LGPL as published by the Free Software Foundation, version | ||
282 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
283 | |||
284 | Or: | ||
285 | |||
286 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
287 | the License at http://www.mozilla.org/MPL/ | ||
288 | |||
289 | The Original Code is eric. The Initial Developer of the Original | ||
290 | Code is Eric Busboom | ||
291 | |||
292 | |||
293 | ======================================================================*/ | ||
294 | |||
295 | #ifndef ICALDIRSET_H | ||
296 | #define ICALDIRSET_H | ||
297 | |||
298 | |||
299 | /* icaldirset Routines for storing, fetching, and searching for ical | ||
300 | * objects in a database */ | ||
301 | |||
302 | typedef void icaldirset; | ||
303 | |||
304 | |||
305 | icaldirset* icaldirset_new(const char* path); | ||
306 | |||
307 | void icaldirset_free(icaldirset* store); | ||
308 | |||
309 | const char* icaldirset_path(icaldirset* store); | ||
310 | |||
311 | /* Mark the cluster as changed, so it will be written to disk when it | ||
312 | is freed. Commit writes to disk immediately*/ | ||
313 | void icaldirset_mark(icaldirset* store); | ||
314 | icalerrorenum icaldirset_commit(icaldirset* store); | ||
315 | |||
316 | icalerrorenum icaldirset_add_component(icaldirset* store, icalcomponent* comp); | ||
317 | icalerrorenum icaldirset_remove_component(icaldirset* store, icalcomponent* comp); | ||
318 | |||
319 | int icaldirset_count_components(icaldirset* store, | ||
320 | icalcomponent_kind kind); | ||
321 | |||
322 | /* Restrict the component returned by icaldirset_first, _next to those | ||
323 | that pass the gauge. _clear removes the gauge. */ | ||
324 | icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge); | ||
325 | void icaldirset_clear(icaldirset* store); | ||
326 | |||
327 | /* Get a component by uid */ | ||
328 | icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid); | ||
329 | int icaldirset_has_uid(icaldirset* store, const char* uid); | ||
330 | icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c); | ||
331 | |||
332 | /* Modify components according to the MODIFY method of CAP. Works on | ||
333 | the currently selected components. */ | ||
334 | icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *oldc, | ||
335 | icalcomponent *newc); | ||
336 | |||
337 | /* Iterate through the components. If a guage has been defined, these | ||
338 | will skip over components that do not pass the gauge */ | ||
339 | |||
340 | icalcomponent* icaldirset_get_current_component(icaldirset* store); | ||
341 | icalcomponent* icaldirset_get_first_component(icaldirset* store); | ||
342 | icalcomponent* icaldirset_get_next_component(icaldirset* store); | ||
343 | |||
344 | #endif /* !ICALDIRSET_H */ | ||
345 | |||
346 | |||
347 | |||
348 | /* -*- Mode: C -*- */ | ||
349 | /*====================================================================== | ||
350 | FILE: icalcalendar.h | ||
351 | CREATOR: eric 23 December 1999 | ||
352 | |||
353 | |||
354 | $Id$ | ||
355 | $Locker$ | ||
356 | |||
357 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
358 | |||
359 | This program is free software; you can redistribute it and/or modify | ||
360 | it under the terms of either: | ||
361 | |||
362 | The LGPL as published by the Free Software Foundation, version | ||
363 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
364 | |||
365 | Or: | ||
366 | |||
367 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
368 | the License at http://www.mozilla.org/MPL/ | ||
369 | |||
370 | The Original Code is eric. The Initial Developer of the Original | ||
371 | Code is Eric Busboom | ||
372 | |||
373 | |||
374 | ======================================================================*/ | ||
375 | |||
376 | #ifndef ICALCALENDAR_H | ||
377 | #define ICALCALENDAR_H | ||
378 | |||
379 | |||
380 | /* icalcalendar | ||
381 | * Routines for storing calendar data in a file system. The calendar | ||
382 | * has two icaldirsets, one for incoming components and one for booked | ||
383 | * components. It also has interfaces to access the free/busy list | ||
384 | * and a list of calendar properties */ | ||
385 | |||
386 | typedef void icalcalendar; | ||
387 | |||
388 | icalcalendar* icalcalendar_new(char* dir); | ||
389 | |||
390 | void icalcalendar_free(icalcalendar* calendar); | ||
391 | |||
392 | int icalcalendar_lock(icalcalendar* calendar); | ||
393 | |||
394 | int icalcalendar_unlock(icalcalendar* calendar); | ||
395 | |||
396 | int icalcalendar_islocked(icalcalendar* calendar); | ||
397 | |||
398 | int icalcalendar_ownlock(icalcalendar* calendar); | ||
399 | |||
400 | icalset* icalcalendar_get_booked(icalcalendar* calendar); | ||
401 | |||
402 | icalset* icalcalendar_get_incoming(icalcalendar* calendar); | ||
403 | |||
404 | icalset* icalcalendar_get_properties(icalcalendar* calendar); | ||
405 | |||
406 | icalset* icalcalendar_get_freebusy(icalcalendar* calendar); | ||
407 | |||
408 | |||
409 | #endif /* !ICALCALENDAR_H */ | ||
410 | |||
411 | |||
412 | |||
413 | /* -*- Mode: C -*- */ | ||
414 | /*====================================================================== | ||
415 | FILE: icalclassify.h | ||
416 | CREATOR: eric 21 Aug 2000 | ||
417 | |||
418 | |||
419 | $Id$ | ||
420 | $Locker$ | ||
421 | |||
422 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
423 | |||
424 | This program is free software; you can redistribute it and/or modify | ||
425 | it under the terms of either: | ||
426 | |||
427 | The LGPL as published by the Free Software Foundation, version | ||
428 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
429 | |||
430 | Or: | ||
431 | |||
432 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
433 | the License at http://www.mozilla.org/MPL/ | ||
434 | |||
435 | |||
436 | =========================================================================*/ | ||
437 | |||
438 | #ifndef ICALCLASSIFY_H | ||
439 | #define ICALCLASSIFY_H | ||
440 | |||
441 | |||
442 | |||
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); | ||
476 | |||
477 | icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp); | ||
478 | |||
479 | char* icalclassify_class_to_string(ical_class iclass); | ||
480 | |||
481 | |||
482 | #endif /* ICALCLASSIFY_H*/ | ||
483 | |||
484 | |||
485 | |||
486 | |||
487 | |||
488 | /* -*- Mode: C -*- */ | ||
489 | /*====================================================================== | ||
490 | FILE: icalspanlist.h | ||
491 | CREATOR: eric 21 Aug 2000 | ||
492 | |||
493 | |||
494 | $Id$ | ||
495 | $Locker$ | ||
496 | |||
497 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
498 | |||
499 | This program is free software; you can redistribute it and/or modify | ||
500 | it under the terms of either: | ||
501 | |||
502 | The LGPL as published by the Free Software Foundation, version | ||
503 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
504 | |||
505 | Or: | ||
506 | |||
507 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
508 | the License at http://www.mozilla.org/MPL/ | ||
509 | |||
510 | |||
511 | =========================================================================*/ | ||
512 | #ifndef ICALSPANLIST_H | ||
513 | #define ICALSPANLIST_H | ||
514 | |||
515 | |||
516 | typedef void icalspanlist; | ||
517 | |||
518 | /* Make a free list from a set of component. Start and end should be in UTC */ | ||
519 | icalspanlist* icalspanlist_new(icalset *set, | ||
520 | struct icaltimetype start, | ||
521 | struct icaltimetype end); | ||
522 | |||
523 | void icalspanlist_free(icalspanlist* spl); | ||
524 | |||
525 | icalcomponent* icalspanlist_make_free_list(icalspanlist* sl); | ||
526 | icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl); | ||
527 | |||
528 | /* Get first free or busy time after time t. all times are in UTC */ | ||
529 | struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl, | ||
530 | struct icaltimetype t); | ||
531 | struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl, | ||
532 | struct icaltimetype t); | ||
533 | |||
534 | void icalspanlist_dump(icalspanlist* s); | ||
535 | |||
536 | #endif | ||
537 | |||
538 | |||
539 | |||
540 | /* -*- Mode: C -*- */ | ||
541 | /*====================================================================== | ||
542 | FILE: icalmessage.h | ||
543 | CREATOR: eric 07 Nov 2000 | ||
544 | |||
545 | |||
546 | $Id$ | ||
547 | $Locker$ | ||
548 | |||
549 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
550 | |||
551 | This program is free software; you can redistribute it and/or modify | ||
552 | it under the terms of either: | ||
553 | |||
554 | The LGPL as published by the Free Software Foundation, version | ||
555 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
556 | |||
557 | Or: | ||
558 | |||
559 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
560 | the License at http://www.mozilla.org/MPL/ | ||
561 | |||
562 | |||
563 | =========================================================================*/ | ||
564 | |||
565 | |||
566 | #ifndef ICALMESSAGE_H | ||
567 | #define ICALMESSAGE_H | ||
568 | |||
569 | |||
570 | icalcomponent* icalmessage_new_accept_reply(icalcomponent* c, | ||
571 | const char* user, | ||
572 | const char* msg); | ||
573 | |||
574 | icalcomponent* icalmessage_new_decline_reply(icalcomponent* c, | ||
575 | const char* user, | ||
576 | const char* msg); | ||
577 | |||
578 | /* New is modified version of old */ | ||
579 | icalcomponent* icalmessage_new_counterpropose_reply(icalcomponent* oldc, | ||
580 | icalcomponent* newc, | ||
581 | const char* user, | ||
582 | const char* msg); | ||
583 | |||
584 | |||
585 | icalcomponent* icalmessage_new_delegate_reply(icalcomponent* c, | ||
586 | const char* user, | ||
587 | const char* delegatee, | ||
588 | const char* msg); | ||
589 | |||
590 | |||
591 | icalcomponent* icalmessage_new_cancel_event(icalcomponent* c, | ||
592 | const char* user, | ||
593 | const char* msg); | ||
594 | icalcomponent* icalmessage_new_cancel_instance(icalcomponent* c, | ||
595 | const char* user, | ||
596 | const char* msg); | ||
597 | icalcomponent* icalmessage_new_cancel_all(icalcomponent* c, | ||
598 | const char* user, | ||
599 | const char* msg); | ||
600 | |||
601 | |||
602 | icalcomponent* icalmessage_new_error_reply(icalcomponent* c, | ||
603 | const char* user, | ||
604 | const char* msg, | ||
605 | const char* debug, | ||
606 | icalrequeststatus rs); | ||
607 | |||
608 | |||
609 | #endif /* ICALMESSAGE_H*/ | ||
610 | /* -*- Mode: C -*- */ | ||
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 | }; | ||
680 | |||
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 */ | ||