jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 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 |
| 6 | * Tampere University of Technology |
| 7 | * Institute of Communications Engineering |
| 8 | * |
| 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) |
| 12 | * any later version. |
| 13 | * |
| 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 |
| 17 | * more details. |
| 18 | |
| 19 | * You should have received a copy of the GNU General Public License along |
| 20 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 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 */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 29 | #define ISIS_MAX_CIRCUITS 32 /* = 1024 */ |
| 30 | |
| 31 | /* |
| 32 | * Flags structure for SSN and SRM flags |
| 33 | */ |
| 34 | struct flags |
| 35 | { |
| 36 | int maxindex; |
| 37 | struct list *free_idcs; |
| 38 | }; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 39 | |
Paul Jakma | c7350c4 | 2008-01-29 19:29:44 +0000 | [diff] [blame] | 40 | void flags_initialize (struct flags *flags); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 41 | long int flags_get_index (struct flags *flags); |
| 42 | void flags_free_index (struct flags *flags, long int index); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 43 | int flags_any_set (u_int32_t * flags); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 44 | |
| 45 | #define ISIS_SET_FLAG(F,C) \ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 46 | { \ |
| 47 | F[C->idx>>5] |= (1<<(C->idx & 0x1F)); \ |
| 48 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 49 | |
| 50 | #define ISIS_CLEAR_FLAG(F,C) \ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 51 | { \ |
| 52 | F[C->idx>>5] &= ~(1<<(C->idx & 0x1F)); \ |
| 53 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 54 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 55 | #define ISIS_CHECK_FLAG(F, C) (F[(C)->idx>>5] & (1<<(C->idx & 0x1F))) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 56 | |
| 57 | /* sets all u_32int_t flags to 1 */ |
| 58 | #define ISIS_FLAGS_SET_ALL(FLAGS) \ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 59 | { \ |
| 60 | memset(FLAGS,0xFF,ISIS_MAX_CIRCUITS*4); \ |
| 61 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 62 | |
| 63 | #define ISIS_FLAGS_CLEAR_ALL(FLAGS) \ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 64 | { \ |
| 65 | memset(FLAGS,0x00,ISIS_MAX_CIRCUITS*4); \ |
| 66 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 67 | |
| 68 | #endif /* _ZEBRA_ISIS_FLAGS_H */ |