RedfishContentCodingLib.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /** @file
  2. Definitinos of RedfishContentCodingLib.
  3. (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef REDFISH_CONTENT_CODING_LIB_H_
  7. #define REDFISH_CONTENT_CODING_LIB_H_
  8. /**
  9. This is the function to encode the content use the
  10. algorithm indicated in ContentEncodedValue. The naming of
  11. ContentEncodedValue is follow HTTP spec or could be a
  12. platform-specific value.
  13. @param[in] ContentEncodedValue HTTP conent encoded value.
  14. The value could be one of below
  15. or any which is platform-specific.
  16. - HTTP_CONTENT_ENCODING_IDENTITY "identity"
  17. - HTTP_CONTENT_ENCODING_GZIP "gzip"
  18. - HTTP_CONTENT_ENCODING_COMPRESS "compress"
  19. - HTTP_CONTENT_ENCODING_DEFLATE "deflate"
  20. - HTTP_CONTENT_ENCODING_BROTLI "br"
  21. @param[in] OriginalContent Original content.
  22. @param[in] OriginalContentLength The length of original content.
  23. @param[out] EncodedContentPointer Pointer to receive the encoded content pointer.
  24. @param[out] EncodedContentLength Length of encoded content.
  25. @retval EFI_SUCCESS Content is encoded successfully.
  26. @retval EFI_UNSUPPORTED No supported encoding funciton,
  27. @retval EFI_INVALID_PARAMETER One of the given parameter is invalid.
  28. **/
  29. EFI_STATUS
  30. RedfishContentEncode (
  31. IN CHAR8 *ContentEncodedValue,
  32. IN CHAR8 *OriginalContent,
  33. IN UINTN OriginalContentLength,
  34. OUT VOID **EncodedContentPointer,
  35. OUT UINTN *EncodedLength
  36. );
  37. /**
  38. This is the function to decode the content use the
  39. algorithm indicated in ContentEncodedValue. The naming of
  40. ContentEncodedValue is follow HTTP spec or could be a
  41. platform-specific value.
  42. @param[in] ContentDecodedValue HTTP conent decoded value.
  43. The value could be one of below
  44. or any which is platform-specific.
  45. - HTTP_CONTENT_ENCODING_IDENTITY "identity"
  46. - HTTP_CONTENT_ENCODING_GZIP "gzip"
  47. - HTTP_CONTENT_ENCODING_COMPRESS "compress"
  48. - HTTP_CONTENT_ENCODING_DEFLATE "deflate"
  49. - HTTP_CONTENT_ENCODING_BROTLI "br"
  50. @param[in] ContentPointer Original content.
  51. @param[in] ContentLength The length of original content.
  52. @param[out] DecodedContentPointer Pointer to receive decoded content pointer.
  53. @param[out] DecodedContentLength Length of decoded content.
  54. @retval EFI_SUCCESS Content is decoded successfully.
  55. @retval EFI_UNSUPPORTED No supported decoding funciton,
  56. @retval EFI_INVALID_PARAMETER One of the given parameter is invalid.
  57. **/
  58. EFI_STATUS
  59. RedfishContentDecode (
  60. IN CHAR8 *ContentEncodedValue,
  61. IN VOID *ContentPointer,
  62. IN UINTN ContentLength,
  63. OUT VOID **DecodedContentPointer,
  64. OUT UINTN *DecodedLength
  65. );
  66. #endif