Line data Source code
1 : /* Zebra's client header.
2 : * Copyright (C) 2020 Netdef, Inc.
3 : *
4 : * This file is part of GNU Zebra.
5 : *
6 : * GNU Zebra is free software; you can redistribute it and/or modify it
7 : * under the terms of the GNU General Public License as published by
8 : * the Free Software Foundation; either version 2, or (at your option)
9 : * any later version.
10 : *
11 : * GNU Zebra is distributed in the hope that it will be useful, but
12 : * WITHOUT ANY WARRANTY; without even the implied warranty of
13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 : * General Public License for more details.
15 : *
16 : * You should have received a copy of the GNU General Public License along
17 : * with this program; see the file COPYING; if not, write to the Free Software
18 : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 : */
20 :
21 : #ifndef _ZEBRA_SRTE_H
22 : #define _ZEBRA_SRTE_H
23 :
24 : #include "zebra/zebra_mpls.h"
25 :
26 : #include "lib/zclient.h"
27 : #include "lib/srte.h"
28 :
29 : #ifdef __cplusplus
30 : extern "C" {
31 : #endif
32 :
33 : enum zebra_sr_policy_update_label_mode {
34 : ZEBRA_SR_POLICY_LABEL_CREATED = 1,
35 : ZEBRA_SR_POLICY_LABEL_UPDATED = 2,
36 : ZEBRA_SR_POLICY_LABEL_REMOVED = 3,
37 : };
38 :
39 : struct zebra_sr_policy {
40 : RB_ENTRY(zebra_sr_policy) entry;
41 : uint32_t color;
42 : struct ipaddr endpoint;
43 : char name[SRTE_POLICY_NAME_MAX_LENGTH];
44 : enum zebra_sr_policy_status status;
45 : struct zapi_srte_tunnel segment_list;
46 : struct zebra_lsp *lsp;
47 : struct zebra_vrf *zvrf;
48 : int sock;
49 : };
50 : RB_HEAD(zebra_sr_policy_instance_head, zebra_sr_policy);
51 171 : RB_PROTOTYPE(zebra_sr_policy_instance_head, zebra_sr_policy, entry,
52 : zebra_sr_policy_instance_compare)
53 :
54 : extern struct zebra_sr_policy_instance_head zebra_sr_policy_instances;
55 :
56 : struct zebra_sr_policy *
57 : zebra_sr_policy_add(uint32_t color, struct ipaddr *endpoint, char *name);
58 : void zebra_sr_policy_del(struct zebra_sr_policy *policy);
59 : struct zebra_sr_policy *zebra_sr_policy_find(uint32_t color,
60 : struct ipaddr *endpoint);
61 : struct zebra_sr_policy *zebra_sr_policy_find_by_name(char *name);
62 : int zebra_sr_policy_validate(struct zebra_sr_policy *policy,
63 : struct zapi_srte_tunnel *new_tunnel);
64 : int zebra_sr_policy_bsid_install(struct zebra_sr_policy *policy);
65 : void zebra_sr_policy_bsid_uninstall(struct zebra_sr_policy *policy,
66 : mpls_label_t old_bsid);
67 : void zebra_srte_init(void);
68 : int zebra_sr_policy_label_update(mpls_label_t label,
69 : enum zebra_sr_policy_update_label_mode mode);
70 :
71 : #ifdef __cplusplus
72 : }
73 : #endif
74 :
75 : #endif /* _ZEBRA_SRTE_H */
|