summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_spf.h
blob: de50e94a8a545784ff61c13094ed2b15be3c93b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * Copyright (C) 1999 Yasuhiro Ohara
 *
 * This file is part of GNU Zebra.
 *
 * GNU Zebra is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * GNU Zebra is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU Zebra; see the file COPYING.  If not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
 * Boston, MA 02111-1307, USA.  
 */

#ifndef OSPF6_SPF_H
#define OSPF6_SPF_H

#include "prefix.h"

/* Transit Vertex */
struct ospf6_vertex
{
  /* type of this vertex */
  u_int8_t type;

  /* Vertex Identifier */
  struct prefix_ls vertex_id;

  /* Identifier String */
  char string[128];

  /* Associated LSA */
  struct ospf6_lsa *lsa;

  /* Distance from Root (Cost) */
  u_int16_t distance;

  /* Depth of this node */
  u_char depth;

  /* nexthops to this node */
  struct linklist *nexthop_list;

  /* upper nodes in spf tree */
  list parent_list;

  /* lower nodes in spf tree */
  list path_list;

  /* capability bits */
  u_char capability_bits;

  /* Optional capabilities */
  u_char opt_capability[3];
};

#define OSPF6_VERTEX_TYPE_ROUTER  0x01
#define OSPF6_VERTEX_TYPE_NETWORK 0x02

struct ospf6_spftree
{
  /* calculation thread */
  struct thread *t_spf_calculation;

  /* root of this tree */
  struct ospf6_vertex *root;

  /* list for search */
  list list;

  /* statistics */
  u_int32_t timerun;

  struct timeval runtime_total;
  struct timeval runtime_min;
  struct timeval runtime_max;

  struct timeval updated_time;
  struct timeval interval_total;
  struct timeval interval_min;
  struct timeval interval_max;
};

int ospf6_spf_calculate_route (void *);

void
ospf6_spf_calculation_schedule (u_int32_t area_id);
struct ospf6_spftree *ospf6_spftree_create ();
void
ospf6_spf_statistics_show (struct vty *vty, struct ospf6_spftree *spf_tree);
void ospf6_spftree_delete (struct ospf6_spftree *spf_tree);

void ospf6_spf_database_hook (struct ospf6_lsa *old, struct ospf6_lsa *new);

void ospf6_spf_init ();

#endif /* OSPF6_SPF_H */