]>
git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_flags.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * IS-IS Rout(e)ing protocol - isis_flags.c
4 * Routines for manipulation of SSN and SRM flags
6 * Copyright (C) 2001,2002 Sampo Saaristo
7 * Tampere University of Technology
8 * Institute of Communications Engineering
15 #include "isisd/isis_constants.h"
16 #include "isisd/isis_common.h"
17 #include "isisd/isis_flags.h"
19 void flags_initialize(struct flags
*flags
)
22 flags
->free_idcs
= NULL
;
25 long int flags_get_index(struct flags
*flags
)
27 struct listnode
*node
;
30 if (flags
->free_idcs
== NULL
|| flags
->free_idcs
->count
== 0) {
31 index
= flags
->maxindex
++;
33 node
= listhead(flags
->free_idcs
);
34 index
= (long int)listgetdata(node
);
35 listnode_delete(flags
->free_idcs
, (void *)index
);
42 void flags_free_index(struct flags
*flags
, long int index
)
44 if (index
+ 1 == flags
->maxindex
) {
49 if (flags
->free_idcs
== NULL
) {
50 flags
->free_idcs
= list_new();
53 listnode_add(flags
->free_idcs
, (void *)(index
+ 1));
58 int flags_any_set(uint32_t *flags
)
60 uint32_t zero
[ISIS_MAX_CIRCUITS
];
61 memset(zero
, 0x00, ISIS_MAX_CIRCUITS
* 4);
63 return bcmp(flags
, zero
, ISIS_MAX_CIRCUITS
* 4);