blob: 484c057595bda9b756ee8f96027dcf7ff16f79c0 [file] [log] [blame]
jardineb5d44e2003-12-23 08:09:43 +00001/*
2 * IS-IS Rout(e)ing protocol - isis_circuit.h
3 *
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23#ifndef ISIS_CIRCUIT_H
24#define ISIS_CIRCUIT_H
25
26#define CIRCUIT_MAX 255
27
hassof390d2c2004-09-10 20:48:21 +000028struct password
29{
jardineb5d44e2003-12-23 08:09:43 +000030 struct password *next;
hassof390d2c2004-09-10 20:48:21 +000031 int len;
32 u_char *pass;
jardineb5d44e2003-12-23 08:09:43 +000033};
34
hassof390d2c2004-09-10 20:48:21 +000035struct metric
36{
jardineb5d44e2003-12-23 08:09:43 +000037 u_char metric_default;
38 u_char metric_error;
39 u_char metric_expense;
40 u_char metric_delay;
41};
42
hassof390d2c2004-09-10 20:48:21 +000043struct isis_bcast_info
44{
45 u_char snpa[ETH_ALEN]; /* SNPA of this circuit */
46 char run_dr_elect[2]; /* Should we run dr election ? */
47 struct thread *t_run_dr[2]; /* DR election thread */
48 struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */
49 struct list *adjdb[2]; /* adjacency dbs */
50 struct list *lan_neighs[2]; /* list of lx neigh snpa */
51 char is_dr[2]; /* Are we level x DR ? */
52 u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
53 u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
54 struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
55 int pad_hellos; /* add padding to Hello PDUs ? */
56 u_char priority[2]; /* l1/2 IS Priority */
jardineb5d44e2003-12-23 08:09:43 +000057};
58
hassof390d2c2004-09-10 20:48:21 +000059struct isis_p2p_info
60{
61 struct isis_adjacency *neighbor;
62 struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
jardineb5d44e2003-12-23 08:09:43 +000063};
64
hassof390d2c2004-09-10 20:48:21 +000065struct isis_circuit
66{
jardineb5d44e2003-12-23 08:09:43 +000067 int state;
hassof390d2c2004-09-10 20:48:21 +000068 u_char circuit_id; /* l1/l2 p2p/bcast CircuitID */
69 struct isis_area *area; /* back pointer to the area */
70 struct interface *interface; /* interface info from z */
71 int fd; /* IS-IS l1/2 socket */
72 struct nlpids nlpids;
jardineb5d44e2003-12-23 08:09:43 +000073 /*
74 * Threads
75 */
76 struct thread *t_read;
77 struct thread *t_send_csnp[2];
78 struct thread *t_send_psnp[2];
hassof390d2c2004-09-10 20:48:21 +000079 struct list *lsp_queue; /* LSPs to be txed (both levels) */
jardineb5d44e2003-12-23 08:09:43 +000080 /* there is no real point in two streams, just for programming kicker */
hassof390d2c2004-09-10 20:48:21 +000081 int (*rx) (struct isis_circuit * circuit, u_char * ssnpa);
82 struct stream *rcv_stream; /* Stream for receiving */
83 int (*tx) (struct isis_circuit * circuit, int level);
84 struct stream *snd_stream; /* Stream for sending */
85 int idx; /* idx in S[RM|SN] flags */
86#define CIRCUIT_T_BROADCAST 0
jardineb5d44e2003-12-23 08:09:43 +000087#define CIRCUIT_T_P2P 1
88#define CIRCUIT_T_STATIC_IN 2
89#define CIRCUIT_T_STATIC_OUT 3
90#define CIRCUIT_T_DA 4
hassof390d2c2004-09-10 20:48:21 +000091 int circ_type; /* type of the physical interface */
92 union
93 {
jardineb5d44e2003-12-23 08:09:43 +000094 struct isis_bcast_info bc;
95 struct isis_p2p_info p2p;
96 } u;
hassof390d2c2004-09-10 20:48:21 +000097 char ext_domain; /* externalDomain (boolean) */
jardineb5d44e2003-12-23 08:09:43 +000098 /*
99 * Configurables
100 */
hassof390d2c2004-09-10 20:48:21 +0000101 struct isis_passwd passwd; /* Circuit rx/tx password */
102 long lsp_interval;
103 int manual_l2_only; /* manualL2OnlyMode (boolean) */
104 int circuit_is_type; /* circuit is type == level of circuit
105 * diffrenciated from circuit type (media) */
106 u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */
107 u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */
108 u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */
109 u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */
110 struct metric metrics[2]; /* l1XxxMetric */
111 struct password *c_rx_passwds; /* circuitReceivePasswords */
112 struct password *c_tc_passwd; /* circuitTransmitPassword */
113 int ip_router; /* Route IP ? */
114 struct list *ip_addrs; /* our IP addresses */
jardineb5d44e2003-12-23 08:09:43 +0000115#ifdef HAVE_IPV6
hassof390d2c2004-09-10 20:48:21 +0000116 int ipv6_router; /* Route IPv6 ? */
117 struct list *ipv6_link; /* our link local IPv6 addresses */
118 struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
119#endif /* HAVE_IPV6 */
jardineb5d44e2003-12-23 08:09:43 +0000120 /*
121 * RFC 2973 IS-IS Mesh Groups
122 */
123#define MESH_INACTIVE 0
124#define MESH_BLOCKED 1
125#define MESH_SET 2
hassof390d2c2004-09-10 20:48:21 +0000126 int mesh_enabled; /* meshGroupEnabled */
127 u_int16_t mesh_group; /* meshGroup */
jardineb5d44e2003-12-23 08:09:43 +0000128 u_int16_t upadjcount[2];
129 /*
130 * Counters as in 10589--11.2.5.9
131 */
hassof390d2c2004-09-10 20:48:21 +0000132 u_int32_t adj_state_changes; /* changesInAdjacencyState */
133 u_int32_t init_failures; /* intialisationFailures */
134 u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */
135 u_int32_t ctrl_pdus_txed; /* controlPDUsSent */
136 u_int32_t desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
137 u_int32_t rej_adjacencies; /* rejectedAdjacencies */
jardineb5d44e2003-12-23 08:09:43 +0000138};
139
hassof390d2c2004-09-10 20:48:21 +0000140void isis_circuit_init (void);
141struct isis_circuit *isis_circuit_new (void);
142struct isis_circuit *circuit_lookup_by_ifp (struct interface *ifp,
143 struct list *list);
144struct isis_circuit *circuit_scan_by_ifp (struct interface *ifp);
145void isis_circuit_del (struct isis_circuit *circuit);
146void isis_circuit_configure (struct isis_circuit *circuit,
147 struct isis_area *area);
148void isis_circuit_up (struct isis_circuit *circuit);
149void isis_circuit_deconfigure (struct isis_circuit *circuit,
150 struct isis_area *area);
jardineb5d44e2003-12-23 08:09:43 +0000151
hassof390d2c2004-09-10 20:48:21 +0000152int isis_circuit_destroy (struct isis_circuit *circuit);
153void isis_circuit_if_add (struct isis_circuit *circuit,
154 struct interface *ifp);
155void isis_circuit_if_del (struct isis_circuit *circuit);
156void circuit_update_nlpids (struct isis_circuit *circuit);
157void isis_circuit_update_params (struct isis_circuit *circuit,
158 struct interface *ifp);
159void isis_circuit_add_addr (struct isis_circuit *circuit,
160 struct connected *conn);
161void isis_circuit_del_addr (struct isis_circuit *circuit,
162 struct connected *conn);
jardineb5d44e2003-12-23 08:09:43 +0000163#endif /* _ZEBRA_ISIS_CIRCUIT_H */