]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h
NetworkPkg: Move Network library and drivers from MdeModulePkg to NetworkPkg
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Dhcp4Dxe / Dhcp4Option.h
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Option.h
deleted file mode 100644 (file)
index 9e25386..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/** @file\r
-  To validate, parse and process the DHCP options.\r
-\r
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef __EFI_DHCP4_OPTION_H__\r
-#define __EFI_DHCP4_OPTION_H__\r
-\r
-///\r
-/// DHCP option tags (types)\r
-///\r
-\r
-#define DHCP_OPTION_MAGIC         0x63538263 // Network byte order\r
-#define DHCP_MAX_OPTIONS          256\r
-\r
-\r
-//\r
-// DHCP option types, this is used to validate the DHCP options.\r
-//\r
-#define DHCP_OPTION_SWITCH        1\r
-#define DHCP_OPTION_INT8          2\r
-#define DHCP_OPTION_INT16         3\r
-#define DHCP_OPTION_INT32         4\r
-#define DHCP_OPTION_IP            5\r
-#define DHCP_OPTION_IPPAIR        6\r
-\r
-//\r
-// Value of DHCP overload option\r
-//\r
-#define DHCP_OVERLOAD_FILENAME    1\r
-#define DHCP_OVERLOAD_SVRNAME     2\r
-#define DHCP_OVERLOAD_BOTH        3\r
-\r
-///\r
-/// The DHCP option structure. This structure extends the EFI_DHCP_OPTION\r
-/// structure to support options longer than 255 bytes, such as classless route.\r
-///\r
-typedef struct {\r
-  UINT8                     Tag;\r
-  UINT16                    Len;\r
-  UINT8                     *Data;\r
-} DHCP_OPTION;\r
-\r
-///\r
-/// Structures used to parse the DHCP options with RFC3396 support.\r
-///\r
-typedef struct {\r
-  UINT8                     Index;\r
-  UINT16                    Offset;\r
-} DHCP_OPTION_COUNT;\r
-\r
-typedef struct {\r
-  DHCP_OPTION_COUNT         *OpCount;\r
-  DHCP_OPTION               *Options;\r
-  UINT8                     *Buf;\r
-} DHCP_OPTION_CONTEXT;\r
-\r
-///\r
-/// The options that matters to DHCP driver itself. The user of\r
-/// DHCP clients may be interested in other options, such as\r
-/// classless route, who can parse the DHCP offer to get them.\r
-///\r
-typedef struct {\r
-  IP4_ADDR                  NetMask;  // DHCP4_TAG_NETMASK\r
-  IP4_ADDR                  Router;   // DHCP4_TAG_ROUTER, only the first router is used\r
-\r
-  //\r
-  // DHCP specific options\r
-  //\r
-  UINT8                     DhcpType; // DHCP4_TAG_MSG_TYPE\r
-  UINT8                     Overload; // DHCP4_TAG_OVERLOAD\r
-  IP4_ADDR                  ServerId; // DHCP4_TAG_SERVER_ID\r
-  UINT32                    Lease;    // DHCP4_TAG_LEASE\r
-  UINT32                    T1;       // DHCP4_TAG_T1\r
-  UINT32                    T2;       // DHCP4_TAG_T2\r
-} DHCP_PARAMETER;\r
-\r
-///\r
-/// Structure used to describe and validate the format of DHCP options.\r
-/// Type is the options' data type, such as DHCP_OPTION_INT8. MinOccur\r
-/// is the minium occurance of this data type. MaxOccur is defined\r
-/// similarly. If MaxOccur is -1, it means that there is no limit on the\r
-/// maximum occurance. Alert tells whether DHCP client should further\r
-/// inspect the option to parse DHCP_PARAMETER.\r
-///\r
-typedef struct {\r
-  UINT8                     Tag;\r
-  INTN                      Type;\r
-  INTN                      MinOccur;\r
-  INTN                      MaxOccur;\r
-  BOOLEAN                   Alert;\r
-} DHCP_OPTION_FORMAT;\r
-\r
-typedef\r
-EFI_STATUS\r
-(*DHCP_CHECK_OPTION) (\r
-  IN UINT8                  Tag,\r
-  IN UINT8                  Len,\r
-  IN UINT8                  *Data,\r
-  IN VOID                   *Context\r
-  );\r
-\r
-/**\r
-  Iterate through a DHCP message to visit each option. First inspect\r
-  all the options in the OPTION field. Then if overloaded, inspect\r
-  the options in FILENAME and SERVERNAME fields. One option may be\r
-  encoded in several places. See RFC 3396 Encoding Long Options in DHCP\r
-\r
-  @param[in]  Packet                 The DHCP packet to check the options for\r
-  @param[in]  Check                  The callback function to be called for each option\r
-                                     found\r
-  @param[in]  Context                The opaque parameter for Check\r
-\r
-  @retval EFI_SUCCESS            The DHCP packet's options are well formated\r
-  @retval EFI_INVALID_PARAMETER  The DHCP packet's options are not well formated\r
-\r
-**/\r
-EFI_STATUS\r
-DhcpIterateOptions (\r
-  IN  EFI_DHCP4_PACKET      *Packet,\r
-  IN  DHCP_CHECK_OPTION     Check         OPTIONAL,\r
-  IN  VOID                  *Context\r
-  );\r
-\r
-/**\r
-  Validate the packet's options. If necessary, allocate\r
-  and fill in the interested parameters.\r
-\r
-  @param[in]  Packet                 The packet to validate the options\r
-  @param[out] Para                   The variable to save the DHCP parameters.\r
-\r
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory to validate the packet.\r
-  @retval EFI_INVALID_PARAMETER  The options are mal-formated\r
-  @retval EFI_SUCCESS            The options are parsed into OptionPoint\r
-\r
-**/\r
-EFI_STATUS\r
-DhcpValidateOptions (\r
-  IN  EFI_DHCP4_PACKET      *Packet,\r
-  OUT DHCP_PARAMETER        **Para       OPTIONAL\r
-  );\r
-\r
-/**\r
-  Parse the options of a DHCP packet. It supports RFC 3396: Encoding\r
-  Long Options in DHCP. That is, it will combine all the option value\r
-  of all the occurances of each option.\r
-  A little bit of implemenation:\r
-  It adopts the "Key indexed counting" algorithm. First, it allocates\r
-  an array of 256 DHCP_OPTION_COUNTs because DHCP option tag is encoded\r
-  as a UINT8. It then iterates the DHCP packet to get data length of\r
-  each option by calling DhcpIterOptions with DhcpGetOptionLen. Now, it\r
-  knows the number of present options and their length. It allocates a\r
-  array of DHCP_OPTION and a continuous buffer after the array to put\r
-  all the options' data. Each option's data is pointed to by the Data\r
-  field in DHCP_OPTION structure. At last, it call DhcpIterateOptions\r
-  with DhcpFillOption to fill each option's data to its position in the\r
-  buffer.\r
-\r
-  @param[in]  Packet                 The DHCP packet to parse the options\r
-  @param[out] Count                  The number of valid dhcp options present in the\r
-                                     packet\r
-  @param[out] OptionPoint            The array that contains the DHCP options. Caller\r
-                                     should free it.\r
-\r
-  @retval EFI_NOT_FOUND          Cannot find any option.\r
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory to parse the packet.\r
-  @retval EFI_INVALID_PARAMETER  The options are mal-formated\r
-  @retval EFI_SUCCESS            The options are parsed into OptionPoint\r
-\r
-**/\r
-EFI_STATUS\r
-DhcpParseOption (\r
-  IN  EFI_DHCP4_PACKET      *Packet,\r
-  OUT INTN                  *Count,\r
-  OUT DHCP_OPTION           **OptionPoint\r
-  );\r
-\r
-/**\r
-  Append an option to the memory, if the option is longer than\r
-  255 bytes, splits it into several options.\r
-\r
-  @param[out] Buf                    The buffer to append the option to\r
-  @param[in]  Tag                    The option's tag\r
-  @param[in]  DataLen                The length of the option's data\r
-  @param[in]  Data                   The option's data\r
-\r
-  @return The position to append the next option\r
-\r
-**/\r
-UINT8 *\r
-DhcpAppendOption (\r
-  OUT UINT8                  *Buf,\r
-  IN  UINT8                  Tag,\r
-  IN  UINT16                 DataLen,\r
-  IN  UINT8                  *Data\r
-  );\r
-\r
-/**\r
-  Build a new DHCP packet from a seed packet. Options may be deleted or\r
-  appended. The caller should free the NewPacket when finished using it.\r
-\r
-  @param[in]  SeedPacket             The seed packet to start with\r
-  @param[in]  DeleteCount            The number of options to delete\r
-  @param[in]  DeleteList             The options to delete from the packet\r
-  @param[in]  AppendCount            The number of options to append\r
-  @param[in]  AppendList             The options to append to the packet\r
-  @param[out] NewPacket              The new packet, allocated and built by this\r
-                                     function.\r
-\r
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory\r
-  @retval EFI_INVALID_PARAMETER  The options in SeekPacket are mal-formated\r
-  @retval EFI_SUCCESS            The packet is build.\r
-\r
-**/\r
-EFI_STATUS\r
-DhcpBuild (\r
-  IN  EFI_DHCP4_PACKET        *SeedPacket,\r
-  IN  UINT32                  DeleteCount,\r
-  IN  UINT8                   *DeleteList     OPTIONAL,\r
-  IN  UINT32                  AppendCount,\r
-  IN  EFI_DHCP4_PACKET_OPTION *AppendList[]   OPTIONAL,\r
-  OUT EFI_DHCP4_PACKET        **NewPacket\r
-  );\r
-\r
-#endif\r