]> git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6d.h
*: Convert `struct event_master` to `struct event_loop`
[mirror_frr.git] / ospf6d / ospf6d.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2003 Yasuhiro Ohara
4 */
5
6 #ifndef OSPF6D_H
7 #define OSPF6D_H
8
9 #include "libospf.h"
10 #include "event.h"
11 #include "memory.h"
12
13 DECLARE_MGROUP(OSPF6D);
14
15 /* global variables */
16 extern struct event_loop *master;
17
18 /* Historical for KAME. */
19 #ifndef IPV6_JOIN_GROUP
20 #ifdef IPV6_ADD_MEMBERSHIP
21 #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
22 #endif /* IPV6_ADD_MEMBERSHIP. */
23 #ifdef IPV6_JOIN_MEMBERSHIP
24 #define IPV6_JOIN_GROUP IPV6_JOIN_MEMBERSHIP
25 #endif /* IPV6_JOIN_MEMBERSHIP. */
26 #endif /* ! IPV6_JOIN_GROUP*/
27
28 #ifndef IPV6_LEAVE_GROUP
29 #ifdef IPV6_DROP_MEMBERSHIP
30 #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
31 #endif /* IPV6_DROP_MEMBERSHIP */
32 #endif /* ! IPV6_LEAVE_GROUP */
33
34 #define MSG_OK 0
35 #define MSG_NG 1
36
37 #define OSPF6_SUCCESS 1
38 #define OSPF6_FAILURE 0
39 #define OSPF6_INVALID -1
40
41 /* cast macro: XXX - these *must* die, ick ick. */
42 #define OSPF6_PROCESS(x) ((struct ospf6 *) (x))
43 #define OSPF6_AREA(x) ((struct ospf6_area *) (x))
44 #define OSPF6_INTERFACE(x) ((struct ospf6_interface *) (x))
45 #define OSPF6_NEIGHBOR(x) ((struct ospf6_neighbor *) (x))
46
47 /* operation on timeval structure */
48 #define timerstring(tv, buf, size) \
49 do { \
50 if ((tv)->tv_sec / 60 / 60 / 24) \
51 snprintf(buf, size, "%lldd%02lld:%02lld:%02lld", \
52 (tv)->tv_sec / 60LL / 60 / 24, \
53 (tv)->tv_sec / 60LL / 60 % 24, \
54 (tv)->tv_sec / 60LL % 60, \
55 (tv)->tv_sec % 60LL); \
56 else \
57 snprintf(buf, size, "%02lld:%02lld:%02lld", \
58 (tv)->tv_sec / 60LL / 60 % 24, \
59 (tv)->tv_sec / 60LL % 60, \
60 (tv)->tv_sec % 60LL); \
61 } while (0)
62
63 #define threadtimer_string(now, t, buf, size) \
64 do { \
65 struct timeval _result; \
66 if (!t) \
67 snprintf(buf, size, "inactive"); \
68 else { \
69 timersub(&t->u.sands, &now, &_result); \
70 timerstring(&_result, buf, size); \
71 } \
72 } while (0)
73
74 /* for commands */
75 #define OSPF6_AREA_STR "Area information\n"
76 #define OSPF6_AREA_ID_STR "Area ID (as an IPv4 notation)\n"
77 #define OSPF6_SPF_STR "Shortest Path First tree information\n"
78 #define OSPF6_ROUTER_ID_STR "Specify Router-ID\n"
79 #define OSPF6_LS_ID_STR "Specify Link State ID\n"
80
81 #define OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6) \
82 do { \
83 if (uj == false && all_vrf == false && ospf6 == NULL) { \
84 vty_out(vty, "%% OSPFv3 instance not found\n"); \
85 return CMD_SUCCESS; \
86 } \
87 } while (0)
88
89 #define IS_OSPF6_ASBR(O) ((O)->flag & OSPF6_FLAG_ASBR)
90 #define OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) \
91 do { \
92 if (argv_find(argv, argc, "vrf", &idx_vrf)) { \
93 vrf_name = argv[idx_vrf + 1]->arg; \
94 all_vrf = strmatch(vrf_name, "all"); \
95 } else { \
96 vrf_name = VRF_DEFAULT_NAME; \
97 } \
98 } while (0)
99
100 #define OSPF6_FALSE false
101 #define OSPF6_TRUE true
102 #define OSPF6_SUCCESS 1
103 #define OSPF6_FAILURE 0
104 #define OSPF6_INVALID -1
105
106 extern struct zebra_privs_t ospf6d_privs;
107
108 /* Function Prototypes */
109 extern struct route_node *route_prev(struct route_node *node);
110
111 extern void ospf6_debug(void);
112 extern void ospf6_init(struct event_loop *master);
113
114 #endif /* OSPF6D_H */