Ospf6d merge from Zebra repository with added privs stuff and merged
zclient changes.
diff --git a/ospf6d/ospf6_neighbor.h b/ospf6d/ospf6_neighbor.h
index c3821c6..441ab81 100644
--- a/ospf6d/ospf6_neighbor.h
+++ b/ospf6d/ospf6_neighbor.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1999 Yasuhiro Ohara
+ * Copyright (C) 2003 Yasuhiro Ohara
  *
  * This file is part of GNU Zebra.
  *
@@ -22,140 +22,117 @@
 #ifndef OSPF6_NEIGHBOR_H
 #define OSPF6_NEIGHBOR_H
 
+/* Debug option */
+extern unsigned char conf_debug_ospf6_neighbor;
+#define OSPF6_DEBUG_NEIGHBOR_STATE   0x01
+#define OSPF6_DEBUG_NEIGHBOR_EVENT   0x02
+#define OSPF6_DEBUG_NEIGHBOR_ON(level) \
+  (conf_debug_ospf6_neighbor |= (level))
+#define OSPF6_DEBUG_NEIGHBOR_OFF(level) \
+  (conf_debug_ospf6_neighbor &= ~(level))
+#define IS_OSPF6_DEBUG_NEIGHBOR(level) \
+  (conf_debug_ospf6_neighbor & OSPF6_DEBUG_NEIGHBOR_ ## level)
+
 /* Neighbor structure */
 struct ospf6_neighbor
 {
   /* Neighbor Router ID String */
-  char str[32];
+  char name[32];
 
   /* OSPFv3 Interface this neighbor belongs to */
-  struct ospf6_interface *ospf6_interface;
+  struct ospf6_interface *ospf6_if;
 
   /* Neighbor state */
   u_char state;
+
+  /* timestamp of last changing state */
   struct timeval last_changed;
 
   /* Neighbor Router ID */
   u_int32_t router_id;
 
+  /* Neighbor Interface ID */
+  u_int32_t ifindex;
+
   /* Router Priority of this neighbor */
   u_char priority;
 
-  u_int32_t ifid;
-  u_int32_t dr;
-  u_int32_t bdr;
-  u_int32_t prevdr;
-  u_int32_t prevbdr;
+  u_int32_t drouter;
+  u_int32_t bdrouter;
+  u_int32_t prev_drouter;
+  u_int32_t prev_bdrouter;
 
-  /* Link-LSA's options field */
+  /* Options field (Capability) */
   char options[3];
 
   /* IPaddr of I/F on our side link */
-  struct in6_addr hisaddr;
-
-  /* new */
-  struct ospf6_lsdb *summary_list;
-  struct ospf6_lsdb *request_list;
-  struct ospf6_lsdb *retrans_list;
+  struct in6_addr linklocal_addr;
 
   /* For Database Exchange */
   u_char               dbdesc_bits;
   u_int32_t            dbdesc_seqnum;
-  struct ospf6_dbdesc *dbdesc_previous;
+  /* Last received Database Description packet */
+  struct ospf6_dbdesc  dbdesc_last;
 
-  /* last received DD , including OSPF capability of this neighbor */
-  struct ospf6_dbdesc last_dd;
+  /* LS-list */
+  struct ospf6_lsdb *summary_list;
+  struct ospf6_lsdb *request_list;
+  struct ospf6_lsdb *retrans_list;
 
-  /* LSAs to retransmit to this neighbor */
-  list dbdesc_lsa;
+  /* LSA list for message transmission */
+  struct ospf6_lsdb *dbdesc_list;
+  struct ospf6_lsdb *lsreq_list;
+  struct ospf6_lsdb *lsupdate_list;
+  struct ospf6_lsdb *lsack_list;
 
-  /* placeholder for DbDesc */
-  struct iovec dbdesc_last_send[1024];
-
+  /* Inactivity timer */
   struct thread *inactivity_timer;
 
-  /* DbDesc */
+  /* Thread for sending message */
   struct thread *thread_send_dbdesc;
-  struct thread *thread_rxmt_dbdesc;
-  list dbdesclist;
-  struct ospf6_lsdb *dbdesc_list;
-
-  /* LSReq */
   struct thread *thread_send_lsreq;
-  struct thread *thread_rxmt_lsreq;
-
-  /* LSUpdate */
-  struct thread *send_update;
-  struct thread *thread_send_update;
-  struct thread *thread_rxmt_update;
-
-  /* statistics */
-  u_int message_send[OSPF6_MESSAGE_TYPE_MAX];
-  u_int message_receive[OSPF6_MESSAGE_TYPE_MAX];
-  u_int lsa_send[OSPF6_MESSAGE_TYPE_MAX];
-  u_int lsa_receive[OSPF6_MESSAGE_TYPE_MAX];
-
-  u_int ospf6_stat_state_changed;
-  u_int ospf6_stat_seqnum_mismatch;
-  u_int ospf6_stat_bad_lsreq;
-  u_int ospf6_stat_oneway_received;
-  u_int ospf6_stat_inactivity_timer;
-  u_int ospf6_stat_dr_election;
-  u_int ospf6_stat_retrans_dbdesc;
-  u_int ospf6_stat_retrans_lsreq;
-  u_int ospf6_stat_retrans_lsupdate;
-  u_int ospf6_stat_received_lsa;
-  u_int ospf6_stat_received_lsupdate;
-
-  struct timeval tv_last_hello_received;
+  struct thread *thread_send_lsupdate;
+  struct thread *thread_send_lsack;
 };
 
-extern char *ospf6_neighbor_state_string[];
+/* Neighbor state */
+#define OSPF6_NEIGHBOR_DOWN     1
+#define OSPF6_NEIGHBOR_ATTEMPT  2
+#define OSPF6_NEIGHBOR_INIT     3
+#define OSPF6_NEIGHBOR_TWOWAY   4
+#define OSPF6_NEIGHBOR_EXSTART  5
+#define OSPF6_NEIGHBOR_EXCHANGE 6
+#define OSPF6_NEIGHBOR_LOADING  7
+#define OSPF6_NEIGHBOR_FULL     8
+
+extern char *ospf6_neighbor_state_str[];
 
 
 /* Function Prototypes */
-int
-ospf6_neighbor_last_dbdesc_release (struct thread *);
+int ospf6_neighbor_cmp (void *va, void *vb);
+void ospf6_neighbor_dbex_init (struct ospf6_neighbor *on);
 
-void
-ospf6_neighbor_lslist_clear (struct ospf6_neighbor *);
+struct ospf6_neighbor *ospf6_neighbor_lookup (u_int32_t,
+                                              struct ospf6_interface *);
+struct ospf6_neighbor *ospf6_neighbor_create (u_int32_t,
+                                              struct ospf6_interface *);
+void ospf6_neighbor_delete (struct ospf6_neighbor *);
 
-void
-ospf6_neighbor_summary_add (struct ospf6_lsa *, struct ospf6_neighbor *);
-void
-ospf6_neighbor_summary_remove (struct ospf6_lsa *, struct ospf6_neighbor *);
-
-void
-ospf6_neighbor_request_add (struct ospf6_lsa *, struct ospf6_neighbor *);
-void
-ospf6_neighbor_request_remove (struct ospf6_lsa *, struct ospf6_neighbor *);
-
-void
-ospf6_neighbor_retrans_add (struct ospf6_lsa *, struct ospf6_neighbor *);
-void
-ospf6_neighbor_retrans_remove (struct ospf6_lsa *, struct ospf6_neighbor *);
-
-void
-ospf6_neighbor_dbdesc_add (struct ospf6_lsa *lsa,
-                           struct ospf6_neighbor *nei);
-void
-ospf6_neighbor_dbdesc_remove (struct ospf6_lsa *lsa,
-                              struct ospf6_neighbor *nei);
-
-void
-ospf6_neighbor_dbex_init (struct ospf6_neighbor *nei);
-
-void
-ospf6_neighbor_thread_cancel_all (struct ospf6_neighbor *);
-
-struct ospf6_neighbor *
-ospf6_neighbor_create (u_int32_t, struct ospf6_interface *);
-void
-ospf6_neighbor_delete (struct ospf6_neighbor *);
-struct ospf6_neighbor *
-ospf6_neighbor_lookup (u_int32_t, struct ospf6_interface *);
+/* Neighbor event */
+int hello_received (struct thread *);
+int twoway_received (struct thread *);
+int negotiation_done (struct thread *);
+int exchange_done (struct thread *);
+int loading_done (struct thread *);
+int adj_ok (struct thread *);
+int seqnumber_mismatch (struct thread *);
+int bad_lsreq (struct thread *);
+int oneway_received (struct thread *);
+int inactivity_timer (struct thread *);
 
 void ospf6_neighbor_init ();
+int config_write_ospf6_debug_neighbor (struct vty *vty);
+void install_element_ospf6_debug_neighbor ();
 
 #endif /* OSPF6_NEIGHBOR_H */