convutil.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 version to a string
  41. /*!
  42. \param[in] version an EPID version
  43. \returns string representing the version
  44. */
  45. char const* EpidVersionToString(EpidVersion version);
  46. /// convert a string to an EPID version
  47. /*!
  48. \param[in] str a string
  49. \param[out] version an EPID version
  50. \retval true string represents an EPID version
  51. \retval false string does not represent an EPID version
  52. */
  53. bool StringToEpidVersion(char const* str, EpidVersion* version);
  54. /// convert an EPID file type to a string
  55. /*!
  56. \param[in] type an EPID file type
  57. \returns string representing the algorithm
  58. */
  59. char const* EpidFileTypeToString(EpidFileType type);
  60. /// convert a string to an EPID file type
  61. /*!
  62. \param[in] str a string
  63. \param[out] type an EPID file type
  64. \retval true string represents an EPID file type
  65. \retval false string does not represent an EPID file type
  66. */
  67. bool StringToEpidFileType(char const* str, EpidFileType* type);
  68. #endif // EXAMPLE_UTIL_CONVUTIL_H_