jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * IS-IS Rout(e)ing protocol - isis_adjacency.h |
| 3 | * IS-IS adjacency handling |
| 4 | * |
| 5 | * Copyright (C) 2001,2002 Sampo Saaristo |
| 6 | * Tampere University of Technology |
| 7 | * Institute of Communications Engineering |
| 8 | * |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public Licenseas published by the Free |
| 12 | * Software Foundation; either version 2 of the License, or (at your option) |
| 13 | * any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful,but WITHOUT |
| 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 18 | * more details. |
| 19 | |
| 20 | * You should have received a copy of the GNU General Public License along |
| 21 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 22 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 23 | */ |
| 24 | |
| 25 | #ifndef _ZEBRA_ISIS_ADJACENCY_H |
| 26 | #define _ZEBRA_ISIS_ADJACENCY_H |
| 27 | |
| 28 | enum isis_adj_usage |
| 29 | { |
| 30 | ISIS_ADJ_NONE, |
| 31 | ISIS_ADJ_LEVEL1, |
| 32 | ISIS_ADJ_LEVEL2, |
| 33 | ISIS_ADJ_LEVEL1AND2 |
| 34 | }; |
| 35 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 36 | enum isis_system_type |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 37 | { |
| 38 | ISIS_SYSTYPE_UNKNOWN, |
| 39 | ISIS_SYSTYPE_ES, |
| 40 | ISIS_SYSTYPE_IS, |
| 41 | ISIS_SYSTYPE_L1_IS, |
| 42 | ISIS_SYSTYPE_L2_IS |
| 43 | }; |
| 44 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 45 | enum isis_adj_state |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 46 | { |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 47 | ISIS_ADJ_UNKNOWN, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 48 | ISIS_ADJ_INITIALIZING, |
| 49 | ISIS_ADJ_UP, |
| 50 | ISIS_ADJ_DOWN |
| 51 | }; |
| 52 | |
| 53 | /* |
| 54 | * we use the following codes to give an indication _why_ |
| 55 | * a specific adjacency is up or down |
| 56 | */ |
| 57 | enum isis_adj_updown_reason |
| 58 | { |
| 59 | ISIS_ADJ_REASON_SEENSELF, |
| 60 | ISIS_ADJ_REASON_AREA_MISMATCH, |
| 61 | ISIS_ADJ_REASON_HOLDTIMER_EXPIRED, |
| 62 | ISIS_ADJ_REASON_AUTH_FAILED, |
| 63 | ISIS_ADJ_REASON_CHECKSUM_FAILED |
| 64 | }; |
| 65 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 66 | #define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 67 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 68 | struct isis_dis_record |
| 69 | { |
| 70 | int dis; /* is our neighbor the DIS ? */ |
| 71 | time_t last_dis_change; /* timestamp for last dis change */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 72 | }; |
| 73 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 74 | struct isis_adjacency |
| 75 | { |
| 76 | u_char snpa[ETH_ALEN]; /* NeighbourSNPAAddress */ |
| 77 | u_char sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */ |
| 78 | u_char lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */ |
| 79 | int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 80 | /* an array of N levels for M records */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 81 | struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS]; |
| 82 | enum isis_adj_state adj_state; /* adjacencyState */ |
| 83 | enum isis_adj_usage adj_usage; /* adjacencyUsage */ |
| 84 | struct list *area_addrs; /* areaAdressesOfNeighbour */ |
| 85 | struct nlpids nlpids; /* protocols spoken ... */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 86 | struct list *ipv4_addrs; |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 87 | struct in_addr router_address; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 88 | #ifdef HAVE_IPV6 |
| 89 | struct list *ipv6_addrs; |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 90 | struct in6_addr router_address6; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 91 | #endif /* HAVE_IPV6 */ |
| 92 | u_char prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */ |
| 93 | int circuit_t; /* from hello PDU hdr */ |
| 94 | int level; /* level (1 or 2) */ |
| 95 | enum isis_system_type sys_type; /* neighbourSystemType */ |
| 96 | u_int16_t hold_time; /* entryRemainingTime */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 97 | u_int32_t last_upd; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 98 | u_int32_t last_flap; /* last time the adj flapped */ |
| 99 | int flaps; /* number of adjacency flaps */ |
| 100 | struct thread *t_expire; /* expire after hold_time */ |
| 101 | struct isis_circuit *circuit; /* back pointer */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 102 | }; |
| 103 | |
Christian Franke | 77277a1 | 2015-11-10 18:04:43 +0100 | [diff] [blame] | 104 | struct isis_adjacency *isis_adj_lookup (const u_char * sysid, struct list *adjdb); |
| 105 | struct isis_adjacency *isis_adj_lookup_snpa (const u_char * ssnpa, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 106 | struct list *adjdb); |
Christian Franke | 77277a1 | 2015-11-10 18:04:43 +0100 | [diff] [blame] | 107 | struct isis_adjacency *isis_new_adj (const u_char * id, const u_char * snpa, int level, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 108 | struct isis_circuit *circuit); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 109 | void isis_delete_adj (void *adj); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 110 | void isis_adj_state_change (struct isis_adjacency *adj, |
hasso | 1cd8084 | 2004-10-07 20:07:40 +0000 | [diff] [blame] | 111 | enum isis_adj_state state, const char *reason); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 112 | void isis_adj_print (struct isis_adjacency *adj); |
| 113 | int isis_adj_expire (struct thread *thread); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 114 | void isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty, char detail); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 115 | void isis_adj_build_neigh_list (struct list *adjdb, struct list *list); |
| 116 | void isis_adj_build_up_list (struct list *adjdb, struct list *list); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 117 | |
| 118 | #endif /* ISIS_ADJACENCY_H */ |