20#include "icalbdbsetimpl.h"
22#include "icalerror_p.h"
32#if !defined(DB_VERSION_MAJOR)
33#define DB_VERSION_MAJOR 1
36static int _compare_ids(
const char *compid,
const char *matchid);
37#if DB_VERSION_MAJOR > 5
38static int _compare_keys(DB *dbp,
const DBT *a,
const DBT *b,
size_t *locp);
40static int _compare_keys(DB *dbp,
const DBT *a,
const DBT *b);
44static icalbdbset_options icalbdbset_options_default =
46 ICALBDB_EVENTS, DB_BTREE, 0644, 0, NULL, NULL};
48static DB_ENV *ICAL_DB_ENV = 0;
53 void (*logDbFunc)(
const DB_ENV *,
const char *,
const char *))
59 struct stat env_dir_sb;
61 if (stat(db_env_dir, &env_dir_sb)) {
62 fprintf(stderr,
"The directory '%s' is missing, please create it.\n", db_env_dir);
67 ret = db_env_create(&ICAL_DB_ENV, 0);
75 if ((ret = ICAL_DB_ENV->set_lk_detect(ICAL_DB_ENV, DB_LOCK_DEFAULT)) != 0) {
77 fprintf(stderr,
"Could not initialize the database locking environment\n");
81 flags = (u_int32_t)(DB_INIT_LOCK | DB_INIT_TXN | DB_CREATE | DB_THREAD |
82 DB_RECOVER | DB_INIT_LOG | DB_INIT_MPOOL);
84 ret = ICAL_DB_ENV->open(ICAL_DB_ENV, db_env_dir, flags, 0 );
86 ret = ICAL_DB_ENV->open(ICAL_DB_ENV, db_env_dir, flags, S_IRUSR | S_IWUSR);
91 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"dbenv->open");
96 if (logDbFunc != NULL) {
97 ICAL_DB_ENV->set_errcall(ICAL_DB_ENV, logDbFunc);
103void icalbdbset_checkpoint(
void)
107 switch (ret = ICAL_DB_ENV->txn_checkpoint(ICAL_DB_ENV, 0, 0, 0)) {
111 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"checkpoint failed");
116void icalbdbset_rmdbLog(
void)
121 if (ICAL_DB_ENV->log_archive(ICAL_DB_ENV, &listp, DB_ARCH_ABS) == 0) {
122 if (*listp != NULL) {
125 while (listp[ii] != NULL) {
126 (void)unlink(listp[ii]);
134int icalbdbset_cleanup(
void)
139 icalbdbset_checkpoint();
142 icalbdbset_rmdbLog();
145 ret = ICAL_DB_ENV->close(ICAL_DB_ENV, 0);
151DB_ENV *icalbdbset_get_env(
void)
164static icalerrorenum icalbdbset_read_database(icalbdbset *bset,
char *(*pfunc)(
const DBT *dbt))
172 char datastore[1024];
173 char *more_mem = NULL;
178 memset(&key, 0,
sizeof(DBT));
179 memset(&data, 0,
sizeof(DBT));
193 if (ICAL_DB_ENV->txn_begin(ICAL_DB_ENV, NULL, &tid, 0) != 0) {
198 if ((ret = dbp->cursor(dbp, tid, &dbcp, 0)) != 0) {
199 dbp->err(dbp, ret,
"primary index");
203 key.flags = DB_DBT_USERMEM;
205 key.ulen = (u_int32_t)
sizeof(keystore);
207 data.flags = DB_DBT_USERMEM;
208 data.data = datastore;
209 data.ulen = (u_int32_t)
sizeof(datastore);
213 ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT);
214 if (ret == DB_NOTFOUND) {
216 }
else if (ret == ENOMEM) {
220 more_mem = malloc(data.ulen + 1024);
221 data.data = more_mem;
222 data.ulen = data.ulen + 1024;
223 }
else if (ret == DB_LOCK_DEADLOCK) {
229 dbp->err(dbp, ret,
"cursor");
235 if ((str = (
char *)calloc(data.size + 1,
sizeof(
char))) == NULL) {
238 memcpy(str, (
char *)data.data, data.size);
246 if (ret != DB_NOTFOUND) {
255 if (dbcp->c_close(dbcp) != 0) {
259 if (tid->commit(tid, 0) != 0) {
274 dbp->err(dbp, ret,
"cursor index");
279icalset *icalbdbset_init(icalset *set,
const char *dsn,
void *options_in)
281 icalbdbset *bset = (icalbdbset *)set;
282 icalbdbset_options *options = (icalbdbset_options *)options_in;
284 const char *subdb_name = NULL;
288 if (options == (icalbdbset_options *)NULL) {
289 options = &icalbdbset_options_default;
292 switch (options->subdb) {
293 case ICALBDB_CALENDARS:
294 subdb_name =
"calendars";
297 subdb_name =
"events";
300 subdb_name =
"todos";
302 case ICALBDB_REMINDERS:
303 subdb_name =
"reminders";
307 cal_db = icalbdbset_bdb_open(set->dsn,
308 subdb_name, options->dbtype, options->mode, options->flag);
309 if (cal_db == NULL) {
318 if (icalbdbset_read_database(bset, options->pfunc) !=
ICAL_NO_ERROR) {
322 return (icalset *)bset;
330icalset *
icalbdbset_new(
const char *database_filename, icalbdbset_subdb_type subdb_type,
int dbtype,
333 icalbdbset_options options = icalbdbset_options_default;
335 options.subdb = subdb_type;
336 options.dbtype = dbtype;
351 int (*callback)(DB *db,
const DBT *dbt1,
const DBT *dbt2,
370 if ((ret = db_create(&sdbp, ICAL_DB_ENV, 0)) != 0) {
371 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"secondary index: %s", sub_database);
375 if ((ret = sdbp->set_flags(sdbp, (u_int32_t)(DB_DUP | DB_DUPSORT))) != 0) {
376 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"set_flags error for secondary index: %s", sub_database);
380 flags = (u_int32_t)(DB_CREATE | DB_THREAD);
381 ret = sdbp->open(sdbp, NULL, database, sub_database, (DBTYPE)type, (u_int32_t)flags, 0644);
383 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"failed to open secondary index: %s", sub_database);
384 if (ret == DB_RUNRECOVERY) {
392 if ((ret = dbp->associate(dbp, NULL, sdbp, callback, 0)) != 0) {
393 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"failed to associate secondary index: %s", sub_database);
400DB *icalbdbset_bdb_open(
const char *path,
const char *subdb,
int dbtype,
int mode, u_int32_t flag)
407 flags = (u_int32_t)(DB_CREATE | DB_THREAD);
417 if (db_create(&dbp, ICAL_DB_ENV, 0) != 0) {
422 if (dbtype == DB_BTREE) {
423 dbp->set_bt_compare(dbp, _compare_keys);
428 dbp->set_flags(dbp, flag);
431 if ((ret = dbp->open(dbp, NULL, path, subdb, (DBTYPE)dbtype, flags, mode)) != 0) {
432 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"%s (database: %s): open failed.", path, subdb);
433 if (ret == DB_RUNRECOVERY) {
444char *icalbdbset_parse_data(DBT *dbt,
char *(*pfunc)(
const DBT *dbt))
449 ret = (
char *)pfunc(dbt);
451 ret = (
char *)dbt->data;
458void icalbdbset_free(icalset *set)
460 icalbdbset *bset = (icalbdbset *)set;
462 icalerror_check_arg_rv((bset != 0),
"bset");
464 if (bset->cluster != 0) {
470 if (bset->gauge != 0) {
474 if (bset->path != 0) {
475 free((
char *)bset->path);
479 if (bset->sindex != 0) {
480 free((
char *)bset->sindex);
484 if (bset->dbp && (bset->dbp->close(bset->dbp, 0) != 0)) {
491int icalbdbset_acquire_cursor(DB *dbp, DB_TXN *tid, DBC **rdbcp)
495 if ((ret = dbp->cursor(dbp, tid, rdbcp, 0)) != 0) {
496 dbp->err(dbp, ret,
"couldn't open cursor");
507int icalbdbset_get_first(DBC *dbcp, DBT *key, DBT *data)
509 return icalbdbset_cget(dbcp, key, data, DB_FIRST);
512int icalbdbset_get_next(DBC *dbcp, DBT *key, DBT *data)
514 return icalbdbset_cget(dbcp, key, data, DB_NEXT);
517int icalbdbset_get_last(DBC *dbcp, DBT *key, DBT *data)
519 return icalbdbset_cget(dbcp, key, data, DB_LAST);
522int icalbdbset_get_key(DBC *dbcp, DBT *key, DBT *data)
524 return icalbdbset_cget(dbcp, key, data, DB_SET);
527int icalbdbset_delete(DB *dbp, DBT *key)
534 while ((retry < MAX_RETRY) && !done) {
535 if ((ret = ICAL_DB_ENV->txn_begin(ICAL_DB_ENV, NULL, &tid, 0)) != 0) {
536 if (ret == DB_LOCK_DEADLOCK) {
545 if ((ret = dbp->del(dbp, tid, key, 0)) != 0) {
546 if (ret == DB_NOTFOUND) {
548 }
else if (ret == DB_LOCK_DEADLOCK) {
553 char *strError = db_strerror(ret);
555 icalerror_warn(
"icalbdbset_delete failed: ");
556 icalerror_warn(strError);
562 if ((ret = tid->commit(tid, 0)) != 0) {
563 if (ret == DB_LOCK_DEADLOCK) {
585int icalbdbset_cget(DBC *dbcp, DBT *key, DBT *data, u_int32_t access_method)
587 key->flags |= DB_DBT_MALLOC;
588 data->flags |= DB_DBT_MALLOC;
591 if (dbcp->c_get(dbcp, key, data, access_method) != 0) {
601int icalbdbset_cput(DBC *dbcp, DBT *key, DBT *data, u_int32_t access_method)
603 _unused(access_method);
605 key->flags |= DB_DBT_MALLOC;
606 data->flags |= DB_DBT_MALLOC;
609 if (dbcp->c_put(dbcp, key, data, 0) != 0) {
619int icalbdbset_put(DB *dbp, DBT *key, DBT *data, u_int32_t access_method)
625 while ((retry < MAX_RETRY) && !done) {
627 if ((ret = ICAL_DB_ENV->txn_begin(ICAL_DB_ENV, NULL, &tid, 0)) != 0) {
628 if (ret == DB_LOCK_DEADLOCK) {
637 if ((ret = dbp->put(dbp, tid, key, data, access_method)) != 0) {
638 if (ret == DB_LOCK_DEADLOCK) {
643 char *strError = db_strerror(ret);
645 icalerror_warn(
"icalbdbset_put failed: ");
646 icalerror_warn(strError);
652 if ((ret = tid->commit(tid, 0)) != 0) {
653 if (ret == DB_LOCK_DEADLOCK) {
676int icalbdbset_get(DB *dbp, DB_TXN *tid, DBT *key, DBT *data, u_int32_t flags)
678 return dbp->get(dbp, tid, key, data, flags);
686 icalerror_check_arg_rz((set != 0),
"set");
691const char *icalbdbset_subdb(icalset *set)
693 const icalbdbset *bset = (icalbdbset *)set;
695 icalerror_check_arg_rz((bset != 0),
"bset");
713 char datastore[1024];
714 char *more_mem = NULL;
716 icalbdbset *bset = (icalbdbset *)set;
717 int bad_uid_counter = 0;
718 int retry = 0, done = 0, completed = 0, deadlocked = 0;
725 if (bset->changed == 0) {
729 memset(&key, 0,
sizeof(key));
730 memset(&data, 0,
sizeof(data));
732 key.flags = DB_DBT_USERMEM;
734 key.ulen = (u_int32_t)
sizeof(keystore);
736 data.flags = DB_DBT_USERMEM;
737 data.data = datastore;
738 data.ulen = (u_int32_t)
sizeof(datastore);
746 while ((retry < MAX_RETRY) && !done) {
748 if ((ret = ICAL_DB_ENV->txn_begin(ICAL_DB_ENV, NULL, &tid, 0)) != 0) {
749 if (ret == DB_LOCK_DEADLOCK) {
752 }
else if (ret == DB_RUNRECOVERY) {
753 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"icalbdbset_commit: txn_begin failed");
756 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"icalbdbset_commit");
762 if ((ret = dbp->cursor(dbp, tid, &dbcp, DB_DIRTY_READ)) != 0) {
764 if (ret == DB_LOCK_DEADLOCK) {
767 }
else if (ret == DB_RUNRECOVERY) {
768 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"curor failed");
771 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"curor failed");
779 while (!completed && !deadlocked) {
780 ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT);
781 if (ret == DB_NOTFOUND) {
783 }
else if (ret == ENOMEM) {
787 more_mem = malloc(data.ulen + 1024);
788 data.data = more_mem;
789 data.ulen = data.ulen + 1024;
790 }
else if (ret == DB_LOCK_DEADLOCK) {
792 }
else if (ret == DB_RUNRECOVERY) {
794 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"c_get failed.");
796 }
else if (ret == 0) {
797 if ((ret = dbcp->c_del(dbcp, 0)) != 0) {
798 dbp->err(dbp, ret,
"cursor");
799 if (ret == DB_KEYEMPTY) {
802 }
else if (ret == DB_LOCK_DEADLOCK) {
834 c != 0 && !deadlocked;
836 memset(&key, 0,
sizeof(key));
837 memset(&data, 0,
sizeof(data));
845 snprintf(uidbuf, 256,
"baduid%d-%d", getpid(), bad_uid_counter++);
851 char *relcalid = NULL;
854 if (relcalid == NULL) {
855 snprintf(uidbuf, 256,
"baduid%d-%d", getpid(), bad_uid_counter++);
861 key.size = (u_int32_t)strlen(key.data);
865 data.size = (u_int32_t)strlen(str);
867 if ((ret = dbcp->c_put(dbcp, &key, &data, DB_KEYLAST)) != 0) {
868 if (ret == DB_LOCK_DEADLOCK) {
870 }
else if (ret == DB_RUNRECOVERY) {
871 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"c_put failed.");
874 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"c_put failed %s.", str);
888 if ((ret = dbcp->c_close(dbcp)) != 0) {
890 if (ret == DB_LOCK_DEADLOCK) {
893 }
else if (ret == DB_RUNRECOVERY) {
894 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"c_closed failed.");
897 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"c_closed failed.");
902 if ((ret = tid->commit(tid, 0)) != 0) {
904 if (ret == DB_LOCK_DEADLOCK) {
907 }
else if (ret == DB_RUNRECOVERY) {
908 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"commit failed.");
911 ICAL_DB_ENV->err(ICAL_DB_ENV, ret,
"commit failed.");
923void icalbdbset_mark(icalset *set)
925 icalbdbset *bset = (icalbdbset *)set;
927 icalerror_check_arg_rv((bset != 0),
"bset");
932icalcomponent *icalbdbset_get_component(icalset *set)
934 const icalbdbset *bset = (icalbdbset *)set;
936 icalerror_check_arg_rz((bset != 0),
"bset");
938 return bset->cluster;
943icalerrorenum icalbdbset_add_component(icalset *set, icalcomponent *child)
945 icalbdbset *bset = (icalbdbset *)set;
952 icalbdbset_mark(set);
957icalerrorenum icalbdbset_remove_component(icalset *set, icalcomponent *child)
959 icalbdbset *bset = (icalbdbset *)set;
966 icalbdbset_mark(set);
980 bset = (icalbdbset *)set;
988 icalbdbset *bset = (icalbdbset *)set;
1002 icalbdbset *bset = (icalbdbset *)set;
1004 icalerror_check_arg_rv((bset != 0),
"bset");
1009icalcomponent *icalbdbset_fetch(icalset *set,
icalcomponent_kind kind,
const char *uid)
1012 icalbdbset *bset = (icalbdbset *)set;
1014 icalerror_check_arg_rz((bset != 0),
"bset");
1021 const char *this_uid = NULL;
1025 this_uid = icalproperty_get_relcalid(p);
1030 this_uid = icalproperty_get_uid(p);
1034 if (this_uid == NULL) {
1035 icalerror_warn(
"icalbdbset_fetch found a component with no UID");
1039 if (strcmp(uid, this_uid) == 0) {
1048int icalbdbset_has_uid(icalset *set,
const char *uid)
1058struct icalbdbset_id {
1060 char *recurrence_id;
1064static void icalbdbset_id_free(
struct icalbdbset_id *
id)
1066 if (id->recurrence_id != 0) {
1067 free(id->recurrence_id);
1075struct icalbdbset_id icalbdbset_get_id(const icalcomponent *comp)
1077 icalcomponent *inner;
1078 struct icalbdbset_id id;
1087 id.uid = strdup(icalproperty_get_uid(p));
1094 id.sequence = icalproperty_get_sequence(p);
1100 id.recurrence_id = NULL;
1107 assert(
id.recurrence_id != 0);
1117static int _compare_ids(
const char *compid,
const char *matchid)
1119 if (compid != NULL && matchid != NULL) {
1120 if (strcmp(compid, matchid) == 0) {
1125 if (compid == NULL && matchid == NULL) {
1132icalcomponent *icalbdbset_fetch_match(icalset *set,
const icalcomponent *comp)
1134 icalbdbset *bset = (icalbdbset *)set;
1136 struct icalbdbset_id comp_id, match_id;
1138 icalerror_check_arg_rz((bset != 0),
"bset");
1139 comp_id = icalbdbset_get_id(comp);
1145 match_id = icalbdbset_get_id(match);
1147 if (_compare_ids(comp_id.uid, match_id.uid) &&
1148 _compare_ids(comp_id.recurrence_id, match_id.recurrence_id)) {
1151 icalbdbset_id_free(&match_id);
1152 icalbdbset_id_free(&comp_id);
1156 icalbdbset_id_free(&match_id);
1159 icalbdbset_id_free(&comp_id);
1163icalerrorenum icalbdbset_modify(icalset *set, icalcomponent *old, icalcomponent *newc)
1173icalerrorenum icalbdbset_set_cluster(icalset *set, icalcomponent *cluster)
1175 icalbdbset *bset = (icalbdbset *)set;
1177 icalerror_check_arg_rz((bset != 0),
"bset");
1179 bset->cluster = cluster;
1185 icalbdbset *bset = (icalbdbset *)set;
1187 icalerror_check_arg_rz((bset != 0),
"bset");
1189 if (bset->cluster != NULL) {
1195icalcomponent *icalbdbset_get_cluster(icalset *set)
1197 const icalbdbset *bset = (icalbdbset *)set;
1199 icalerror_check_arg_rz((bset != 0),
"bset");
1201 return bset->cluster;
1207 icalbdbset *bset = (icalbdbset *)set;
1209 icalerror_check_arg_rz((bset != 0),
"bset");
1214icalcomponent *icalbdbset_get_first_component(icalset *set)
1216 icalbdbset *bset = (icalbdbset *)set;
1217 icalcomponent *c = 0;
1219 icalerror_check_arg_rz((bset != 0),
"bset");
1238 icalgauge *gauge,
const char *tzid)
1241 icalcomponent *comp = NULL;
1245 icalproperty *dtstart, *rrule, *prop, *due;
1249 int orig_time_was_utc = 0;
1252 bset = (icalbdbset *)set;
1270 recur = rrule ? icalproperty_get_rrule(rrule) : NULL;
1273 if (recur != 0 && g == 1) {
1288 start = icalproperty_get_dtstart(dtstart);
1293 start = icalproperty_get_due(due);
1301 orig_time_was_utc = 1;
1304 if (itr.last_component == NULL) {
1307 itr.last_component = comp;
1311 itr.last_component = NULL;
1317 itr.last_component = comp;
1333 icalproperty_set_recurrenceid(prop, next);
1337 if (orig_time_was_utc) {
1352 if ((rrule != NULL && itr.last_component == NULL) || (rrule == NULL)) {
1362icalcomponent *icalbdbset_form_a_matched_recurrence_component(
icalsetiter *itr)
1364 icalcomponent *comp = NULL;
1366 icalproperty *rrule, *prop;
1369 int orig_time_was_utc = 0;
1371 comp = itr->last_component;
1373 if (comp == NULL || itr->gauge == NULL) {
1378 recur = rrule ? icalproperty_get_rrule(rrule) : NULL;
1380 if (recur == NULL) {
1396 start = icalproperty_get_dtstart(dtstart);
1401 start = icalproperty_get_due(due);
1409 orig_time_was_utc = 1;
1412 if (itr->ritr == NULL) {
1415 itr->last_component = comp;
1420 itr->last_component = NULL;
1427 itr->last_component = comp;
1443 icalproperty_set_recurrenceid(prop, next);
1446 if (orig_time_was_utc) {
1459icalcomponent *icalbdbsetiter_to_next(icalset *set,
icalsetiter *i)
1461 icalcomponent *comp = NULL;
1463 icalproperty *rrule, *prop;
1464 int orig_time_was_utc = 0;
1470 if (i->last_component == NULL) {
1473 comp = i->last_component;
1481 if (i->gauge == 0) {
1492 if (recur != 0 && g == 1) {
1505 start = icalproperty_get_dtstart(dtstart);
1510 start = icalproperty_get_due(due);
1518 orig_time_was_utc = 1;
1521 if (i->ritr == NULL) {
1524 i->last_component = comp;
1528 i->last_component = NULL;
1534 i->last_component = comp;
1550 icalproperty_set_recurrenceid(prop, next);
1553 if (orig_time_was_utc) {
1562 }
while (comp != 0);
1568icalcomponent *icalbdbset_get_next_component(icalset *set)
1570 icalbdbset *bset = (icalbdbset *)set;
1571 icalcomponent *c = 0;
1573 icalerror_check_arg_rz((bset != 0),
"bset");
1586int icalbdbset_begin_transaction(DB_TXN *parent_id, DB_TXN **txnid)
1588 return ICAL_DB_ENV->txn_begin(ICAL_DB_ENV, parent_id, txnid, 0);
1591int icalbdbset_commit_transaction(DB_TXN *txnid)
1593 return txnid->commit(txnid, 0);
1596#if DB_VERSION_MAJOR > 5
1597static int _compare_keys(DB *dbp,
const DBT *a,
const DBT *b,
size_t *locp)
1599static int _compare_keys(DB *dbp,
const DBT *a,
const DBT *b)
1602#if DB_VERSION_MAJOR > 5
1612 const char *ac = a->data;
1613 const char *bc = b->data;
1616 return strncmp(ac, bc, a->size);
icalerrorenum icalbdbset_select(icalset *set, icalgauge *gauge)
DB * icalbdbset_bdb_open_secondary(DB *dbp, const char *database, const char *sub_database, int(*callback)(DB *db, const DBT *dbt1, const DBT *dbt2, DBT *dbt3), int type)
void icalbdbset_clear(icalset *set)
int icalbdbset_init_dbenv(char *db_env_dir, void(*logDbFunc)(const DB_ENV *, const char *, const char *))
const char * icalbdbset_path(icalset *set)
icalcomponent * icalbdbset_get_current_component(icalset *set)
icalset * icalbdbset_new(const char *database_filename, icalbdbset_subdb_type subdb_type, int dbtype, u_int32_t flag)
icalerrorenum icalbdbset_commit(icalset *set)
Manages a Berkeley database of ical components and offers interfaces for reading, writing and searchi...
icalproperty * icalcomponent_get_first_property(icalcomponent *c, icalproperty_kind kind)
icalcomponent * icalcompiter_next(icalcompiter *i)
icalcomponent * icalcomponent_get_next_component(icalcomponent *c, icalcomponent_kind kind)
icalcomponent * icalcomponent_get_first_component(icalcomponent *c, icalcomponent_kind kind)
icalcomponent * icalcomponent_get_current_component(icalcomponent *component)
void icalcomponent_remove_component(icalcomponent *parent, icalcomponent *child)
icalcomponent * icalcompiter_deref(icalcompiter *i)
icalcomponent * icalcomponent_new(icalcomponent_kind kind)
const char * icalcomponent_get_relcalid(icalcomponent *comp)
icalcomponent * icalcomponent_get_first_real_component(const icalcomponent *c)
bool icalproperty_recurrence_is_excluded(icalcomponent *comp, struct icaltimetype *dtstart, struct icaltimetype *recurtime)
Decides if a recurrence is acceptable.
const char * icalcomponent_get_uid(icalcomponent *comp)
void icalcomponent_add_property(icalcomponent *component, icalproperty *property)
icalcompiter icalcomponent_begin_component(icalcomponent *component, icalcomponent_kind kind)
char * icalcomponent_as_ical_string_r(const icalcomponent *component)
icalcomponent_kind icalcomponent_isa(const icalcomponent *component)
void icalcomponent_free(icalcomponent *c)
void icalcomponent_add_component(icalcomponent *parent, icalcomponent *child)
int icalcomponent_count_components(icalcomponent *component, icalcomponent_kind kind)
void icalerror_set_errno(icalerrorenum x)
Sets the icalerrno to a given error.
icalerrorenum
Represents the different types of errors that can be triggered in libical.
bool icalgauge_compare(icalgauge *gauge, icalcomponent *comp)
void icalgauge_free(icalgauge *gauge)
int icalgauge_get_expand(const icalgauge *gauge)
icalcomponent * icalparser_parse_string(const char *str)
Parses a string and returns the parsed icalcomponent.
icalvalue * icalproperty_get_value(const icalproperty *prop)
void icalrecur_iterator_free(icalrecur_iterator *impl)
icalrecur_iterator * icalrecur_iterator_new(struct icalrecurrencetype *rule, struct icaltimetype dtstart)
struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *impl)
icalsetiter icalsetiter_null
icalset * icalset_new(icalset_kind kind, const char *dsn, void *options)
struct icaltimetype icaltime_from_timet_with_zone(const icaltime_t tm, const bool is_date, const icaltimezone *zone)
Constructor.
bool icaltime_is_utc(const struct icaltimetype t)
struct icaltimetype icaltime_convert_to_zone(const struct icaltimetype tt, icaltimezone *zone)
bool icaltime_is_null_time(const struct icaltimetype t)
icaltimezone * icaltimezone_get_builtin_timezone(const char *location)
icaltimezone * icaltimezone_get_utc_timezone(void)
Timezone handling routines.
struct _icaltimezone icaltimezone
char * icalvalue_as_ical_string_r(const icalvalue *value)
Defines the data structure representing iCalendar parameter values.