2009-06-24 10:24:09 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2009 Nicira Networks.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2011-08-24 15:17:32 -07:00
|
|
|
#ifndef NETLINK_NOTIFIER_H
|
|
|
|
#define NETLINK_NOTIFIER_H 1
|
2009-06-24 10:24:09 -07:00
|
|
|
|
2009-07-28 13:05:20 -07:00
|
|
|
/* These functions are Linux specific, so they should be used directly only by
|
|
|
|
* Linux-specific code. */
|
2009-06-24 10:24:09 -07:00
|
|
|
|
|
|
|
#include "list.h"
|
|
|
|
|
2011-08-24 15:17:32 -07:00
|
|
|
struct nln;
|
2010-12-21 13:44:37 -08:00
|
|
|
struct nlattr;
|
|
|
|
struct ofpbuf;
|
|
|
|
|
2011-08-24 15:17:32 -07:00
|
|
|
/* Function called to report netlink notifications. 'change' describes the
|
|
|
|
* specific change filled out by an nln_parse_func. It may be null if the
|
|
|
|
* buffer of change information overflowed, in which case the function must
|
2010-12-21 13:44:37 -08:00
|
|
|
* assume that everything may have changed. 'aux' is as specified in
|
2011-08-24 15:17:32 -07:00
|
|
|
* nln_notifier_register(). */
|
|
|
|
typedef void nln_notify_func(const void *change, void *aux);
|
2009-06-24 10:24:09 -07:00
|
|
|
|
2011-08-24 15:17:32 -07:00
|
|
|
/* Function called to parse incoming nln notifications. The 'buf' message
|
|
|
|
* should be parsed into 'change' as specified in nln_create(). */
|
|
|
|
typedef bool nln_parse_func(struct ofpbuf *buf, void *change);
|
2009-06-24 10:24:09 -07:00
|
|
|
|
2011-08-24 15:17:32 -07:00
|
|
|
struct nln_notifier {
|
2009-06-24 10:24:09 -07:00
|
|
|
struct list node;
|
2011-08-24 15:17:32 -07:00
|
|
|
nln_notify_func *cb;
|
2009-06-24 10:24:09 -07:00
|
|
|
void *aux;
|
|
|
|
};
|
|
|
|
|
2011-08-24 15:17:32 -07:00
|
|
|
struct nln *nln_create(int protocol, int multicast_group, nln_parse_func *,
|
|
|
|
void *change);
|
|
|
|
void nln_destroy(struct nln *);
|
|
|
|
int nln_notifier_register(struct nln *, struct nln_notifier *,
|
|
|
|
nln_notify_func *, void *aux);
|
|
|
|
void nln_notifier_unregister(struct nln *, struct nln_notifier *);
|
2011-09-15 11:23:08 -07:00
|
|
|
void nln_run(struct nln *);
|
|
|
|
void nln_wait(struct nln *);
|
2011-08-24 15:17:32 -07:00
|
|
|
#endif /* netlink-notifier.h */
|