You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.4 KiB

  1. /**
  2. * @file PEPMessage_codec.h
  3. * @brief Definitions for PEPMessage encode and decode functions which transform message payloads to
  4. * and from PER-encoded data, and XER text to and from PER
  5. *
  6. * @see https://www.itu.int/en/ITU-T/asn1/Pages/introduction.aspx
  7. *
  8. * @license GNU General Public License 3.0 - see LICENSE.txt
  9. */
  10. #ifndef PEPMESSAGE_CODEC_H
  11. #define PEPMESSAGE_CODEC_H
  12. #include "pEpEngine.h"
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. struct PEPMessage;
  17. /**
  18. * <!-- decode_PEPMessage_message() -->
  19. *
  20. * @brief decode PER encoded PEPMessage message
  21. *
  22. * @param[in] data PER encoded data
  23. * @param[in] size size of PER encoded data
  24. * @param[out] msg decoded PEPMessage message
  25. *
  26. * @retval status
  27. *
  28. * @ownership msg goes into the ownership of the caller
  29. */
  30. DYNAMIC_API PEP_STATUS decode_PEPMessage_message(
  31. const char *data,
  32. size_t size,
  33. struct PEPMessage **msg
  34. );
  35. /**
  36. * <!-- encode_PEPMessage_message() -->
  37. *
  38. * @brief decode PER encoded PEPMessage message
  39. *
  40. * @param[in] msg PEPMessage message to encode
  41. * @param[out] data PER encoded data
  42. * @param[out] size size of PER encoded data
  43. *
  44. * @retval status
  45. *
  46. * @ownership msg goes into the ownership of the caller
  47. */
  48. DYNAMIC_API PEP_STATUS encode_PEPMessage_message(
  49. struct PEPMessage *msg,
  50. char **data,
  51. size_t *size
  52. );
  53. /**
  54. * <!-- PER_to_XER_PEPMessage_msg() -->
  55. *
  56. * @brief decode PEPMessage message from PER into XER
  57. *
  58. * @param[in] data PER encoded data
  59. * @param[in] size size of PER encoded data
  60. * @param[out] text XER text of the same PEPMessage message
  61. *
  62. * @retval status
  63. */
  64. DYNAMIC_API PEP_STATUS PER_to_XER_PEPMessage_msg(
  65. const char *data,
  66. size_t size,
  67. char **text
  68. );
  69. /**
  70. * <!-- XER_to_PER_PEPMessage_msg() -->
  71. *
  72. * @brief encode PEPMessage message from XER into PER
  73. *
  74. * @param[in] text string text with XER text of the PEPMessage message
  75. * @param[out] data PER encoded data
  76. * @param[out] size size of PER encoded data
  77. *
  78. * @retval status
  79. */
  80. DYNAMIC_API PEP_STATUS XER_to_PER_PEPMessage_msg(
  81. const char *text,
  82. char **data,
  83. size_t *size
  84. );
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88. #endif