summaryrefslogtreecommitdiffstats
path: root/RedfishPkg/Include/Library/RedfishContentCodingLib.h
blob: 71a8adcb261010cacf56ff5255f276e693814f5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/** @file
  Definitinos of RedfishContentCodingLib.

  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

**/
#ifndef REDFISH_CONTENT_CODING_LIB_H_
#define REDFISH_CONTENT_CODING_LIB_H_

/**
  This is the function to encode the content use the
  algorithm indicated in ContentEncodedValue. The naming of
  ContentEncodedValue is follow HTTP spec or could be a
  platform-specific value.

  @param[in]   ContentEncodedValue   HTTP conent encoded value.
                                     The value could be one of below
                                     or any which is platform-specific.
                                       - HTTP_CONTENT_ENCODING_IDENTITY "identity"
                                       - HTTP_CONTENT_ENCODING_GZIP     "gzip"
                                       - HTTP_CONTENT_ENCODING_COMPRESS "compress"
                                       - HTTP_CONTENT_ENCODING_DEFLATE  "deflate"
                                       - HTTP_CONTENT_ENCODING_BROTLI   "br"
  @param[in]   OriginalContent       Original content.
  @param[in]   OriginalContentLength The length of original content.
  @param[out]  EncodedContentPointer Pointer to receive the encoded content pointer.
  @param[out]  EncodedContentLength  Length of encoded content.

  @retval EFI_SUCCESS              Content is encoded successfully.
  @retval EFI_UNSUPPORTED          No supported encoding funciton,
  @retval EFI_INVALID_PARAMETER    One of the given parameter is invalid.

**/

EFI_STATUS
RedfishContentEncode  (
  IN CHAR8  *ContentEncodedValue,
  IN CHAR8  *OriginalContent,
  IN UINTN  OriginalContentLength,
  OUT VOID  **EncodedContentPointer,
  OUT UINTN *EncodedLength
  );

/**
  This is the function to decode the content use the
  algorithm indicated in ContentEncodedValue. The naming of
  ContentEncodedValue is follow HTTP spec or could be a
  platform-specific value.

  @param[in]   ContentDecodedValue   HTTP conent decoded value.
                                     The value could be one of below
                                     or any which is platform-specific.
                                       - HTTP_CONTENT_ENCODING_IDENTITY "identity"
                                       - HTTP_CONTENT_ENCODING_GZIP     "gzip"
                                       - HTTP_CONTENT_ENCODING_COMPRESS "compress"
                                       - HTTP_CONTENT_ENCODING_DEFLATE  "deflate"
                                       - HTTP_CONTENT_ENCODING_BROTLI   "br"
  @param[in]   ContentPointer        Original content.
  @param[in]   ContentLength         The length of original content.
  @param[out]  DecodedContentPointer Pointer to receive decoded content pointer.
  @param[out]  DecodedContentLength  Length of decoded content.

  @retval EFI_SUCCESS              Content is decoded successfully.
  @retval EFI_UNSUPPORTED          No supported decoding funciton,
  @retval EFI_INVALID_PARAMETER    One of the given parameter is invalid.

**/
EFI_STATUS
RedfishContentDecode (
  IN CHAR8  *ContentEncodedValue,
  IN VOID   *ContentPointer,
  IN UINTN  ContentLength,
  OUT VOID  **DecodedContentPointer,
  OUT UINTN *DecodedLength
  );
#endif