summaryrefslogtreecommitdiffstats
path: root/src/ck-log-event.h
blob: 0c04c1d0fa4a053b3c6f6015afabec4400a363f5 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 */

#ifndef __CK_LOG_EVENT_H
#define __CK_LOG_EVENT_H

#include <glib.h>

G_BEGIN_DECLS

typedef enum
{
        CK_LOG_EVENT_NONE = 0,
        CK_LOG_EVENT_START,
        CK_LOG_EVENT_STOP,
        CK_LOG_EVENT_SYSTEM_START,
        CK_LOG_EVENT_SYSTEM_STOP,
        CK_LOG_EVENT_SYSTEM_RESTART,
        CK_LOG_EVENT_SYSTEM_RUNLEVEL_CHANGED,
        CK_LOG_EVENT_SEAT_ADDED,
        CK_LOG_EVENT_SEAT_REMOVED,
        CK_LOG_EVENT_SEAT_SESSION_ADDED,
        CK_LOG_EVENT_SEAT_SESSION_REMOVED,
        CK_LOG_EVENT_SEAT_DEVICE_ADDED,
        CK_LOG_EVENT_SEAT_DEVICE_REMOVED,
        CK_LOG_EVENT_SEAT_ACTIVE_SESSION_CHANGED,
} CkLogEventType;

typedef struct
{
        gpointer dummy;
} CkLogNoneEvent;

typedef struct
{
        gpointer dummy;
} CkLogSystemStopEvent;

typedef struct
{
        gpointer dummy;
} CkLogSystemRestartEvent;

typedef struct
{
        gpointer dummy;
} CkLogSystemStartEvent;

typedef struct
{
        char *seat_id;
        int   seat_kind;
} CkLogSeatAddedEvent;

typedef struct
{
        char *seat_id;
        int   seat_kind;
} CkLogSeatRemovedEvent;

typedef struct
{
        char    *seat_id;
        char    *session_id;
        char    *session_type;
        char    *session_x11_display;
        char    *session_x11_display_device;
        char    *session_display_device;
        char    *session_remote_host_name;
        gboolean session_is_local;
        guint    session_unix_user;
        char    *session_creation_time;
} CkLogSeatSessionAddedEvent;

typedef struct
{
        char    *seat_id;
        char    *session_id;
        char    *session_type;
        char    *session_x11_display;
        char    *session_x11_display_device;
        char    *session_display_device;
        char    *session_remote_host_name;
        gboolean session_is_local;
        guint    session_unix_user;
        char    *session_creation_time;
} CkLogSeatSessionRemovedEvent;

typedef struct
{
        char    *seat_id;
        char    *session_id;
} CkLogSeatActiveSessionChangedEvent;

typedef struct
{
        char *seat_id;
        char *device_type;
        char *device_id;
} CkLogSeatDeviceAddedEvent;

typedef struct
{
        char *seat_id;
        char *device_type;
        char *device_id;
} CkLogSeatDeviceRemovedEvent;

typedef struct
{
        union {
                CkLogNoneEvent none;
                CkLogSystemRestartEvent system_start;
                CkLogSystemStopEvent system_stop;
                CkLogSystemRestartEvent system_restart;
                CkLogSeatAddedEvent seat_added;
                CkLogSeatRemovedEvent seat_removed;
                CkLogSeatSessionAddedEvent seat_session_added;
                CkLogSeatSessionRemovedEvent seat_session_removed;
                CkLogSeatActiveSessionChangedEvent seat_active_session_changed;
                CkLogSeatDeviceAddedEvent seat_device_added;
                CkLogSeatDeviceRemovedEvent seat_device_removed;
        } event;

        GTimeVal       timestamp;
        CkLogEventType type;
} CkLogEvent;

CkLogEvent         * ck_log_event_copy             (CkLogEvent    *event);
void                 ck_log_event_free             (CkLogEvent    *event);

CkLogEvent         * ck_log_event_new_from_string  (const GString *str);
gboolean             ck_log_event_fill_from_string (CkLogEvent    *event,
                                                    const GString *str);

void                 ck_log_event_to_string        (CkLogEvent    *event,
                                                    GString       *str);

G_END_DECLS

#endif /* __CK_LOG_EVENT_H */