paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 2 | * Copyright (C) 2003 Yasuhiro Ohara |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3 | * |
| 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 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 25 | #define OSPF6_DAEMON_VERSION "0.9.7a" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 26 | |
| 27 | /* global variables */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 28 | extern int errno; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 29 | extern struct thread_master *master; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 30 | |
| 31 | #ifdef INRIA_IPV6 |
| 32 | #ifndef IPV6_PKTINFO |
| 33 | #define IPV6_PKTINFO IPV6_RECVPKTINFO |
| 34 | #endif /* IPV6_PKTINFO */ |
| 35 | #endif /* INRIA_IPV6 */ |
| 36 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 37 | /* Historical for KAME. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 38 | #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 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 53 | /* operation on timeval structure */ |
| 54 | #ifndef timerclear |
| 55 | #define timerclear(a) (a)->tv_sec = (tvp)->tv_usec = 0 |
| 56 | #endif /*timerclear*/ |
| 57 | #ifndef timersub |
| 58 | #define timersub(a, b, res) \ |
| 59 | do { \ |
| 60 | (res)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ |
| 61 | (res)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ |
| 62 | if ((res)->tv_usec < 0) \ |
| 63 | { \ |
| 64 | (res)->tv_sec--; \ |
| 65 | (res)->tv_usec += 1000000; \ |
| 66 | } \ |
| 67 | } while (0) |
| 68 | #endif /*timersub*/ |
| 69 | #define timerstring(tv, buf, size) \ |
| 70 | do { \ |
| 71 | if ((tv)->tv_sec / 60 / 60 / 24) \ |
| 72 | snprintf (buf, size, "%ldd%02ld:%02ld:%02ld", \ |
| 73 | (tv)->tv_sec / 60 / 60 / 24, \ |
| 74 | (tv)->tv_sec / 60 / 60 % 24, \ |
| 75 | (tv)->tv_sec / 60 % 60, \ |
| 76 | (tv)->tv_sec % 60); \ |
| 77 | else \ |
| 78 | snprintf (buf, size, "%02ld:%02ld:%02ld", \ |
| 79 | (tv)->tv_sec / 60 / 60 % 24, \ |
| 80 | (tv)->tv_sec / 60 % 60, \ |
| 81 | (tv)->tv_sec % 60); \ |
| 82 | } while (0) |
| 83 | #define timerstring_local(tv, buf, size) \ |
| 84 | do { \ |
| 85 | int ret; \ |
| 86 | struct tm *tm; \ |
| 87 | tm = localtime (&(tv)->tv_sec); \ |
| 88 | ret = strftime (buf, size, "%Y/%m/%d %H:%M:%S", tm); \ |
| 89 | if (ret == 0) \ |
| 90 | zlog_warn ("strftime error"); \ |
| 91 | } while (0) |
| 92 | |
| 93 | /* for commands */ |
| 94 | #define OSPF6_AREA_STR "Area information\n" |
| 95 | #define OSPF6_AREA_ID_STR "Area ID (as an IPv4 notation)\n" |
| 96 | #define OSPF6_SPF_STR "Shortest Path First tree information\n" |
| 97 | #define OSPF6_ROUTER_ID_STR "Specify Router-ID\n" |
| 98 | #define OSPF6_LS_ID_STR "Specify Link State ID\n" |
| 99 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 100 | #define OSPF6_CMD_CHECK_RUNNING() \ |
| 101 | if (ospf6 == NULL) \ |
| 102 | { \ |
| 103 | vty_out (vty, "OSPFv3 is not running%s", VTY_NEWLINE); \ |
| 104 | return CMD_SUCCESS; \ |
| 105 | } |
| 106 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 107 | |
| 108 | /* Function Prototypes */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 109 | struct route_node *route_prev (struct route_node *node); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 110 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 111 | void ospf6_debug (); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 112 | void ospf6_init (); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 113 | |
| 114 | #endif /* OSPF6D_H */ |
| 115 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 116 | |