1 /* Zebra's client header.
2 * Copyright (C) 1999 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
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
8 * the Free Software Foundation; either version 2, or (at your option)
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.
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.
22 #ifndef _ZEBRA_ZCLIENT_H
23 #define _ZEBRA_ZCLIENT_H
25 /* For struct interface and struct connected. */
28 /* For input/output buffer to zebra. */
29 #define ZEBRA_MAX_PACKET_SIZ 4096
31 /* Zebra header size. */
32 #define ZEBRA_HEADER_SIZE 3
34 /* Structure for the zebra client. */
37 /* Socket to zebra daemon. */
40 /* Flag of communication to zebra is enabled or not. Default is on.
41 This flag is disabled by `no router zebra' statement. */
44 /* Connection failure count. */
47 /* Input buffer for zebra message. */
50 /* Output buffer for zebra message. */
53 /* Read and connect thread. */
54 struct thread
*t_read
;
55 struct thread
*t_connect
;
57 /* Redistribute information. */
58 u_char redist_default
;
59 u_char redist
[ZEBRA_ROUTE_MAX
];
61 /* Redistribute defauilt. */
62 u_char default_information
;
64 /* Pointer to the callback functions. */
65 int (*interface_add
) (int, struct zclient
*, zebra_size_t
);
66 int (*interface_delete
) (int, struct zclient
*, zebra_size_t
);
67 int (*interface_up
) (int, struct zclient
*, zebra_size_t
);
68 int (*interface_down
) (int, struct zclient
*, zebra_size_t
);
69 int (*interface_address_add
) (int, struct zclient
*, zebra_size_t
);
70 int (*interface_address_delete
) (int, struct zclient
*, zebra_size_t
);
71 int (*ipv4_route_add
) (int, struct zclient
*, zebra_size_t
);
72 int (*ipv4_route_delete
) (int, struct zclient
*, zebra_size_t
);
73 int (*ipv6_route_add
) (int, struct zclient
*, zebra_size_t
);
74 int (*ipv6_route_delete
) (int, struct zclient
*, zebra_size_t
);
77 /* Zebra API message flag. */
78 #define ZAPI_MESSAGE_NEXTHOP 0x01
79 #define ZAPI_MESSAGE_IFINDEX 0x02
80 #define ZAPI_MESSAGE_DISTANCE 0x04
81 #define ZAPI_MESSAGE_METRIC 0x08
83 /* Zebra IPv4 route message API. */
93 struct in_addr
**nexthop
;
96 unsigned int *ifindex
;
104 zapi_ipv4_add (struct zclient
*, struct prefix_ipv4
*, struct zapi_ipv4
*);
107 zapi_ipv4_delete (struct zclient
*, struct prefix_ipv4
*, struct zapi_ipv4
*);
109 /* Prototypes of zebra client service functions. */
110 struct zclient
*zclient_new (void);
111 void zclient_free (struct zclient
*);
112 void zclient_init (struct zclient
*, int);
113 int zclient_start (struct zclient
*);
114 void zclient_stop (struct zclient
*);
115 void zclient_reset (struct zclient
*);
116 int zclient_socket ();
117 int zclient_socket_un (char *);
119 void zclient_redistribute_set (struct zclient
*, int);
120 void zclient_redistribute_unset (struct zclient
*, int);
122 void zclient_redistribute_default_set (struct zclient
*);
123 void zclient_redistribute_default_unset (struct zclient
*);
125 /* struct zebra *zebra_new (); */
126 int zebra_redistribute_send (int, int, int);
128 struct interface
*zebra_interface_add_read (struct stream
*);
129 struct interface
*zebra_interface_state_read (struct stream
*s
);
130 struct connected
*zebra_interface_address_add_read (struct stream
*);
131 struct connected
*zebra_interface_address_delete_read (struct stream
*);
134 /* IPv6 prefix add and delete function prototype. */
145 struct in6_addr
**nexthop
;
148 unsigned int *ifindex
;
156 zapi_ipv6_add (struct zclient
*zclient
, struct prefix_ipv6
*p
,
157 struct zapi_ipv6
*api
);
159 zapi_ipv6_delete (struct zclient
*zclient
, struct prefix_ipv6
*p
,
160 struct zapi_ipv6
*api
);
162 #endif /* HAVE_IPV6 */
164 #endif /* _ZEBRA_ZCLIENT_H */