summaryrefslogtreecommitdiffstats
path: root/isisd/isis_adjacency.h
blob: 5c0772cc43ac5e9829a6527d8352cb86e5fecca9 (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
 * IS-IS Rout(e)ing protocol - isis_adjacency.h   
 *                             IS-IS adjacency handling
 *
 * Copyright (C) 2001,2002   Sampo Saaristo
 *                           Tampere University of Technology      
 *                           Institute of Communications Engineering
 *
 *
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public Licenseas published by the Free 
 * Software Foundation; either version 2 of the License, or (at your option) 
 * any later version.
 *
 * This program 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 this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifndef _ZEBRA_ISIS_ADJACENCY_H
#define _ZEBRA_ISIS_ADJACENCY_H

enum isis_adj_usage
{
  ISIS_ADJ_NONE,
  ISIS_ADJ_LEVEL1,
  ISIS_ADJ_LEVEL2,
  ISIS_ADJ_LEVEL1AND2
};

enum isis_system_type 
{
  ISIS_SYSTYPE_UNKNOWN,
  ISIS_SYSTYPE_ES,
  ISIS_SYSTYPE_IS,
  ISIS_SYSTYPE_L1_IS,
  ISIS_SYSTYPE_L2_IS
};

enum isis_adj_state 
{
  ISIS_ADJ_INITIALIZING,
  ISIS_ADJ_UP,
  ISIS_ADJ_DOWN
};

/*
 * we use the following codes to give an indication _why_
 * a specific adjacency is up or down
 */
enum isis_adj_updown_reason
{
  ISIS_ADJ_REASON_SEENSELF,
  ISIS_ADJ_REASON_AREA_MISMATCH,
  ISIS_ADJ_REASON_HOLDTIMER_EXPIRED,
  ISIS_ADJ_REASON_AUTH_FAILED,
  ISIS_ADJ_REASON_CHECKSUM_FAILED
};

#define DIS_RECORDS 8 /* keep the last 8 DIS state changes on record */

struct isis_dis_record {
  int                              dis; /* is our neighbor the DIS ? */          time_t               last_dis_change; /* timestamp for last dis change */
};

struct isis_adjacency{
  u_char snpa[ETH_ALEN];           /* NeighbourSNPAAddress */ 
  u_char sysid[ISIS_SYS_ID_LEN];   /* neighbourSystemIdentifier */
  u_char lanid[ISIS_SYS_ID_LEN+1]; /* LAN id on bcast circuits */
  int dischanges[ISIS_LEVELS];     /* how many DIS changes ?*/ 
  /* an array of N levels for M records */
  struct isis_dis_record  dis_record[DIS_RECORDS * ISIS_LEVELS]; 
  enum isis_adj_state adj_state;  /* adjacencyState */
  enum isis_adj_usage adj_usage;  /* adjacencyUsage */
  struct list *area_addrs;        /* areaAdressesOfNeighbour */
  struct nlpids nlpids;           /* protocols spoken ... */
  struct list *ipv4_addrs;
#ifdef HAVE_IPV6
  struct list *ipv6_addrs;
#endif /* HAVE_IPV6 */
  u_char prio[ISIS_LEVELS];        /* priorityOfNeighbour for DIS*/
  int circuit_t;                   /* from hello PDU hdr */
  int level;                       /* level (1 or 2) */
  enum  isis_system_type sys_type; /* neighbourSystemType */
  u_int16_t hold_time;             /* entryRemainingTime */
  u_int32_t last_upd;
  u_int32_t last_flap;             /* last time the adj flapped */
  int flaps;                       /* number of adjacency flaps  */
  struct thread *t_expire;         /* expire after hold_time  */
  struct isis_circuit *circuit;    /* back pointer */     
};


struct isis_adjacency *isis_adj_lookup (u_char *sysid, struct list *adjdb);
struct isis_adjacency *isis_adj_lookup_snpa (u_char *ssnpa, 
					     struct list *adjdb);
struct isis_adjacency *isis_new_adj (u_char *id, u_char *snpa, int level, 
                                     struct isis_circuit *circuit); 
void isis_delete_adj (struct isis_adjacency *adj, struct list *adjdb); 
void isis_adj_state_change (struct isis_adjacency *adj, 
                            enum isis_adj_state state, char *reason); 
void isis_adj_print (struct isis_adjacency *adj); 
int  isis_adj_expire (struct thread *thread);
void isis_adj_print_vty (struct isis_adjacency *adj, struct vty *vty);
void isis_adj_print_vty_detail (struct isis_adjacency *adj, struct vty *vty);
void isis_adj_print_vty_extensive (struct isis_adjacency *adj, 
                                   struct vty *vty);
void isis_adj_p2p_print_vty (struct isis_adjacency *adj, struct vty *vty);
void isis_adj_p2p_print_vty_detail (struct isis_adjacency *adj, 
                                    struct vty *vty);
void isis_adj_p2p_print_vty_extensive (struct isis_adjacency *adj, 
                                       struct vty *vty);

void isis_adj_build_neigh_list (struct list *adjdb, struct list *list);
void isis_adj_build_up_list (struct list *adjdb, struct list *list);
void isis_adjdb_iterate (struct list *adjdb, 
                         void (*func)(struct isis_adjacency*, 
                                      void *), void *arg);

#endif /* ISIS_ADJACENCY_H */