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 */
135 typedef struct vtodo_s
{
136 ICLINE_S
*dtstamp
; /* required, at most one */
137 ICLINE_S
*uid
; /* required, at most one */
138 ICLINE_S
*class; /* optional, at most one */
139 ICLINE_S
*completed
; /* optional, at most one */
140 ICLINE_S
*created
; /* optional, at most one */
141 ICLINE_S
*description
;/* optional, at most one */
142 ICLINE_S
*dtstart
; /* optional, at most one */
143 ICLINE_S
*geo
; /* optional, at most one */
144 ICLINE_S
*lastmod
; /* optional, at most one */
145 ICLINE_S
*location
; /* optional, at most one */
146 ICLINE_S
*organizer
; /* optional, at most one */
147 ICLINE_S
*percent
; /* optional, at most one */
148 ICLINE_S
*priority
; /* optional, at most one */
149 ICLINE_S
*recurid
; /* optional, at most one */
150 ICLINE_S
*seq
; /* optional, at most one */
151 ICLINE_S
*status
; /* optional, at most one */
152 ICLINE_S
*summary
; /* optional, at most one */
153 ICLINE_S
*url
; /* optional, at most one */
154 RRULE_S
*rrule
; /* optional, at most one */
155 ICLINE_S
*due
; /* optional, at most one, but exclude duration */
156 ICLINE_S
*duration
; /* optional, at most one, but exclude due, and add dtstart */
157 ICLINE_S
*attach
; /* optional, can appear more than once */
158 ICLINE_S
*attendee
; /* optional, can appear more than once */
159 ICLINE_S
*categories
; /* optional, can appear more than once */
160 ICLINE_S
*comment
; /* optional, can appear more than once */
161 ICLINE_S
*contact
; /* optional, can appear more than once */
162 ICLINE_S
*exdate
; /* optional, can appear more than once */
163 ICLINE_S
*rstatus
; /* optional, can appear more than once */
164 ICLINE_S
*related
; /* optional, can appear more than once */
165 ICLINE_S
*resources
; /* optional, can appear more than once */
166 ICLINE_S
*rdate
; /* optional, can appear more than once */
167 ICAL_PARAMETER_S
*unknown
; /* unknown values */
168 VALARM_S
*valarm
; /* optional valarm */
171 typedef struct journal_s
{
172 ICLINE_S
*dtstamp
; /* required, at most one */
173 ICLINE_S
*uid
; /* required, at most one */
174 ICLINE_S
*class; /* optional, at most one */
175 ICLINE_S
*created
; /* optional, at most one */
176 ICLINE_S
*dtstart
; /* optional, at most one */
177 ICLINE_S
*lastmod
; /* optional, at most one */
178 ICLINE_S
*organizer
; /* optional, at most one */
179 ICLINE_S
*recurid
; /* optional, at most one */
180 ICLINE_S
*seq
; /* optional, at most one */
181 ICLINE_S
*status
; /* optional, at most one */
182 ICLINE_S
*summary
; /* optional, at most one */
183 ICLINE_S
*url
; /* optional, at most one */
184 RRULE_S
*rrule
; /* optional, at most one */
185 ICLINE_S
*attach
; /* optional, may occur more than once */
186 ICLINE_S
*attendee
; /* optional, may occur more than once */
187 ICLINE_S
*categories
; /* optional, may occur more than once */
188 ICLINE_S
*comment
; /* optional, may occur more than once */
189 ICLINE_S
*contact
; /* optional, may occur more than once */
190 ICLINE_S
*description
;/* optional, may occur more than once */
191 ICLINE_S
*exdate
; /* optional, may occur more than once */
192 ICLINE_S
*related
; /* optional, may occur more than once */
193 ICLINE_S
*rdate
; /* optional, may occur more than once */
194 ICLINE_S
*rstatus
; /* optional, may occur more than once */
195 ICAL_PARAMETER_S
*unknown
; /* unknown values */
198 typedef struct freebusy_s
{
199 ICLINE_S
*dtstamp
; /* required, at most one */
200 ICLINE_S
*uid
; /* required, at most one */
201 ICLINE_S
*contact
; /* optional, at most one */
202 ICLINE_S
*dtstart
; /* optional, at most one */
203 ICLINE_S
*dtend
; /* optional, at most one */
204 ICLINE_S
*organizer
; /* optional, at most one */
205 ICLINE_S
*url
; /* optional, at most one */
206 ICLINE_S
*attendee
; /* optional, may appear more than oncece */
207 ICLINE_S
*comment
; /* optional, may appear more than oncece */
208 ICLINE_S
*freebusy
; /* optional, may appear more than oncece */
209 ICLINE_S
*rstatus
; /* optional, may appear more than once */
210 ICAL_PARAMETER_S
*unknown
; /* unknown values */
213 typedef struct ical_tzprop_s
{
215 struct tm dtstart
; /* required, at most one */
216 int tzoffsetto
; /* required, at most one */
217 int tzoffsetfrom
; /* required, at most one */
218 RRULE_S
*rrule
; /* optional, at most one */
219 GEN_ICLINE_S
*comment
; /* optional, may appear more than once */
220 GEN_ICLINE_S
*rdate
; /* optional, may appear more than once */
221 GEN_ICLINE_S
*tzname
; /* optional, may appear more than once */
223 void **prop
; /* the bunch of timezone properties */
224 GEN_ICLINE_S
*uk_prop
; /* optional, may appear more than once */
225 struct ical_tzprop_s
*next
;
228 typedef struct vtimezone_s
{
230 ICLINE_S
*tzid
; /* required, at most one */
231 ICLINE_S
*last_mod
; /* optional, at most one */
232 ICLINE_S
*tzurl
; /* optional, at most one */
234 void **prop
; /* array of timezone properties */
235 ICAL_TZPROP_S
*standardc
; /* optional, may appear more than once */
236 ICAL_TZPROP_S
*daylightc
; /* optional, may appear more than once */
237 GEN_ICLINE_S
*uk_prop
; /* optional, may appear more than once */
240 typedef struct vcalendar_s
{
241 ICLINE_S
*prodid
; /* required, at most one */
242 ICLINE_S
*version
; /* required, at most one */
243 ICLINE_S
*calscale
; /* optional, at most one */
244 ICLINE_S
*method
; /* optional, at most one */
245 GEN_ICLINE_S
*uk_prop
;/* in case there is an unknown property */
246 void **comp
; /* an array with the components of a calendar */
247 ICAL_S
*uk_comp
; /* in case there is an unknown component */
248 unsigned short encoding
; /* save the original encoding. */
252 typedef enum {Individual
, Group
, Resource
, Room
, CUUnknown
} CUType
;
253 typedef enum {EventNeedsAction
, EventAccepted
, EventDeclined
, EventTentative
,
254 EventDelegated
, EventUnknown
,
255 TodoNeedsAction
, TodoAccepted
, TodoDeclined
, TodoTentative
,
256 TodoDelegated
, TodoCompleted
, TodoInProgress
, TodoUnknown
,
257 JournalNeedsAction
, JournalAccepted
, JournalDeclined
,
258 JournalUnknown
} PartStat
;
259 typedef enum {RelBegin
, RelEnd
, RelUnknown
} Related
;
260 typedef enum {Parent
, Child
, Sibling
} RelType
;
261 typedef enum {ReqPart
, Chair
, OptPart
, NonPart
, RoleUnknown
} Role
;
262 typedef enum {RSVPFalse
, RSVPTrue
, RSVPUnknown
} RSVP
;
263 typedef enum {Binary
, _Boolean
, CalAddress
, Date
, DateTime
, _Duration
,
264 Float
, Integer
, Period
, Recur
, _Text
, Time
, Uri
,
265 UtcOffset
, ValueUnknown
} Value
;
267 typedef struct icalpar_s
{
268 ICLINE_S
*altrep
; /* altrep uri, inside dquote RFC 2392, RFC 2616 and RFC 2818 */
269 ICLINE_S
*cn
; /* common name */
270 CUType cutype
; /* calendar user type: individual, group, resource, room, unknown */
271 ADDRESS
*delegated_from
; /* person(s) who delegated their participation */
272 ADDRESS
*delegated_to
; /* person that was delegated participation */
273 ICLINE_S
*dir
; /* reference to a directory entry associated with the calendar user specified by the property. */
274 unsigned short encoding
; /* encoding, either 8bit or base64 */
275 unsigned short type
; /* type for FMTTYPE */
276 ICLINE_S
*subtype
; /* subtype for FMTTYPE */
277 ICLINE_S
*fbtype
; /* FreeBusy type */
278 ICLINE_S
*language
; /* language */
279 ADDRESS
*member
; /* group or list membership of the calendar user specified by the property */
280 PartStat partstat
; /* participation status for the calendar user specified by the property. */
281 ICLINE_S
*range
; /* this and future */
282 Related related
; /* relationship of the alarm trigger with respect to the start or end of the calendar component. */
283 RelType reltype
; /* type of hierarchical relationship associated with the calendar component specified by the property. */
284 Role role
; /* participation role for the calendar user specified by the property. */
285 RSVP rsvp
; /* whether there is an expectation of a favor of a reply from the calendar user specified by the property value. */
286 ADDRESS
*sentby
; /* the calendar user that is acting on behalf of the calendar user specified by the property. */
287 ICLINE_S
*tzid
; /* the identifier for the time zone definition for a time component in the property value. */
288 Value value
; /* specify the value type format for a property value. */
291 typedef struct ical_duration_s
{
292 unsigned sign
:1; /* sign = 0 for positive, sign = 1 for negative */
298 struct ical_duration_s
*next
; /* another duration */
301 /* altrepparam = "ALTREP" "=" DQUOTE uri DQUOTE
302 * cnparam = "CN" "=" param-value
303 * cutypeparam = "CUTYPE" "="
304 ("INDIVIDUAL" ; An individual
305 / "GROUP" ; A group of individuals
306 / "RESOURCE" ; A physical resource
307 / "ROOM" ; A room resource
308 / "UNKNOWN" ; Otherwise not known
309 / x-name ; Experimental type
310 / iana-token) ; Other IANA-registered
312 * delfromparam = "DELEGATED-FROM" "=" DQUOTE cal-address
313 DQUOTE *("," DQUOTE cal-address DQUOTE)
315 * deltoparam = "DELEGATED-TO" "=" DQUOTE cal-address DQUOTE
316 *("," DQUOTE cal-address DQUOTE)
318 * dirparam = "DIR" "=" DQUOTE uri DQUOTE
320 * encodingparam = "ENCODING" "="
322 ; "8bit" text encoding is defined in [RFC2045]
324 ; "BASE64" binary encoding format is defined in [RFC4648]
326 * fmttypeparam = "FMTTYPE" "=" type-name "/" subtype-name
327 ; Where "type-name" and "subtype-name" are
328 ; defined in Section 4.2 of [RFC4288].
330 * fbtypeparam = "FBTYPE" "=" ("FREE" / "BUSY"
331 / "BUSY-UNAVAILABLE" / "BUSY-TENTATIVE"
333 ; Some experimental iCalendar free/busy type.
335 ; Some other IANA-registered iCalendar free/busy type.
337 * languageparam = "LANGUAGE" "=" language
339 language = Language-Tag
340 ; As defined in [RFC5646].
342 * memberparam = "MEMBER" "=" DQUOTE cal-address DQUOTE
343 *("," DQUOTE cal-address DQUOTE)
345 * partstatparam = "PARTSTAT" "="
350 partstat-event = ("NEEDS-ACTION" ; Event needs action
351 / "ACCEPTED" ; Event accepted
352 / "DECLINED" ; Event declined
353 / "TENTATIVE" ; Event tentatively
355 / "DELEGATED" ; Event delegated
356 / x-name ; Experimental status
357 / iana-token) ; Other IANA-registered
359 ; These are the participation statuses for a "VEVENT".
360 ; Default is NEEDS-ACTION.
362 partstat-todo = ("NEEDS-ACTION" ; To-do needs action
363 / "ACCEPTED" ; To-do accepted
364 / "DECLINED" ; To-do declined
365 / "TENTATIVE" ; To-do tentatively
367 / "DELEGATED" ; To-do delegated
368 / "COMPLETED" ; To-do completed
369 ; COMPLETED property has
370 ; DATE-TIME completed
371 / "IN-PROCESS" ; To-do in process of
373 / x-name ; Experimental status
374 / iana-token) ; Other IANA-registered
376 ; These are the participation statuses for a "VTODO".
377 ; Default is NEEDS-ACTION.
381 partstat-jour = ("NEEDS-ACTION" ; Journal needs action
382 / "ACCEPTED" ; Journal accepted
383 / "DECLINED" ; Journal declined
384 / x-name ; Experimental status
385 / iana-token) ; Other IANA-registered
387 ; These are the participation statuses for a "VJOURNAL".
388 ; Default is NEEDS-ACTION.
390 * rangeparam = "RANGE" "=" "THISANDFUTURE"
391 ; To specify the instance specified by the recurrence identifier
392 ; and all subsequent recurrence instances.
394 * trigrelparam = "RELATED" "="
395 ("START" ; Trigger off of start
396 / "END") ; Trigger off of end
398 * reltypeparam = "RELTYPE" "="
399 ("PARENT" ; Parent relationship - Default
400 / "CHILD" ; Child relationship
401 / "SIBLING" ; Sibling relationship
402 / iana-token ; Some other IANA-registered
403 ; iCalendar relationship type
404 / x-name) ; A non-standard, experimental
407 * roleparam = "ROLE" "="
408 ("CHAIR" ; Indicates chair of the
410 / "REQ-PARTICIPANT" ; Indicates a participant whose
411 ; participation is required
412 / "OPT-PARTICIPANT" ; Indicates a participant whose
413 ; participation is optional
414 / "NON-PARTICIPANT" ; Indicates a participant who
415 ; is copied for information
417 / x-name ; Experimental role
418 / iana-token) ; Other IANA role
419 ; Default is REQ-PARTICIPANT
421 * rsvpparam = "RSVP" "=" ("TRUE" / "FALSE")
424 * sentbyparam = "SENT-BY" "=" DQUOTE cal-address DQUOTE
426 * tzidparam = "TZID" "=" [tzidprefix] paramtext
432 typedef struct vevent_summary_s
{
445 unsigned char **description
;
448 typedef enum {VCalendar
= 0, VTimeZone
, VEvent
, VTodo
, VJournal
,
449 VAlarm
, VFreeBusy
, VUnknown
} Cal_comp
;
451 typedef enum {EvDtstamp
= 0, EvUid
, EvDtstart
, EvClass
, EvCreated
,
452 EvDescription
, EvGeo
, EvLastMod
, EvLocation
,
453 EvOrganizer
, EvPriority
, EvSequence
, EvStatus
,
454 EvSummary
, EvTransp
, EvUrl
, EvRecurrence
, EvRrule
,
455 EvDtend
, EvDuration
, EvAttach
, EvAttendee
, EvCategories
,
456 EvComment
, EvContact
, EvExdate
, EvRstatus
, EvRelated
,
457 EvResources
, EvRdate
,
458 EvUnknown
} Event_prop
;
460 typedef enum {TZCid
= 0, TZCLastMod
, TZCUrl
, TZCUnknown
} TZ_comp
;
462 typedef enum {TZPDtstart
= 0, TZPOffsetto
, TZPOffsetfrom
,
463 TZPRrule
, TZPComment
, TZPRdate
, TZPTzname
, TZPUnknown
} TZ_prop
;
465 typedef enum {AlAction
= 0, AlTrigger
, AlDuration
, AlRepeat
,
466 AlDescription
, AlSummary
, AlAttach
, AlAttendee
,
467 AlUnknown
} Alarm_prop
;
469 typedef enum {RRFreq
, RRUntil
, RRCount
, RRInterval
,
470 RRBysecond
, RRByminute
, RRByhour
, RRByday
,
471 RRByweekno
, RRBymonth
, RRBysetpos
, RRWkst
,
472 RRBymonthday
, RRByyearday
,
473 RRUnknown
} RRule_prop
;
475 #endif /* ifndef ICALTYPE_INCLUDED */