isis_circuit.h 6.3 KB

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