2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-05-20 02:40:44 +02:00
|
|
|
/*
|
|
|
|
* Definitions for prescriptive topology module (PTM).
|
|
|
|
* Copyright (C) 1998, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ZEBRA_PTM_H
|
|
|
|
#define _ZEBRA_PTM_H
|
|
|
|
|
|
|
|
extern const char ZEBRA_PTM_SOCK_NAME[];
|
|
|
|
#define ZEBRA_PTM_MAX_SOCKBUF 3200 /* 25B *128 ports */
|
2015-06-12 16:59:11 +02:00
|
|
|
#define ZEBRA_PTM_SEND_MAX_SOCKBUF 512
|
2015-07-22 22:07:08 +02:00
|
|
|
|
2016-06-21 12:39:58 +02:00
|
|
|
#define ZEBRA_PTM_BFD_CLIENT_FLAG_REG (1 << 1) /* client registered with BFD */
|
|
|
|
|
2018-03-07 00:08:37 +01:00
|
|
|
#include "zebra/zserv.h"
|
2018-04-22 22:01:20 +02:00
|
|
|
#include "zebra/interface.h"
|
2018-03-07 00:08:37 +01:00
|
|
|
|
2019-03-25 15:11:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-07-22 22:07:08 +02:00
|
|
|
/* Zebra ptm context block */
|
|
|
|
struct zebra_ptm_cb {
|
|
|
|
int ptm_sock; /* ptm file descriptor. */
|
|
|
|
|
|
|
|
struct buffer *wb; /* Buffer of data waiting to be written to ptm. */
|
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *t_read; /* Thread for read */
|
|
|
|
struct event *t_write; /* Thread for write */
|
|
|
|
struct event *t_timer; /* Thread for timer */
|
2015-07-22 22:07:08 +02:00
|
|
|
|
|
|
|
char *out_data;
|
|
|
|
char *in_data;
|
|
|
|
int reconnect_time;
|
|
|
|
|
|
|
|
int ptm_enable;
|
|
|
|
int pid;
|
2018-03-27 21:13:34 +02:00
|
|
|
uint8_t client_flags[ZEBRA_ROUTE_MAX];
|
2015-07-22 22:07:08 +02:00
|
|
|
};
|
2015-05-20 02:40:44 +02:00
|
|
|
|
2015-10-09 20:18:09 +02:00
|
|
|
#define ZEBRA_PTM_STATUS_DOWN 0
|
|
|
|
#define ZEBRA_PTM_STATUS_UP 1
|
|
|
|
#define ZEBRA_PTM_STATUS_UNKNOWN 2
|
|
|
|
|
2016-04-22 00:39:38 +02:00
|
|
|
/* For interface ptm-enable configuration. */
|
|
|
|
#define ZEBRA_IF_PTM_ENABLE_OFF 0
|
|
|
|
#define ZEBRA_IF_PTM_ENABLE_ON 1
|
|
|
|
#define ZEBRA_IF_PTM_ENABLE_UNSPEC 2
|
|
|
|
|
2021-03-24 13:40:10 +01:00
|
|
|
#define IS_BFD_ENABLED_PROTOCOL(protocol) \
|
|
|
|
((protocol) == ZEBRA_ROUTE_BGP || (protocol) == ZEBRA_ROUTE_OSPF || \
|
|
|
|
(protocol) == ZEBRA_ROUTE_OSPF6 || (protocol) == ZEBRA_ROUTE_ISIS || \
|
|
|
|
(protocol) == ZEBRA_ROUTE_PIM || \
|
|
|
|
(protocol) == ZEBRA_ROUTE_OPENFABRIC || \
|
2021-10-14 17:12:37 +02:00
|
|
|
(protocol) == ZEBRA_ROUTE_STATIC || (protocol) == ZEBRA_ROUTE_RIP)
|
2018-09-20 15:09:43 +02:00
|
|
|
|
2015-05-20 02:40:44 +02:00
|
|
|
void zebra_ptm_init(void);
|
2015-07-22 22:07:08 +02:00
|
|
|
void zebra_ptm_finish(void);
|
2022-03-01 22:18:12 +01:00
|
|
|
void zebra_ptm_connect(struct event *t);
|
2015-07-22 22:07:08 +02:00
|
|
|
int zebra_ptm_get_enable_state(void);
|
2015-05-20 02:40:44 +02:00
|
|
|
|
2024-01-24 02:03:50 +01:00
|
|
|
#if HAVE_BFDD == 0
|
|
|
|
void zebra_global_ptm_enable(void);
|
|
|
|
void zebra_global_ptm_disable(void);
|
|
|
|
void zebra_if_ptm_enable(struct interface *ifp);
|
|
|
|
void zebra_if_ptm_disable(struct interface *ifp);
|
|
|
|
#endif
|
|
|
|
|
2018-03-07 00:08:37 +01:00
|
|
|
/* ZAPI message handlers */
|
2018-03-06 23:57:33 +01:00
|
|
|
void zebra_ptm_bfd_dst_register(ZAPI_HANDLER_ARGS);
|
|
|
|
void zebra_ptm_bfd_dst_deregister(ZAPI_HANDLER_ARGS);
|
|
|
|
void zebra_ptm_bfd_client_register(ZAPI_HANDLER_ARGS);
|
2018-06-27 18:40:50 +02:00
|
|
|
#if HAVE_BFDD > 0
|
|
|
|
void zebra_ptm_bfd_dst_replay(ZAPI_HANDLER_ARGS);
|
|
|
|
#endif /* HAVE_BFDD */
|
2018-03-06 23:57:33 +01:00
|
|
|
|
2021-08-02 20:38:26 +02:00
|
|
|
void zebra_ptm_show_status(struct vty *vty, json_object *json,
|
|
|
|
struct interface *ifp);
|
2016-04-22 00:39:38 +02:00
|
|
|
void zebra_ptm_if_init(struct zebra_if *zebra_ifp);
|
|
|
|
void zebra_ptm_if_set_ptm_state(struct interface *ifp,
|
|
|
|
struct zebra_if *zebra_ifp);
|
2019-03-25 15:11:55 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-05-20 02:40:44 +02:00
|
|
|
#endif
|