Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtcm / server / cmscalendar.h
1 /* $XConsortium: cmscalendar.h /main/4 1995/11/09 12:40:57 rswiston $ */
2 /*
3  *  (c) Copyright 1993, 1994 Hewlett-Packard Company
4  *  (c) Copyright 1993, 1994 International Business Machines Corp.
5  *  (c) Copyright 1993, 1994 Novell, Inc.
6  *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
7  */
8
9 #ifndef _CMSCALENDAR_H
10 #define _CMSCALENDAR_H
11
12 #include "ansi_c.h"
13 #include "csa.h"
14 #include "cm.h"
15 #include "nametbl.h"
16 #include "tree.h"
17 #include "list.h"
18 #include "data.h"
19 #include "reminder.h"
20 #include "rtable4.h"
21 #include "callback.h"
22 #include "log.h"
23
24 #define GET_R_ACCESS(cal)               ((Access_Entry_4 *) (cal->r_access))
25 #define SET_R_ACCESS(cal,v)             (cal)->r_access = (caddr_t) v
26 #define GET_W_ACCESS(cal)               ((Access_Entry_4 *) (cal->w_access))
27 #define SET_W_ACCESS(cal,v)             (cal)->w_access = (caddr_t) v
28 #define GET_D_ACCESS(cal)               ((Access_Entry_4 *) (cal->d_access))
29 #define SET_D_ACCESS(cal,v)             (cal)->d_access = (caddr_t) v
30 #define GET_X_ACCESS(cal)               ((Access_Entry_4 *) (cal->x_access))
31 #define SET_X_ACCESS(cal,v)             (cal)->x_access = (caddr_t) v
32 #define APPT_TREE(info)                 ((Rb_tree *) ((info)->tree))
33 #define REPT_LIST(info)                 ((Hc_list *) ((info)->list))
34 #define APPT_KEY(p_appt)                ((Appt_4 *) (p_appt))->appt_id.key
35 #define APPT_TICK(p_appt)               ((Appt_4 *) (p_appt))->appt_id.tick
36
37 typedef CSA_return_code (*_DtCmGetAttrFunc)();
38
39 typedef struct __DtCmsCalendar {
40         char            *owner;
41         char            *calendar;
42         _DtCmNameTable  *cal_tbl;
43         _DtCmNameTable  *entry_tbl;
44         int             *types;         /* type associated with entry attrs */
45         int             num_entry_attrs; /* number of entry attrs associated
46                                           * with this calendar */
47         boolean_t       hashed;         /* true if file converted to hashed
48                                          * format */
49         int             fversion;
50         long            lastkey;
51         boolean_t       modified;       /* if true, do garbage collection */
52         Rb_tree         *tree;          /* for single appointments */
53         Hc_list         *list;          /* for repeating appointments */
54         Rm_que          *rm_queue;      /* active reminder queue, version 1 */
55         _DtCmsRemQueue  *remq;          /* reminder queue, version 4 */
56         caddr_t         r_access;       /* read access, version 1 */
57         caddr_t         w_access;       /* write access, version 1 */
58         caddr_t         d_access;       /* delete access, version 1 */
59         caddr_t         x_access;       /* exec access, version 1 */
60         Access_Entry_4  *alist;         /* combined v1 access list */
61         uint            num_attrs;      /* number of calendar attrs,version 4 */
62         cms_attribute   *attrs;         /* calendar attributes, version 4 */
63         _DtCmGetAttrFunc *getattrfuncs; /* array of function ptr to get attrs */
64         _DtCmsRegistrationInfo *rlist;  /* client registration list */
65         boolean_t       *checkowner;
66         struct __DtCmsCalendar *next;
67 } _DtCmsCalendar;
68
69
70 extern _DtCmsCalendar * _DtCmsMakeCalendar P((
71                                 char *owner,
72                                 char *name));
73
74 extern void _DtCmsPutInCalList P((_DtCmsCalendar *cal));
75
76 extern void _DtCmsFreeCalendar P((_DtCmsCalendar *cal));
77
78 extern CSA_return_code _DtCmsSetFileVersion P((
79                                 _DtCmsCalendar *cal,
80                                 int version));
81
82 extern CSA_return_code _DtCmsLoadCalendar P((
83                                 char *target,
84                                 _DtCmsCalendar **cal));
85
86 extern char * _DtCmsGetCalendarOwner P((char *target));
87
88 extern CSA_return_code _DtCmsGetCalendarByName P((
89                                 char *target,
90                                 boolean_t load,
91                                 _DtCmsCalendar **cal));
92
93 extern CSA_return_code _DtCmsInsertEntry4Parser P((
94                                 _DtCmsCalendar *cal,
95                                 cms_entry *entry));
96
97 extern void _DtCmsSetAccess4Parser P((
98                                 _DtCmsCalendar *cal,
99                                 Access_Entry_4 *list,
100                                 int type));
101
102 extern void _DtCmsSetCalendarAttrs4Parser P((
103                                 _DtCmsCalendar *cal,
104                                 int len,
105                                 cms_attribute *attrs));
106
107 extern void _DtCmsGenerateKey P((_DtCmsCalendar *cal, long *key));
108
109 extern CSA_return_code _DtCmsEnumerateUp P((
110                                 _DtCmsCalendar *cal,
111                                 _DtCmsEnumerateProc doit));
112
113 extern void _DtCmsEnumerateDown P((
114                                 _DtCmsCalendar *cal,
115                                 _DtCmsEnumerateProc doit));
116
117 extern CSA_return_code _DtCmsRbToCsaStat P((Rb_Status rb_stat));
118
119 extern CSA_return_code _DtCmsGetCalAttrsByName P((
120                                 _DtCmsCalendar  *cal,
121                                 uint            num_names,
122                                 cms_attr_name   *names,
123                                 uint            *num_attrs_r,
124                                 cms_attribute   **attrs_r));
125
126 extern CSA_return_code _DtCmsGetAllCalAttrs P((
127                                 _DtCmsCalendar  *cal,
128                                 u_int           *num_attrs_r,
129                                 cms_attribute   **attrs_r,
130                                 boolean_t       returnall));
131
132 extern CSA_return_code _DtCmsGetCalAttrNames P((
133                                 _DtCmsCalendar  *cal,
134                                 uint            *num_names_r,
135                                 cms_attr_name   **names_r));
136
137 extern void _DtCmsFreeCmsAttrNames P((uint num, cms_attr_name *names));
138
139 extern CSA_return_code _DtCmsUpdateCalAttributesAndLog P((
140                                 _DtCmsCalendar  *cal,
141                                 uint            numsrc,
142                                 cms_attribute   *srcattrs,
143                                 uint            access));
144
145 extern CSA_return_code _DtCmsV5TransactLog P((
146                                 _DtCmsCalendar  *cal,
147                                 cms_entry       *e,
148                                 _DtCmsLogOps    op));
149
150 #endif