1 #ifndef ICALTYPE_INCLUDED
2 #define ICALTYPE_INCLUDED
4 /* Due to the line by line processing algorithm, not all informatio
5 * is available when process some lines. In particular, when we
6 * process anything that has to do with time, we do not know if
7 * we are processing a date in daylight savings time or not. We
8 * solve this by creating a new value for tm_isdst, called
9 * ICAL_DST_UNKNOWN, which is a positive integer. We set this
10 * when the date comes in GMT. Once we process it, we either
11 * change it to 0, which means it is not dst, or change it
12 * to a different value, ICAL_DST_SET which means we know the date
15 #define ICAL_DST_UNKNOWN (1)
16 #define ICAL_DST_SET (ICAL_DST_UNKNOWN + 1)
18 /* this is the PARAMETER struct from mail.h, but with possibility of
20 typedef struct ical_param_s
{
23 struct ical_param_s
*next
;
26 #define ICAL_S struct ical_s
29 char *comp
; /* component name */
31 ICAL_S
*branch
; /* component in same level */
32 ICAL_S
*next
; /* component at next level */
35 typedef struct icline_s
{
37 ICAL_PARAMETER_S
*param
;
38 char *value
; /* this could need further processing, so consider this a raw value */
41 typedef struct gen_icline_s
{
43 struct gen_icline_s
*next
;
46 typedef enum {FSecondly
, FMinutely
, FHourly
, FDaily
, FWeekly
,
47 FMonthly
, FYearly
, FUnknown
} Freq_value
;
49 /* believe it or not, I did not need to copy these values from
51 typedef enum {Sunday
, Monday
, Tuesday
, Wednesday
, Thursday
,
52 Friday
, Saturday
} Weekday
;
54 typedef struct ical_weekday_s
{
55 int value
; /* number value being parsed */
57 struct ical_weekday_s
*next
;
60 typedef struct ical_rrule_s
{
62 Freq_value freq
; /* required, at most one */
63 ICLINE_S
*until
; /* optional, must not occur with count */
64 ICLINE_S
*count
; /* optional, must not occur with until */
65 unsigned long interval
; /* optional, at most one */
66 BYWKDY_S
*bysecond
; /* optional, at most one */
67 ICLINE_S
*byminute
; /* optional, at most one */
68 ICLINE_S
*byhour
; /* optional, at most one */
69 BYWKDY_S
*byday
; /* optional, at most one */
70 ICLINE_S
*bymonthday
; /* optional, at most one */
71 ICLINE_S
*byyearday
; /* optional, at most one */
72 ICLINE_S
*byweekno
; /* optional, at most one */
73 BYWKDY_S
*bymonth
; /* optional, at most one, only use value */
74 ICLINE_S
*bysetpos
; /* optional, at most one */
75 ICLINE_S
*wkst
; /* optional, at most one */
77 void **prop
; /* the list of properties of a recurring rule */
78 ICAL_PARAMETER_S
*param
;
81 typedef struct valarm_s
{
83 ICLINE_S
*action
; /* required, at most one */
84 ICLINE_S
*trigger
; /* required, at most one */
85 ICLINE_S
*duration
; /* audio,display,email.optional, at most one. Must occur with repeat */
86 ICLINE_S
*repeat
; /* audio,display,email.optional, at most one. Must occur with duration */
87 ICLINE_S
*description
; /* display,email.required, at most one */
88 ICLINE_S
*summary
; /* email.required, at most one */
89 GEN_ICLINE_S
*attach
; /* audio.optional, at most one;email.optional, may occur more than once */
90 GEN_ICLINE_S
*attendee
; /* email.required, may occur more than once */
92 void **prop
; /* an array of all properties of an alarm */
93 GEN_ICLINE_S
*uk_prop
; /* optional, may occur more than once */
94 struct valarm_s
*next
;
97 typedef struct vevent_s
{
99 ICLINE_S
*dtstamp
; /* required, at most one */
100 ICLINE_S
*uid
; /* required, at most one */
101 ICLINE_S
*dtstart
; /* required if METHOD not specified, at most one */
102 ICLINE_S
*class; /* optional, at most one */
103 ICLINE_S
*created
; /* optional, at most one */
104 ICLINE_S
*description
;/* optional, at most one */
105 ICLINE_S
*geo
; /* optional, at most one */
106 ICLINE_S
*lastmod
; /* optional, at most one */
107 ICLINE_S
*location
; /* optional, at most one */
108 ICLINE_S
*organizer
; /* optional, at most one */
109 ICLINE_S
*priority
; /* optional, at most one */
110 ICLINE_S
*seq
; /* optional, at most one */
111 ICLINE_S
*status
; /* optional, at most one */
112 ICLINE_S
*summary
; /* optional, at most one */
113 ICLINE_S
*transp
; /* optional, at most one */
114 ICLINE_S
*url
; /* optional, at most one */
115 ICLINE_S
*recurid
; /* optional, at most one */
116 RRULE_S
*rrule
; /* optional, at most one */
117 ICLINE_S
*dtend
; /* optional, at most one, exclude duration */
118 ICLINE_S
*duration
; /* optional, at most one, exclude dtend */
119 GEN_ICLINE_S
*attach
; /* optional, may occur more than once */
120 GEN_ICLINE_S
*attendee
; /* optional, may occur more than once */
121 GEN_ICLINE_S
*categories
; /* optional, may occur more than once */
122 GEN_ICLINE_S
*comment
; /* optional, may occur more than once */
123 GEN_ICLINE_S
*contact
; /* optional, may occur more than once */
124 GEN_ICLINE_S
*exdate
; /* optional, may occur more than once */
125 GEN_ICLINE_S
*rstatus
; /* optional, may occur more than once */
126 GEN_ICLINE_S
*related
; /* optional, may occur more than once */
127 GEN_ICLINE_S
*resources
; /* optional, may occur more than once */
128 GEN_ICLINE_S
*rdate
; /* optional, may occur more than once */
130 void **prop
; /* the properties of an event component */
131 GEN_ICLINE_S
*uk_prop
; /* unknown values */
132 VALARM_S
*valarm
; /* possible valarm */
133 struct vevent_s
*next
; /* calendar of method publish has many events */
136 typedef struct vtodo_s
{
137 ICLINE_S
*dtstamp
; /* required, at most one */
138 ICLINE_S
*uid
; /* required, at most one */
139 ICLINE_S
*class; /* optional, at most one */
140 ICLINE_S
*completed
; /* optional, at most one */
141 ICLINE_S
*created
; /* optional, at most one */
142 ICLINE_S
*description
;/* optional, at most one */
143 ICLINE_S
*dtstart
; /* optional, at most one */
144 ICLINE_S
*geo
; /* optional, at most one */
145 ICLINE_S
*lastmod
; /* optional, at most one */
146 ICLINE_S
*location
; /* optional, at most one */
147 ICLINE_S
*organizer
; /* optional, at most one */
148 ICLINE_S
*percent
; /* optional, at most one */
149 ICLINE_S
*priority
; /* optional, at most one */
150 ICLINE_S
*recurid
; /* optional, at most one */
151 ICLINE_S
*seq
; /* optional, at most one */
152 ICLINE_S
*status
; /* optional, at most one */
153 ICLINE_S
*summary
; /* optional, at most one */
154 ICLINE_S
*url
; /* optional, at most one */
155 RRULE_S
*rrule
; /* optional, at most one */
156 ICLINE_S
*due
; /* optional, at most one, but exclude duration */
157 ICLINE_S
*duration
; /* optional, at most one, but exclude due, and add dtstart */
158 ICLINE_S
*attach
; /* optional, can appear more than once */
159 ICLINE_S
*attendee
; /* optional, can appear more than once */
160 ICLINE_S
*categories
; /* optional, can appear more than once */
161 ICLINE_S
*comment
; /* optional, can appear more than once */
162 ICLINE_S
*contact
; /* optional, can appear more than once */
163 ICLINE_S
*exdate
; /* optional, can appear more than once */
164 ICLINE_S
*rstatus
; /* optional, can appear more than once */
165 ICLINE_S
*related
; /* optional, can appear more than once */
166 ICLINE_S
*resources
; /* optional, can appear more than once */
167 ICLINE_S
*rdate
; /* optional, can appear more than once */
168 ICAL_PARAMETER_S
*unknown
; /* unknown values */
169 VALARM_S
*valarm
; /* optional valarm */
172 typedef struct journal_s
{
173 ICLINE_S
*dtstamp
; /* required, at most one */
174 ICLINE_S
*uid
; /* required, at most one */
175 ICLINE_S
*class; /* optional, at most one */
176 ICLINE_S
*created
; /* optional, at most one */
177 ICLINE_S
*dtstart
; /* optional, at most one */
178 ICLINE_S
*lastmod
; /* optional, at most one */
179 ICLINE_S
*organizer
; /* optional, at most one */
180 ICLINE_S
*recurid
; /* optional, at most one */
181 ICLINE_S
*seq
; /* optional, at most one */
182 ICLINE_S
*status
; /* optional, at most one */
183 ICLINE_S
*summary
; /* optional, at most one */
184 ICLINE_S
*url
; /* optional, at most one */
185 RRULE_S
*rrule
; /* optional, at most one */
186 ICLINE_S
*attach
; /* optional, may occur more than once */
187 ICLINE_S
*attendee
; /* optional, may occur more than once */
188 ICLINE_S
*categories
; /* optional, may occur more than once */
189 ICLINE_S
*comment
; /* optional, may occur more than once */
190 ICLINE_S
*contact
; /* optional, may occur more than once */
191 ICLINE_S
*description
;/* optional, may occur more than once */
192 ICLINE_S
*exdate
; /* optional, may occur more than once */
193 ICLINE_S
*related
; /* optional, may occur more than once */
194 ICLINE_S
*rdate
; /* optional, may occur more than once */
195 ICLINE_S
*rstatus
; /* optional, may occur more than once */
196 ICAL_PARAMETER_S
*unknown
; /* unknown values */
199 typedef struct freebusy_s
{
200 ICLINE_S
*dtstamp
; /* required, at most one */
201 ICLINE_S
*uid
; /* required, at most one */
202 ICLINE_S
*contact
; /* optional, at most one */
203 ICLINE_S
*dtstart
; /* optional, at most one */
204 ICLINE_S
*dtend
; /* optional, at most one */
205 ICLINE_S
*organizer
; /* optional, at most one */
206 ICLINE_S
*url
; /* optional, at most one */
207 ICLINE_S
*attendee
; /* optional, may appear more than oncece */
208 ICLINE_S
*comment
; /* optional, may appear more than oncece */
209 ICLINE_S
*freebusy
; /* optional, may appear more than oncece */
210 ICLINE_S
*rstatus
; /* optional, may appear more than once */
211 ICAL_PARAMETER_S
*unknown
; /* unknown values */
214 typedef struct ical_tzprop_s
{
216 struct tm dtstart
; /* required, at most one */
217 int tzoffsetto
; /* required, at most one */
218 int tzoffsetfrom
; /* required, at most one */
219 RRULE_S
*rrule
; /* optional, at most one */
220 GEN_ICLINE_S
*comment
; /* optional, may appear more than once */
221 GEN_ICLINE_S
*rdate
; /* optional, may appear more than once */
222 GEN_ICLINE_S
*tzname
; /* optional, may appear more than once */
224 void **prop
; /* the bunch of timezone properties */
225 GEN_ICLINE_S
*uk_prop
; /* optional, may appear more than once */
226 struct ical_tzprop_s
*next
;
229 typedef struct vtimezone_s
{
231 ICLINE_S
*tzid
; /* required, at most one */
232 ICLINE_S
*last_mod
; /* optional, at most one */
233 ICLINE_S
*tzurl
; /* optional, at most one */
235 void **prop
; /* array of timezone properties */
236 ICAL_TZPROP_S
*standardc
; /* optional, may appear more than once */
237 ICAL_TZPROP_S
*daylightc
; /* optional, may appear more than once */
238 GEN_ICLINE_S
*uk_prop
; /* optional, may appear more than once */
241 typedef struct vcalendar_s
{
242 ICLINE_S
*prodid
; /* required, at most one */
243 ICLINE_S
*version
; /* required, at most one */
244 ICLINE_S
*calscale
; /* optional, at most one */
245 ICLINE_S
*method
; /* optional, at most one */
246 GEN_ICLINE_S
*uk_prop
;/* in case there is an unknown property */
247 void **comp
; /* an array with the components of a calendar */
248 ICAL_S
*uk_comp
; /* in case there is an unknown component */
249 unsigned short encoding
; /* save the original encoding. */
253 typedef enum {Individual
, Group
, Resource
, Room
, CUUnknown
} CUType
;
254 typedef enum {EventNeedsAction
, EventAccepted
, EventDeclined
, EventTentative
,
255 EventDelegated
, EventUnknown
,
256 TodoNeedsAction
, TodoAccepted
, TodoDeclined
, TodoTentative
,
257 TodoDelegated
, TodoCompleted
, TodoInProgress
, TodoUnknown
,
258 JournalNeedsAction
, JournalAccepted
, JournalDeclined
,
259 JournalUnknown
} PartStat
;
260 typedef enum {RelBegin
, RelEnd
, RelUnknown
} Related
;
261 typedef enum {Parent
, Child
, Sibling
} RelType
;
262 typedef enum {ReqPart
, Chair
, OptPart
, NonPart
, RoleUnknown
} Role
;
263 typedef enum {RSVPFalse
, RSVPTrue
, RSVPUnknown
} RSVP
;
264 typedef enum {Binary
, _Boolean
, CalAddress
, Date
, DateTime
, _Duration
,
265 Float
, Integer
, Period
, Recur
, _Text
, Time
, Uri
,
266 UtcOffset
, ValueUnknown
} Value
;
268 typedef struct icalpar_s
{
269 ICLINE_S
*altrep
; /* altrep uri, inside dquote RFC 2392, RFC 2616 and RFC 2818 */
270 ICLINE_S
*cn
; /* common name */
271 CUType cutype
; /* calendar user type: individual, group, resource, room, unknown */
272 ADDRESS
*delegated_from
; /* person(s) who delegated their participation */
273 ADDRESS
*delegated_to
; /* person that was delegated participation */
274 ICLINE_S
*dir
; /* reference to a directory entry associated with the calendar user specified by the property. */
275 unsigned short encoding
; /* encoding, either 8bit or base64 */
276 unsigned short type
; /* type for FMTTYPE */
277 ICLINE_S
*subtype
; /* subtype for FMTTYPE */
278 ICLINE_S
*fbtype
; /* FreeBusy type */
279 ICLINE_S
*language
; /* language */
280 ADDRESS
*member
; /* group or list membership of the calendar user specified by the property */
281 PartStat partstat
; /* participation status for the calendar user specified by the property. */
282 ICLINE_S
*range
; /* this and future */
283 Related related
; /* relationship of the alarm trigger with respect to the start or end of the calendar component. */
284 RelType reltype
; /* type of hierarchical relationship associated with the calendar component specified by the property. */
285 Role role
; /* participation role for the calendar user specified by the property. */
286 RSVP rsvp
; /* whether there is an expectation of a favor of a reply from the calendar user specified by the property value. */
287 ADDRESS
*sentby
; /* the calendar user that is acting on behalf of the calendar user specified by the property. */
288 ICLINE_S
*tzid
; /* the identifier for the time zone definition for a time component in the property value. */
289 Value value
; /* specify the value type format for a property value. */
292 typedef struct ical_duration_s
{
293 unsigned sign
:1; /* sign = 0 for positive, sign = 1 for negative */
299 struct ical_duration_s
*next
; /* another duration */
302 /* altrepparam = "ALTREP" "=" DQUOTE uri DQUOTE
303 * cnparam = "CN" "=" param-value
304 * cutypeparam = "CUTYPE" "="
305 ("INDIVIDUAL" ; An individual
306 / "GROUP" ; A group of individuals
307 / "RESOURCE" ; A physical resource
308 / "ROOM" ; A room resource
309 / "UNKNOWN" ; Otherwise not known
310 / x-name ; Experimental type
311 / iana-token) ; Other IANA-registered
313 * delfromparam = "DELEGATED-FROM" "=" DQUOTE cal-address
314 DQUOTE *("," DQUOTE cal-address DQUOTE)
316 * deltoparam = "DELEGATED-TO" "=" DQUOTE cal-address DQUOTE
317 *("," DQUOTE cal-address DQUOTE)
319 * dirparam = "DIR" "=" DQUOTE uri DQUOTE
321 * encodingparam = "ENCODING" "="
323 ; "8bit" text encoding is defined in [RFC2045]
325 ; "BASE64" binary encoding format is defined in [RFC4648]
327 * fmttypeparam = "FMTTYPE" "=" type-name "/" subtype-name
328 ; Where "type-name" and "subtype-name" are
329 ; defined in Section 4.2 of [RFC4288].
331 * fbtypeparam = "FBTYPE" "=" ("FREE" / "BUSY"
332 / "BUSY-UNAVAILABLE" / "BUSY-TENTATIVE"
334 ; Some experimental iCalendar free/busy type.
336 ; Some other IANA-registered iCalendar free/busy type.
338 * languageparam = "LANGUAGE" "=" language
340 language = Language-Tag
341 ; As defined in [RFC5646].
343 * memberparam = "MEMBER" "=" DQUOTE cal-address DQUOTE
344 *("," DQUOTE cal-address DQUOTE)
346 * partstatparam = "PARTSTAT" "="
351 partstat-event = ("NEEDS-ACTION" ; Event needs action
352 / "ACCEPTED" ; Event accepted
353 / "DECLINED" ; Event declined
354 / "TENTATIVE" ; Event tentatively
356 / "DELEGATED" ; Event delegated
357 / x-name ; Experimental status
358 / iana-token) ; Other IANA-registered
360 ; These are the participation statuses for a "VEVENT".
361 ; Default is NEEDS-ACTION.
363 partstat-todo = ("NEEDS-ACTION" ; To-do needs action
364 / "ACCEPTED" ; To-do accepted
365 / "DECLINED" ; To-do declined
366 / "TENTATIVE" ; To-do tentatively
368 / "DELEGATED" ; To-do delegated
369 / "COMPLETED" ; To-do completed
370 ; COMPLETED property has
371 ; DATE-TIME completed
372 / "IN-PROCESS" ; To-do in process of
374 / x-name ; Experimental status
375 / iana-token) ; Other IANA-registered
377 ; These are the participation statuses for a "VTODO".
378 ; Default is NEEDS-ACTION.
382 partstat-jour = ("NEEDS-ACTION" ; Journal needs action
383 / "ACCEPTED" ; Journal accepted
384 / "DECLINED" ; Journal declined
385 / x-name ; Experimental status
386 / iana-token) ; Other IANA-registered
388 ; These are the participation statuses for a "VJOURNAL".
389 ; Default is NEEDS-ACTION.
391 * rangeparam = "RANGE" "=" "THISANDFUTURE"
392 ; To specify the instance specified by the recurrence identifier
393 ; and all subsequent recurrence instances.
395 * trigrelparam = "RELATED" "="
396 ("START" ; Trigger off of start
397 / "END") ; Trigger off of end
399 * reltypeparam = "RELTYPE" "="
400 ("PARENT" ; Parent relationship - Default
401 / "CHILD" ; Child relationship
402 / "SIBLING" ; Sibling relationship
403 / iana-token ; Some other IANA-registered
404 ; iCalendar relationship type
405 / x-name) ; A non-standard, experimental
408 * roleparam = "ROLE" "="
409 ("CHAIR" ; Indicates chair of the
411 / "REQ-PARTICIPANT" ; Indicates a participant whose
412 ; participation is required
413 / "OPT-PARTICIPANT" ; Indicates a participant whose
414 ; participation is optional
415 / "NON-PARTICIPANT" ; Indicates a participant who
416 ; is copied for information
418 / x-name ; Experimental role
419 / iana-token) ; Other IANA role
420 ; Default is REQ-PARTICIPANT
422 * rsvpparam = "RSVP" "=" ("TRUE" / "FALSE")
425 * sentbyparam = "SENT-BY" "=" DQUOTE cal-address DQUOTE
427 * tzidparam = "TZID" "=" [tzidprefix] paramtext
433 typedef struct vevent_summary_s
{
446 unsigned char **description
;
447 struct vevent_summary_s
*next
;
450 typedef enum {VCalendar
= 0, VTimeZone
, VEvent
, VTodo
, VJournal
,
451 VAlarm
, VFreeBusy
, VUnknown
} Cal_comp
;
453 typedef enum {EvDtstamp
= 0, EvUid
, EvDtstart
, EvClass
, EvCreated
,
454 EvDescription
, EvGeo
, EvLastMod
, EvLocation
,
455 EvOrganizer
, EvPriority
, EvSequence
, EvStatus
,
456 EvSummary
, EvTransp
, EvUrl
, EvRecurrence
, EvRrule
,
457 EvDtend
, EvDuration
, EvAttach
, EvAttendee
, EvCategories
,
458 EvComment
, EvContact
, EvExdate
, EvRstatus
, EvRelated
,
459 EvResources
, EvRdate
,
460 EvUnknown
} Event_prop
;
462 typedef enum {TZCid
= 0, TZCLastMod
, TZCUrl
, TZCUnknown
} TZ_comp
;
464 typedef enum {TZPDtstart
= 0, TZPOffsetto
, TZPOffsetfrom
,
465 TZPRrule
, TZPComment
, TZPRdate
, TZPTzname
, TZPUnknown
} TZ_prop
;
467 typedef enum {AlAction
= 0, AlTrigger
, AlDuration
, AlRepeat
,
468 AlDescription
, AlSummary
, AlAttach
, AlAttendee
,
469 AlUnknown
} Alarm_prop
;
471 typedef enum {RRFreq
, RRUntil
, RRCount
, RRInterval
,
472 RRBysecond
, RRByminute
, RRByhour
, RRByday
,
473 RRByweekno
, RRBymonth
, RRBysetpos
, RRWkst
,
474 RRBymonthday
, RRByyearday
,
475 RRUnknown
} RRule_prop
;
477 #endif /* ifndef ICALTYPE_INCLUDED */