]>
Commit | Line | Data |
---|---|---|
244c1cdc DS |
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 | * | |
896014f4 DL |
17 | * You should have received a copy of the GNU General Public License along |
18 | * with this program; see the file COPYING; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
244c1cdc DS |
20 | */ |
21 | ||
22 | #ifndef _ZEBRA_PTM_H | |
23 | #define _ZEBRA_PTM_H | |
24 | ||
25 | extern const char ZEBRA_PTM_SOCK_NAME[]; | |
26 | #define ZEBRA_PTM_MAX_SOCKBUF 3200 /* 25B *128 ports */ | |
c43ed2e4 | 27 | #define ZEBRA_PTM_SEND_MAX_SOCKBUF 512 |
c8ed14dd | 28 | |
2376c3f2 | 29 | #define ZEBRA_PTM_BFD_CLIENT_FLAG_REG (1 << 1) /* client registered with BFD */ |
30 | ||
1002497a | 31 | #include "zebra/zserv.h" |
bf094f69 | 32 | #include "zebra/interface.h" |
1002497a | 33 | |
51e94aa7 EDP |
34 | #ifdef __cplusplus |
35 | extern "C" { | |
36 | #endif | |
37 | ||
c8ed14dd | 38 | /* Zebra ptm context block */ |
d62a17ae | 39 | struct zebra_ptm_cb { |
40 | int ptm_sock; /* ptm file descriptor. */ | |
c8ed14dd | 41 | |
d62a17ae | 42 | struct buffer *wb; /* Buffer of data waiting to be written to ptm. */ |
c8ed14dd | 43 | |
d62a17ae | 44 | struct thread *t_read; /* Thread for read */ |
45 | struct thread *t_write; /* Thread for write */ | |
46 | struct thread *t_timer; /* Thread for timer */ | |
c8ed14dd | 47 | |
d62a17ae | 48 | char *out_data; |
49 | char *in_data; | |
50 | int reconnect_time; | |
c8ed14dd | 51 | |
d62a17ae | 52 | int ptm_enable; |
53 | int pid; | |
d7c0a89a | 54 | uint8_t client_flags[ZEBRA_ROUTE_MAX]; |
c8ed14dd | 55 | }; |
244c1cdc | 56 | |
950bd436 | 57 | #define ZEBRA_PTM_STATUS_DOWN 0 |
58 | #define ZEBRA_PTM_STATUS_UP 1 | |
59 | #define ZEBRA_PTM_STATUS_UNKNOWN 2 | |
60 | ||
986aa00f | 61 | /* For interface ptm-enable configuration. */ |
62 | #define ZEBRA_IF_PTM_ENABLE_OFF 0 | |
63 | #define ZEBRA_IF_PTM_ENABLE_ON 1 | |
64 | #define ZEBRA_IF_PTM_ENABLE_UNSPEC 2 | |
65 | ||
4943f243 CF |
66 | #define IS_BFD_ENABLED_PROTOCOL(protocol) ( \ |
67 | (protocol) == ZEBRA_ROUTE_BGP || \ | |
68 | (protocol) == ZEBRA_ROUTE_OSPF || \ | |
69 | (protocol) == ZEBRA_ROUTE_OSPF6 || \ | |
a0d5840b CF |
70 | (protocol) == ZEBRA_ROUTE_ISIS || \ |
71 | (protocol) == ZEBRA_ROUTE_PIM || \ | |
72 | (protocol) == ZEBRA_ROUTE_OPENFABRIC \ | |
4943f243 CF |
73 | ) |
74 | ||
d62a17ae | 75 | void zebra_ptm_init(void); |
c8ed14dd | 76 | void zebra_ptm_finish(void); |
cc9f21da | 77 | void zebra_ptm_connect(struct thread *t); |
d62a17ae | 78 | void zebra_ptm_write(struct vty *vty); |
c8ed14dd | 79 | int zebra_ptm_get_enable_state(void); |
244c1cdc | 80 | |
1002497a | 81 | /* ZAPI message handlers */ |
89f4e507 QY |
82 | void zebra_ptm_bfd_dst_register(ZAPI_HANDLER_ARGS); |
83 | void zebra_ptm_bfd_dst_deregister(ZAPI_HANDLER_ARGS); | |
84 | void zebra_ptm_bfd_client_register(ZAPI_HANDLER_ARGS); | |
d3af6147 RZ |
85 | #if HAVE_BFDD > 0 |
86 | void zebra_ptm_bfd_dst_replay(ZAPI_HANDLER_ARGS); | |
87 | #endif /* HAVE_BFDD */ | |
89f4e507 | 88 | |
c15dc24f RW |
89 | void zebra_ptm_show_status(struct vty *vty, json_object *json, |
90 | struct interface *ifp); | |
986aa00f | 91 | void zebra_ptm_if_init(struct zebra_if *zebra_ifp); |
d62a17ae | 92 | void zebra_ptm_if_set_ptm_state(struct interface *ifp, |
93 | struct zebra_if *zebra_ifp); | |
94 | void zebra_ptm_if_write(struct vty *vty, struct zebra_if *zebra_ifp); | |
51e94aa7 EDP |
95 | |
96 | #ifdef __cplusplus | |
97 | } | |
98 | #endif | |
99 | ||
244c1cdc | 100 | #endif |