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 OSPF6_NEIGHBOR_H |
| 23 | #define OSPF6_NEIGHBOR_H |
| 24 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 25 | /* Debug option */ |
| 26 | extern unsigned char conf_debug_ospf6_neighbor; |
| 27 | #define OSPF6_DEBUG_NEIGHBOR_STATE 0x01 |
| 28 | #define OSPF6_DEBUG_NEIGHBOR_EVENT 0x02 |
| 29 | #define OSPF6_DEBUG_NEIGHBOR_ON(level) \ |
| 30 | (conf_debug_ospf6_neighbor |= (level)) |
| 31 | #define OSPF6_DEBUG_NEIGHBOR_OFF(level) \ |
| 32 | (conf_debug_ospf6_neighbor &= ~(level)) |
| 33 | #define IS_OSPF6_DEBUG_NEIGHBOR(level) \ |
| 34 | (conf_debug_ospf6_neighbor & OSPF6_DEBUG_NEIGHBOR_ ## level) |
| 35 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 36 | /* Neighbor structure */ |
| 37 | struct ospf6_neighbor |
| 38 | { |
| 39 | /* Neighbor Router ID String */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 40 | char name[32]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 41 | |
| 42 | /* OSPFv3 Interface this neighbor belongs to */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 43 | struct ospf6_interface *ospf6_if; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 44 | |
| 45 | /* Neighbor state */ |
| 46 | u_char state; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 47 | |
| 48 | /* timestamp of last changing state */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 49 | struct timeval last_changed; |
| 50 | |
| 51 | /* Neighbor Router ID */ |
| 52 | u_int32_t router_id; |
| 53 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 54 | /* Neighbor Interface ID */ |
| 55 | u_int32_t ifindex; |
| 56 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 57 | /* Router Priority of this neighbor */ |
| 58 | u_char priority; |
| 59 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 60 | u_int32_t drouter; |
| 61 | u_int32_t bdrouter; |
| 62 | u_int32_t prev_drouter; |
| 63 | u_int32_t prev_bdrouter; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 64 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 65 | /* Options field (Capability) */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 66 | char options[3]; |
| 67 | |
| 68 | /* IPaddr of I/F on our side link */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 69 | struct in6_addr linklocal_addr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 70 | |
| 71 | /* For Database Exchange */ |
| 72 | u_char dbdesc_bits; |
| 73 | u_int32_t dbdesc_seqnum; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 74 | /* Last received Database Description packet */ |
| 75 | struct ospf6_dbdesc dbdesc_last; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 76 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 77 | /* LS-list */ |
| 78 | struct ospf6_lsdb *summary_list; |
| 79 | struct ospf6_lsdb *request_list; |
| 80 | struct ospf6_lsdb *retrans_list; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 81 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 82 | /* LSA list for message transmission */ |
| 83 | struct ospf6_lsdb *dbdesc_list; |
| 84 | struct ospf6_lsdb *lsreq_list; |
| 85 | struct ospf6_lsdb *lsupdate_list; |
| 86 | struct ospf6_lsdb *lsack_list; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 87 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 88 | /* Inactivity timer */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 89 | struct thread *inactivity_timer; |
| 90 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 91 | /* Thread for sending message */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 92 | struct thread *thread_send_dbdesc; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 93 | struct thread *thread_send_lsreq; |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 94 | struct thread *thread_send_lsupdate; |
| 95 | struct thread *thread_send_lsack; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 96 | }; |
| 97 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 98 | /* Neighbor state */ |
| 99 | #define OSPF6_NEIGHBOR_DOWN 1 |
| 100 | #define OSPF6_NEIGHBOR_ATTEMPT 2 |
| 101 | #define OSPF6_NEIGHBOR_INIT 3 |
| 102 | #define OSPF6_NEIGHBOR_TWOWAY 4 |
| 103 | #define OSPF6_NEIGHBOR_EXSTART 5 |
| 104 | #define OSPF6_NEIGHBOR_EXCHANGE 6 |
| 105 | #define OSPF6_NEIGHBOR_LOADING 7 |
| 106 | #define OSPF6_NEIGHBOR_FULL 8 |
| 107 | |
paul | 0c083ee | 2004-10-10 12:54:58 +0000 | [diff] [blame^] | 108 | const extern char *ospf6_neighbor_state_str[]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 109 | |
| 110 | |
| 111 | /* Function Prototypes */ |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 112 | int ospf6_neighbor_cmp (void *va, void *vb); |
| 113 | void ospf6_neighbor_dbex_init (struct ospf6_neighbor *on); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 114 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 115 | struct ospf6_neighbor *ospf6_neighbor_lookup (u_int32_t, |
| 116 | struct ospf6_interface *); |
| 117 | struct ospf6_neighbor *ospf6_neighbor_create (u_int32_t, |
| 118 | struct ospf6_interface *); |
| 119 | void ospf6_neighbor_delete (struct ospf6_neighbor *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 120 | |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 121 | /* Neighbor event */ |
| 122 | int hello_received (struct thread *); |
| 123 | int twoway_received (struct thread *); |
| 124 | int negotiation_done (struct thread *); |
| 125 | int exchange_done (struct thread *); |
| 126 | int loading_done (struct thread *); |
| 127 | int adj_ok (struct thread *); |
| 128 | int seqnumber_mismatch (struct thread *); |
| 129 | int bad_lsreq (struct thread *); |
| 130 | int oneway_received (struct thread *); |
| 131 | int inactivity_timer (struct thread *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 132 | |
| 133 | void ospf6_neighbor_init (); |
hasso | 508e53e | 2004-05-18 18:57:06 +0000 | [diff] [blame] | 134 | int config_write_ospf6_debug_neighbor (struct vty *vty); |
| 135 | void install_element_ospf6_debug_neighbor (); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 136 | |
| 137 | #endif /* OSPF6_NEIGHBOR_H */ |
| 138 | |