]>
Commit | Line | Data |
---|---|---|
eb5d44eb | 1 | /* |
d62a17ae | 2 | * IS-IS Rout(e)ing protocol - isis_adjacency.h |
eb5d44eb | 3 | * IS-IS adjacency handling |
4 | * | |
5 | * Copyright (C) 2001,2002 Sampo Saaristo | |
d62a17ae | 6 | * Tampere University of Technology |
eb5d44eb | 7 | * Institute of Communications Engineering |
8 | * | |
9 | * | |
d62a17ae | 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) | |
eb5d44eb | 13 | * any later version. |
14 | * | |
d62a17ae | 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 | |
eb5d44eb | 18 | * more details. |
896014f4 DL |
19 | * |
20 | * You should have received a copy of the GNU General Public License along | |
21 | * with this program; see the file COPYING; if not, write to the Free Software | |
22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
eb5d44eb | 23 | */ |
24 | ||
25 | #ifndef _ZEBRA_ISIS_ADJACENCY_H | |
26 | #define _ZEBRA_ISIS_ADJACENCY_H | |
27 | ||
42fe2621 CF |
28 | #include "isisd/isis_tlvs.h" |
29 | ||
d62a17ae | 30 | enum isis_adj_usage { |
31 | ISIS_ADJ_NONE, | |
32 | ISIS_ADJ_LEVEL1, | |
33 | ISIS_ADJ_LEVEL2, | |
34 | ISIS_ADJ_LEVEL1AND2 | |
eb5d44eb | 35 | }; |
36 | ||
d62a17ae | 37 | enum isis_system_type { |
38 | ISIS_SYSTYPE_UNKNOWN, | |
39 | ISIS_SYSTYPE_ES, | |
40 | ISIS_SYSTYPE_IS, | |
41 | ISIS_SYSTYPE_L1_IS, | |
42 | ISIS_SYSTYPE_L2_IS | |
eb5d44eb | 43 | }; |
44 | ||
d62a17ae | 45 | enum isis_adj_state { |
46 | ISIS_ADJ_UNKNOWN, | |
47 | ISIS_ADJ_INITIALIZING, | |
48 | ISIS_ADJ_UP, | |
49 | ISIS_ADJ_DOWN | |
eb5d44eb | 50 | }; |
51 | ||
52 | /* | |
53 | * we use the following codes to give an indication _why_ | |
54 | * a specific adjacency is up or down | |
55 | */ | |
d62a17ae | 56 | enum isis_adj_updown_reason { |
57 | ISIS_ADJ_REASON_SEENSELF, | |
58 | ISIS_ADJ_REASON_AREA_MISMATCH, | |
59 | ISIS_ADJ_REASON_HOLDTIMER_EXPIRED, | |
60 | ISIS_ADJ_REASON_AUTH_FAILED, | |
61 | ISIS_ADJ_REASON_CHECKSUM_FAILED | |
eb5d44eb | 62 | }; |
63 | ||
f390d2c7 | 64 | #define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */ |
eb5d44eb | 65 | |
d62a17ae | 66 | struct isis_dis_record { |
67 | int dis; /* is our neighbor the DIS ? */ | |
68 | time_t last_dis_change; /* timestamp for last dis change */ | |
eb5d44eb | 69 | }; |
70 | ||
20a42f01 CF |
71 | struct bfd_session; |
72 | ||
d62a17ae | 73 | struct isis_adjacency { |
d7c0a89a QY |
74 | uint8_t snpa[ETH_ALEN]; /* NeighbourSNPAAddress */ |
75 | uint8_t sysid[ISIS_SYS_ID_LEN]; /* neighbourSystemIdentifier */ | |
76 | uint8_t lanid[ISIS_SYS_ID_LEN + 1]; /* LAN id on bcast circuits */ | |
d62a17ae | 77 | int dischanges[ISIS_LEVELS]; /* how many DIS changes ? */ |
78 | /* an array of N levels for M records */ | |
79 | struct isis_dis_record dis_record[DIS_RECORDS * ISIS_LEVELS]; | |
0c1bd758 CF |
80 | enum isis_adj_state adj_state; /* adjacencyState */ |
81 | enum isis_adj_usage adj_usage; /* adjacencyUsage */ | |
82 | struct area_addr *area_addresses; /* areaAdressesOfNeighbour */ | |
83 | unsigned int area_address_count; | |
84 | struct nlpids nlpids; /* protocols spoken ... */ | |
85 | struct in_addr *ipv4_addresses; | |
86 | unsigned int ipv4_address_count; | |
d62a17ae | 87 | struct in_addr router_address; |
0c1bd758 CF |
88 | struct in6_addr *ipv6_addresses; |
89 | unsigned int ipv6_address_count; | |
d62a17ae | 90 | struct in6_addr router_address6; |
d7c0a89a | 91 | uint8_t prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */ |
d62a17ae | 92 | int circuit_t; /* from hello PDU hdr */ |
93 | int level; /* level (1 or 2) */ | |
94 | enum isis_system_type sys_type; /* neighbourSystemType */ | |
d7c0a89a QY |
95 | uint16_t hold_time; /* entryRemainingTime */ |
96 | uint32_t last_upd; | |
97 | uint32_t last_flap; /* last time the adj flapped */ | |
42fe2621 CF |
98 | enum isis_threeway_state threeway_state; |
99 | uint32_t ext_circuit_id; | |
d62a17ae | 100 | int flaps; /* number of adjacency flaps */ |
101 | struct thread *t_expire; /* expire after hold_time */ | |
102 | struct isis_circuit *circuit; /* back pointer */ | |
103 | uint16_t *mt_set; /* Topologies this adjacency is valid for */ | |
104 | unsigned int mt_count; /* Number of entries in mt_set */ | |
20a42f01 | 105 | struct bfd_session *bfd_session; |
eb5d44eb | 106 | }; |
107 | ||
42fe2621 CF |
108 | struct isis_threeway_adj; |
109 | ||
d7c0a89a QY |
110 | struct isis_adjacency *isis_adj_lookup(const uint8_t *sysid, |
111 | struct list *adjdb); | |
112 | struct isis_adjacency *isis_adj_lookup_snpa(const uint8_t *ssnpa, | |
d62a17ae | 113 | struct list *adjdb); |
d7c0a89a | 114 | struct isis_adjacency *isis_new_adj(const uint8_t *id, const uint8_t *snpa, |
d62a17ae | 115 | int level, struct isis_circuit *circuit); |
116 | void isis_delete_adj(void *adj); | |
42fe2621 CF |
117 | void isis_adj_process_threeway(struct isis_adjacency *adj, |
118 | struct isis_threeway_adj *tw_adj, | |
119 | enum isis_adj_usage adj_usage); | |
a5b5e946 | 120 | DECLARE_HOOK(isis_adj_state_change_hook, (struct isis_adjacency *adj), (adj)) |
d62a17ae | 121 | void isis_adj_state_change(struct isis_adjacency *adj, |
122 | enum isis_adj_state state, const char *reason); | |
123 | void isis_adj_print(struct isis_adjacency *adj); | |
2a1c520e | 124 | const char *isis_adj_yang_state(enum isis_adj_state state); |
d62a17ae | 125 | int isis_adj_expire(struct thread *thread); |
126 | void isis_adj_print_vty(struct isis_adjacency *adj, struct vty *vty, | |
127 | char detail); | |
128 | void isis_adj_build_neigh_list(struct list *adjdb, struct list *list); | |
129 | void isis_adj_build_up_list(struct list *adjdb, struct list *list); | |
d8fba7d9 | 130 | int isis_adj_usage2levels(enum isis_adj_usage usage); |
eb5d44eb | 131 | |
132 | #endif /* ISIS_ADJACENCY_H */ |