2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2002-12-13 21:15:29 +01:00
|
|
|
/*
|
2004-05-18 20:57:06 +02:00
|
|
|
* Copyright (C) 2003 Yasuhiro Ohara
|
2002-12-13 21:15:29 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSPF6D_H
|
|
|
|
#define OSPF6D_H
|
|
|
|
|
2013-10-23 02:42:18 +02:00
|
|
|
#include "libospf.h"
|
2023-03-07 20:22:48 +01:00
|
|
|
#include "frrevent.h"
|
2021-03-22 19:31:56 +01:00
|
|
|
#include "memory.h"
|
2013-10-23 02:42:18 +02:00
|
|
|
|
2021-03-22 19:31:56 +01:00
|
|
|
DECLARE_MGROUP(OSPF6D);
|
2015-05-29 05:48:31 +02:00
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* global variables */
|
2023-03-07 20:14:41 +01:00
|
|
|
extern struct event_loop *master;
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2023-06-18 13:22:45 +02:00
|
|
|
/* OSPF config processing timer thread */
|
|
|
|
extern struct event *t_ospf6_cfg;
|
|
|
|
|
2011-08-20 18:58:15 +02:00
|
|
|
#define MSG_OK 0
|
|
|
|
#define MSG_NG 1
|
|
|
|
|
2021-05-28 11:33:03 +02:00
|
|
|
#define OSPF6_SUCCESS 1
|
|
|
|
#define OSPF6_FAILURE 0
|
|
|
|
#define OSPF6_INVALID -1
|
|
|
|
|
2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
2005-04-07 09:30:20 +02:00
|
|
|
/* cast macro: XXX - these *must* die, ick ick. */
|
2004-08-15 07:52:07 +02:00
|
|
|
#define OSPF6_PROCESS(x) ((struct ospf6 *) (x))
|
|
|
|
#define OSPF6_AREA(x) ((struct ospf6_area *) (x))
|
|
|
|
#define OSPF6_INTERFACE(x) ((struct ospf6_interface *) (x))
|
|
|
|
#define OSPF6_NEIGHBOR(x) ((struct ospf6_neighbor *) (x))
|
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* operation on timeval structure */
|
2015-03-03 08:48:11 +01:00
|
|
|
#define timerstring(tv, buf, size) \
|
|
|
|
do { \
|
|
|
|
if ((tv)->tv_sec / 60 / 60 / 24) \
|
|
|
|
snprintf(buf, size, "%lldd%02lld:%02lld:%02lld", \
|
|
|
|
(tv)->tv_sec / 60LL / 60 / 24, \
|
|
|
|
(tv)->tv_sec / 60LL / 60 % 24, \
|
|
|
|
(tv)->tv_sec / 60LL % 60, \
|
|
|
|
(tv)->tv_sec % 60LL); \
|
|
|
|
else \
|
|
|
|
snprintf(buf, size, "%02lld:%02lld:%02lld", \
|
|
|
|
(tv)->tv_sec / 60LL / 60 % 24, \
|
|
|
|
(tv)->tv_sec / 60LL % 60, \
|
|
|
|
(tv)->tv_sec % 60LL); \
|
2004-05-18 20:57:06 +02:00
|
|
|
} while (0)
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2013-08-26 05:40:23 +02:00
|
|
|
#define threadtimer_string(now, t, buf, size) \
|
|
|
|
do { \
|
2018-09-13 17:37:08 +02:00
|
|
|
struct timeval _result; \
|
2013-08-26 05:40:23 +02:00
|
|
|
if (!t) \
|
|
|
|
snprintf(buf, size, "inactive"); \
|
|
|
|
else { \
|
2018-09-13 17:37:08 +02:00
|
|
|
timersub(&t->u.sands, &now, &_result); \
|
|
|
|
timerstring(&_result, buf, size); \
|
2013-08-26 05:40:23 +02:00
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2004-05-18 20:57:06 +02:00
|
|
|
/* for commands */
|
|
|
|
#define OSPF6_AREA_STR "Area information\n"
|
|
|
|
#define OSPF6_AREA_ID_STR "Area ID (as an IPv4 notation)\n"
|
|
|
|
#define OSPF6_SPF_STR "Shortest Path First tree information\n"
|
|
|
|
#define OSPF6_ROUTER_ID_STR "Specify Router-ID\n"
|
|
|
|
#define OSPF6_LS_ID_STR "Specify Link State ID\n"
|
|
|
|
|
2022-01-11 10:21:05 +01:00
|
|
|
#define OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6) \
|
|
|
|
do { \
|
|
|
|
if (uj == false && all_vrf == false && ospf6 == NULL) { \
|
|
|
|
vty_out(vty, "%% OSPFv3 instance not found\n"); \
|
|
|
|
return CMD_SUCCESS; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2021-02-10 07:44:44 +01:00
|
|
|
#define IS_OSPF6_ASBR(O) ((O)->flag & OSPF6_FLAG_ASBR)
|
2021-05-05 22:19:01 +02:00
|
|
|
#define OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) \
|
2022-01-11 10:21:05 +01:00
|
|
|
do { \
|
|
|
|
if (argv_find(argv, argc, "vrf", &idx_vrf)) { \
|
|
|
|
vrf_name = argv[idx_vrf + 1]->arg; \
|
|
|
|
all_vrf = strmatch(vrf_name, "all"); \
|
|
|
|
} else { \
|
|
|
|
vrf_name = VRF_DEFAULT_NAME; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2021-05-05 22:19:01 +02:00
|
|
|
|
2021-06-28 09:04:54 +02:00
|
|
|
#define OSPF6_FALSE false
|
|
|
|
#define OSPF6_TRUE true
|
|
|
|
#define OSPF6_SUCCESS 1
|
|
|
|
#define OSPF6_FAILURE 0
|
|
|
|
#define OSPF6_INVALID -1
|
|
|
|
|
2017-10-11 16:13:59 +02:00
|
|
|
extern struct zebra_privs_t ospf6d_privs;
|
2014-06-04 06:53:35 +02:00
|
|
|
|
2023-06-18 13:22:45 +02:00
|
|
|
/* Event Debug option */
|
|
|
|
extern unsigned char conf_debug_ospf6_event;
|
|
|
|
#define OSPF6_DEBUG_EVENT_ON() (conf_debug_ospf6_event = 1)
|
|
|
|
#define OSPF6_DEBUG_EVENT_OFF() (conf_debug_ospf6_event = 0)
|
|
|
|
#define IS_OSPF6_DEBUG_EVENT (conf_debug_ospf6_event)
|
|
|
|
|
2002-12-13 21:15:29 +01:00
|
|
|
/* Function Prototypes */
|
2008-08-15 14:45:30 +02:00
|
|
|
extern struct route_node *route_prev(struct route_node *node);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
2008-08-15 14:45:30 +02:00
|
|
|
extern void ospf6_debug(void);
|
2023-03-07 20:14:41 +01:00
|
|
|
extern void ospf6_init(struct event_loop *master);
|
2002-12-13 21:15:29 +01:00
|
|
|
|
|
|
|
#endif /* OSPF6D_H */
|