summaryrefslogtreecommitdiffstats
path: root/src/windows/identity/ui/timer.h
blob: 91ca5203247aa1fbaf131e77f3297150ebb5d417 (plain)
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
/*
 * Copyright (c) 2005 Massachusetts Institute of Technology
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/* $Id$ */

#ifndef __KHIMAIRA_TIMER_H
#define __KHIMAIRA_TIMER_H

/* note that the ordering of the first few enum constants are
   significant.  The values of the constants up to KHUI_N_TTYPES are
   used as indices.  */
typedef enum tag_khui_timer_type {
    KHUI_TTYPE_ID_EXP = 0,      /* Identity expiration */
    KHUI_TTYPE_ID_CRIT,         /* Identity critical */
    KHUI_TTYPE_ID_WARN,         /* Identity warning */
    KHUI_TTYPE_CRED_EXP,        /* Credential expiration */
    KHUI_TTYPE_CRED_CRIT,       /* Credential critical */
    KHUI_TTYPE_CRED_WARN,       /* Credential warning */

    KHUI_N_TTYPES,              /* Count of the timers that we
                                   aggregate for notifications */

    KHUI_TTYPE_ID_MARK,         /* Identity marker */

    KHUI_TTYPE_ID_RENEW,        /* Identity auto renewal */
    KHUI_TTYPE_CRED_RENEW,      /* Credential renewal */

#if 0
    KHUI_TTYPE_BMSG,            /* Custom. Sends broadcast message
                                   when triggered.*/
    KHUI_TTYPE_SMSG,            /* Custom. Sends subscription message
                                   when triggered. */
#endif
} khui_timer_type;

typedef struct tag_khui_timer_event {
    khm_handle       key;
    khui_timer_type  type;

    khm_int64 expire;    /* time at which the timer expires */
    khm_int64 offset;    /* time offset at which the event that the
                            timer warns of happens */
    void *           data;
    khm_int32        flags;
} khui_timer_event;

#define KHUI_TRIGGER_TIMER_ID 48
#define KHUI_REFRESH_TIMER_ID 49

#define KHUI_REFRESH_TIMEOUT 5000

#define KHUI_TE_FLAG_EXPIRED 0x00000001
#define KHUI_TE_FLAG_STALE   0x00000002

#define KHUI_DEF_TIMEOUT_WARN 900
#define KHUI_DEF_TIMEOUT_CRIT 300
#define KHUI_DEF_TIMEOUT_RENEW 60

/* the max absolute difference between two timers (in seconds) that
   can exist where we consider both timers to be in the same
   timeslot. */
#define KHUI_TIMEEQ_ERROR 20

/* the small error. */
#define KHUI_TIMEEQ_ERROR_SMALL 1

void
khm_timer_refresh(HWND hwnd);

void
khm_timer_fire(HWND hwnd);

void
khm_timer_init(void);

void
khm_timer_exit(void);

#endif