]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
eb5d44eb | 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 | |
d62a17ae | 7 | * Tampere University of Technology |
eb5d44eb | 8 | * Institute of Communications Engineering |
eb5d44eb | 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 */ | |
3f045a08 | 16 | #define ISIS_MAX_CIRCUITS 32 /* = 1024 */ |
eb5d44eb | 17 | |
3f045a08 JB |
18 | /* |
19 | * Flags structure for SSN and SRM flags | |
20 | */ | |
d62a17ae | 21 | struct flags { |
22 | int maxindex; | |
23 | struct list *free_idcs; | |
3f045a08 | 24 | }; |
eb5d44eb | 25 | |
d62a17ae | 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); | |
d7c0a89a | 29 | int flags_any_set(uint32_t *flags); |
eb5d44eb | 30 | |
996c9314 LB |
31 | #define _ISIS_SET_FLAG(F, C) \ |
32 | { \ | |
33 | F[(C) >> 5] |= (1 << ((C)&0x1F)); \ | |
d62a17ae | 34 | } |
068c8222 | 35 | #define ISIS_SET_FLAG(F, C) _ISIS_SET_FLAG(F, C->idx) |
eb5d44eb | 36 | |
996c9314 LB |
37 | #define _ISIS_CLEAR_FLAG(F, C) \ |
38 | { \ | |
39 | F[(C) >> 5] &= ~(1 << ((C)&0x1F)); \ | |
d62a17ae | 40 | } |
068c8222 CF |
41 | #define ISIS_CLEAR_FLAG(F, C) _ISIS_CLEAR_FLAG(F, C->idx) |
42 | ||
068c8222 CF |
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) | |
eb5d44eb | 45 | |
46 | /* sets all u_32int_t flags to 1 */ | |
d62a17ae | 47 | #define ISIS_FLAGS_SET_ALL(FLAGS) \ |
48 | { \ | |
49 | memset(FLAGS, 0xFF, ISIS_MAX_CIRCUITS * 4); \ | |
50 | } | |
eb5d44eb | 51 | |
d62a17ae | 52 | #define ISIS_FLAGS_CLEAR_ALL(FLAGS) \ |
53 | { \ | |
54 | memset(FLAGS, 0x00, ISIS_MAX_CIRCUITS * 4); \ | |
55 | } | |
eb5d44eb | 56 | |
57 | #endif /* _ZEBRA_ISIS_FLAGS_H */ |