blob: 3274242dfad6cf8742d42aaf68be9a56f31616f0 [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
hasso6452df02004-08-15 05:52:07 +000025#define OSPF6_DAEMON_VERSION "0.9.7i"
paul718e3742002-12-13 20:15:29 +000026
27/* global variables */
paul718e3742002-12-13 20:15:29 +000028extern int errno;
paul718e3742002-12-13 20:15:29 +000029extern struct thread_master *master;
paul718e3742002-12-13 20:15:29 +000030
31#ifdef INRIA_IPV6
32#ifndef IPV6_PKTINFO
33#define IPV6_PKTINFO IPV6_RECVPKTINFO
34#endif /* IPV6_PKTINFO */
35#endif /* INRIA_IPV6 */
36
hasso508e53e2004-05-18 18:57:06 +000037/* Historical for KAME. */
paul718e3742002-12-13 20:15:29 +000038#ifndef IPV6_JOIN_GROUP
39#ifdef IPV6_ADD_MEMBERSHIP
40#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
41#endif /* IPV6_ADD_MEMBERSHIP. */
42#ifdef IPV6_JOIN_MEMBERSHIP
43#define IPV6_JOIN_GROUP IPV6_JOIN_MEMBERSHIP
44#endif /* IPV6_JOIN_MEMBERSHIP. */
45#endif /* ! IPV6_JOIN_GROUP*/
46
47#ifndef IPV6_LEAVE_GROUP
48#ifdef IPV6_DROP_MEMBERSHIP
49#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
50#endif /* IPV6_DROP_MEMBERSHIP */
51#endif /* ! IPV6_LEAVE_GROUP */
52
hasso6452df02004-08-15 05:52:07 +000053/* cast macro */
54#define OSPF6_PROCESS(x) ((struct ospf6 *) (x))
55#define OSPF6_AREA(x) ((struct ospf6_area *) (x))
56#define OSPF6_INTERFACE(x) ((struct ospf6_interface *) (x))
57#define OSPF6_NEIGHBOR(x) ((struct ospf6_neighbor *) (x))
58
hasso508e53e2004-05-18 18:57:06 +000059/* operation on timeval structure */
60#ifndef timerclear
61#define timerclear(a) (a)->tv_sec = (tvp)->tv_usec = 0
62#endif /*timerclear*/
63#ifndef timersub
64#define timersub(a, b, res) \
65 do { \
66 (res)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
67 (res)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
68 if ((res)->tv_usec < 0) \
69 { \
70 (res)->tv_sec--; \
71 (res)->tv_usec += 1000000; \
72 } \
73 } while (0)
74#endif /*timersub*/
75#define timerstring(tv, buf, size) \
76 do { \
77 if ((tv)->tv_sec / 60 / 60 / 24) \
78 snprintf (buf, size, "%ldd%02ld:%02ld:%02ld", \
79 (tv)->tv_sec / 60 / 60 / 24, \
80 (tv)->tv_sec / 60 / 60 % 24, \
81 (tv)->tv_sec / 60 % 60, \
82 (tv)->tv_sec % 60); \
83 else \
84 snprintf (buf, size, "%02ld:%02ld:%02ld", \
85 (tv)->tv_sec / 60 / 60 % 24, \
86 (tv)->tv_sec / 60 % 60, \
87 (tv)->tv_sec % 60); \
88 } while (0)
89#define timerstring_local(tv, buf, size) \
90 do { \
91 int ret; \
92 struct tm *tm; \
93 tm = localtime (&(tv)->tv_sec); \
94 ret = strftime (buf, size, "%Y/%m/%d %H:%M:%S", tm); \
95 if (ret == 0) \
96 zlog_warn ("strftime error"); \
97 } while (0)
98
99/* for commands */
100#define OSPF6_AREA_STR "Area information\n"
101#define OSPF6_AREA_ID_STR "Area ID (as an IPv4 notation)\n"
102#define OSPF6_SPF_STR "Shortest Path First tree information\n"
103#define OSPF6_ROUTER_ID_STR "Specify Router-ID\n"
104#define OSPF6_LS_ID_STR "Specify Link State ID\n"
105
hasso049207c2004-08-04 20:02:13 +0000106#define VNL VTY_NEWLINE
paul718e3742002-12-13 20:15:29 +0000107#define OSPF6_CMD_CHECK_RUNNING() \
108 if (ospf6 == NULL) \
109 { \
110 vty_out (vty, "OSPFv3 is not running%s", VTY_NEWLINE); \
111 return CMD_SUCCESS; \
112 }
113
paul718e3742002-12-13 20:15:29 +0000114
115/* Function Prototypes */
hasso508e53e2004-05-18 18:57:06 +0000116struct route_node *route_prev (struct route_node *node);
paul718e3742002-12-13 20:15:29 +0000117
hasso508e53e2004-05-18 18:57:06 +0000118void ospf6_debug ();
paul718e3742002-12-13 20:15:29 +0000119void ospf6_init ();
paul718e3742002-12-13 20:15:29 +0000120
121#endif /* OSPF6D_H */
122
hasso508e53e2004-05-18 18:57:06 +0000123