summaryrefslogtreecommitdiffstats
path: root/lib/ldp_sync.h
blob: daede566f0a2cf89394e9b669535fc76a39949a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * Defines and structures common to LDP-Sync for OSPFv2 and OSPFv3 and ISIS
 * Copyright (C) 2020 Volta Networks, Inc.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; see the file COPYING; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef _LIBLDPSYNC_H
#define _LIBLDPSYNC_H

#ifdef __cplusplus
extern "C" {
#endif

/* LDP-IGP Sync values */
#define LDP_SYNC_FLAG_ENABLE     (1 << 0) /* LDP-SYNC enabled */
#define LDP_SYNC_FLAG_HOLDDOWN   (1 << 1) /* Holddown timer enabled */
#define LDP_SYNC_FLAG_IF_CONFIG  (1 << 2) /* LDP-SYNC enabled on interface */
#define LDP_SYNC_FLAG_SET_METRIC (1 << 3) /* Metric has been set on ISIS intf */

#define LDP_IGP_SYNC_DEFAULT        0
#define LDP_IGP_SYNC_ENABLED        1

#define LDP_IGP_SYNC_STATE_NOT_REQUIRED     0
#define LDP_IGP_SYNC_STATE_REQUIRED_NOT_UP  1
#define LDP_IGP_SYNC_STATE_REQUIRED_UP      2

#define LDP_IGP_SYNC_HOLDDOWN_DEFAULT 0

#define LDP_IGP_SYNC_HELLO_TIMEOUT 1

/* LDP-IGP Sync structures */
struct ldp_sync_info_cmd {
	uint16_t flags;
	uint16_t holddown;       /* timer value */
	uint32_t sequence;       /* hello sequence number */
	struct thread *t_hello;  /* hello timer for detecting LDP going down */
};

struct ldp_sync_info {
	uint16_t flags;          /* indicate if set on interface or globally */
	uint8_t enabled;         /* enabled */
	uint8_t state;           /* running state */
	uint16_t holddown;       /* timer value */
	struct thread *t_holddown; /* holddown timer*/
	uint32_t metric[2];      /* isis interface metric */
};

/* Prototypes. */
extern struct ldp_sync_info *ldp_sync_info_create(void);
extern bool ldp_sync_if_is_enabled(struct ldp_sync_info *ldp_sync_info);
extern bool ldp_sync_if_down(struct ldp_sync_info *ldp_sync_info);
extern void ldp_sync_info_free(struct ldp_sync_info **ldp_sync_info);

struct ldp_igp_sync_announce {
	int proto;
};

struct ldp_igp_sync_if_state {
	ifindex_t ifindex;
	bool sync_start;
};

struct ldp_igp_sync_if_state_req {
	int proto;
	ifindex_t ifindex;
	char name[INTERFACE_NAMSIZ];
};

struct ldp_igp_sync_hello {
	int proto;
	unsigned int sequence;
};

#ifdef __cplusplus
}
#endif

#endif /* _LIBLDPSYNC_H */