jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame^] | 1 | /* |
| 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 | |
| 28 | struct password { |
| 29 | struct password *next; |
| 30 | int len; |
| 31 | u_char *pass; |
| 32 | }; |
| 33 | |
| 34 | struct metric { |
| 35 | u_char metric_default; |
| 36 | u_char metric_error; |
| 37 | u_char metric_expense; |
| 38 | u_char metric_delay; |
| 39 | }; |
| 40 | |
| 41 | struct isis_bcast_info { |
| 42 | u_char snpa [ETH_ALEN]; /* SNPA of this circuit */ |
| 43 | char run_dr_elect[2]; /* Should we run dr election ? */ |
| 44 | struct thread *t_run_dr[2]; /* DR election thread */ |
| 45 | struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */ |
| 46 | struct list *adjdb[2]; /* adjacency dbs */ |
| 47 | struct list *lan_neighs[2]; /* list of lx neigh snpa */ |
| 48 | char is_dr[2]; /* Are we level x DR ? */ |
| 49 | u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */ |
| 50 | u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */ |
| 51 | struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */ |
| 52 | int pad_hellos; /* add padding to Hello PDUs ? */ |
| 53 | u_char priority[2]; /* l1/2 IS Priority */ |
| 54 | }; |
| 55 | |
| 56 | struct isis_p2p_info { |
| 57 | struct isis_adjacency *neighbor; |
| 58 | struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */ |
| 59 | }; |
| 60 | |
| 61 | struct isis_circuit { |
| 62 | int state; |
| 63 | u_char circuit_id; /* l1/l2 p2p/bcast CircuitID */ |
| 64 | struct isis_area *area; /* back pointer to the area */ |
| 65 | struct interface *interface; /* interface info from z */ |
| 66 | int fd; /* IS-IS l1/2 socket */ |
| 67 | struct nlpids nlpids; |
| 68 | /* |
| 69 | * Threads |
| 70 | */ |
| 71 | struct thread *t_read; |
| 72 | struct thread *t_send_csnp[2]; |
| 73 | struct thread *t_send_psnp[2]; |
| 74 | struct list *lsp_queue; /* LSPs to be txed (both levels) */ |
| 75 | /* there is no real point in two streams, just for programming kicker */ |
| 76 | int (* rx) (struct isis_circuit *circuit, u_char *ssnpa); |
| 77 | struct stream *rcv_stream; /* Stream for receiving */ |
| 78 | int (* tx) (struct isis_circuit *circuit, int level); |
| 79 | struct stream *snd_stream; /* Stream for sending */ |
| 80 | int idx; /* idx in S[RM|SN] flags */ |
| 81 | #define CIRCUIT_T_BROADCAST 0 |
| 82 | #define CIRCUIT_T_P2P 1 |
| 83 | #define CIRCUIT_T_STATIC_IN 2 |
| 84 | #define CIRCUIT_T_STATIC_OUT 3 |
| 85 | #define CIRCUIT_T_DA 4 |
| 86 | int circ_type; /* type of the physical interface */ |
| 87 | union { |
| 88 | struct isis_bcast_info bc; |
| 89 | struct isis_p2p_info p2p; |
| 90 | } u; |
| 91 | char ext_domain; /* externalDomain (boolean) */ |
| 92 | /* |
| 93 | * Configurables |
| 94 | */ |
| 95 | struct isis_passwd passwd; /* Circuit rx/tx password */ |
| 96 | long lsp_interval; |
| 97 | int manual_l2_only; /* manualL2OnlyMode (boolean) */ |
| 98 | int circuit_is_type; /* circuit is type == level of circuit |
| 99 | * diffrenciated from circuit type (media) */ |
| 100 | u_int32_t hello_interval[2]; /* l1HelloInterval in msecs */ |
| 101 | u_int16_t hello_multiplier[2]; /* l1HelloMultiplier */ |
| 102 | u_int16_t csnp_interval[2]; /* level-1 csnp-interval in seconds */ |
| 103 | u_int16_t psnp_interval[2]; /* level-1 psnp-interval in seconds */ |
| 104 | struct metric metrics[2]; /* l1XxxMetric */ |
| 105 | struct password *c_rx_passwds; /* circuitReceivePasswords */ |
| 106 | struct password *c_tc_passwd; /* circuitTransmitPassword */ |
| 107 | int ip_router; /* Route IP ? */ |
| 108 | struct list *ip_addrs; /* our IP addresses */ |
| 109 | #ifdef HAVE_IPV6 |
| 110 | int ipv6_router; /* Route IPv6 ? */ |
| 111 | struct list *ipv6_link; /* our link local IPv6 addresses */ |
| 112 | struct list *ipv6_non_link; /* our non-link local IPv6 addresses */ |
| 113 | #endif /* HAVE_IPV6 */ |
| 114 | /* |
| 115 | * RFC 2973 IS-IS Mesh Groups |
| 116 | */ |
| 117 | #define MESH_INACTIVE 0 |
| 118 | #define MESH_BLOCKED 1 |
| 119 | #define MESH_SET 2 |
| 120 | int mesh_enabled; /* meshGroupEnabled */ |
| 121 | u_int16_t mesh_group; /* meshGroup */ |
| 122 | u_int16_t upadjcount[2]; |
| 123 | /* |
| 124 | * Counters as in 10589--11.2.5.9 |
| 125 | */ |
| 126 | u_int32_t adj_state_changes; /* changesInAdjacencyState */ |
| 127 | u_int32_t init_failures; /* intialisationFailures */ |
| 128 | u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */ |
| 129 | u_int32_t ctrl_pdus_txed; /* controlPDUsSent */ |
| 130 | u_int32_t desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges*/ |
| 131 | u_int32_t rej_adjacencies; /* rejectedAdjacencies */ |
| 132 | }; |
| 133 | |
| 134 | |
| 135 | void isis_circuit_init (void); |
| 136 | struct isis_circuit *isis_circuit_new (void); |
| 137 | struct isis_circuit *circuit_lookup_by_ifp (struct interface *ifp, |
| 138 | struct list *list); |
| 139 | struct isis_circuit *circuit_scan_by_ifp (struct interface *ifp); |
| 140 | void isis_circuit_del (struct isis_circuit *circuit); |
| 141 | void isis_circuit_configure (struct isis_circuit *circuit, |
| 142 | struct isis_area *area); |
| 143 | void isis_circuit_up (struct isis_circuit *circuit); |
| 144 | void isis_circuit_deconfigure (struct isis_circuit *circuit, |
| 145 | struct isis_area *area); |
| 146 | |
| 147 | int isis_circuit_destroy (struct isis_circuit *circuit); |
| 148 | void isis_circuit_if_add (struct isis_circuit *circuit, |
| 149 | struct interface *ifp); |
| 150 | void isis_circuit_if_del (struct isis_circuit *circuit); |
| 151 | void circuit_update_nlpids (struct isis_circuit *circuit); |
| 152 | void isis_circuit_update_params (struct isis_circuit *circuit, |
| 153 | struct interface *ifp); |
| 154 | void isis_circuit_add_addr (struct isis_circuit *circuit, |
| 155 | struct connected *conn); |
| 156 | void isis_circuit_del_addr (struct isis_circuit *circuit, |
| 157 | struct connected *conn); |
| 158 | #endif /* _ZEBRA_ISIS_CIRCUIT_H */ |