ospf6_lsdb.h 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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_debug ("Remove MaxAge %s", lsa->name); \
  44. ospf6_lsdb_remove (lsa, lsdb); \
  45. } \
  46. } while (0)
  47. /* Function Prototypes */
  48. extern struct ospf6_lsdb *ospf6_lsdb_create (void *data);
  49. extern void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb);
  50. extern struct ospf6_lsa *ospf6_lsdb_lookup (u_int16_t type, u_int32_t id,
  51. u_int32_t adv_router,
  52. struct ospf6_lsdb *lsdb);
  53. extern struct ospf6_lsa *ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id,
  54. u_int32_t adv_router,
  55. struct ospf6_lsdb *lsdb);
  56. extern void ospf6_lsdb_add (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
  57. extern void ospf6_lsdb_remove (struct ospf6_lsa *lsa, struct ospf6_lsdb *lsdb);
  58. extern struct ospf6_lsa *ospf6_lsdb_head (struct ospf6_lsdb *lsdb);
  59. extern struct ospf6_lsa *ospf6_lsdb_next (struct ospf6_lsa *lsa);
  60. extern struct ospf6_lsa *ospf6_lsdb_type_router_head (u_int16_t type,
  61. u_int32_t adv_router,
  62. struct ospf6_lsdb *lsdb);
  63. extern struct ospf6_lsa *ospf6_lsdb_type_router_next (u_int16_t type,
  64. u_int32_t adv_router,
  65. struct ospf6_lsa *lsa);
  66. extern struct ospf6_lsa *ospf6_lsdb_type_head (u_int16_t type,
  67. struct ospf6_lsdb *lsdb);
  68. extern struct ospf6_lsa *ospf6_lsdb_type_next (u_int16_t type,
  69. struct ospf6_lsa *lsa);
  70. extern 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. extern void ospf6_lsdb_show (struct vty *vty, int level, u_int16_t *type,
  76. u_int32_t *id, u_int32_t *adv_router,
  77. struct ospf6_lsdb *lsdb);
  78. extern u_int32_t ospf6_new_ls_id (u_int16_t type, u_int32_t adv_router,
  79. struct ospf6_lsdb *lsdb);
  80. extern u_int32_t ospf6_new_ls_seqnum (u_int16_t type, u_int32_t id,
  81. u_int32_t adv_router,
  82. struct ospf6_lsdb *lsdb);
  83. #endif /* OSPF6_LSDB_H */