convutil.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*############################################################################
  2. # Copyright 2016 Intel Corporation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################*/
  16. /*!
  17. * \file
  18. * \brief Conversion utilities interface.
  19. */
  20. #ifndef EXAMPLE_UTIL_CONVUTIL_H_
  21. #define EXAMPLE_UTIL_CONVUTIL_H_
  22. #include <stddef.h>
  23. #include "epid/common/types.h"
  24. #include "epid/common/file_parser.h"
  25. #include "util/stdtypes.h"
  26. /// convert a hash algorithm to a string
  27. /*!
  28. \param[in] alg a hash algorithm
  29. \returns string representing the algorithm
  30. */
  31. char const* HashAlgToString(HashAlg alg);
  32. /// convert a string to a hash algorithm
  33. /*!
  34. \param[in] str a string
  35. \param[out] alg a hash algorithm
  36. \retval true string represents a hash algorithm
  37. \retval false string does not represent a hash algorithm
  38. */
  39. bool StringToHashAlg(char const* str, HashAlg* alg);
  40. /// convert an EPID file type to a string
  41. /*!
  42. \param[in] type an EPID file type
  43. \returns string representing the algorithm
  44. */
  45. char const* EpidFileTypeToString(EpidFileType type);
  46. /// convert a string to an EPID file type
  47. /*!
  48. \param[in] str a string
  49. \param[out] type an EPID file type
  50. \retval true string represents an EPID file type
  51. \retval false string does not represent an EPID file type
  52. */
  53. bool StringToEpidFileType(char const* str, EpidFileType* type);
  54. #endif // EXAMPLE_UTIL_CONVUTIL_H_