]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_hook.h
Initial revision
[mirror_frr.git] / ospf6d / ospf6_hook.h
1 /*
2 * Copyright (C) 2001 Yasuhiro Ohara
3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22 #ifndef OSPF6_HOOK_H
23 #define OSPF6_HOOK_H
24
25 #include "ospf6_dump.h"
26
27 struct ospf6_hook
28 {
29 struct ospf6_hook *prev;
30 struct ospf6_hook *next;
31
32 char *name;
33 int (*hook_add) (void *);
34 int (*hook_change) (void *);
35 int (*hook_remove) (void *);
36 };
37
38 struct ospf6_hook_master
39 {
40 char *name;
41 struct ospf6_hook *head;
42 struct ospf6_hook *tail;
43 int count;
44 };
45
46 #define CALL_HOOKS(master,hookname,hookstr,data) \
47 {\
48 struct ospf6_hook *hook;\
49 for (hook = (master)->head; hook; hook = hook->next)\
50 {\
51 if (hook->hookname)\
52 {\
53 if (IS_OSPF6_DUMP_HOOK)\
54 zlog_info ("HOOK: Call %s hook: %s", (hookstr), hook->name);\
55 (*(hook->hookname)) (data);\
56 }\
57 }\
58 }
59 #define CALL_ADD_HOOK(master,data) \
60 { CALL_HOOKS ((master), hook_add, "ADD", (data)) }
61 #define CALL_CHANGE_HOOK(master,data) \
62 { CALL_HOOKS ((master), hook_change, "CHANGE", (data)) }
63 #define CALL_REMOVE_HOOK(master,data) \
64 { CALL_HOOKS ((master), hook_remove, "REMOVE", (data)) }
65
66 #define IS_HOOK_SET(hook) \
67 ((hook)->hook_add || (hook)->hook_change || (hook)->hook_remove)
68
69 extern struct ospf6_hook_master neighbor_hook;
70 extern struct ospf6_hook_master interface_hook;
71 extern struct ospf6_hook_master area_hook;
72 extern struct ospf6_hook_master top_hook;
73 extern struct ospf6_hook_master database_hook;
74 extern struct ospf6_hook_master intra_topology_hook;
75 extern struct ospf6_hook_master inter_topology_hook;
76 extern struct ospf6_hook_master route_hook;
77 extern struct ospf6_hook_master redistribute_hook;
78
79 void ospf6_hook_register (struct ospf6_hook *,
80 struct ospf6_hook_master *);
81 void ospf6_hook_unregister (struct ospf6_hook *,
82 struct ospf6_hook_master *);
83 void ospf6_hook_unregister_all (struct ospf6_hook_master *);
84 void ospf6_hook_init ();
85
86 #endif /*OSPF6_HOOK_H*/
87