jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * IS-IS Rout(e)ing protocol - isis_spf.h |
| 3 | * IS-IS Shortest Path First algorithm |
| 4 | * |
| 5 | * Copyright (C) 2001,2002 Sampo Saaristo |
| 6 | * Tampere University of Technology |
| 7 | * Institute of Communications Engineering |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify it |
| 10 | * under the terms of the GNU General Public Licenseas published by the Free |
| 11 | * Software Foundation; either version 2 of the License, or (at your option) |
| 12 | * any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful,but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 17 | * more details. |
| 18 | |
| 19 | * You should have received a copy of the GNU General Public License along |
| 20 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 22 | */ |
| 23 | |
| 24 | #ifndef _ZEBRA_ISIS_SPF_H |
| 25 | #define _ZEBRA_ISIS_SPF_H |
| 26 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 27 | enum vertextype |
| 28 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 29 | VTYPE_PSEUDO_IS = 1, |
hasso | 82a8428 | 2005-09-26 18:15:36 +0000 | [diff] [blame] | 30 | VTYPE_PSEUDO_TE_IS, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 31 | VTYPE_NONPSEUDO_IS, |
hasso | 82a8428 | 2005-09-26 18:15:36 +0000 | [diff] [blame] | 32 | VTYPE_NONPSEUDO_TE_IS, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 33 | VTYPE_ES, |
| 34 | VTYPE_IPREACH_INTERNAL, |
hasso | 82a8428 | 2005-09-26 18:15:36 +0000 | [diff] [blame] | 35 | VTYPE_IPREACH_EXTERNAL, |
| 36 | VTYPE_IPREACH_TE |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 37 | #ifdef HAVE_IPV6 |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 38 | , |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 39 | VTYPE_IP6REACH_INTERNAL, |
| 40 | VTYPE_IP6REACH_EXTERNAL |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 41 | #endif /* HAVE_IPV6 */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | /* |
| 45 | * Triple <N, d(N), {Adj(N)}> |
| 46 | */ |
| 47 | struct isis_vertex |
| 48 | { |
| 49 | enum vertextype type; |
| 50 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 51 | union |
| 52 | { |
| 53 | u_char id[ISIS_SYS_ID_LEN + 1]; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 54 | struct prefix prefix; |
| 55 | } N; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 56 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 57 | u_int32_t d_N; /* d(N) Distance from this IS */ |
| 58 | u_int16_t depth; /* The depth in the imaginary tree */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 59 | struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */ |
| 60 | struct list *parents; /* list of parents for ECMP */ |
| 61 | struct list *children; /* list of children used for tree dump */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 62 | }; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 63 | |
| 64 | struct isis_spftree |
| 65 | { |
hasso | 12a5cae | 2004-09-19 19:39:26 +0000 | [diff] [blame] | 66 | struct thread *t_spf; /* spf threads */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 67 | struct list *paths; /* the SPT */ |
| 68 | struct list *tents; /* TENT */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 69 | struct isis_area *area; /* back pointer to area */ |
| 70 | int pending; /* already scheduled */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 71 | unsigned int runcount; /* number of runs since uptime */ |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 72 | time_t last_run_timestamp; /* last run timestamp for scheduling */ |
| 73 | time_t last_run_duration; /* last run duration in msec */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 74 | }; |
| 75 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 76 | struct isis_spftree * isis_spftree_new (struct isis_area *area); |
| 77 | void isis_spftree_del (struct isis_spftree *spftree); |
| 78 | void isis_spftree_adj_del (struct isis_spftree *spftree, |
| 79 | struct isis_adjacency *adj); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 80 | void spftree_area_init (struct isis_area *area); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 81 | void spftree_area_del (struct isis_area *area); |
| 82 | void spftree_area_adj_del (struct isis_area *area, |
| 83 | struct isis_adjacency *adj); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 84 | int isis_spf_schedule (struct isis_area *area, int level); |
| 85 | void isis_spf_cmds_init (void); |
| 86 | #ifdef HAVE_IPV6 |
| 87 | int isis_spf_schedule6 (struct isis_area *area, int level); |
| 88 | #endif |
| 89 | #endif /* _ZEBRA_ISIS_SPF_H */ |