]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_flags.h
mgmtd: fix cleanup of cleanup in FE adapter code
[mirror_frr.git] / isisd / isis_flags.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * IS-IS Rout(e)ing protocol - isis_flags.h
4 * Routines for manipulation of SSN and SRM flags
5 *
6 * Copyright (C) 2001,2002 Sampo Saaristo
7 * Tampere University of Technology
8 * Institute of Communications Engineering
9 */
10
11 #ifndef _ZEBRA_ISIS_FLAGS_H
12 #define _ZEBRA_ISIS_FLAGS_H
13
14 /* The grand plan is to support 1024 circuits so we have 32*32 bit flags
15 * the support will be achived using the newest drafts */
16 #define ISIS_MAX_CIRCUITS 32 /* = 1024 */
17
18 /*
19 * Flags structure for SSN and SRM flags
20 */
21 struct flags {
22 int maxindex;
23 struct list *free_idcs;
24 };
25
26 void flags_initialize(struct flags *flags);
27 long int flags_get_index(struct flags *flags);
28 void flags_free_index(struct flags *flags, long int index);
29 int flags_any_set(uint32_t *flags);
30
31 #define _ISIS_SET_FLAG(F, C) \
32 { \
33 F[(C) >> 5] |= (1 << ((C)&0x1F)); \
34 }
35 #define ISIS_SET_FLAG(F, C) _ISIS_SET_FLAG(F, C->idx)
36
37 #define _ISIS_CLEAR_FLAG(F, C) \
38 { \
39 F[(C) >> 5] &= ~(1 << ((C)&0x1F)); \
40 }
41 #define ISIS_CLEAR_FLAG(F, C) _ISIS_CLEAR_FLAG(F, C->idx)
42
43 #define _ISIS_CHECK_FLAG(F, C) (F[(C)>>5] & (1<<((C) & 0x1F)))
44 #define ISIS_CHECK_FLAG(F, C) _ISIS_CHECK_FLAG(F, C->idx)
45
46 /* sets all u_32int_t flags to 1 */
47 #define ISIS_FLAGS_SET_ALL(FLAGS) \
48 { \
49 memset(FLAGS, 0xFF, ISIS_MAX_CIRCUITS * 4); \
50 }
51
52 #define ISIS_FLAGS_CLEAR_ALL(FLAGS) \
53 { \
54 memset(FLAGS, 0x00, ISIS_MAX_CIRCUITS * 4); \
55 }
56
57 #endif /* _ZEBRA_ISIS_FLAGS_H */