zserv.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. #include "if.h"
  25. #include "workqueue.h"
  26. /* Default port information. */
  27. #define ZEBRA_VTY_PORT 2601
  28. /* Default configuration filename. */
  29. #define DEFAULT_CONFIG_FILE "zebra.conf"
  30. /* Client structure. */
  31. struct zserv
  32. {
  33. /* Client file descriptor. */
  34. int sock;
  35. /* Input/output buffer to the client. */
  36. struct stream *ibuf;
  37. struct stream *obuf;
  38. /* Buffer of data waiting to be written to client. */
  39. struct buffer *wb;
  40. /* Threads for read/write. */
  41. struct thread *t_read;
  42. struct thread *t_write;
  43. /* Thread for delayed close. */
  44. struct thread *t_suicide;
  45. /* default routing table this client munges */
  46. int rtm_table;
  47. /* This client's redistribute flag. */
  48. u_char redist[ZEBRA_ROUTE_MAX];
  49. /* Redistribute default route flag. */
  50. u_char redist_default;
  51. /* Interface information. */
  52. u_char ifinfo;
  53. /* Router-id information. */
  54. u_char ridinfo;
  55. };
  56. /* Zebra instance */
  57. struct zebra_t
  58. {
  59. /* Thread master */
  60. struct thread_master *master;
  61. struct list *client_list;
  62. /* default table */
  63. int rtm_table_default;
  64. /* rib work queue */
  65. struct work_queue *ribq;
  66. struct meta_queue *mq;
  67. };
  68. /* Count prefix size from mask length */
  69. #define PSIZE(a) (((a) + 7) / (8))
  70. /* Prototypes. */
  71. extern void zebra_init (void);
  72. extern void zebra_if_init (void);
  73. extern void zebra_zserv_socket_init (char *path);
  74. extern void hostinfo_get (void);
  75. extern void rib_init (void);
  76. extern void interface_list (void);
  77. extern void kernel_init (void);
  78. extern void route_read (void);
  79. extern void zebra_route_map_init (void);
  80. extern void zebra_snmp_init (void);
  81. extern void zebra_vty_init (void);
  82. extern int zsend_interface_add (struct zserv *, struct interface *);
  83. extern int zsend_interface_delete (struct zserv *, struct interface *);
  84. extern int zsend_interface_address (int, struct zserv *, struct interface *,
  85. struct connected *);
  86. extern int zsend_interface_update (int, struct zserv *, struct interface *);
  87. extern int zsend_route_multipath (int, struct zserv *, struct prefix *,
  88. struct rib *);
  89. extern int zsend_router_id_update(struct zserv *, struct prefix *);
  90. extern pid_t pid;
  91. #endif /* _ZEBRA_ZEBRA_H */