NCDModuleIndex.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 64
  29. typedef struct {
  30. BAVL modules_tree;
  31. DebugObject d_obj;
  32. } NCDModuleIndex;
  33. struct NCDModuleIndex_module {
  34. char type[NCDMODULEINDEX_MAX_TYPE_LEN + 1];
  35. const struct NCDModule *module;
  36. BAVLNode modules_tree_node;
  37. };
  38. void NCDModuleIndex_Init (NCDModuleIndex *o);
  39. void NCDModuleIndex_Free (NCDModuleIndex *o);
  40. int NCDModuleIndex_AddGroup (NCDModuleIndex *o, const struct NCDModuleGroup *group) WARN_UNUSED;
  41. const struct NCDModule * NCDModuleIndex_FindModule (NCDModuleIndex *o, const char *type);
  42. #endif