]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_dplane.h
Merge branch 'pr/3063'
[mirror_frr.git] / zebra / zebra_dplane.h
1 /*
2 * Zebra dataplane layer api interfaces.
3 * Copyright (c) 2018 Volta Networks, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef _ZEBRA_DPLANE_H
21 #define _ZEBRA_DPLANE_H 1
22
23 #include "zebra.h"
24 #include "zserv.h"
25 #include "prefix.h"
26 #include "nexthop.h"
27 #include "nexthop_group.h"
28
29
30 /*
31 * API between the zebra dataplane system and the main zebra processing
32 * context.
33 */
34
35 /* Key netlink info from zebra ns */
36 struct zebra_dplane_info {
37 ns_id_t ns_id;
38
39 #if defined(HAVE_NETLINK)
40 uint32_t nl_pid;
41 bool is_cmd;
42 #endif
43 };
44
45 /* Utility to fill in zns info from main zns struct */
46 static inline void
47 zebra_dplane_info_from_zns(struct zebra_dplane_info *zns_info,
48 const struct zebra_ns *zns, bool is_cmd)
49 {
50 zns_info->ns_id = zns->ns_id;
51
52 #if defined(HAVE_NETLINK)
53 zns_info->is_cmd = is_cmd;
54 if (is_cmd) {
55 zns_info->nl_pid = zns->netlink_cmd.snl.nl_pid;
56 } else {
57 zns_info->nl_pid = zns->netlink.snl.nl_pid;
58 }
59 #endif /* NETLINK */
60 }
61
62 /*
63 * Enqueue a route install or update for the dataplane.
64 */
65
66 /*
67 * Enqueue a route removal for the dataplane.
68 */
69
70 /*
71 * Result codes used when returning status back to the main zebra context.
72 */
73
74 /*
75 * Philosophy Note:
76 *
77 * Flags being SET/UNSET do not belong in the South Bound
78 * Interface. This Setting belongs at the calling level
79 * because we can and will have multiple different interfaces
80 * and we will have potentially multiple different
81 * modules/filters to call. As such Setting/Unsetting
82 * success failure should be handled by the caller.
83 */
84 enum zebra_dplane_status {
85 ZEBRA_DPLANE_STATUS_NONE = 0,
86 ZEBRA_DPLANE_INSTALL_SUCCESS,
87 ZEBRA_DPLANE_INSTALL_FAILURE,
88 ZEBRA_DPLANE_DELETE_SUCCESS,
89 ZEBRA_DPLANE_DELETE_FAILURE,
90
91 };
92
93 enum zebra_dplane_result {
94 ZEBRA_DPLANE_REQUEST_QUEUED,
95 ZEBRA_DPLANE_REQUEST_SUCCESS,
96 ZEBRA_DPLANE_REQUEST_FAILURE,
97 };
98
99 #endif /* _ZEBRA_DPLANE_H */