isis_circuit.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef ISIS_CIRCUIT_H
  22. #define ISIS_CIRCUIT_H
  23. #include "vty.h"
  24. #include "if.h"
  25. #include "isis_constants.h"
  26. #include "isis_common.h"
  27. #define CIRCUIT_MAX 255
  28. struct password
  29. {
  30. struct password *next;
  31. int len;
  32. u_char *pass;
  33. };
  34. struct metric
  35. {
  36. u_char metric_default;
  37. u_char metric_error;
  38. u_char metric_expense;
  39. u_char metric_delay;
  40. };
  41. struct isis_bcast_info
  42. {
  43. u_char snpa[ETH_ALEN]; /* SNPA of this circuit */
  44. char run_dr_elect[2]; /* Should we run dr election ? */
  45. struct thread *t_run_dr[2]; /* DR election thread */
  46. struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */
  47. struct list *adjdb[2]; /* adjacency dbs */
  48. struct list *lan_neighs[2]; /* list of lx neigh snpa */
  49. char is_dr[2]; /* Are we level x DR ? */
  50. u_char l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
  51. u_char l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
  52. struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
  53. };
  54. struct isis_p2p_info
  55. {
  56. struct isis_adjacency *neighbor;
  57. struct thread *t_send_p2p_hello; /* send P2P IIHs in this thread */
  58. };
  59. struct isis_circuit
  60. {
  61. int state;
  62. u_char circuit_id; /* l1/l2 p2p/bcast CircuitID */
  63. struct isis_area *area; /* back pointer to the area */
  64. struct interface *interface; /* interface info from z */
  65. int fd; /* IS-IS l1/2 socket */
  66. int sap_length; /* SAP length for DLPI */
  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. time_t lsp_queue_last_cleared;/* timestamp used to enforce transmit interval;
  76. * for scalability, use one timestamp per
  77. * circuit, instead of one per lsp per circuit
  78. */
  79. /* there is no real point in two streams, just for programming kicker */
  80. int (*rx) (struct isis_circuit * circuit, u_char * ssnpa);
  81. struct stream *rcv_stream; /* Stream for receiving */
  82. int (*tx) (struct isis_circuit * circuit, int level);
  83. struct stream *snd_stream; /* Stream for sending */
  84. int idx; /* idx in S[RM|SN] flags */
  85. #define CIRCUIT_T_UNKNOWN 0
  86. #define CIRCUIT_T_BROADCAST 1
  87. #define CIRCUIT_T_P2P 2
  88. #define CIRCUIT_T_LOOPBACK 3
  89. int circ_type; /* type of the physical interface */
  90. int circ_type_config; /* config type of the physical interface */
  91. union
  92. {
  93. struct isis_bcast_info bc;
  94. struct isis_p2p_info p2p;
  95. } u;
  96. u_char priority[2]; /* l1/2 IS configured priority */
  97. int pad_hellos; /* add padding to Hello PDUs ? */
  98. char ext_domain; /* externalDomain (boolean) */
  99. int lsp_regenerate_pending[ISIS_LEVELS];
  100. /*
  101. * Configurables
  102. */
  103. struct isis_passwd passwd; /* Circuit rx/tx password */
  104. int is_type; /* circuit is type == level of circuit
  105. * differentiated 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. u_int8_t metric[2];
  111. u_int32_t te_metric[2];
  112. struct mpls_te_circuit *mtc; /* Support for MPLS-TE parameters - see isis_te.[c,h] */
  113. int ip_router; /* Route IP ? */
  114. int is_passive; /* Is Passive ? */
  115. struct list *ip_addrs; /* our IP addresses */
  116. #ifdef HAVE_IPV6
  117. int ipv6_router; /* Route IPv6 ? */
  118. struct list *ipv6_link; /* our link local IPv6 addresses */
  119. struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
  120. #endif /* HAVE_IPV6 */
  121. u_int16_t upadjcount[2];
  122. #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
  123. u_char flags;
  124. /*
  125. * Counters as in 10589--11.2.5.9
  126. */
  127. u_int32_t adj_state_changes; /* changesInAdjacencyState */
  128. u_int32_t init_failures; /* intialisationFailures */
  129. u_int32_t ctrl_pdus_rxed; /* controlPDUsReceived */
  130. u_int32_t ctrl_pdus_txed; /* controlPDUsSent */
  131. u_int32_t desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
  132. u_int32_t rej_adjacencies; /* rejectedAdjacencies */
  133. };
  134. void isis_circuit_init (void);
  135. struct isis_circuit *isis_circuit_new (void);
  136. void isis_circuit_del (struct isis_circuit *circuit);
  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_configure (struct isis_circuit *circuit,
  141. struct isis_area *area);
  142. void isis_circuit_deconfigure (struct isis_circuit *circuit,
  143. struct isis_area *area);
  144. void isis_circuit_if_add (struct isis_circuit *circuit,
  145. struct interface *ifp);
  146. void isis_circuit_if_del (struct isis_circuit *circuit,
  147. struct interface *ifp);
  148. void isis_circuit_if_bind (struct isis_circuit *circuit,
  149. struct interface *ifp);
  150. void isis_circuit_if_unbind (struct isis_circuit *circuit,
  151. struct interface *ifp);
  152. void isis_circuit_add_addr (struct isis_circuit *circuit,
  153. struct connected *conn);
  154. void isis_circuit_del_addr (struct isis_circuit *circuit,
  155. struct connected *conn);
  156. int isis_circuit_up (struct isis_circuit *circuit);
  157. void isis_circuit_down (struct isis_circuit *);
  158. void circuit_update_nlpids (struct isis_circuit *circuit);
  159. void isis_circuit_print_vty (struct isis_circuit *circuit, struct vty *vty,
  160. char detail);
  161. size_t isis_circuit_pdu_size(struct isis_circuit *circuit);
  162. void isis_circuit_stream(struct isis_circuit *circuit, struct stream **stream);
  163. struct isis_circuit *isis_circuit_create (struct isis_area *area, struct interface *ifp);
  164. void isis_circuit_af_set (struct isis_circuit *circuit, bool ip_router, bool ipv6_router);
  165. int isis_circuit_passive_set (struct isis_circuit *circuit, bool passive);
  166. void isis_circuit_is_type_set (struct isis_circuit *circuit, int is_type);
  167. int isis_circuit_circ_type_set (struct isis_circuit *circuit, int circ_type);
  168. int isis_circuit_metric_set (struct isis_circuit *circuit, int level, int metric);
  169. int isis_circuit_passwd_unset (struct isis_circuit *circuit);
  170. int isis_circuit_passwd_cleartext_set (struct isis_circuit *circuit, const char *passwd);
  171. int isis_circuit_passwd_hmac_md5_set (struct isis_circuit *circuit, const char *passwd);
  172. #endif /* _ZEBRA_ISIS_CIRCUIT_H */