dtcm: Resolve CID 87822
[oweals/cde.git] / cde / programs / dtcm / server / reminder.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: reminder.h /main/4 1995/11/09 12:48:37 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 _REMINDER_H
32 #define _REMINDER_H
33
34 #include "ansi_c.h"
35 #include "EUSCompat.h"
36 #include "cm.h"
37 #include "rtable4.h"
38 #include "list.h"
39
40 typedef struct _RemInfo {
41         boolean_t       isentry;        /* entry vs appt */
42         time_t          runtime;        /* run time of reminder */
43         time_t          starttime;
44         time_t          lasttick;       /* lasttick of a repeating event */
45         List_node       *lnode;
46         union {
47                 Appt_4          *a;
48                 cms_entry       *e;
49         } data;                         /* associated entry */
50         union {
51                 Attr_4          *a;     /* v4 reminder structure */
52                 int             i;      /* index of attribute name */
53         } rem;                          /* associated reminder info */
54         struct _RemInfo *next;          /* next reminder */
55 } _DtCmsRemInfo;
56
57 typedef struct _RemQueue {
58         time_t          cutoff;
59         uint            num_queues;
60         int             *aindex;        /* array of attribute index */
61         char            **names;        /* array of names */
62         _DtCmsRemInfo   **active;       /* array of unexpired reminders */
63         _DtCmsRemInfo   **oldhead;      /* head of old reminders list */
64 } _DtCmsRemQueue;
65
66 typedef struct reminder_q {
67         time_t  remind_at;
68         int     remind_ord;
69         Attr_4  attr;
70         Appt_4  *appt;
71         struct reminder_q *next;
72 } Rm_que;
73
74 extern void _DtCmsAddReminderV4 P((Rm_que **qhead, Rm_que *p_reminder));
75
76 extern Rm_que *_DtCmsRemoveReminderV4 P((
77                 Rm_que **qhead,
78                 Rm_que *p_prev,
79                 Rm_que *p_curr));
80
81 extern Rm_que *build_reminder P((
82                 time_t  current_time,
83                 Appt_4  *p_appt,
84                 Attr_4  p_attr,
85                 time_t  start_tick,
86                 u_int   start_ord));
87
88 extern Reminder_4 *_DtCmsGetReminderInfoV4 P((Rm_que *original));
89
90 extern void _DtCmsPrintReminderListV4 P((Rm_que *qhead));
91
92 extern void _DtCmsObsoleteReminderV4 P((
93                 Rm_que          **qhead,
94                 Appt_4          *p_appt,
95                 int             ord, 
96                 boolean_t       delforward));
97
98 extern void _DtCmsAddReminders4Entry P((
99                 _DtCmsRemQueue  **qhead,
100                 cms_entry       *entry,
101                 List_node       *lnode));
102
103 extern void _DtCmsObsoleteReminder4Entry P((
104                 _DtCmsRemQueue  *qhead,
105                 cms_entry       *entry,
106                 List_node       *lnode,
107                 time_t          starttime,
108                 boolean_t       delfwd));
109
110 extern CSA_return_code _DtCmsLookupReminder P((
111                         _DtCmsRemQueue          *remq,
112                         time_t                  tick,
113                         uint                    num_names,
114                         cms_attr_name           *names,
115                         cms_reminder_ref        **rems));
116
117 extern void _DtCmsFreeReminderRef P((cms_reminder_ref *rems));
118
119 extern void _DtCmsUpdateReminders(_DtCmsRemQueue *remq);
120
121 #endif