object_event_private.h 2.3 KB
Newer Older
1 2 3
/*
 * object_event_private.h: object event queue processing helpers
 *
4
 * Copyright (C) 2012-2014 Red Hat, Inc.
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
 * Copyright (C) 2008 VirtualIron
 * Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * Author: Ben Guthro
 */

#include "datatypes.h"

#ifndef __OBJECT_EVENT_PRIVATE_H__
# define __OBJECT_EVENT_PRIVATE_H__

struct _virObjectMeta {
    int id;
    char *name;
    unsigned char uuid[VIR_UUID_BUFLEN];
};
typedef struct _virObjectMeta virObjectMeta;
typedef virObjectMeta *virObjectMetaPtr;

typedef struct _virObjectEventCallbackList virObjectEventCallbackList;
typedef virObjectEventCallbackList *virObjectEventCallbackListPtr;

41 42 43 44 45 46
typedef void
(*virObjectEventDispatchFunc)(virConnectPtr conn,
                              virObjectEventPtr event,
                              virConnectObjectEventGenericCallback cb,
                              void *cbopaque);

47 48 49 50
struct _virObjectEvent {
    virObject parent;
    int eventID;
    virObjectMeta meta;
51
    virObjectEventDispatchFunc dispatch;
52 53
};

54 55
virClassPtr
virClassForObjectEvent(void);
56

57 58 59 60 61 62 63 64 65
int
virObjectEventStateCallbackID(virConnectPtr conn,
                              virObjectEventStatePtr state,
                              virClassPtr klass,
                              int eventID,
                              virConnectObjectEventGenericCallback callback)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
    ATTRIBUTE_NONNULL(5);

66 67
void *
virObjectEventNew(virClassPtr klass,
68
                  virObjectEventDispatchFunc dispatcher,
69 70 71 72
                  int eventID,
                  int id,
                  const char *name,
                  const unsigned char *uuid);
73 74

#endif