]> git.proxmox.com Git - mirror_frr.git/blame - ospf6d/ospf6d.h
Merge pull request #12646 from pguibert6WIND/mpls_alloc_per_nh
[mirror_frr.git] / ospf6d / ospf6d.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
718e3744 2/*
508e53e2 3 * Copyright (C) 2003 Yasuhiro Ohara
718e3744 4 */
5
6#ifndef OSPF6D_H
7#define OSPF6D_H
8
8551e6da 9#include "libospf.h"
24a58196 10#include "frrevent.h"
30043e4c 11#include "memory.h"
8551e6da 12
30043e4c 13DECLARE_MGROUP(OSPF6D);
4a1ab8e4 14
718e3744 15/* global variables */
cd9d0537 16extern struct event_loop *master;
718e3744 17
508e53e2 18/* Historical for KAME. */
718e3744 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
ef95122e
DO
34#define MSG_OK 0
35#define MSG_NG 1
36
4dc43886
MR
37#define OSPF6_SUCCESS 1
38#define OSPF6_FAILURE 0
39#define OSPF6_INVALID -1
40
1eb8ef25 41/* cast macro: XXX - these *must* die, ick ick. */
6452df09 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
508e53e2 47/* operation on timeval structure */
d62a17ae 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 { \
7fe96307 65 struct timeval _result; \
d62a17ae 66 if (!t) \
67 snprintf(buf, size, "inactive"); \
68 else { \
7fe96307
A
69 timersub(&t->u.sands, &now, &_result); \
70 timerstring(&_result, buf, size); \
d62a17ae 71 } \
72 } while (0)
a0edf674 73
508e53e2 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
d6b901ac 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
b8212e03 89#define IS_OSPF6_ASBR(O) ((O)->flag & OSPF6_FLAG_ASBR)
d48ef099 90#define OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) \
d6b901ac 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)
d48ef099 99
59790f52 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
101dc9bc 106extern struct zebra_privs_t ospf6d_privs;
6b0655a2 107
718e3744 108/* Function Prototypes */
d62a17ae 109extern struct route_node *route_prev(struct route_node *node);
718e3744 110
d62a17ae 111extern void ospf6_debug(void);
cd9d0537 112extern void ospf6_init(struct event_loop *master);
718e3744 113
114#endif /* OSPF6D_H */