ospf6_lsdb.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (C) 2003 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_LSDB_H
  22. #define OSPF6_LSDB_H
  23. #include "prefix.h"
  24. #include "table.h"
  25. struct ospf6_lsdb
  26. {
  27. struct route_table *table;
  28. u_int32_t count;
  29. void (*hook_add) (struct ospf6_lsa *);
  30. void (*hook_remove) (struct ospf6_lsa *);
  31. };
  32. #define OSPF6_LSDB_MAXAGE_REMOVER(lsdb) \
  33. do { \
  34. struct ospf6_lsa *lsa; \
  35. for (lsa = ospf6_lsdb_head (lsdb); lsa; lsa = ospf6_lsdb_next (lsa)) \
  36. { \
  37. if (! OSPF6_LSA_IS_MAXAGE (lsa)) \
  38. continue; \
  39. if (lsa->onretrans != 0) \
  40. continue; \
  41. if (IS_OSPF6_DEBUG_LSA (TIMER)) \
  42. zlog_info (" remove maxage %s", lsa->name); \
  43. ospf6_lsdb_remove (lsa, lsdb); \
  44. } \
  45. } while (0)
  46. /* Function Prototypes */
  47. struct ospf6_lsdb *ospf6_lsdb_create ();
  48. void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb);
  49. struct ospf6_lsa *ospf6_lsdb_lookup (u_int16_t type, u_int32_t id,
  50. u_int32_t adv_router,
  51. struct ospf6_lsdb *lsdb);
  52. void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
  53. void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
  54. struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb);
  55. struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa);
  56. struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type,
  57. u_int32_t adv_router,
  58. struct ospf6_lsdb *lsdb);
  59. struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type,
  60. u_int32_t adv_router,
  61. struct ospf6_lsa *lsa);
  62. struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type,
  63. struct ospf6_lsdb *lsdb);
  64. struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type,
  65. struct ospf6_lsa *lsa);
  66. void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb);
  67. #define OSPF6_LSDB_SHOW_LEVEL_NORMAL 0
  68. #define OSPF6_LSDB_SHOW_LEVEL_DETAIL 1
  69. #define OSPF6_LSDB_SHOW_LEVEL_INTERNAL 2
  70. #define OSPF6_LSDB_SHOW_LEVEL_DUMP 3
  71. void ospf6_lsdb_show
  72. (struct vty *vty, int level,
  73. u_int16_t *type, u_int32_t *id, u_int32_t *adv_router,
  74. struct ospf6_lsdb *lsdb);
  75. u_int32_t ospf6_new_ls_id
  76. (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb);
  77. u_int32_t ospf6_new_ls_seqnum
  78. (u_int16_t type, u_int32_t id, u_int32_t adv_router, struct ospf6_lsdb *lsdb);
  79. #endif /* OSPF6_LSDB_H */