1 /*
2  * SR-TE definitions
3  * Copyright 2020 NetDef Inc.
4  *                Sascha Kattelmann
5  *
6  * This file is part of GNU Zebra.
7  *
8  * GNU Zebra is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published
10  * by the Free Software Foundation; either version 2, or (at your
11  * option) any later version.
12  *
13  * GNU Zebra is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; see the file COPYING; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef _FRR_SRTE_H
24 #define _FRR_SRTE_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #define SRTE_POLICY_NAME_MAX_LENGTH 64
31 
32 enum zebra_sr_policy_status {
33 	ZEBRA_SR_POLICY_UP = 0,
34 	ZEBRA_SR_POLICY_DOWN,
35 };
36 
sr_policy_compare(const struct ipaddr * a_endpoint,const struct ipaddr * b_endpoint,uint32_t a_color,uint32_t b_color)37 static inline int sr_policy_compare(const struct ipaddr *a_endpoint,
38 				    const struct ipaddr *b_endpoint,
39 				    uint32_t a_color, uint32_t b_color)
40 {
41 	int ret;
42 
43 	ret = ipaddr_cmp(a_endpoint, b_endpoint);
44 	if (ret < 0)
45 		return -1;
46 	if (ret > 0)
47 		return 1;
48 
49 	return a_color - b_color;
50 }
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 #endif /* _FRR_SRTE_H */
57