]>
Commit | Line | Data |
---|---|---|
05a12619 LS |
1 | /* |
2 | * Affinity-map function. | |
3 | * | |
4 | * Copyright 2022 Hiroki Shirokura, LINE Corporation | |
5 | * Copyright 2022 Masakazu Asama | |
6 | * Copyright 2022 6WIND S.A. | |
7 | * | |
8 | * This file is part of Free Range Routing (FRR). | |
9 | * | |
10 | * FRR is free software; you can redistribute it and/or modify it | |
11 | * under the terms of the GNU General Public License as published by the | |
12 | * Free Software Foundation; either version 2, or (at your option) any | |
13 | * later version. | |
14 | * | |
15 | * FRR is distributed in the hope that it will be useful, but | |
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License along | |
21 | * with this program; see the file COPYING; if not, write to the Free Software | |
22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
23 | */ | |
24 | ||
25 | #ifndef _ZEBRA_AFFINITYMAP_H | |
26 | #define _ZEBRA_AFFINITYMAP_H | |
27 | ||
28 | #include "typesafe.h" | |
29 | #include "prefix.h" | |
30 | #include "memory.h" | |
31 | #include "qobj.h" | |
32 | #include "vty.h" | |
33 | #include "lib/plist.h" | |
34 | #include "lib/plist_int.h" | |
35 | ||
36 | #ifdef __cplusplus | |
37 | extern "C" { | |
38 | #endif | |
39 | ||
40 | #define AFFINITY_NAME_SIZE 32 | |
41 | ||
42 | struct affinity_map { | |
43 | char name[AFFINITY_NAME_SIZE]; | |
44 | uint16_t bit_position; | |
45 | ||
46 | QOBJ_FIELDS; | |
47 | }; | |
48 | DECLARE_QOBJ_TYPE(affinity_map); | |
49 | ||
50 | struct affinity_maps { | |
51 | struct list *maps; | |
52 | ||
ae251b86 LS |
53 | bool (*check_use_hook)(const char *affmap_name); |
54 | bool (*check_update_hook)(const char *affmap_name, uint16_t new_pos); | |
55 | void (*update_hook)(const char *affmap_name, uint16_t old_pos, | |
56 | uint16_t new_pos); | |
57 | ||
05a12619 LS |
58 | QOBJ_FIELDS; |
59 | }; | |
60 | DECLARE_QOBJ_TYPE(affinity_maps); | |
61 | ||
62 | extern const struct frr_yang_module_info frr_affinity_map_info; | |
63 | ||
64 | void affinity_map_set(const char *name, int pos); | |
65 | void affinity_map_unset(const char *name); | |
66 | struct affinity_map *affinity_map_get(const char *name); | |
67 | char *affinity_map_name_get(const int pos); | |
68 | ||
ae251b86 LS |
69 | bool affinity_map_check_use_hook(const char *affmap_name); |
70 | bool affinity_map_check_update_hook(const char *affmap_name, uint16_t new_pos); | |
71 | void affinity_map_update_hook(const char *affmap_name, uint16_t new_pos); | |
72 | ||
73 | void affinity_map_set_check_use_hook(bool (*func)(const char *affmap_name)); | |
74 | void affinity_map_set_check_update_hook(bool (*func)(const char *affmap_name, | |
75 | uint16_t new_pos)); | |
76 | void affinity_map_set_update_hook(void (*func)(const char *affmap_name, | |
77 | uint16_t old_pos, | |
78 | uint16_t new_pos)); | |
79 | ||
05a12619 LS |
80 | void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode, |
81 | bool show_defaults); | |
82 | ||
83 | void affinity_map_init(void); | |
84 | ||
85 | ||
86 | #ifdef __cplusplus | |
87 | } | |
88 | #endif | |
89 | ||
90 | #endif /* _ZEBRA_AFFINITYMAP_H */ |