blob: 9a8df61002be5da612148cd86ed695511ce99efc [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
2 * IS-IS Rout(e)ing protocol - isis_routemap.c
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
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#include <stdlib.h>
24#include <stdio.h>
25#include <zebra.h>
jardineb5d44e2003-12-23 08:09:43 +000026
27#include "thread.h"
28#include "linklist.h"
29#include "vty.h"
30#include "log.h"
31#include "memory.h"
32#include "prefix.h"
33#include "hash.h"
34#include "if.h"
35#include "table.h"
36#include "routemap.h"
37
38#include "isis_constants.h"
39#include "isis_common.h"
40#include "dict.h"
41#include "isisd.h"
42#include "isis_misc.h"
43#include "isis_adjacency.h"
44#include "isis_circuit.h"
45#include "isis_tlv.h"
46#include "isis_pdu.h"
47#include "isis_lsp.h"
48#include "isis_spf.h"
49#include "isis_route.h"
50#include "isis_zebra.h"
51
52extern struct isis *isis;
53
54void
55isis_route_map_upd()
56{
57 int i = 0;
58
59 if (!isis)
60 return;
61
62 for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
63 if (isis->rmap[i].name)
64 isis->rmap[i].map = isis->rmap[i].map =
65 route_map_lookup_by_name (isis->rmap[i].name);
66 else
67 isis->rmap[i].map = NULL;
68 }
69 /* FIXME: do the address family sub-mode AF_INET6 here ? */
70}
71
72void
73isis_route_map_event(route_map_event_t event, char *name)
74{
75 int type;
76
77 if (!isis)
78 return;
79
80 for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
81 if (isis->rmap[type].name && isis->rmap[type].map &&
82 !strcmp (isis->rmap[type].name, name)) {
83 isis_distribute_list_update (type);
84 }
85 }
86}
87
88
89void
90isis_route_map_init (void)
91{
92 route_map_init ();
93 route_map_init_vty ();
94
95 route_map_add_hook (isis_route_map_upd);
96 route_map_delete_hook (isis_route_map_upd);
97 route_map_event_hook (isis_route_map_event);
98
99}