diff options
author | Abner Chang <abner.chang@hpe.com> | 2021-01-07 14:57:02 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-01-14 14:54:12 +0000 |
commit | 40c4cd54213b78ef0daee2f4b186150d7ef63bb4 (patch) | |
tree | 3a2f33ec4683a5e45560b60996869e6e160f6137 /NetworkPkg/Include/Library/HttpLib.h | |
parent | 536a3e67263b6d891152c0511cbdbbadf42a7360 (diff) | |
download | edk2-40c4cd54213b78ef0daee2f4b186150d7ef63bb4.zip edk2-40c4cd54213b78ef0daee2f4b186150d7ef63bb4.tar.gz edk2-40c4cd54213b78ef0daee2f4b186150d7ef63bb4.tar.bz2 |
NetworkPkg/DxeHttpLib: Migrate HTTP header manipulation APIs
Move HTTP header manipulation functions to DxeHttpLib from
HttpBootSupport.c. These general functions are used by both
Http BOOT and RedfishLib (patches will be sent later).
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Fan Wang <fan.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Diffstat (limited to 'NetworkPkg/Include/Library/HttpLib.h')
-rw-r--r-- | NetworkPkg/Include/Library/HttpLib.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/NetworkPkg/Include/Library/HttpLib.h b/NetworkPkg/Include/Library/HttpLib.h index a906126..2c3367f 100644 --- a/NetworkPkg/Include/Library/HttpLib.h +++ b/NetworkPkg/Include/Library/HttpLib.h @@ -476,6 +476,59 @@ HttpIsValidHttpHeader ( IN CHAR8 *FieldName
);
+//
+// A wrapper structure to hold the HTTP headers.
+//
+typedef struct {
+ UINTN MaxHeaderCount;
+ UINTN HeaderCount;
+ EFI_HTTP_HEADER *Headers;
+} HTTP_IO_HEADER;
+
+
+/**
+ Create a HTTP_IO_HEADER to hold the HTTP header items.
+
+ @param[in] MaxHeaderCount The maximun number of HTTP header in this holder.
+
+ @return A pointer of the HTTP header holder or NULL if failed.
+
+**/
+HTTP_IO_HEADER *
+HttpIoCreateHeader (
+ UINTN MaxHeaderCount
+ );
+
+/**
+ Destroy the HTTP_IO_HEADER and release the resources.
+
+ @param[in] HttpIoHeader Point to the HTTP header holder to be destroyed.
+
+**/
+VOID
+HttpIoFreeHeader (
+ IN HTTP_IO_HEADER *HttpIoHeader
+ );
+
+/**
+ Set or update a HTTP header with the field name and corresponding value.
+
+ @param[in] HttpIoHeader Point to the HTTP header holder.
+ @param[in] FieldName Null terminated string which describes a field name.
+ @param[in] FieldValue Null terminated string which describes the corresponding field value.
+
+ @retval EFI_SUCCESS The HTTP header has been set or updated.
+ @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
+ @retval EFI_OUT_OF_RESOURCES Insufficient resource to complete the operation.
+ @retval Other Unexpected error happened.
+
+**/
+EFI_STATUS
+HttpIoSetHeader (
+ IN HTTP_IO_HEADER *HttpIoHeader,
+ IN CHAR8 *FieldName,
+ IN CHAR8 *FieldValue
+ );
#endif
|