]> git.proxmox.com Git - mirror_frr.git/blob - lib/ldp_sync.h
*: auto-convert to SPDX License IDs
[mirror_frr.git] / lib / ldp_sync.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Defines and structures common to LDP-Sync for OSPFv2 and OSPFv3 and ISIS
4 * Copyright (C) 2020 Volta Networks, Inc.
5 */
6
7 #ifndef _LIBLDPSYNC_H
8 #define _LIBLDPSYNC_H
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 /* LDP-IGP Sync values */
15 #define LDP_SYNC_FLAG_ENABLE (1 << 0) /* LDP-SYNC enabled */
16 #define LDP_SYNC_FLAG_HOLDDOWN (1 << 1) /* Holddown timer enabled */
17 #define LDP_SYNC_FLAG_IF_CONFIG (1 << 2) /* LDP-SYNC enabled on interface */
18 #define LDP_SYNC_FLAG_SET_METRIC (1 << 3) /* Metric has been set on ISIS intf */
19
20 #define LDP_IGP_SYNC_DEFAULT 0
21 #define LDP_IGP_SYNC_ENABLED 1
22
23 #define LDP_IGP_SYNC_STATE_NOT_REQUIRED 0
24 #define LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP 1
25 #define LDP_IGP_SYNC_STATE_REQUIRED_UP 2
26
27 #define LDP_IGP_SYNC_HOLDDOWN_DEFAULT 0
28
29 /* LDP-IGP Sync structures */
30 struct ldp_sync_info_cmd {
31 uint16_t flags;
32 uint16_t holddown; /* timer value */
33 };
34
35 struct ldp_sync_info {
36 uint16_t flags; /* indicate if set on interface or globally */
37 uint8_t enabled; /* enabled */
38 uint8_t state; /* running state */
39 uint16_t holddown; /* timer value */
40 struct thread *t_holddown; /* holddown timer*/
41 uint32_t metric[2]; /* isis interface metric */
42 };
43
44 /* Prototypes. */
45 extern struct ldp_sync_info *ldp_sync_info_create(void);
46 extern bool ldp_sync_if_is_enabled(struct ldp_sync_info *ldp_sync_info);
47 extern bool ldp_sync_if_down(struct ldp_sync_info *ldp_sync_info);
48 extern void ldp_sync_info_free(struct ldp_sync_info **ldp_sync_info);
49
50 struct ldp_igp_sync_announce {
51 int proto;
52 };
53
54 struct ldp_igp_sync_if_state {
55 ifindex_t ifindex;
56 bool sync_start;
57 };
58
59 struct ldp_igp_sync_if_state_req {
60 int proto;
61 ifindex_t ifindex;
62 char name[INTERFACE_NAMSIZ];
63 };
64
65 #ifdef __cplusplus
66 }
67 #endif
68
69 #endif /* _LIBLDPSYNC_H */