ospf6_message.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (C) 1999-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_MESSAGE_H
  22. #define OSPF6_MESSAGE_H
  23. #define OSPF6_MESSAGE_BUFSIZ 4096
  24. /* Debug option */
  25. extern unsigned char conf_debug_ospf6_message[];
  26. #define OSPF6_DEBUG_MESSAGE_SEND 0x01
  27. #define OSPF6_DEBUG_MESSAGE_RECV 0x02
  28. #define OSPF6_DEBUG_MESSAGE_ON(type, level) \
  29. (conf_debug_ospf6_message[type] |= (level))
  30. #define OSPF6_DEBUG_MESSAGE_OFF(type, level) \
  31. (conf_debug_ospf6_message[type] &= ~(level))
  32. #define IS_OSPF6_DEBUG_MESSAGE(t, e) \
  33. (conf_debug_ospf6_message[t] & OSPF6_DEBUG_MESSAGE_ ## e)
  34. /* Type */
  35. #define OSPF6_MESSAGE_TYPE_UNKNOWN 0x0
  36. #define OSPF6_MESSAGE_TYPE_HELLO 0x1 /* Discover/maintain neighbors */
  37. #define OSPF6_MESSAGE_TYPE_DBDESC 0x2 /* Summarize database contents */
  38. #define OSPF6_MESSAGE_TYPE_LSREQ 0x3 /* Database download request */
  39. #define OSPF6_MESSAGE_TYPE_LSUPDATE 0x4 /* Database update */
  40. #define OSPF6_MESSAGE_TYPE_LSACK 0x5 /* Flooding acknowledgment */
  41. #define OSPF6_MESSAGE_TYPE_ALL 0x6 /* For debug option */
  42. #define OSPF6_MESSAGE_TYPE_CANONICAL(T) \
  43. ((T) > OSPF6_MESSAGE_TYPE_LSACK ? OSPF6_MESSAGE_TYPE_UNKNOWN : (T))
  44. extern const char *ospf6_message_type_str[];
  45. #define OSPF6_MESSAGE_TYPE_NAME(T) \
  46. (ospf6_message_type_str[ OSPF6_MESSAGE_TYPE_CANONICAL (T) ])
  47. /* OSPFv3 packet header */
  48. struct ospf6_header
  49. {
  50. u_char version;
  51. u_char type;
  52. u_int16_t length;
  53. u_int32_t router_id;
  54. u_int32_t area_id;
  55. u_int16_t checksum;
  56. u_char instance_id;
  57. u_char reserved;
  58. };
  59. #define OSPF6_MESSAGE_END(H) ((caddr_t) (H) + ntohs ((H)->length))
  60. /* Hello */
  61. struct ospf6_hello
  62. {
  63. u_int32_t interface_id;
  64. u_char priority;
  65. u_char options[3];
  66. u_int16_t hello_interval;
  67. u_int16_t dead_interval;
  68. u_int32_t drouter;
  69. u_int32_t bdrouter;
  70. /* Followed by Router-IDs */
  71. };
  72. /* Database Description */
  73. struct ospf6_dbdesc
  74. {
  75. u_char reserved1;
  76. u_char options[3];
  77. u_int16_t ifmtu;
  78. u_char reserved2;
  79. u_char bits;
  80. u_int32_t seqnum;
  81. /* Followed by LSA Headers */
  82. };
  83. #define OSPF6_DBDESC_MSBIT (0x01) /* master/slave bit */
  84. #define OSPF6_DBDESC_MBIT (0x02) /* more bit */
  85. #define OSPF6_DBDESC_IBIT (0x04) /* initial bit */
  86. /* Link State Request */
  87. /* It is just a sequence of entries below */
  88. struct ospf6_lsreq_entry
  89. {
  90. u_int16_t reserved; /* Must Be Zero */
  91. u_int16_t type; /* LS type */
  92. u_int32_t id; /* Link State ID */
  93. u_int32_t adv_router; /* Advertising Router */
  94. };
  95. /* Link State Update */
  96. struct ospf6_lsupdate
  97. {
  98. u_int32_t lsa_number;
  99. /* Followed by LSAs */
  100. };
  101. /* Link State Acknowledgement */
  102. /* It is just a sequence of LSA Headers */
  103. /* Function definition */
  104. extern void ospf6_hello_print (struct ospf6_header *);
  105. extern void ospf6_dbdesc_print (struct ospf6_header *);
  106. extern void ospf6_lsreq_print (struct ospf6_header *);
  107. extern void ospf6_lsupdate_print (struct ospf6_header *);
  108. extern void ospf6_lsack_print (struct ospf6_header *);
  109. extern int ospf6_iobuf_size (unsigned int size);
  110. extern int ospf6_receive (struct thread *thread);
  111. extern int ospf6_hello_send (struct thread *thread);
  112. extern int ospf6_dbdesc_send (struct thread *thread);
  113. extern int ospf6_dbdesc_send_newone (struct thread *thread);
  114. extern int ospf6_lsreq_send (struct thread *thread);
  115. extern int ospf6_lsupdate_send_interface (struct thread *thread);
  116. extern int ospf6_lsupdate_send_neighbor (struct thread *thread);
  117. extern int ospf6_lsack_send_interface (struct thread *thread);
  118. extern int ospf6_lsack_send_neighbor (struct thread *thread);
  119. extern int config_write_ospf6_debug_message (struct vty *);
  120. extern void install_element_ospf6_debug_message (void);
  121. #endif /* OSPF6_MESSAGE_H */