ospf6d.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 OSPF6D_H
  22. #define OSPF6D_H
  23. #define OSPF6_DAEMON_VERSION "0.9.7r"
  24. /* global variables */
  25. extern struct thread_master *master;
  26. #ifdef INRIA_IPV6
  27. #ifndef IPV6_PKTINFO
  28. #define IPV6_PKTINFO IPV6_RECVPKTINFO
  29. #endif /* IPV6_PKTINFO */
  30. #endif /* INRIA_IPV6 */
  31. /* Historical for KAME. */
  32. #ifndef IPV6_JOIN_GROUP
  33. #ifdef IPV6_ADD_MEMBERSHIP
  34. #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
  35. #endif /* IPV6_ADD_MEMBERSHIP. */
  36. #ifdef IPV6_JOIN_MEMBERSHIP
  37. #define IPV6_JOIN_GROUP IPV6_JOIN_MEMBERSHIP
  38. #endif /* IPV6_JOIN_MEMBERSHIP. */
  39. #endif /* ! IPV6_JOIN_GROUP*/
  40. #ifndef IPV6_LEAVE_GROUP
  41. #ifdef IPV6_DROP_MEMBERSHIP
  42. #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
  43. #endif /* IPV6_DROP_MEMBERSHIP */
  44. #endif /* ! IPV6_LEAVE_GROUP */
  45. /* cast macro: XXX - these *must* die, ick ick. */
  46. #define OSPF6_PROCESS(x) ((struct ospf6 *) (x))
  47. #define OSPF6_AREA(x) ((struct ospf6_area *) (x))
  48. #define OSPF6_INTERFACE(x) ((struct ospf6_interface *) (x))
  49. #define OSPF6_NEIGHBOR(x) ((struct ospf6_neighbor *) (x))
  50. /* operation on timeval structure */
  51. #ifndef timerclear
  52. #define timerclear(a) (a)->tv_sec = (tvp)->tv_usec = 0
  53. #endif /*timerclear*/
  54. #ifndef timersub
  55. #define timersub(a, b, res) \
  56. do { \
  57. (res)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
  58. (res)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
  59. if ((res)->tv_usec < 0) \
  60. { \
  61. (res)->tv_sec--; \
  62. (res)->tv_usec += 1000000; \
  63. } \
  64. } while (0)
  65. #endif /*timersub*/
  66. #define timerstring(tv, buf, size) \
  67. do { \
  68. if ((tv)->tv_sec / 60 / 60 / 24) \
  69. snprintf (buf, size, "%ldd%02ld:%02ld:%02ld", \
  70. (tv)->tv_sec / 60 / 60 / 24, \
  71. (tv)->tv_sec / 60 / 60 % 24, \
  72. (tv)->tv_sec / 60 % 60, \
  73. (tv)->tv_sec % 60); \
  74. else \
  75. snprintf (buf, size, "%02ld:%02ld:%02ld", \
  76. (tv)->tv_sec / 60 / 60 % 24, \
  77. (tv)->tv_sec / 60 % 60, \
  78. (tv)->tv_sec % 60); \
  79. } while (0)
  80. #define timerstring_local(tv, buf, size) \
  81. do { \
  82. int ret; \
  83. struct tm *tm; \
  84. tm = localtime (&(tv)->tv_sec); \
  85. ret = strftime (buf, size, "%Y/%m/%d %H:%M:%S", tm); \
  86. if (ret == 0) \
  87. zlog_warn ("strftime error"); \
  88. } while (0)
  89. /* for commands */
  90. #define OSPF6_AREA_STR "Area information\n"
  91. #define OSPF6_AREA_ID_STR "Area ID (as an IPv4 notation)\n"
  92. #define OSPF6_SPF_STR "Shortest Path First tree information\n"
  93. #define OSPF6_ROUTER_ID_STR "Specify Router-ID\n"
  94. #define OSPF6_LS_ID_STR "Specify Link State ID\n"
  95. #define VNL VTY_NEWLINE
  96. #define OSPF6_CMD_CHECK_RUNNING() \
  97. if (ospf6 == NULL) \
  98. { \
  99. vty_out (vty, "OSPFv3 is not running%s", VTY_NEWLINE); \
  100. return CMD_SUCCESS; \
  101. }
  102. /* Function Prototypes */
  103. extern struct route_node *route_prev (struct route_node *node);
  104. extern void ospf6_debug (void);
  105. extern void ospf6_init (void);
  106. #endif /* OSPF6D_H */