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
|
/*
* Affinity-map function.
*
* Copyright 2022 Hiroki Shirokura, LINE Corporation
* Copyright 2022 Masakazu Asama
* Copyright 2022 6WIND S.A.
*
* This file is part of Free Range Routing (FRR).
*
* FRR 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, or (at your option) any
* later version.
*
* FRR 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 _ZEBRA_AFFINITYMAP_H
#define _ZEBRA_AFFINITYMAP_H
#include "typesafe.h"
#include "prefix.h"
#include "memory.h"
#include "qobj.h"
#include "vty.h"
#include "lib/plist.h"
#include "lib/plist_int.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AFFINITY_NAME_SIZE 32
struct affinity_map {
char name[AFFINITY_NAME_SIZE];
uint16_t bit_position;
QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(affinity_map);
struct affinity_maps {
struct list *maps;
bool (*check_use_hook)(const char *affmap_name);
bool (*check_update_hook)(const char *affmap_name, uint16_t new_pos);
void (*update_hook)(const char *affmap_name, uint16_t old_pos,
uint16_t new_pos);
QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(affinity_maps);
extern const struct frr_yang_module_info frr_affinity_map_info;
void affinity_map_set(const char *name, int pos);
void affinity_map_unset(const char *name);
struct affinity_map *affinity_map_get(const char *name);
char *affinity_map_name_get(const int pos);
bool affinity_map_check_use_hook(const char *affmap_name);
bool affinity_map_check_update_hook(const char *affmap_name, uint16_t new_pos);
void affinity_map_update_hook(const char *affmap_name, uint16_t new_pos);
void affinity_map_set_check_use_hook(bool (*func)(const char *affmap_name));
void affinity_map_set_check_update_hook(bool (*func)(const char *affmap_name,
uint16_t new_pos));
void affinity_map_set_update_hook(void (*func)(const char *affmap_name,
uint16_t old_pos,
uint16_t new_pos));
void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults);
void affinity_map_init(void);
#ifdef __cplusplus
}
#endif
#endif /* _ZEBRA_AFFINITYMAP_H */
|