aboutsummaryrefslogtreecommitdiffstats
path: root/libical/src/libical/icaltypes.h
blob: c33e8acd7d690011df848752f977abef37573dec (plain) (blame)
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
/* -*- Mode: C -*- */
/*======================================================================
 FILE: icaltypes.h
 CREATOR: eric 20 March 1999


  (C) COPYRIGHT 1999 Eric Busboom 
  http://www.softwarestudio.org

  The contents of this file are subject to the Mozilla Public License
  Version 1.0 (the "License"); you may not use this file except in
  compliance with the License. You may obtain a copy of the License at
  http://www.mozilla.org/MPL/
 
  Software distributed under the License is distributed on an "AS IS"
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  the License for the specific language governing rights and
  limitations under the License.

  The original author is Eric Busboom
  The original code is icaltypes.h

======================================================================*/

#ifndef ICALTYPES_H
#define ICALTYPES_H

#include <time.h>
#include "icalenums.h" /* for recurrence enums */

/* This type type should probably be an opaque type... */
struct icalattachtype
{
    void* binary;
    int owns_binary; 

    char* base64;
    int owns_base64;

    char* url;

    int refcount; 

};

/* converts base64 to binary, fetches url and stores as binary, or
   just returns data */

struct icalattachtype* icalattachtype_new();
void  icalattachtype_add_reference(struct icalattachtype* v);
void icalattachtype_free(struct icalattachtype* v);

void icalattachtype_set_url(struct icalattachtype* v, char* url);
char* icalattachtype_get_url(struct icalattachtype* v);

void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
                int owns);
char* icalattachtype_get_base64(struct icalattachtype* v);

void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
                int owns);
void* icalattachtype_get_binary(struct icalattachtype* v);

struct icalgeotype 
{
    float lat;
    float lon;
};

struct icaltimetype
{
    int year;
    int month;
    int day;
    int hour;
    int minute;
    int second;

    int is_utc; /* 1-> time is in UTC timezone */

    int is_date; /* 1 -> interpret this as date. */
};  

struct icaltimetype icaltimetype_from_timet(time_t v, int is_date);
                       

/* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of
   the values and fields in struct icalrecurrencetype */


struct icalrecurrencetype 
{
    icalrecurrencetype_frequency freq;


    /* until and count are mutually exclusive. */
        struct icaltimetype until;
    int count;

    short interval;
    
    icalrecurrencetype_weekday week_start;
    
    /* The BY* parameters can each take a list of values. Here I
     * assume that the list of values will not be larger than the
     * range of the value -- that is, the client will not name a
     * value more than once. 
     
     * Each of the lists is terminated with the value SHRT_MAX
     * unless the the list is full. */

    short by_second[61];
    short by_minute[61];
    short by_hour[25];
    short by_day[8];
    short by_month_day[32];
    short by_year_day[367];
    short by_week_no[54];
    short by_month[13];
    short by_set_pos[367];
};


void icalrecurrencetype_clear(struct icalrecurrencetype *r);

struct icaldurationtype
{
    unsigned int days;
    unsigned int weeks;
    unsigned int hours;
    unsigned int minutes;
    unsigned int seconds;
};

struct icaldurationtype icaldurationtype_from_timet(time_t t);
time_t icaldurationtype_as_timet(struct icaldurationtype duration);

/* Return the next occurance of 'r' after the time specified by 'after' */
struct icaltimetype icalrecurrencetype_next_occurance(
    struct icalrecurrencetype *r,
    struct icaltimetype *after);


struct icalperiodtype 
{
    struct icaltimetype start; /* Must be absolute */   
    struct icaltimetype end; /* Must be absolute */
    struct icaldurationtype duration;
};

time_t icalperiodtype_duration(struct icalperiodtype period);
time_t icalperiodtype_end(struct icalperiodtype period);

union icaltriggertype 
{
    struct icaltimetype time; 
    struct icaldurationtype duration;
};

struct icalrequestsstatustype {

    short minor;
    short major; 

};


#endif /* !ICALTYPES_H */