/*
- * Copyright (C) 1999 Yasuhiro Ohara
+ * Copyright (C) 2003 Yasuhiro Ohara
*
* This file is part of GNU Zebra.
*
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef OSPF6D_H
#define OSPF6D_H
-#include <zebra.h>
-#include "linklist.h"
+#define OSPF6_DAEMON_VERSION "0.9.7r"
-#ifndef HEADER_DEPENDENCY
-/* Include other stuffs */
-#include <lib/version.h>
-#include "log.h"
-#include "getopt.h"
+#include "libospf.h"
#include "thread.h"
-#include "command.h"
-#include "memory.h"
-#include "sockunion.h"
-#include "if.h"
-#include "prefix.h"
-#include "stream.h"
-#include "thread.h"
-#include "filter.h"
-#include "zclient.h"
-#include "table.h"
-#include "plist.h"
-
-/* OSPF stuffs */
-#include "ospf6_hook.h"
-#include "ospf6_types.h"
-#include "ospf6_prefix.h"
-#include "ospf6_lsa.h"
-#include "ospf6_lsdb.h"
-
-#include "ospf6_message.h"
-#include "ospf6_proto.h"
-#include "ospf6_spf.h"
-#include "ospf6_top.h"
-#include "ospf6_area.h"
-#include "ospf6_interface.h"
-#include "ospf6_neighbor.h"
-#include "ospf6_ism.h"
-#include "ospf6_nsm.h"
-#include "ospf6_route.h"
-#include "ospf6_dbex.h"
-#include "ospf6_network.h"
-#include "ospf6_zebra.h"
-#include "ospf6_dump.h"
-#include "ospf6_routemap.h"
-#include "ospf6_asbr.h"
-#include "ospf6_abr.h"
-#include "ospf6_intra.h"
-#endif /*HEADER_DEPENDENCY*/
-
-#define HASHVAL 64
-#define MAXIOVLIST 1024
-
-#define OSPF6_DAEMON_VERSION "0.9.6p"
-
-#define AF_LINKSTATE 0xff
+
+#include "ospf6_memory.h"
/* global variables */
-extern char *progname;
-extern int errno;
-extern int daemon_mode;
extern struct thread_master *master;
-extern list iflist;
-extern list nexthoplist;
-extern struct sockaddr_in6 allspfrouters6;
-extern struct sockaddr_in6 alldrouters6;
-extern int ospf6_sock;
-extern char *recent_reason;
-
-/* Default configuration file name for ospfd. */
-#define OSPF6_DEFAULT_CONFIG "ospf6d.conf"
-
-/* Default port values. */
-#define OSPF6_VTY_PORT 2606
-
-#ifdef INRIA_IPV6
-#ifndef IPV6_PKTINFO
-#define IPV6_PKTINFO IPV6_RECVPKTINFO
-#endif /* IPV6_PKTINFO */
-#endif /* INRIA_IPV6 */
-
-/* Historycal for KAME. */
+
+/* Historical for KAME. */
#ifndef IPV6_JOIN_GROUP
#ifdef IPV6_ADD_MEMBERSHIP
#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
#endif /* IPV6_DROP_MEMBERSHIP */
#endif /* ! IPV6_LEAVE_GROUP */
+#define MSG_OK 0
+#define MSG_NG 1
+
+/* cast macro: XXX - these *must* die, ick ick. */
+#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))
+
+/* operation on timeval structure */
+#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); \
+ } while (0)
+
+#define threadtimer_string(now, t, buf, size) \
+ do { \
+ struct timeval result; \
+ if (!t) \
+ snprintf(buf, size, "inactive"); \
+ else { \
+ timersub(&t->u.sands, &now, &result); \
+ timerstring(&result, buf, size); \
+ } \
+} while (0)
+
+/* 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"
+
#define OSPF6_CMD_CHECK_RUNNING() \
if (ospf6 == NULL) \
{ \
- vty_out (vty, "OSPFv3 is not running%s", VTY_NEWLINE); \
+ vty_out (vty, "OSPFv3 is not running%s", VTYNL); \
return CMD_SUCCESS; \
}
-#define OSPF6_LEVEL_NONE 0
-#define OSPF6_LEVEL_NEIGHBOR 1
-#define OSPF6_LEVEL_INTERFACE 2
-#define OSPF6_LEVEL_AREA 3
-#define OSPF6_LEVEL_TOP 4
-#define OSPF6_LEVEL_MAX 5
-#define OSPF6_PASSIVE_STR \
- "Suppress routing updates on an interface\n"
-#define OSPF6_PREFIX_LIST_STR \
- "Advertise I/F Address only match entries of prefix-list\n"
-
-#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"
-
-\f
/* Function Prototypes */
-void
-ospf6_timeval_sub (const struct timeval *t1, const struct timeval *t2,
- struct timeval *result);
-void
-ospf6_timeval_div (const struct timeval *t1, u_int by,
- struct timeval *result);
-void
-ospf6_timeval_sub_equal (const struct timeval *t, struct timeval *result);
-void
-ospf6_timeval_decode (const struct timeval *t, long *dayp, long *hourp,
- long *minp, long *secp, long *msecp, long *usecp);
-void
-ospf6_timeval_string (struct timeval *tv, char *buf, int size);
-void
-ospf6_timeval_string_summary (struct timeval *tv, char *buf, int size);
-
-void
-ospf6_count_state (void *arg, int val, void *obj);
-
-void ospf6_init ();
-void ospf6_terminate ();
-
-void ospf6_maxage_remover ();
-
-void *ospf6_lsa_get_scope (u_int16_t type, struct ospf6_interface *o6i);
+extern struct route_node *route_prev (struct route_node *node);
+
+extern void ospf6_debug (void);
+extern void ospf6_init (void);
#endif /* OSPF6D_H */
+