]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_ptm.h
Merge pull request #263 from opensourcerouting/assorted-20170308
[mirror_frr.git] / zebra / zebra_ptm.h
1 /*
2 * Definitions for prescriptive topology module (PTM).
3 * Copyright (C) 1998, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada
4 *
5 * This file is part of GNU Zebra.
6 *
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */
22
23 #ifndef _ZEBRA_PTM_H
24 #define _ZEBRA_PTM_H
25
26 extern const char ZEBRA_PTM_SOCK_NAME[];
27 #define ZEBRA_PTM_MAX_SOCKBUF 3200 /* 25B *128 ports */
28 #define ZEBRA_PTM_SEND_MAX_SOCKBUF 512
29
30 #define ZEBRA_PTM_BFD_CLIENT_FLAG_REG (1 << 1) /* client registered with BFD */
31
32 /* Zebra ptm context block */
33 struct zebra_ptm_cb
34 {
35 int ptm_sock; /* ptm file descriptor. */
36
37 struct buffer *wb; /* Buffer of data waiting to be written to ptm. */
38
39 struct thread *t_read; /* Thread for read */
40 struct thread *t_write; /* Thread for write */
41 struct thread *t_timer; /* Thread for timer */
42
43 char *out_data;
44 char *in_data;
45 int reconnect_time;
46
47 int ptm_enable;
48 int pid;
49 u_int8_t client_flags[ZEBRA_ROUTE_MAX];
50 };
51
52 #define ZEBRA_PTM_STATUS_DOWN 0
53 #define ZEBRA_PTM_STATUS_UP 1
54 #define ZEBRA_PTM_STATUS_UNKNOWN 2
55
56 /* For interface ptm-enable configuration. */
57 #define ZEBRA_IF_PTM_ENABLE_OFF 0
58 #define ZEBRA_IF_PTM_ENABLE_ON 1
59 #define ZEBRA_IF_PTM_ENABLE_UNSPEC 2
60
61 void zebra_ptm_init (void);
62 void zebra_ptm_finish(void);
63 int zebra_ptm_connect (struct thread *t);
64 void zebra_ptm_write (struct vty *vty);
65 int zebra_ptm_get_enable_state(void);
66
67 int zebra_ptm_bfd_dst_register (struct zserv *client, int sock, u_short length,
68 int command, struct zebra_vrf *zvrf);
69 int zebra_ptm_bfd_dst_deregister (struct zserv *client, int sock,
70 u_short length, struct zebra_vrf *zvrf);
71 void
72 zebra_ptm_show_status(struct vty *vty, struct interface *ifp);
73 int zebra_ptm_bfd_client_register (struct zserv *client, int sock,
74 u_short length);
75 void zebra_ptm_if_init(struct zebra_if *zebra_ifp);
76 void zebra_ptm_if_set_ptm_state(struct interface *ifp, struct zebra_if *zebra_ifp);
77 void zebra_ptm_if_write (struct vty *vty, struct zebra_if *zebra_ifp);
78 void zebra_ptm_bfd_client_deregister (int proto);
79 #endif