2011-06-22 21:42:51 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
2012-02-03 14:13:19 +00:00
|
|
|
* Copyright (C) 2010-2012 IBM Corporation
|
2011-06-22 21:42:51 +00:00
|
|
|
*
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2011-06-22 18:17:36 +00:00
|
|
|
#ifndef __VIR_NETLINK_H__
|
|
|
|
# define __VIR_NETLINK_H__
|
|
|
|
|
2011-06-23 15:54:11 +00:00
|
|
|
# include "config.h"
|
2012-02-22 13:17:13 +00:00
|
|
|
# include "internal.h"
|
2011-06-23 15:54:11 +00:00
|
|
|
|
|
|
|
# if defined(__linux__) && defined(HAVE_LIBNL)
|
2011-06-22 18:17:36 +00:00
|
|
|
|
|
|
|
# include <netlink/msg.h>
|
|
|
|
|
|
|
|
# else
|
|
|
|
|
|
|
|
struct nl_msg;
|
2012-02-22 13:17:13 +00:00
|
|
|
struct sockaddr_nl;
|
2012-03-06 01:12:34 +00:00
|
|
|
struct nlattr;
|
2011-06-22 18:17:36 +00:00
|
|
|
|
|
|
|
# endif /* __linux__ */
|
|
|
|
|
2012-02-03 14:13:19 +00:00
|
|
|
int virNetlinkCommand(struct nl_msg *nl_msg,
|
|
|
|
unsigned char **respbuf, unsigned int *respbuflen,
|
|
|
|
int nl_pid);
|
2011-06-22 18:17:36 +00:00
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
typedef void (*virNetlinkEventHandleCallback)(unsigned char *msg, int length, struct sockaddr_nl *peer, bool *handled, void *opaque);
|
|
|
|
|
|
|
|
typedef void (*virNetlinkEventRemoveCallback)(int watch, const unsigned char *macaddr, void *opaque);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* stopNetlinkEventServer: stop the monitor to receive netlink messages for libvirtd
|
|
|
|
*/
|
|
|
|
int virNetlinkEventServiceStop(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* startNetlinkEventServer: start a monitor to receive netlink messages for libvirtd
|
|
|
|
*/
|
|
|
|
int virNetlinkEventServiceStart(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkEventServiceIsRunning: returns if the netlink event service is running.
|
|
|
|
*/
|
|
|
|
bool virNetlinkEventServiceIsRunning(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkEventAddClient: register a callback for handling of netlink messages
|
|
|
|
*/
|
|
|
|
int virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB,
|
|
|
|
virNetlinkEventRemoveCallback removeCB,
|
|
|
|
void *opaque, const unsigned char *macaddr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkEventRemoveClient: unregister a callback from a netlink monitor
|
|
|
|
*/
|
|
|
|
int virNetlinkEventRemoveClient(int watch, const unsigned char *macaddr);
|
|
|
|
|
2011-06-22 18:17:36 +00:00
|
|
|
#endif /* __VIR_NETLINK_H__ */
|