1 /*
2  * libvirt-gconfig-domain-clock.h: libvirt domain clock configuration
3  *
4  * Copyright (C) 2011 Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  * Author: Christophe Fergeau <cfergeau@redhat.com>
21  */
22 
23 #if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
24 #error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
25 #endif
26 
27 #ifndef __LIBVIRT_GCONFIG_DOMAIN_CLOCK_H__
28 #define __LIBVIRT_GCONFIG_DOMAIN_CLOCK_H__
29 
30 #include <libvirt-gconfig/libvirt-gconfig-domain-timer.h>
31 
32 G_BEGIN_DECLS
33 
34 #define GVIR_CONFIG_TYPE_DOMAIN_CLOCK            (gvir_config_domain_clock_get_type ())
35 #define GVIR_CONFIG_DOMAIN_CLOCK(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_CLOCK, GVirConfigDomainClock))
36 #define GVIR_CONFIG_DOMAIN_CLOCK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_CLOCK, GVirConfigDomainClockClass))
37 #define GVIR_CONFIG_IS_DOMAIN_CLOCK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_CLOCK))
38 #define GVIR_CONFIG_IS_DOMAIN_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_CLOCK))
39 #define GVIR_CONFIG_DOMAIN_CLOCK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_CLOCK, GVirConfigDomainClockClass))
40 
41 typedef struct _GVirConfigDomainClock GVirConfigDomainClock;
42 typedef struct _GVirConfigDomainClockPrivate GVirConfigDomainClockPrivate;
43 typedef struct _GVirConfigDomainClockClass GVirConfigDomainClockClass;
44 
45 struct _GVirConfigDomainClock
46 {
47     GVirConfigObject parent;
48 
49     GVirConfigDomainClockPrivate *priv;
50 
51     /* Do not add fields to this struct */
52 };
53 
54 struct _GVirConfigDomainClockClass
55 {
56     GVirConfigObjectClass parent_class;
57 
58     gpointer padding[20];
59 };
60 
61 typedef enum {
62     GVIR_CONFIG_DOMAIN_CLOCK_UTC,
63     GVIR_CONFIG_DOMAIN_CLOCK_LOCALTIME,
64     GVIR_CONFIG_DOMAIN_CLOCK_TIMEZONE,
65     GVIR_CONFIG_DOMAIN_CLOCK_VARIABLE
66 } GVirConfigDomainClockOffset;
67 
68 GType gvir_config_domain_clock_get_type(void);
69 
70 GVirConfigDomainClock *gvir_config_domain_clock_new(void);
71 GVirConfigDomainClock *gvir_config_domain_clock_new_from_xml(const gchar *xml,
72                                                 GError **error);
73 GVirConfigDomainClockOffset gvir_config_domain_clock_get_offset(GVirConfigDomainClock *klock);
74 void gvir_config_domain_clock_set_offset(GVirConfigDomainClock *klock,
75                                          GVirConfigDomainClockOffset offset);
76 const char *gvir_config_domain_clock_get_timezone(GVirConfigDomainClock *klock);
77 void gvir_config_domain_clock_set_timezone(GVirConfigDomainClock *klock,
78                                            const char *tz);
79 gint gvir_config_domain_clock_get_variable_offset(GVirConfigDomainClock *klock);
80 void gvir_config_domain_clock_set_variable_offset(GVirConfigDomainClock *klock,
81                                                   gint seconds);
82 void gvir_config_domain_clock_add_timer(GVirConfigDomainClock *klock,
83                                         GVirConfigDomainTimer *timer);
84 
85 
86 G_END_DECLS
87 
88 #endif /* __LIBVIRT_GCONFIG_DOMAIN_CLOCK_H__ */
89