]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_ptm.h
Merge pull request #13425 from FRRouting/revert-12646-mpls_alloc_per_nh
[mirror_frr.git] / zebra / zebra_ptm.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Definitions for prescriptive topology module (PTM).
4 * Copyright (C) 1998, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada
5 */
6
7 #ifndef _ZEBRA_PTM_H
8 #define _ZEBRA_PTM_H
9
10 extern const char ZEBRA_PTM_SOCK_NAME[];
11 #define ZEBRA_PTM_MAX_SOCKBUF 3200 /* 25B *128 ports */
12 #define ZEBRA_PTM_SEND_MAX_SOCKBUF 512
13
14 #define ZEBRA_PTM_BFD_CLIENT_FLAG_REG (1 << 1) /* client registered with BFD */
15
16 #include "zebra/zserv.h"
17 #include "zebra/interface.h"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 /* Zebra ptm context block */
24 struct zebra_ptm_cb {
25 int ptm_sock; /* ptm file descriptor. */
26
27 struct buffer *wb; /* Buffer of data waiting to be written to ptm. */
28
29 struct event *t_read; /* Thread for read */
30 struct event *t_write; /* Thread for write */
31 struct event *t_timer; /* Thread for timer */
32
33 char *out_data;
34 char *in_data;
35 int reconnect_time;
36
37 int ptm_enable;
38 int pid;
39 uint8_t client_flags[ZEBRA_ROUTE_MAX];
40 };
41
42 #define ZEBRA_PTM_STATUS_DOWN 0
43 #define ZEBRA_PTM_STATUS_UP 1
44 #define ZEBRA_PTM_STATUS_UNKNOWN 2
45
46 /* For interface ptm-enable configuration. */
47 #define ZEBRA_IF_PTM_ENABLE_OFF 0
48 #define ZEBRA_IF_PTM_ENABLE_ON 1
49 #define ZEBRA_IF_PTM_ENABLE_UNSPEC 2
50
51 #define IS_BFD_ENABLED_PROTOCOL(protocol) \
52 ((protocol) == ZEBRA_ROUTE_BGP || (protocol) == ZEBRA_ROUTE_OSPF || \
53 (protocol) == ZEBRA_ROUTE_OSPF6 || (protocol) == ZEBRA_ROUTE_ISIS || \
54 (protocol) == ZEBRA_ROUTE_PIM || \
55 (protocol) == ZEBRA_ROUTE_OPENFABRIC || \
56 (protocol) == ZEBRA_ROUTE_STATIC || (protocol) == ZEBRA_ROUTE_RIP)
57
58 void zebra_ptm_init(void);
59 void zebra_ptm_finish(void);
60 void zebra_ptm_connect(struct event *t);
61 void zebra_ptm_write(struct vty *vty);
62 int zebra_ptm_get_enable_state(void);
63
64 /* ZAPI message handlers */
65 void zebra_ptm_bfd_dst_register(ZAPI_HANDLER_ARGS);
66 void zebra_ptm_bfd_dst_deregister(ZAPI_HANDLER_ARGS);
67 void zebra_ptm_bfd_client_register(ZAPI_HANDLER_ARGS);
68 #if HAVE_BFDD > 0
69 void zebra_ptm_bfd_dst_replay(ZAPI_HANDLER_ARGS);
70 #endif /* HAVE_BFDD */
71
72 void zebra_ptm_show_status(struct vty *vty, json_object *json,
73 struct interface *ifp);
74 void zebra_ptm_if_init(struct zebra_if *zebra_ifp);
75 void zebra_ptm_if_set_ptm_state(struct interface *ifp,
76 struct zebra_if *zebra_ifp);
77 void zebra_ptm_if_write(struct vty *vty, struct zebra_if *zebra_ifp);
78
79 #ifdef __cplusplus
80 }
81 #endif
82
83 #endif