blob: a9b1913e8a43c928d00da26b5da9e82389190da5 [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
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
28enum isis_adj_usage
29{
30 ISIS_ADJ_NONE,
31 ISIS_ADJ_LEVEL1,
32 ISIS_ADJ_LEVEL2,
33 ISIS_ADJ_LEVEL1AND2
34};
35
hassof390d2c2004-09-10 20:48:21 +000036enum isis_system_type
jardineb5d44e2003-12-23 08:09:43 +000037{
38 ISIS_SYSTYPE_UNKNOWN,
39 ISIS_SYSTYPE_ES,
40 ISIS_SYSTYPE_IS,
41 ISIS_SYSTYPE_L1_IS,
42 ISIS_SYSTYPE_L2_IS
43};
44
hassof390d2c2004-09-10 20:48:21 +000045enum isis_adj_state
jardineb5d44e2003-12-23 08:09:43 +000046{
47 ISIS_ADJ_INITIALIZING,
48 ISIS_ADJ_UP,
49 ISIS_ADJ_DOWN
50};
51
52/*
53 * we use the following codes to give an indication _why_
54 * a specific adjacency is up or down
55 */
56enum isis_adj_updown_reason
57{
58 ISIS_ADJ_REASON_SEENSELF,
59 ISIS_ADJ_REASON_AREA_MISMATCH,
60 ISIS_ADJ_REASON_HOLDTIMER_EXPIRED,
61 ISIS_ADJ_REASON_AUTH_FAILED,
62 ISIS_ADJ_REASON_CHECKSUM_FAILED
63};
64
hassof390d2c2004-09-10 20:48:21 +000065#define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */
jardineb5d44e2003-12-23 08:09:43 +000066
hassof390d2c2004-09-10 20:48:21 +000067struct isis_dis_record
68{
69 int dis; /* is our neighbor the DIS ? */
70 time_t last_dis_change; /* timestamp for last dis change */
jardineb5d44e2003-12-23 08:09:43 +000071};
72
hassof390d2c2004-09-10 20:48:21 +000073struct isis_adjacency
74{
75 u_char snpa[ETH_ALEN]; /* NeighbourSNPAAddress */
76 u_char sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */
77 u_char lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */
78 int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */
jardineb5d44e2003-12-23 08:09:43 +000079 /* an array of N levels for M records */
hassof390d2c2004-09-10 20:48:21 +000080 struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS];
81 enum isis_adj_state adj_state; /* adjacencyState */
82 enum isis_adj_usage adj_usage; /* adjacencyUsage */
83 struct list *area_addrs; /* areaAdressesOfNeighbour */
84 struct nlpids nlpids; /* protocols spoken ... */
jardineb5d44e2003-12-23 08:09:43 +000085 struct list *ipv4_addrs;
86#ifdef HAVE_IPV6
87 struct list *ipv6_addrs;
hassof390d2c2004-09-10 20:48:21 +000088#endif /* HAVE_IPV6 */
89 u_char prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */
90 int circuit_t; /* from hello PDU hdr */
91 int level; /* level (1 or 2) */
92 enum isis_system_type sys_type; /* neighbourSystemType */
93 u_int16_t hold_time; /* entryRemainingTime */
jardineb5d44e2003-12-23 08:09:43 +000094 u_int32_t last_upd;
hassof390d2c2004-09-10 20:48:21 +000095 u_int32_t last_flap; /* last time the adj flapped */
96 int flaps; /* number of adjacency flaps */
97 struct thread *t_expire; /* expire after hold_time */
98 struct isis_circuit *circuit; /* back pointer */
jardineb5d44e2003-12-23 08:09:43 +000099};
100
hassof390d2c2004-09-10 20:48:21 +0000101struct isis_adjacency *isis_adj_lookup (u_char * sysid, struct list *adjdb);
102struct isis_adjacency *isis_adj_lookup_snpa (u_char * ssnpa,
jardineb5d44e2003-12-23 08:09:43 +0000103 struct list *adjdb);
hassof390d2c2004-09-10 20:48:21 +0000104struct isis_adjacency *isis_new_adj (u_char * id, u_char * snpa, int level,
105 struct isis_circuit *circuit);
106void isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb);
107void isis_adj_state_change (struct isis_adjacency *adj,
108 enum isis_adj_state state, char *reason);
109void isis_adj_print (struct isis_adjacency *adj);
110int isis_adj_expire (struct thread *thread);
jardineb5d44e2003-12-23 08:09:43 +0000111void isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty);
112void isis_adj_print_vty_detail (struct isis_adjacency *adj, struct vty *vty);
hassof390d2c2004-09-10 20:48:21 +0000113void isis_adj_print_vty_extensive (struct isis_adjacency *adj,
114 struct vty *vty);
jardineb5d44e2003-12-23 08:09:43 +0000115void isis_adj_p2p_print_vty (struct isis_adjacency *adj, struct vty *vty);
hassof390d2c2004-09-10 20:48:21 +0000116void isis_adj_p2p_print_vty_detail (struct isis_adjacency *adj,
117 struct vty *vty);
118void isis_adj_p2p_print_vty_extensive (struct isis_adjacency *adj,
119 struct vty *vty);
jardineb5d44e2003-12-23 08:09:43 +0000120
121void isis_adj_build_neigh_list (struct list *adjdb, struct list *list);
122void isis_adj_build_up_list (struct list *adjdb, struct list *list);
hassof390d2c2004-09-10 20:48:21 +0000123void isis_adjdb_iterate (struct list *adjdb,
124 void (*func) (struct isis_adjacency *,
125 void *), void *arg);
jardineb5d44e2003-12-23 08:09:43 +0000126
127#endif /* ISIS_ADJACENCY_H */