qdf_parse.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: Text parsing related abstractions, not related to a specific type
  20. */
  21. #ifndef __QDF_PARSE_H
  22. #define __QDF_PARSE_H
  23. #include "qdf_status.h"
  24. typedef QDF_STATUS (*qdf_ini_section_cb)(void *context, const char *name);
  25. typedef QDF_STATUS (*qdf_ini_item_cb)(void *context,
  26. const char *key,
  27. const char *value);
  28. /**
  29. * qdf_ini_parse() - parse an ini file
  30. * @ini_path: The full file path of the ini file to parse
  31. * @context: The caller supplied context to pass into callbacks
  32. * @item_cb: Ini item (key/value pair) handler callback function
  33. * Return QDF_STATUS_SUCCESS to continue parsing, else to abort
  34. * @section_cb: Ini section header handler callback function
  35. * Return QDF_STATUS_SUCCESS to continue parsing, else to abort
  36. *
  37. * The *.ini file format is a simple format consisting of a list of key/value
  38. * pairs (items), separated by an '=' character. Comments are initiated with
  39. * a '#' character. Sections are also supported, using '[' and ']' around the
  40. * section name. e.g.
  41. *
  42. * # comments are started with a '#' character
  43. * # items are key/value string pairs, separated by the '=' character
  44. * someKey1=someValue1
  45. * someKey2=someValue2 # this is also a comment
  46. *
  47. * # section headers are enclosed in square brackets
  48. * [some section header] # new section begins
  49. * someKey3=someValue3
  50. *
  51. * Return: QDF_STATUS
  52. */
  53. QDF_STATUS
  54. qdf_ini_parse(const char *ini_path, void *context,
  55. qdf_ini_item_cb item_cb, qdf_ini_section_cb section_cb);
  56. #endif /* __QDF_PARSE_H */