blob: 9e2efb41d716969532c240d2817746e6aa55b076 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/*
hasso508e53e2004-05-18 18:57:06 +00002 * Copyright (C) 2003 Yasuhiro Ohara
paul718e3742002-12-13 20:15:29 +00003 *
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 OSPF6D_H
23#define OSPF6D_H
24
Paul Jakma0b26f812006-05-15 10:47:53 +000025#define OSPF6_DAEMON_VERSION "0.9.7r"
paul718e3742002-12-13 20:15:29 +000026
Dinesh Dutt8551e6d2013-10-22 17:42:18 -070027#include "libospf.h"
28#include "thread.h"
29
paul718e3742002-12-13 20:15:29 +000030/* global variables */
paul718e3742002-12-13 20:15:29 +000031extern struct thread_master *master;
paul718e3742002-12-13 20:15:29 +000032
hasso508e53e2004-05-18 18:57:06 +000033/* Historical for KAME. */
paul718e3742002-12-13 20:15:29 +000034#ifndef IPV6_JOIN_GROUP
35#ifdef IPV6_ADD_MEMBERSHIP
36#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
37#endif /* IPV6_ADD_MEMBERSHIP. */
38#ifdef IPV6_JOIN_MEMBERSHIP
39#define IPV6_JOIN_GROUP IPV6_JOIN_MEMBERSHIP
40#endif /* IPV6_JOIN_MEMBERSHIP. */
41#endif /* ! IPV6_JOIN_GROUP*/
42
43#ifndef IPV6_LEAVE_GROUP
44#ifdef IPV6_DROP_MEMBERSHIP
45#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
46#endif /* IPV6_DROP_MEMBERSHIP */
47#endif /* ! IPV6_LEAVE_GROUP */
48
Denis Ovsienkoef951222011-08-20 20:58:15 +040049#define MSG_OK 0
50#define MSG_NG 1
51
paul1eb8ef22005-04-07 07:30:20 +000052/* cast macro: XXX - these *must* die, ick ick. */
hasso6452df02004-08-15 05:52:07 +000053#define OSPF6_PROCESS(x) ((struct ospf6 *) (x))
54#define OSPF6_AREA(x) ((struct ospf6_area *) (x))
55#define OSPF6_INTERFACE(x) ((struct ospf6_interface *) (x))
56#define OSPF6_NEIGHBOR(x) ((struct ospf6_neighbor *) (x))
57
hasso508e53e2004-05-18 18:57:06 +000058/* operation on timeval structure */
59#ifndef timerclear
60#define timerclear(a) (a)->tv_sec = (tvp)->tv_usec = 0
61#endif /*timerclear*/
62#ifndef timersub
63#define timersub(a, b, res) \
64 do { \
65 (res)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
66 (res)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
67 if ((res)->tv_usec < 0) \
68 { \
69 (res)->tv_sec--; \
70 (res)->tv_usec += 1000000; \
71 } \
72 } while (0)
73#endif /*timersub*/
David Lamparteref008d22015-03-03 08:48:11 +010074#define timerstring(tv, buf, size) \
75 do { \
76 if ((tv)->tv_sec / 60 / 60 / 24) \
77 snprintf (buf, size, "%lldd%02lld:%02lld:%02lld", \
78 (tv)->tv_sec / 60LL / 60 / 24, \
79 (tv)->tv_sec / 60LL / 60 % 24, \
80 (tv)->tv_sec / 60LL % 60, \
81 (tv)->tv_sec % 60LL); \
82 else \
83 snprintf (buf, size, "%02lld:%02lld:%02lld", \
84 (tv)->tv_sec / 60LL / 60 % 24, \
85 (tv)->tv_sec / 60LL % 60, \
86 (tv)->tv_sec % 60LL); \
hasso508e53e2004-05-18 18:57:06 +000087 } while (0)
88#define timerstring_local(tv, buf, size) \
89 do { \
90 int ret; \
91 struct tm *tm; \
92 tm = localtime (&(tv)->tv_sec); \
93 ret = strftime (buf, size, "%Y/%m/%d %H:%M:%S", tm); \
94 if (ret == 0) \
95 zlog_warn ("strftime error"); \
96 } while (0)
97
Dinesh Dutta0edf672013-08-26 03:40:23 +000098#define threadtimer_string(now, t, buf, size) \
99 do { \
100 struct timeval result; \
101 if (!t) \
102 snprintf(buf, size, "inactive"); \
103 else { \
104 timersub(&t->u.sands, &now, &result); \
105 timerstring(&result, buf, size); \
106 } \
107} while (0)
108
hasso508e53e2004-05-18 18:57:06 +0000109/* for commands */
110#define OSPF6_AREA_STR "Area information\n"
111#define OSPF6_AREA_ID_STR "Area ID (as an IPv4 notation)\n"
112#define OSPF6_SPF_STR "Shortest Path First tree information\n"
113#define OSPF6_ROUTER_ID_STR "Specify Router-ID\n"
114#define OSPF6_LS_ID_STR "Specify Link State ID\n"
115
hasso049207c2004-08-04 20:02:13 +0000116#define VNL VTY_NEWLINE
paul718e3742002-12-13 20:15:29 +0000117#define OSPF6_CMD_CHECK_RUNNING() \
118 if (ospf6 == NULL) \
119 { \
120 vty_out (vty, "OSPFv3 is not running%s", VTY_NEWLINE); \
121 return CMD_SUCCESS; \
122 }
123
David Lamparter6b0655a2014-06-04 06:53:35 +0200124
paul718e3742002-12-13 20:15:29 +0000125/* Function Prototypes */
Paul Jakma6ac29a52008-08-15 13:45:30 +0100126extern struct route_node *route_prev (struct route_node *node);
paul718e3742002-12-13 20:15:29 +0000127
Paul Jakma6ac29a52008-08-15 13:45:30 +0100128extern void ospf6_debug (void);
129extern void ospf6_init (void);
paul718e3742002-12-13 20:15:29 +0000130
131#endif /* OSPF6D_H */
132
hasso508e53e2004-05-18 18:57:06 +0000133