ospf6_lsdb.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. void *data; /* data structure that holds this lsdb */
  28. struct route_table *table;
  29. u_int32_t count;
  30. void (*hook_add) (struct ospf6_lsa *);
  31. void (*hook_remove) (struct ospf6_lsa *);
  32. };
  33. #define OSPF6_LSDB_MAXAGE_REMOVER(lsdb) \
  34. do { \
  35. struct ospf6_lsa *lsa; \
  36. for (lsa = ospf6_lsdb_head (lsdb); lsa; lsa = ospf6_lsdb_next (lsa)) \
  37. { \
  38. if (! OSPF6_LSA_IS_MAXAGE (lsa)) \
  39. continue; \
  40. if (lsa->retrans_count != 0) \
  41. continue; \
  42. if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type)) \
  43. zlog_info ("Remove MaxAge %s", lsa->name); \
  44. ospf6_lsdb_remove (lsa, lsdb); \
  45. } \
  46. } while (0)
  47. /* Function Prototypes */
  48. struct ospf6_lsdb *ospf6_lsdb_create (void *data);
  49. void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb);
  50. struct ospf6_lsa *
  51. ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router,
  52. struct ospf6_lsdb *lsdb);
  53. struct ospf6_lsa *
  54. ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id,
  55. u_int32_t adv_router, struct ospf6_lsdb *lsdb);
  56. void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
  57. void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
  58. struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb);
  59. struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa);
  60. struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type,
  61. u_int32_t adv_router,
  62. struct ospf6_lsdb *lsdb);
  63. struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type,
  64. u_int32_t adv_router,
  65. struct ospf6_lsa *lsa);
  66. struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type,
  67. struct ospf6_lsdb *lsdb);
  68. struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type,
  69. struct ospf6_lsa *lsa);
  70. void ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb);
  71. #define OSPF6_LSDB_SHOW_LEVEL_NORMAL 0
  72. #define OSPF6_LSDB_SHOW_LEVEL_DETAIL 1
  73. #define OSPF6_LSDB_SHOW_LEVEL_INTERNAL 2
  74. #define OSPF6_LSDB_SHOW_LEVEL_DUMP 3
  75. void ospf6_lsdb_show
  76. (struct vty *vty, int level,
  77. u_int16_t *type, u_int32_t *id, u_int32_t *adv_router,
  78. struct ospf6_lsdb *lsdb);
  79. u_int32_t ospf6_new_ls_id
  80. (u_int16_t type, u_int32_t adv_router, struct ospf6_lsdb *lsdb);
  81. u_int32_t ospf6_new_ls_seqnum
  82. (u_int16_t type, u_int32_t id, u_int32_t adv_router, struct ospf6_lsdb *lsdb);
  83. #endif /* OSPF6_LSDB_H */