]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Include/Library/HttpLib.h
NetworkPkg/DxeHttpLib: Migrate HTTP header manipulation APIs
[mirror_edk2.git] / NetworkPkg / Include / Library / HttpLib.h
index a906126b3d6e590143a6f2409f09f0cb09565703..2c3367fb01976e91f25a9ee9f8127b1596d5a9a0 100644 (file)
@@ -476,6 +476,59 @@ HttpIsValidHttpHeader (
   IN  CHAR8            *FieldName\r
   );\r
 \r
+//\r
+// A wrapper structure to hold the HTTP headers.\r
+//\r
+typedef struct {\r
+  UINTN                       MaxHeaderCount;\r
+  UINTN                       HeaderCount;\r
+  EFI_HTTP_HEADER             *Headers;\r
+} HTTP_IO_HEADER;\r
+\r
+\r
+/**\r
+  Create a HTTP_IO_HEADER to hold the HTTP header items.\r
+\r
+  @param[in]  MaxHeaderCount         The maximun number of HTTP header in this holder.\r
+\r
+  @return    A pointer of the HTTP header holder or NULL if failed.\r
+\r
+**/\r
+HTTP_IO_HEADER *\r
+HttpIoCreateHeader (\r
+  UINTN                     MaxHeaderCount\r
+  );\r
+\r
+/**\r
+  Destroy the HTTP_IO_HEADER and release the resources.\r
+\r
+  @param[in]  HttpIoHeader       Point to the HTTP header holder to be destroyed.\r
+\r
+**/\r
+VOID\r
+HttpIoFreeHeader (\r
+  IN  HTTP_IO_HEADER       *HttpIoHeader\r
+  );\r
+\r
+/**\r
+  Set or update a HTTP header with the field name and corresponding value.\r
+\r
+  @param[in]  HttpIoHeader       Point to the HTTP header holder.\r
+  @param[in]  FieldName          Null terminated string which describes a field name.\r
+  @param[in]  FieldValue         Null terminated string which describes the corresponding field value.\r
+\r
+  @retval  EFI_SUCCESS           The HTTP header has been set or updated.\r
+  @retval  EFI_INVALID_PARAMETER Any input parameter is invalid.\r
+  @retval  EFI_OUT_OF_RESOURCES  Insufficient resource to complete the operation.\r
+  @retval  Other                 Unexpected error happened.\r
+\r
+**/\r
+EFI_STATUS\r
+HttpIoSetHeader (\r
+  IN  HTTP_IO_HEADER       *HttpIoHeader,\r
+  IN  CHAR8                *FieldName,\r
+  IN  CHAR8                *FieldValue\r
+  );\r
 \r
 #endif\r
 \r