ospf6_asbr.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (C) 2001 Yasuhiro Ohara
  3. *
  4. * This file is part of GNU Zebra.
  5. *
  6. * GNU Zebra is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2, or (at your option) any
  9. * later version.
  10. *
  11. * GNU Zebra is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with GNU Zebra; see the file COPYING. If not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef OSPF6_ASBR_H
  22. #define OSPF6_ASBR_H
  23. /* for struct ospf6_prefix */
  24. #include "ospf6_proto.h"
  25. /* for struct ospf6_lsa */
  26. #include "ospf6_lsa.h"
  27. /* for struct ospf6_route */
  28. #include "ospf6_route.h"
  29. /* Debug option */
  30. extern unsigned char conf_debug_ospf6_asbr;
  31. #define OSPF6_DEBUG_ASBR_ON() \
  32. (conf_debug_ospf6_asbr = 1)
  33. #define OSPF6_DEBUG_ASBR_OFF() \
  34. (conf_debug_ospf6_asbr = 0)
  35. #define IS_OSPF6_DEBUG_ASBR \
  36. (conf_debug_ospf6_asbr)
  37. struct ospf6_external_info
  38. {
  39. /* External route type */
  40. int type;
  41. /* Originating Link State ID */
  42. u_int32_t id;
  43. struct in6_addr forwarding;
  44. route_tag_t tag;
  45. ifindex_t ifindex;
  46. };
  47. /* AS-External-LSA */
  48. #define OSPF6_AS_EXTERNAL_LSA_MIN_SIZE 4U /* w/o IPv6 prefix */
  49. struct ospf6_as_external_lsa
  50. {
  51. u_int32_t bits_metric;
  52. struct ospf6_prefix prefix;
  53. /* followed by none or one forwarding address */
  54. /* followed by none or one external route tag */
  55. /* followed by none or one referenced LS-ID */
  56. };
  57. #define OSPF6_ASBR_BIT_T ntohl (0x01000000)
  58. #define OSPF6_ASBR_BIT_F ntohl (0x02000000)
  59. #define OSPF6_ASBR_BIT_E ntohl (0x04000000)
  60. #define OSPF6_ASBR_METRIC(E) (ntohl ((E)->bits_metric & htonl (0x00ffffff)))
  61. #define OSPF6_ASBR_METRIC_SET(E,C) \
  62. { (E)->bits_metric &= htonl (0xff000000); \
  63. (E)->bits_metric |= htonl (0x00ffffff) & htonl (C); }
  64. extern void ospf6_asbr_lsa_add (struct ospf6_lsa *lsa);
  65. extern void ospf6_asbr_lsa_remove (struct ospf6_lsa *lsa);
  66. extern void ospf6_asbr_lsentry_add (struct ospf6_route *asbr_entry);
  67. extern void ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry);
  68. extern int ospf6_asbr_is_asbr (struct ospf6 *o);
  69. extern void ospf6_asbr_redistribute_add (int type, ifindex_t ifindex,
  70. struct prefix *prefix,
  71. u_int nexthop_num,
  72. struct in6_addr *nexthop,
  73. route_tag_t tag);
  74. extern void ospf6_asbr_redistribute_remove (int type, ifindex_t ifindex,
  75. struct prefix *prefix);
  76. extern int ospf6_redistribute_config_write (struct vty *vty);
  77. extern void ospf6_asbr_init (void);
  78. extern void ospf6_asbr_redistribute_reset (void);
  79. extern void ospf6_asbr_terminate (void);
  80. extern int config_write_ospf6_debug_asbr (struct vty *vty);
  81. extern void install_element_ospf6_debug_asbr (void);
  82. #endif /* OSPF6_ASBR_H */