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