]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_flags.h
Merge pull request #9490 from pguibert6WIND/fix_ipv6_seg6
[mirror_frr.git] / isisd / isis_flags.h
CommitLineData
eb5d44eb 1/*
2 * IS-IS Rout(e)ing protocol - isis_flags.h
3 * Routines for manipulation of SSN and SRM flags
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 6 * Tampere University of Technology
eb5d44eb 7 * Institute of Communications Engineering
8 *
d62a17ae 9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public Licenseas published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
eb5d44eb 12 * any later version.
13 *
d62a17ae 14 * This program is distributed in the hope that it will be useful,but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eb5d44eb 17 * more details.
896014f4
DL
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; see the file COPYING; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
eb5d44eb 22 */
23
24#ifndef _ZEBRA_ISIS_FLAGS_H
25#define _ZEBRA_ISIS_FLAGS_H
26
27/* The grand plan is to support 1024 circuits so we have 32*32 bit flags
28 * the support will be achived using the newest drafts */
3f045a08 29#define ISIS_MAX_CIRCUITS 32 /* = 1024 */
eb5d44eb 30
3f045a08
JB
31/*
32 * Flags structure for SSN and SRM flags
33 */
d62a17ae 34struct flags {
35 int maxindex;
36 struct list *free_idcs;
3f045a08 37};
eb5d44eb 38
d62a17ae 39void flags_initialize(struct flags *flags);
40long int flags_get_index(struct flags *flags);
41void flags_free_index(struct flags *flags, long int index);
d7c0a89a 42int flags_any_set(uint32_t *flags);
eb5d44eb 43
996c9314
LB
44#define _ISIS_SET_FLAG(F, C) \
45 { \
46 F[(C) >> 5] |= (1 << ((C)&0x1F)); \
d62a17ae 47 }
068c8222 48#define ISIS_SET_FLAG(F, C) _ISIS_SET_FLAG(F, C->idx)
eb5d44eb 49
996c9314
LB
50#define _ISIS_CLEAR_FLAG(F, C) \
51 { \
52 F[(C) >> 5] &= ~(1 << ((C)&0x1F)); \
d62a17ae 53 }
068c8222
CF
54#define ISIS_CLEAR_FLAG(F, C) _ISIS_CLEAR_FLAG(F, C->idx)
55
068c8222
CF
56#define _ISIS_CHECK_FLAG(F, C) (F[(C)>>5] & (1<<((C) & 0x1F)))
57#define ISIS_CHECK_FLAG(F, C) _ISIS_CHECK_FLAG(F, C->idx)
eb5d44eb 58
59/* sets all u_32int_t flags to 1 */
d62a17ae 60#define ISIS_FLAGS_SET_ALL(FLAGS) \
61 { \
62 memset(FLAGS, 0xFF, ISIS_MAX_CIRCUITS * 4); \
63 }
eb5d44eb 64
d62a17ae 65#define ISIS_FLAGS_CLEAR_ALL(FLAGS) \
66 { \
67 memset(FLAGS, 0x00, ISIS_MAX_CIRCUITS * 4); \
68 }
eb5d44eb 69
70#endif /* _ZEBRA_ISIS_FLAGS_H */