notifiers: Rename run and wait functions.
[sliver-openvswitch.git] / lib / netlink-notifier.h
1 /*
2  * Copyright (c) 2009 Nicira Networks.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef NETLINK_NOTIFIER_H
18 #define NETLINK_NOTIFIER_H 1
19
20 /* These functions are Linux specific, so they should be used directly only by
21  * Linux-specific code. */
22
23 #include "list.h"
24
25 struct nln;
26 struct nlattr;
27 struct ofpbuf;
28
29 /* Function called to report netlink notifications.  'change' describes the
30  * specific change filled out by an nln_parse_func.  It may be null if the
31  * buffer of change information overflowed, in which case the function must
32  * assume that everything may have changed. 'aux' is as specified in
33  * nln_notifier_register(). */
34 typedef void nln_notify_func(const void *change, void *aux);
35
36 /* Function called to parse incoming nln notifications.  The 'buf' message
37  * should be parsed into 'change' as specified in nln_create(). */
38 typedef bool nln_parse_func(struct ofpbuf *buf, void *change);
39
40 struct nln_notifier {
41     struct list node;
42     nln_notify_func *cb;
43     void *aux;
44 };
45
46 struct nln *nln_create(int protocol, int multicast_group, nln_parse_func *,
47                        void *change);
48 void nln_destroy(struct nln *);
49 int nln_notifier_register(struct nln *, struct nln_notifier *,
50                           nln_notify_func *, void *aux);
51 void nln_notifier_unregister(struct nln *, struct nln_notifier *);
52 void nln_run(struct nln *);
53 void nln_wait(struct nln *);
54 #endif /* netlink-notifier.h */