Initial commit for branch ical
[alpine.git] / pith / icaltype.h
blob0474464f3b39d6bb928f7f91c1467fb5f72cefb8
1 #ifndef ICALTYPE_INCLUDED
2 #define ICALTYPE_INCLUDED
4 #ifdef STANDALONE
5 #define ADDRESS struct mail_address
7 ADDRESS {
8 char *personal; /* personal name phrase */
9 char *adl; /* at-domain-list source route */
10 char *mailbox; /* mailbox name */
11 char *host; /* domain name of mailbox's host */
12 char *error; /* error in address from SMTP module */
13 struct {
14 char *type; /* address type (default "rfc822") */
15 char *addr; /* address as xtext */
16 } orcpt;
17 ADDRESS *next; /* pointer to next address in list */
19 #endif /* STANDALONE */
21 /* this is the PARAMETER struct from mail.h, but with possibility of
22 * extension */
23 typedef struct ical_param_s {
24 char *name;
25 char *value;
26 struct ical_param_s *next;
27 } ICAL_PARAMETER_S;
29 #define ICAL_S struct ical_s
31 ICAL_S {
32 char *comp; /* component name */
33 void *value;
34 ICAL_S *branch; /* component in same level */
35 ICAL_S *next; /* component at next level */
38 typedef struct icline_s {
39 char *token;
40 ICAL_PARAMETER_S *param;
41 char *value; /* this could need further processing, so consider this a raw value */
42 } ICLINE_S;
44 typedef struct gen_icline_s {
45 ICLINE_S *cline;
46 struct gen_icline_s *next;
47 } GEN_ICLINE_S;
49 typedef enum {FSecondly, FMinutely, FHourly, FDaily, FWeekly,
50 FMonthly, FYearly, FUnknown} Freq_value;
52 /* believe it or not, I did not need to copy these values from
53 * RFC 5545! */
54 typedef enum {Sunday, Monday, Tuesday, Wednesday, Thursday,
55 Friday, Saturday} Weekday;
57 typedef struct ical_weekday_s {
58 int value; /* number value being parsed */
59 Weekday wd;
60 struct ical_weekday_s *next;
61 } BYWKDY_S;
63 typedef struct ical_rrule_s {
64 #if 0
65 Freq_value freq; /* required, at most one */
66 ICLINE_S *until; /* optional, must not occur with count */
67 ICLINE_S *count; /* optional, must not occur with until */
68 unsigned long interval; /* optional, at most one */
69 BYWKDY_S *bysecond; /* optional, at most one */
70 ICLINE_S *byminute; /* optional, at most one */
71 ICLINE_S *byhour; /* optional, at most one */
72 BYWKDY_S *byday; /* optional, at most one */
73 ICLINE_S *bymonthday; /* optional, at most one */
74 ICLINE_S *byyearday; /* optional, at most one */
75 ICLINE_S *byweekno; /* optional, at most one */
76 BYWKDY_S *bymonth; /* optional, at most one, only use value */
77 ICLINE_S *bysetpos; /* optional, at most one */
78 ICLINE_S *wkst; /* optional, at most one */
79 #endif /* if 0 */
80 void **prop; /* the list of properties of a recurring rule */
81 ICAL_PARAMETER_S *param;
82 } RRULE_S;
84 typedef struct valarm_s {
85 #if 0
86 ICLINE_S *action; /* required, at most one */
87 ICLINE_S *trigger; /* required, at most one */
88 ICLINE_S *duration; /* audio,display,email.optional, at most one. Must occur with repeat */
89 ICLINE_S *repeat; /* audio,display,email.optional, at most one. Must occur with duration */
90 ICLINE_S *description; /* display,email.required, at most one */
91 ICLINE_S *summary; /* email.required, at most one */
92 GEN_ICLINE_S *attach; /* audio.optional, at most one;email.optional, may occur more than once */
93 GEN_ICLINE_S *attendee; /* email.required, may occur more than once */
94 #endif /* if 0 */
95 void **prop; /* an array of all properties of an alarm */
96 GEN_ICLINE_S *uk_prop; /* optional, may occur more than once */
97 struct valarm_s *next;
98 } VALARM_S;
100 typedef struct vevent_s {
101 #if 0
102 ICLINE_S *dtstamp; /* required, at most one */
103 ICLINE_S *uid; /* required, at most one */
104 ICLINE_S *dtstart; /* required if METHOD not specified, at most one */
105 ICLINE_S *class; /* optional, at most one */
106 ICLINE_S *created; /* optional, at most one */
107 ICLINE_S *description;/* optional, at most one */
108 ICLINE_S *geo; /* optional, at most one */
109 ICLINE_S *lastmod; /* optional, at most one */
110 ICLINE_S *location; /* optional, at most one */
111 ICLINE_S *organizer; /* optional, at most one */
112 ICLINE_S *priority; /* optional, at most one */
113 ICLINE_S *seq; /* optional, at most one */
114 ICLINE_S *status; /* optional, at most one */
115 ICLINE_S *summary; /* optional, at most one */
116 ICLINE_S *transp; /* optional, at most one */
117 ICLINE_S *url; /* optional, at most one */
118 ICLINE_S *recurid; /* optional, at most one */
119 RRULE_S *rrule; /* optional, at most one */
120 ICLINE_S *dtend; /* optional, at most one, exclude duration */
121 ICLINE_S *duration; /* optional, at most one, exclude dtend */
122 GEN_ICLINE_S *attach; /* optional, may occur more than once */
123 GEN_ICLINE_S *attendee; /* optional, may occur more than once */
124 GEN_ICLINE_S *categories; /* optional, may occur more than once */
125 GEN_ICLINE_S *comment; /* optional, may occur more than once */
126 GEN_ICLINE_S *contact; /* optional, may occur more than once */
127 GEN_ICLINE_S *exdate; /* optional, may occur more than once */
128 GEN_ICLINE_S *rstatus; /* optional, may occur more than once */
129 GEN_ICLINE_S *related; /* optional, may occur more than once */
130 GEN_ICLINE_S *resources; /* optional, may occur more than once */
131 GEN_ICLINE_S *rdate; /* optional, may occur more than once */
132 #endif /* if 0 */
133 void **prop; /* the properties of an event component */
134 GEN_ICLINE_S *uk_prop; /* unknown values */
135 VALARM_S *valarm; /* possible valarm */
136 } VEVENT_S;
138 typedef struct vtodo_s {
139 ICLINE_S *dtstamp; /* required, at most one */
140 ICLINE_S *uid; /* required, at most one */
141 ICLINE_S *class; /* optional, at most one */
142 ICLINE_S *completed; /* optional, at most one */
143 ICLINE_S *created; /* optional, at most one */
144 ICLINE_S *description;/* optional, at most one */
145 ICLINE_S *dtstart; /* optional, at most one */
146 ICLINE_S *geo; /* optional, at most one */
147 ICLINE_S *lastmod; /* optional, at most one */
148 ICLINE_S *location; /* optional, at most one */
149 ICLINE_S *organizer; /* optional, at most one */
150 ICLINE_S *percent; /* optional, at most one */
151 ICLINE_S *priority; /* optional, at most one */
152 ICLINE_S *recurid; /* optional, at most one */
153 ICLINE_S *seq; /* optional, at most one */
154 ICLINE_S *status; /* optional, at most one */
155 ICLINE_S *summary; /* optional, at most one */
156 ICLINE_S *url; /* optional, at most one */
157 RRULE_S *rrule; /* optional, at most one */
158 ICLINE_S *due; /* optional, at most one, but exclude duration */
159 ICLINE_S *duration; /* optional, at most one, but exclude due, and add dtstart */
160 ICLINE_S *attach; /* optional, can appear more than once */
161 ICLINE_S *attendee; /* optional, can appear more than once */
162 ICLINE_S *categories; /* optional, can appear more than once */
163 ICLINE_S *comment; /* optional, can appear more than once */
164 ICLINE_S *contact; /* optional, can appear more than once */
165 ICLINE_S *exdate; /* optional, can appear more than once */
166 ICLINE_S *rstatus; /* optional, can appear more than once */
167 ICLINE_S *related; /* optional, can appear more than once */
168 ICLINE_S *resources; /* optional, can appear more than once */
169 ICLINE_S *rdate; /* optional, can appear more than once */
170 ICAL_PARAMETER_S *unknown; /* unknown values */
171 VALARM_S *valarm; /* optional valarm */
172 } VTODO_S;
174 typedef struct journal_s {
175 ICLINE_S *dtstamp; /* required, at most one */
176 ICLINE_S *uid; /* required, at most one */
177 ICLINE_S *class; /* optional, at most one */
178 ICLINE_S *created; /* optional, at most one */
179 ICLINE_S *dtstart; /* optional, at most one */
180 ICLINE_S *lastmod; /* optional, at most one */
181 ICLINE_S *organizer; /* optional, at most one */
182 ICLINE_S *recurid; /* optional, at most one */
183 ICLINE_S *seq; /* optional, at most one */
184 ICLINE_S *status; /* optional, at most one */
185 ICLINE_S *summary; /* optional, at most one */
186 ICLINE_S *url; /* optional, at most one */
187 RRULE_S *rrule; /* optional, at most one */
188 ICLINE_S *attach; /* optional, may occur more than once */
189 ICLINE_S *attendee; /* optional, may occur more than once */
190 ICLINE_S *categories; /* optional, may occur more than once */
191 ICLINE_S *comment; /* optional, may occur more than once */
192 ICLINE_S *contact; /* optional, may occur more than once */
193 ICLINE_S *description;/* optional, may occur more than once */
194 ICLINE_S *exdate; /* optional, may occur more than once */
195 ICLINE_S *related; /* optional, may occur more than once */
196 ICLINE_S *rdate; /* optional, may occur more than once */
197 ICLINE_S *rstatus; /* optional, may occur more than once */
198 ICAL_PARAMETER_S *unknown; /* unknown values */
199 } VJOURNAL_S;
201 typedef struct freebusy_s {
202 ICLINE_S *dtstamp; /* required, at most one */
203 ICLINE_S *uid; /* required, at most one */
204 ICLINE_S *contact; /* optional, at most one */
205 ICLINE_S *dtstart; /* optional, at most one */
206 ICLINE_S *dtend; /* optional, at most one */
207 ICLINE_S *organizer; /* optional, at most one */
208 ICLINE_S *url; /* optional, at most one */
209 ICLINE_S *attendee; /* optional, may appear more than oncece */
210 ICLINE_S *comment; /* optional, may appear more than oncece */
211 ICLINE_S *freebusy; /* optional, may appear more than oncece */
212 ICLINE_S *rstatus; /* optional, may appear more than once */
213 ICAL_PARAMETER_S *unknown; /* unknown values */
214 } VFREEBUSY_S;
216 typedef struct ical_tzprop_s {
217 #if 0
218 struct tm dtstart; /* required, at most one */
219 int tzoffsetto; /* required, at most one */
220 int tzoffsetfrom; /* required, at most one */
221 RRULE_S *rrule; /* optional, at most one */
222 GEN_ICLINE_S *comment; /* optional, may appear more than once */
223 GEN_ICLINE_S *rdate; /* optional, may appear more than once */
224 GEN_ICLINE_S *tzname; /* optional, may appear more than once */
225 #endif /* if 0 */
226 void **prop; /* the bunch of timezone properties */
227 GEN_ICLINE_S *uk_prop; /* optional, may appear more than once */
228 struct ical_tzprop_s *next;
229 } ICAL_TZPROP_S;
231 typedef struct vtimezone_s {
232 #if 0
233 ICLINE_S *tzid; /* required, at most one */
234 ICLINE_S *last_mod; /* optional, at most one */
235 ICLINE_S *tzurl; /* optional, at most one */
236 #endif /* if 0 */
237 void **prop; /* array of timezone properties */
238 ICAL_TZPROP_S *standardc; /* optional, may appear more than once */
239 ICAL_TZPROP_S *daylightc; /* optional, may appear more than once */
240 GEN_ICLINE_S *uk_prop; /* optional, may appear more than once */
241 } VTIMEZONE_S;
243 typedef struct vcalendar_s {
244 ICLINE_S *prodid; /* required, at most one */
245 ICLINE_S *version; /* required, at most one */
246 ICLINE_S *calscale; /* optional, at most one */
247 ICLINE_S *method; /* optional, at most one */
248 GEN_ICLINE_S *uk_prop;/* in case there is an unknown property */
249 void **comp; /* an array with the components of a calendar */
250 ICAL_S *uk_comp; /* in case there is an unknown component */
251 } VCALENDAR_S;
254 typedef enum {Individual, Group, Resource, Room, CUUnknown} CUType;
255 typedef enum {EventNeedsAction, EventAccepted, EventDeclined, EventTentative,
256 EventDelegated, EventUnknown,
257 TodoNeedsAction, TodoAccepted, TodoDeclined, TodoTentative,
258 TodoDelegated, TodoCompleted, TodoInProgress, TodoUnknown,
259 JournalNeedsAction, JournalAccepted, JournalDeclined,
260 JournalUnknown} PartStat;
261 typedef enum {RelBegin, RelEnd, RelUnknown} Related;
262 typedef enum {Parent, Child, Sibling} RelType;
263 typedef enum {ReqPart, Chair, OptPart, NonPart, RoleUnknown} Role;
264 typedef enum {RSVPFalse, RSVPTrue, RSVPUnknown} RSVP;
265 typedef enum {Binary, Boolean, CalAddress, Date, DateTime, Duration,
266 Float, Integer, Period, Recur, _Text, Time, Uri,
267 UtcOffset, ValueUnknown} Value;
269 typedef struct icalpar_s {
270 ICLINE_S *altrep; /* altrep uri, inside dquote RFC 2392, RFC 2616 and RFC 2818 */
271 ICLINE_S *cn; /* common name */
272 CUType cutype; /* calendar user type: individual, group, resource, room, unknown */
273 ADDRESS *delegated_from; /* person(s) who delegated their participation */
274 ADDRESS *delegated_to; /* person that was delegated participation */
275 ICLINE_S *dir; /* reference to a directory entry associated with the calendar user specified by the property. */
276 unsigned short encoding; /* encoding, either 8bit or base64 */
277 unsigned short type; /* type for FMTTYPE */
278 ICLINE_S *subtype; /* subtype for FMTTYPE */
279 ICLINE_S *fbtype; /* FreeBusy type */
280 ICLINE_S *language; /* language */
281 ADDRESS *member; /* group or list membership of the calendar user specified by the property */
282 PartStat partstat; /* participation status for the calendar user specified by the property. */
283 ICLINE_S *range; /* this and future */
284 Related related; /* relationship of the alarm trigger with respect to the start or end of the calendar component. */
285 RelType reltype; /* type of hierarchical relationship associated with the calendar component specified by the property. */
286 Role role; /* participation role for the calendar user specified by the property. */
287 RSVP rsvp; /* whether there is an expectation of a favor of a reply from the calendar user specified by the property value. */
288 ADDRESS *sentby; /* the calendar user that is acting on behalf of the calendar user specified by the property. */
289 ICLINE_S *tzid; /* the identifier for the time zone definition for a time component in the property value. */
290 Value value; /* specify the value type format for a property value. */
291 } ICALPAR_S;
293 typedef struct ical_duration_s {
294 unsigned sign:1; /* sign = 0 for positive, sign = 1 for negative */
295 unsigned weeks;
296 unsigned days;
297 unsigned hours;
298 unsigned minutes;
299 unsigned seconds;
300 struct ical_duration_s *next; /* another duration */
301 } ICAL_DURATION_S;
303 /* altrepparam = "ALTREP" "=" DQUOTE uri DQUOTE
304 * cnparam = "CN" "=" param-value
305 * cutypeparam = "CUTYPE" "="
306 ("INDIVIDUAL" ; An individual
307 / "GROUP" ; A group of individuals
308 / "RESOURCE" ; A physical resource
309 / "ROOM" ; A room resource
310 / "UNKNOWN" ; Otherwise not known
311 / x-name ; Experimental type
312 / iana-token) ; Other IANA-registered
313 ; type
314 * delfromparam = "DELEGATED-FROM" "=" DQUOTE cal-address
315 DQUOTE *("," DQUOTE cal-address DQUOTE)
317 * deltoparam = "DELEGATED-TO" "=" DQUOTE cal-address DQUOTE
318 *("," DQUOTE cal-address DQUOTE)
320 * dirparam = "DIR" "=" DQUOTE uri DQUOTE
322 * encodingparam = "ENCODING" "="
323 ( "8BIT"
324 ; "8bit" text encoding is defined in [RFC2045]
325 / "BASE64"
326 ; "BASE64" binary encoding format is defined in [RFC4648]
328 * fmttypeparam = "FMTTYPE" "=" type-name "/" subtype-name
329 ; Where "type-name" and "subtype-name" are
330 ; defined in Section 4.2 of [RFC4288].
332 * fbtypeparam = "FBTYPE" "=" ("FREE" / "BUSY"
333 / "BUSY-UNAVAILABLE" / "BUSY-TENTATIVE"
334 / x-name
335 ; Some experimental iCalendar free/busy type.
336 / iana-token)
337 ; Some other IANA-registered iCalendar free/busy type.
339 * languageparam = "LANGUAGE" "=" language
341 language = Language-Tag
342 ; As defined in [RFC5646].
344 * memberparam = "MEMBER" "=" DQUOTE cal-address DQUOTE
345 *("," DQUOTE cal-address DQUOTE)
347 * partstatparam = "PARTSTAT" "="
348 (partstat-event
349 / partstat-todo
350 / partstat-jour)
352 partstat-event = ("NEEDS-ACTION" ; Event needs action
353 / "ACCEPTED" ; Event accepted
354 / "DECLINED" ; Event declined
355 / "TENTATIVE" ; Event tentatively
356 ; accepted
357 / "DELEGATED" ; Event delegated
358 / x-name ; Experimental status
359 / iana-token) ; Other IANA-registered
360 ; status
361 ; These are the participation statuses for a "VEVENT".
362 ; Default is NEEDS-ACTION.
364 partstat-todo = ("NEEDS-ACTION" ; To-do needs action
365 / "ACCEPTED" ; To-do accepted
366 / "DECLINED" ; To-do declined
367 / "TENTATIVE" ; To-do tentatively
368 ; accepted
369 / "DELEGATED" ; To-do delegated
370 / "COMPLETED" ; To-do completed
371 ; COMPLETED property has
372 ; DATE-TIME completed
373 / "IN-PROCESS" ; To-do in process of
374 ; being completed
375 / x-name ; Experimental status
376 / iana-token) ; Other IANA-registered
377 ; status
378 ; These are the participation statuses for a "VTODO".
379 ; Default is NEEDS-ACTION.
383 partstat-jour = ("NEEDS-ACTION" ; Journal needs action
384 / "ACCEPTED" ; Journal accepted
385 / "DECLINED" ; Journal declined
386 / x-name ; Experimental status
387 / iana-token) ; Other IANA-registered
388 ; status
389 ; These are the participation statuses for a "VJOURNAL".
390 ; Default is NEEDS-ACTION.
392 * rangeparam = "RANGE" "=" "THISANDFUTURE"
393 ; To specify the instance specified by the recurrence identifier
394 ; and all subsequent recurrence instances.
396 * trigrelparam = "RELATED" "="
397 ("START" ; Trigger off of start
398 / "END") ; Trigger off of end
400 * reltypeparam = "RELTYPE" "="
401 ("PARENT" ; Parent relationship - Default
402 / "CHILD" ; Child relationship
403 / "SIBLING" ; Sibling relationship
404 / iana-token ; Some other IANA-registered
405 ; iCalendar relationship type
406 / x-name) ; A non-standard, experimental
407 ; relationship type
409 * roleparam = "ROLE" "="
410 ("CHAIR" ; Indicates chair of the
411 ; calendar entity
412 / "REQ-PARTICIPANT" ; Indicates a participant whose
413 ; participation is required
414 / "OPT-PARTICIPANT" ; Indicates a participant whose
415 ; participation is optional
416 / "NON-PARTICIPANT" ; Indicates a participant who
417 ; is copied for information
418 ; purposes only
419 / x-name ; Experimental role
420 / iana-token) ; Other IANA role
421 ; Default is REQ-PARTICIPANT
423 * rsvpparam = "RSVP" "=" ("TRUE" / "FALSE")
424 ; Default is FALSE
426 * sentbyparam = "SENT-BY" "=" DQUOTE cal-address DQUOTE
428 * tzidparam = "TZID" "=" [tzidprefix] paramtext
430 tzidprefix = "/"
434 typedef struct vevent_summary_s {
435 int cancel:1;
436 int priority;
437 char *class;
438 char *summary;
439 char *sender;
440 char *organizer;
441 char *location;
442 char *evstart;
443 char *evend;
444 char **duration;
445 char **attendee;
446 char **description;
447 } VEVENT_SUMMARY_S;
449 typedef enum {VCalendar = 0, VTimeZone, VEvent, VTodo, VJournal,
450 VAlarm, VFreeBusy, VUnknown} Cal_comp;
452 typedef enum {EvDtstamp = 0, EvUid, EvDtstart, EvClass, EvCreated,
453 EvDescription, EvGeo, EvLastMod, EvLocation,
454 EvOrganizer, EvPriority, EvSequence, EvStatus,
455 EvSummary, EvTransp, EvUrl, EvRecurrence, EvRrule,
456 EvDtend, EvDuration, EvAttach, EvAttendee, EvCategories,
457 EvComment, EvContact, EvExdate, EvRstatus, EvRelated,
458 EvResources, EvRdate,
459 EvUnknown} Event_prop;
461 typedef enum {TZCid = 0, TZCLastMod, TZCUrl, TZCUnknown} TZ_comp;
463 typedef enum {TZPDtstart = 0, TZPOffsetto, TZPOffsetfrom,
464 TZPRrule, TZPComment, TZPRdate, TZPTzname, TZPUnknown} TZ_prop;
466 typedef enum {AlAction = 0, AlTrigger, AlDuration, AlRepeat,
467 AlDescription, AlSummary, AlAttach, AlAttendee,
468 AlUnknown} Alarm_prop;
470 typedef enum {RRFreq, RRUntil, RRCount, RRInterval,
471 RRBysecond, RRByminute, RRByhour, RRByday,
472 RRByweekno, RRBymonth, RRBysetpos, RRWkst,
473 RRBymonthday, RRByyearday,
474 RRUnknown} RRule_prop;
476 #endif /* ifndef ICALTYPE_INCLUDED */