isis_flags.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. #ifndef _ZEBRA_ISIS_FLAGS_H
  23. #define _ZEBRA_ISIS_FLAGS_H
  24. /* The grand plan is to support 1024 circuits so we have 32*32 bit flags
  25. * the support will be achived using the newest drafts */
  26. #define ISIS_MAX_CIRCUITS 32 /* = 1024 */
  27. /*
  28. * Flags structure for SSN and SRM flags
  29. */
  30. struct flags
  31. {
  32. int maxindex;
  33. struct list *free_idcs;
  34. };
  35. void flags_initialize (struct flags *flags);
  36. long int flags_get_index (struct flags *flags);
  37. void flags_free_index (struct flags *flags, long int index);
  38. int flags_any_set (u_int32_t * flags);
  39. #define ISIS_SET_FLAG(F,C) \
  40. { \
  41. F[C->idx>>5] |= (1<<(C->idx & 0x1F)); \
  42. }
  43. #define ISIS_CLEAR_FLAG(F,C) \
  44. { \
  45. F[C->idx>>5] &= ~(1<<(C->idx & 0x1F)); \
  46. }
  47. #define ISIS_CHECK_FLAG(F, C) (F[(C)->idx>>5] & (1<<(C->idx & 0x1F)))
  48. /* sets all u_32int_t flags to 1 */
  49. #define ISIS_FLAGS_SET_ALL(FLAGS) \
  50. { \
  51. memset(FLAGS,0xFF,ISIS_MAX_CIRCUITS*4); \
  52. }
  53. #define ISIS_FLAGS_CLEAR_ALL(FLAGS) \
  54. { \
  55. memset(FLAGS,0x00,ISIS_MAX_CIRCUITS*4); \
  56. }
  57. #endif /* _ZEBRA_ISIS_FLAGS_H */