2 * Copyright (C) 1999 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
25 #include "ospf6_hook.h"
26 #include "ospf6_linklist.h"
28 struct ospf6_route_table
35 struct route_table
*table
;
38 struct linklist
*hook_list
[3];
39 void (*hook_add
) (void *);
40 void (*hook_change
) (void *);
41 void (*hook_remove
) (void *);
53 /* Destination Type */
67 /* Link State Origin */
68 struct ls_origin origin
;
73 /* Optional Capabilities */
77 u_char prefix_options
;
97 /* IP address, if any */
98 struct in6_addr address
;
101 struct ospf6_route_node
103 struct ospf6_route_table
*table
;
107 struct route_node
*route_node
;
108 struct ospf6_route route
;
109 struct linklist
*path_list
;
112 struct ospf6_path_node
114 struct ospf6_route_node
*route_node
;
115 struct ospf6_path path
;
116 struct linklist
*nexthop_list
;
119 struct ospf6_nexthop_node
122 struct timeval installed
;
124 struct ospf6_path_node
*path_node
;
125 struct ospf6_nexthop nexthop
;
128 struct ospf6_route_req
130 struct ospf6_route_table
*table
;
131 struct route_node
*route_node
;
132 struct linklist_node path_lnode
;
133 struct linklist_node nexthop_lnode
;
137 struct ospf6_route route
;
138 struct ospf6_path path
;
139 struct ospf6_nexthop nexthop
;
142 #define OSPF6_DEST_TYPE_NONE 0
143 #define OSPF6_DEST_TYPE_ROUTER 1
144 #define OSPF6_DEST_TYPE_NETWORK 2
145 #define OSPF6_DEST_TYPE_DISCARD 3
146 #define OSPF6_DEST_TYPE_MAX 4
148 #define OSPF6_PATH_TYPE_NONE 0
149 #define OSPF6_PATH_TYPE_INTRA 1
150 #define OSPF6_PATH_TYPE_INTER 2
151 #define OSPF6_PATH_TYPE_EXTERNAL1 3
152 #define OSPF6_PATH_TYPE_EXTERNAL2 4
153 #define OSPF6_PATH_TYPE_ZOFFSET 5
154 #define OSPF6_PATH_TYPE_ZSYSTEM (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_SYSTEM)
155 #define OSPF6_PATH_TYPE_ZKERNEL (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_KERNEL)
156 #define OSPF6_PATH_TYPE_ZCONNECT (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_CONNECT)
157 #define OSPF6_PATH_TYPE_ZSTATIC (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_STATIC)
158 #define OSPF6_PATH_TYPE_ZRIP (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_RIP)
159 #define OSPF6_PATH_TYPE_ZRIPNG (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_RIPNG)
160 #define OSPF6_PATH_TYPE_ZOSPF (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_OSPF)
161 #define OSPF6_PATH_TYPE_ZOSPF6 (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_OSPF6)
162 #define OSPF6_PATH_TYPE_ZBGP (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_BGP)
163 #define OSPF6_PATH_TYPE_MAX (OSPF6_PATH_TYPE_ZOFFSET + ZEBRA_ROUTE_MAX)
165 #define OSPF6_ROUTE_FLAG_ROUTE_CHANGE 0x01
166 #define OSPF6_ROUTE_FLAG_PATH_CHANGE 0x02
167 #define OSPF6_ROUTE_FLAG_ADD 0x04
168 #define OSPF6_ROUTE_FLAG_REMOVE 0x08
169 #define OSPF6_ROUTE_FLAG_CHANGE 0x10
171 int ospf6_route_lookup (struct ospf6_route_req
*request
,
172 struct prefix
*prefix
,
173 struct ospf6_route_table
*table
);
174 void ospf6_route_head (struct ospf6_route_req
*request
,
175 struct ospf6_route_table
*table
);
176 int ospf6_route_end (struct ospf6_route_req
*request
);
177 void ospf6_route_next (struct ospf6_route_req
*request
);
179 void ospf6_route_add (struct ospf6_route_req
*, struct ospf6_route_table
*);
180 void ospf6_route_remove (struct ospf6_route_req
*, struct ospf6_route_table
*);
181 void ospf6_route_remove_all (struct ospf6_route_table
*);
183 struct ospf6_route_table
*ospf6_route_table_create ();
184 void ospf6_route_table_delete (struct ospf6_route_table
*);
186 void ospf6_route_table_freeze (struct ospf6_route_table
*);
187 void ospf6_route_table_thaw (struct ospf6_route_table
*);
189 void ospf6_route_log_request (char *what
, char *where
,
190 struct ospf6_route_req
*request
);
193 ospf6_route_hook_register (void (*add
) (struct ospf6_route_req
*),
194 void (*change
) (struct ospf6_route_req
*),
195 void (*remove
) (struct ospf6_route_req
*),
196 struct ospf6_route_table
*table
);
198 ospf6_route_hook_unregister (void (*add
) (struct ospf6_route_req
*),
199 void (*change
) (struct ospf6_route_req
*),
200 void (*remove
) (struct ospf6_route_req
*),
201 struct ospf6_route_table
*table
);
203 void ospf6_route_init ();
205 int ospf6_route_table_show (struct vty
*, int, char **,
206 struct ospf6_route_table
*);
208 #endif /* OSPF6_ROUTE_H */