source: trunk/packages/xen-3.1/xen-3.1/tools/libxen/include/xen/api/xen_event.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 2.5 KB
Line 
1/*
2 * Copyright (c) 2006-2007, XenSource Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
17 */
18
19#ifndef XEN_EVENT_H
20#define XEN_EVENT_H
21
22#include <xen/api/xen_common.h>
23#include <xen/api/xen_event_decl.h>
24#include <xen/api/xen_event_operation.h>
25#include <xen/api/xen_string_set.h>
26
27
28/*
29 * The event class.
30 *
31 * Asynchronous event registration and handling.
32 */
33
34
35
36typedef struct xen_event_record
37{
38    int64_t id;
39    time_t timestamp;
40    char *class;
41    enum xen_event_operation operation;
42    char *ref;
43    char *obj_uuid;
44} xen_event_record;
45
46/**
47 * Allocate a xen_event_record.
48 */
49extern xen_event_record *
50xen_event_record_alloc(void);
51
52/**
53 * Free the given xen_event_record, and all referenced values.  The
54 * given record must have been allocated by this library.
55 */
56extern void
57xen_event_record_free(xen_event_record *record);
58
59
60typedef struct xen_event_record_set
61{
62    size_t size;
63    xen_event_record *contents[];
64} xen_event_record_set;
65
66/**
67 * Allocate a xen_event_record_set of the given size.
68 */
69extern xen_event_record_set *
70xen_event_record_set_alloc(size_t size);
71
72/**
73 * Free the given xen_event_record_set, and all referenced values.  The
74 * given set must have been allocated by this library.
75 */
76extern void
77xen_event_record_set_free(xen_event_record_set *set);
78
79
80/**
81 * Registers this session with the event system.  Specifying the empty
82 * list will register for all classes.
83 */
84extern bool
85xen_event_register(xen_session *session, struct xen_string_set *classes);
86
87
88/**
89 * Unregisters this session with the event system.
90 */
91extern bool
92xen_event_unregister(xen_session *session, struct xen_string_set *classes);
93
94
95/**
96 * Blocking call which returns a (possibly empty) batch of events.
97 */
98extern bool
99xen_event_next(xen_session *session, struct xen_event_record_set **result);
100
101
102#endif
Note: See TracBrowser for help on using the repository browser.