dtcm: Resolve CID 87822
[oweals/cde.git] / cde / programs / dtcm / server / cmscalendar.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: cmscalendar.h /main/4 1995/11/09 12:40:57 rswiston $ */
24 /*
25  *  (c) Copyright 1993, 1994 Hewlett-Packard Company
26  *  (c) Copyright 1993, 1994 International Business Machines Corp.
27  *  (c) Copyright 1993, 1994 Novell, Inc.
28  *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
29  */
30
31 #ifndef _CMSCALENDAR_H
32 #define _CMSCALENDAR_H
33
34 #include "ansi_c.h"
35 #include "csa.h"
36 #include "cm.h"
37 #include "nametbl.h"
38 #include "tree.h"
39 #include "list.h"
40 #include "data.h"
41 #include "reminder.h"
42 #include "rtable4.h"
43 #include "callback.h"
44 #include "log.h"
45
46 #define GET_R_ACCESS(cal)               ((Access_Entry_4 *) (cal->r_access))
47 #define SET_R_ACCESS(cal,v)             (cal)->r_access = (caddr_t) v
48 #define GET_W_ACCESS(cal)               ((Access_Entry_4 *) (cal->w_access))
49 #define SET_W_ACCESS(cal,v)             (cal)->w_access = (caddr_t) v
50 #define GET_D_ACCESS(cal)               ((Access_Entry_4 *) (cal->d_access))
51 #define SET_D_ACCESS(cal,v)             (cal)->d_access = (caddr_t) v
52 #define GET_X_ACCESS(cal)               ((Access_Entry_4 *) (cal->x_access))
53 #define SET_X_ACCESS(cal,v)             (cal)->x_access = (caddr_t) v
54 #define APPT_TREE(info)                 ((Rb_tree *) ((info)->tree))
55 #define REPT_LIST(info)                 ((Hc_list *) ((info)->list))
56 #define APPT_KEY(p_appt)                ((Appt_4 *) (p_appt))->appt_id.key
57 #define APPT_TICK(p_appt)               ((Appt_4 *) (p_appt))->appt_id.tick
58
59 typedef CSA_return_code (*_DtCmGetAttrFunc)();
60
61 typedef struct __DtCmsCalendar {
62         char            *owner;
63         char            *calendar;
64         _DtCmNameTable  *cal_tbl;
65         _DtCmNameTable  *entry_tbl;
66         int             *types;         /* type associated with entry attrs */
67         int             num_entry_attrs; /* number of entry attrs associated
68                                           * with this calendar */
69         boolean_t       hashed;         /* true if file converted to hashed
70                                          * format */
71         int             fversion;
72         long            lastkey;
73         boolean_t       modified;       /* if true, do garbage collection */
74         Rb_tree         *tree;          /* for single appointments */
75         Hc_list         *list;          /* for repeating appointments */
76         Rm_que          *rm_queue;      /* active reminder queue, version 1 */
77         _DtCmsRemQueue  *remq;          /* reminder queue, version 4 */
78         caddr_t         r_access;       /* read access, version 1 */
79         caddr_t         w_access;       /* write access, version 1 */
80         caddr_t         d_access;       /* delete access, version 1 */
81         caddr_t         x_access;       /* exec access, version 1 */
82         Access_Entry_4  *alist;         /* combined v1 access list */
83         uint            num_attrs;      /* number of calendar attrs,version 4 */
84         cms_attribute   *attrs;         /* calendar attributes, version 4 */
85         _DtCmGetAttrFunc *getattrfuncs; /* array of function ptr to get attrs */
86         _DtCmsRegistrationInfo *rlist;  /* client registration list */
87         boolean_t       *checkowner;
88         struct __DtCmsCalendar *next;
89 } _DtCmsCalendar;
90
91
92 extern _DtCmsCalendar * _DtCmsMakeCalendar P((
93                                 char *owner,
94                                 char *name));
95
96 extern void _DtCmsPutInCalList P((_DtCmsCalendar *cal));
97
98 extern void _DtCmsFreeCalendar P((_DtCmsCalendar *cal));
99
100 extern CSA_return_code _DtCmsSetFileVersion P((
101                                 _DtCmsCalendar *cal,
102                                 int version));
103
104 extern CSA_return_code _DtCmsLoadCalendar P((
105                                 char *target,
106                                 _DtCmsCalendar **cal));
107
108 extern char * _DtCmsGetCalendarOwner P((char *target));
109
110 extern CSA_return_code _DtCmsGetCalendarByName P((
111                                 char *target,
112                                 boolean_t load,
113                                 _DtCmsCalendar **cal));
114
115 extern CSA_return_code _DtCmsInsertEntry4Parser P((
116                                 _DtCmsCalendar *cal,
117                                 cms_entry *entry));
118
119 extern void _DtCmsSetAccess4Parser P((
120                                 _DtCmsCalendar *cal,
121                                 Access_Entry_4 *list,
122                                 int type));
123
124 extern void _DtCmsSetCalendarAttrs4Parser P((
125                                 _DtCmsCalendar *cal,
126                                 int len,
127                                 cms_attribute *attrs));
128
129 extern void _DtCmsGenerateKey P((_DtCmsCalendar *cal, long *key));
130
131 extern CSA_return_code _DtCmsEnumerateUp P((
132                                 _DtCmsCalendar *cal,
133                                 _DtCmsEnumerateProc doit));
134
135 extern void _DtCmsEnumerateDown P((
136                                 _DtCmsCalendar *cal,
137                                 _DtCmsEnumerateProc doit));
138
139 extern CSA_return_code _DtCmsRbToCsaStat P((Rb_Status rb_stat));
140
141 extern CSA_return_code _DtCmsGetCalAttrsByName P((
142                                 _DtCmsCalendar  *cal,
143                                 uint            num_names,
144                                 cms_attr_name   *names,
145                                 uint            *num_attrs_r,
146                                 cms_attribute   **attrs_r));
147
148 extern CSA_return_code _DtCmsGetAllCalAttrs P((
149                                 _DtCmsCalendar  *cal,
150                                 u_int           *num_attrs_r,
151                                 cms_attribute   **attrs_r,
152                                 boolean_t       returnall));
153
154 extern CSA_return_code _DtCmsGetCalAttrNames P((
155                                 _DtCmsCalendar  *cal,
156                                 uint            *num_names_r,
157                                 cms_attr_name   **names_r));
158
159 extern void _DtCmsFreeCmsAttrNames P((uint num, cms_attr_name *names));
160
161 extern CSA_return_code _DtCmsUpdateCalAttributesAndLog P((
162                                 _DtCmsCalendar  *cal,
163                                 uint            numsrc,
164                                 cms_attribute   *srcattrs,
165                                 uint            access));
166
167 extern CSA_return_code _DtCmsV5TransactLog P((
168                                 _DtCmsCalendar  *cal,
169                                 cms_entry       *e,
170                                 _DtCmsLogOps    op));
171
172 #endif