zserv.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* Zebra daemon server header.
  2. * Copyright (C) 1997, 98 Kunihiro Ishiguro
  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 Free
  18. * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  19. * 02111-1307, USA.
  20. */
  21. #ifndef _ZEBRA_ZSERV_H
  22. #define _ZEBRA_ZSERV_H
  23. #include "rib.h"
  24. /* Default port information. */
  25. #define ZEBRA_PORT 2600
  26. #define ZEBRA_VTY_PORT 2601
  27. /* Default configuration filename. */
  28. #define DEFAULT_CONFIG_FILE "zebra.conf"
  29. /* Client structure. */
  30. struct zserv
  31. {
  32. /* Client file descriptor. */
  33. int sock;
  34. /* Input/output buffer to the client. */
  35. struct stream *ibuf;
  36. struct stream *obuf;
  37. /* Threads for read/write. */
  38. struct thread *t_read;
  39. struct thread *t_write;
  40. /* default routing table this client munges */
  41. int rtm_table;
  42. /* This client's redistribute flag. */
  43. u_char redist[ZEBRA_ROUTE_MAX];
  44. /* Redistribute default route flag. */
  45. u_char redist_default;
  46. /* Interface information. */
  47. u_char ifinfo;
  48. };
  49. /* Zebra instance */
  50. struct zebra_t
  51. {
  52. /* Thread master */
  53. struct thread_master *master;
  54. list client_list;
  55. /* default table */
  56. int rtm_table_default;
  57. };
  58. /* Count prefix size from mask length */
  59. #define PSIZE(a) (((a) + 7) / (8))
  60. /* Prototypes. */
  61. void zebra_init ();
  62. void zebra_if_init ();
  63. void hostinfo_get ();
  64. void rib_init ();
  65. void interface_list ();
  66. void kernel_init ();
  67. void route_read ();
  68. void rtadv_init ();
  69. void zebra_snmp_init ();
  70. int zsend_interface_add (struct zserv *, struct interface *);
  71. #if (defined(RTM_IFANNOUNCE) || defined(HAVE_NETLINK))
  72. int zsend_interface_delete (struct zserv *, struct interface *);
  73. #endif
  74. int zsend_interface_address (int, struct zserv *, struct interface *,
  75. struct connected *);
  76. int zsend_interface_update (int, struct zserv *, struct interface *);
  77. int zsend_route_multipath (int, struct zserv *, struct prefix *, struct rib *);
  78. extern pid_t pid;
  79. extern pid_t old_pid;
  80. #endif /* _ZEBRA_ZEBRA_H */