HttpUtilitiesDxe.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /** @file
  2. The header files of Http Utilities functions for HttpUtilities driver.
  3. Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
  4. (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef __EFI_HTTP_UTILITIES_DXE_H__
  8. #define __EFI_HTTP_UTILITIES_DXE_H__
  9. #include <Uefi.h>
  10. //
  11. // Libraries
  12. //
  13. #include <Library/UefiBootServicesTableLib.h>
  14. #include <Library/MemoryAllocationLib.h>
  15. #include <Library/BaseMemoryLib.h>
  16. #include <Library/BaseLib.h>
  17. #include <Library/UefiLib.h>
  18. #include <Library/DebugLib.h>
  19. #include <Library/HttpLib.h>
  20. //
  21. // Consumed Protocols
  22. //
  23. #include <Protocol/HttpUtilities.h>
  24. #include <Protocol/Http.h>
  25. //
  26. // Protocol instances
  27. //
  28. extern EFI_HTTP_UTILITIES_PROTOCOL mHttpUtilitiesProtocol;
  29. /**
  30. Create HTTP header based on a combination of seed header, fields
  31. to delete, and fields to append.
  32. The Build() function is used to manage the headers portion of an
  33. HTTP message by providing the ability to add, remove, or replace
  34. HTTP headers.
  35. @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.
  36. @param[in] SeedMessageSize Size of the initial HTTP header. This can be zero.
  37. @param[in] SeedMessage Initial HTTP header to be used as a base for
  38. building a new HTTP header. If NULL,
  39. SeedMessageSize is ignored.
  40. @param[in] DeleteCount Number of null-terminated HTTP header field names
  41. in DeleteList.
  42. @param[in] DeleteList List of null-terminated HTTP header field names to
  43. remove from SeedMessage. Only the field names are
  44. in this list because the field values are irrelevant
  45. to this operation.
  46. @param[in] AppendCount Number of header fields in AppendList.
  47. @param[in] AppendList List of HTTP headers to populate NewMessage with.
  48. If SeedMessage is not NULL, AppendList will be
  49. appended to the existing list from SeedMessage in
  50. NewMessage.
  51. @param[out] NewMessageSize Pointer to number of header fields in NewMessage.
  52. @param[out] NewMessage Pointer to a new list of HTTP headers based on.
  53. @retval EFI_SUCCESS Add, remove, and replace operations succeeded.
  54. @retval EFI_OUT_OF_RESOURCES Could not allocate memory for NewMessage.
  55. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  56. This is NULL.
  57. **/
  58. EFI_STATUS
  59. EFIAPI
  60. HttpUtilitiesBuild (
  61. IN EFI_HTTP_UTILITIES_PROTOCOL *This,
  62. IN UINTN SeedMessageSize,
  63. IN VOID *SeedMessage OPTIONAL,
  64. IN UINTN DeleteCount,
  65. IN CHAR8 *DeleteList[] OPTIONAL,
  66. IN UINTN AppendCount,
  67. IN EFI_HTTP_HEADER *AppendList[] OPTIONAL,
  68. OUT UINTN *NewMessageSize,
  69. OUT VOID **NewMessage
  70. );
  71. /**
  72. Parses HTTP header and produces an array of key/value pairs.
  73. The Parse() function is used to transform data stored in HttpHeader
  74. into a list of fields paired with their corresponding values.
  75. @param[in] This Pointer to EFI_HTTP_UTILITIES_PROTOCOL instance.
  76. @param[in] HttpMessage Contains raw unformatted HTTP header string.
  77. @param[in] HttpMessageSize Size of HTTP header.
  78. @param[out] HeaderFields Array of key/value header pairs.
  79. @param[out] FieldCount Number of headers in HeaderFields.
  80. @retval EFI_SUCCESS Allocation succeeded.
  81. @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been
  82. initialized.
  83. @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
  84. This is NULL.
  85. HttpMessage is NULL.
  86. HeaderFields is NULL.
  87. FieldCount is NULL.
  88. **/
  89. EFI_STATUS
  90. EFIAPI
  91. HttpUtilitiesParse (
  92. IN EFI_HTTP_UTILITIES_PROTOCOL *This,
  93. IN CHAR8 *HttpMessage,
  94. IN UINTN HttpMessageSize,
  95. OUT EFI_HTTP_HEADER **HeaderFields,
  96. OUT UINTN *FieldCount
  97. );
  98. #endif