NCDModuleIndex.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * @file NCDModuleIndex.h
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  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. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #ifndef BADVPN_NCDMODULEINDEX_H
  23. #define BADVPN_NCDMODULEINDEX_H
  24. #include <misc/debug.h>
  25. #include <structure/BAVL.h>
  26. #include <base/DebugObject.h>
  27. #include <ncd/NCDModule.h>
  28. #define NCDMODULEINDEX_MAX_TYPE_LEN 63
  29. typedef struct {
  30. BAVL modules_tree;
  31. BAVL base_types_tree;
  32. DebugObject d_obj;
  33. } NCDModuleIndex;
  34. struct NCDModuleIndex_module {
  35. char type[NCDMODULEINDEX_MAX_TYPE_LEN + 1];
  36. const struct NCDModule *module;
  37. BAVLNode modules_tree_node;
  38. };
  39. struct NCDModuleIndex_base_type {
  40. const char *base_type;
  41. const struct NCDModuleGroup *group;
  42. BAVLNode base_types_tree_node;
  43. };
  44. void NCDModuleIndex_Init (NCDModuleIndex *o);
  45. void NCDModuleIndex_Free (NCDModuleIndex *o);
  46. int NCDModuleIndex_AddGroup (NCDModuleIndex *o, const struct NCDModuleGroup *group) WARN_UNUSED;
  47. const struct NCDModule * NCDModuleIndex_FindModule (NCDModuleIndex *o, const char *type);
  48. #endif