]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.h
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Mtftp4Dxe / Mtftp4Option.h
index a136304df40ac17b6bf87feeef839ba6c6d04781..a3fdc4dca26da1d1fedd3a87d88e5ba7b5378b6d 100644 (file)
-/** @file
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-  Mtftp4Option.h
-
-Abstract:
-
-  Mtftp4 option process routines.
-
-
-**/
-
-#ifndef __EFI_MTFTP4_OPTION_H__
-#define __EFI_MTFTP4_OPTION_H__
-
-enum {
-  MTFTP4_SUPPORTED_OPTIONS = 4,
-  MTFTP4_OPCODE_LEN        = 2,
-  MTFTP4_ERRCODE_LEN       = 2,
-  MTFTP4_BLKNO_LEN         = 2,
-  MTFTP4_DATA_HEAD_LEN     = 4,
-
-  MTFTP4_BLKSIZE_EXIST     = 0x01,
-  MTFTP4_TIMEOUT_EXIST     = 0x02,
-  MTFTP4_TSIZE_EXIST       = 0x04,
-  MTFTP4_MCAST_EXIST       = 0x08,
-};
-
-typedef struct {
-  UINT16                    BlkSize;
-  UINT8                     Timeout;
-  UINT32                    Tsize;
-  IP4_ADDR                  McastIp;
-  UINT16                    McastPort;
-  BOOLEAN                   Master;
-  UINT32                    Exist;
-} MTFTP4_OPTION;
-
-EFI_STATUS
-Mtftp4ExtractOptions (
-  IN  EFI_MTFTP4_PACKET     *Packet,
-  IN  UINT32                PacketLen,
-  IN  OUT UINT32            *OptionCount,
-  OUT EFI_MTFTP4_OPTION     **OptionList OPTIONAL
-  );
-
-EFI_STATUS
-Mtftp4ParseOption (
-  IN  EFI_MTFTP4_OPTION     *OptionList,
-  IN  UINT32                Count,
-  IN  BOOLEAN               Request,
-  OUT MTFTP4_OPTION         *Option
-  );
-
-EFI_STATUS
-Mtftp4ParseOptionOack (
-  IN  EFI_MTFTP4_PACKET     *Packet,
-  IN  UINT32                PacketLen,
-  OUT MTFTP4_OPTION         *Option
-  );
-
-extern UINT8  *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];
-#endif
+/** @file\r
+  Routines to process MTFTP4 options.\r
+\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php<BR>\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+\r
+#ifndef __EFI_MTFTP4_OPTION_H__\r
+#define __EFI_MTFTP4_OPTION_H__\r
+\r
+#define MTFTP4_SUPPORTED_OPTIONS  4\r
+#define MTFTP4_OPCODE_LEN         2\r
+#define MTFTP4_ERRCODE_LEN        2\r
+#define MTFTP4_BLKNO_LEN          2\r
+#define MTFTP4_DATA_HEAD_LEN      4\r
+\r
+#define MTFTP4_BLKSIZE_EXIST      0x01\r
+#define MTFTP4_TIMEOUT_EXIST      0x02\r
+#define MTFTP4_TSIZE_EXIST        0x04\r
+#define MTFTP4_MCAST_EXIST        0x08\r
+\r
+typedef struct {\r
+  UINT16                    BlkSize;\r
+  UINT8                     Timeout;\r
+  UINT32                    Tsize;\r
+  IP4_ADDR                  McastIp;\r
+  UINT16                    McastPort;\r
+  BOOLEAN                   Master;\r
+  UINT32                    Exist;\r
+} MTFTP4_OPTION;\r
+\r
+/**\r
+  Allocate and fill in a array of Mtftp options from the Packet.\r
+\r
+  It first calls Mtftp4FillOption to get the option number, then allocate\r
+  the array, at last, call Mtftp4FillOption again to save the options.\r
+\r
+  @param  Packet                 The packet to parse\r
+  @param  PacketLen              The length of the packet\r
+  @param  OptionCount            The number of options in the packet\r
+  @param  OptionList             The point to get the option array.\r
+\r
+  @retval EFI_INVALID_PARAMETER  The parametera are invalid or packet isn't a\r
+                                 well-formated OACK packet.\r
+  @retval EFI_SUCCESS            The option array is build\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory for the array\r
+\r
+**/\r
+EFI_STATUS\r
+Mtftp4ExtractOptions (\r
+  IN     EFI_MTFTP4_PACKET     *Packet,\r
+  IN     UINT32                PacketLen,\r
+     OUT UINT32                *OptionCount,\r
+     OUT EFI_MTFTP4_OPTION     **OptionList        OPTIONAL\r
+  );\r
+\r
+/**\r
+  Parse the option in Options array to MTFTP4_OPTION which program\r
+  can access directly.\r
+\r
+  @param  Options                The option array, which contains addresses of each\r
+                                 option's name/value string.\r
+  @param  Count                  The number of options in the Options\r
+  @param  Request                Whether this is a request or OACK. The format of\r
+                                 multicast is different according to this setting.\r
+  @param  MtftpOption            The MTFTP4_OPTION for easy access.\r
+\r
+  @retval EFI_INVALID_PARAMETER  The option is mal-formated\r
+  @retval EFI_UNSUPPORTED        Some option isn't supported\r
+  @retval EFI_SUCCESS            The option are OK and has been parsed.\r
+\r
+**/\r
+EFI_STATUS\r
+Mtftp4ParseOption (\r
+  IN     EFI_MTFTP4_OPTION     *Options,\r
+  IN     UINT32                Count,\r
+  IN     BOOLEAN               Request,\r
+     OUT MTFTP4_OPTION         *MtftpOption\r
+  );\r
+\r
+/**\r
+  Parse the options in the OACK packet to MTFTP4_OPTION which program\r
+  can access directly.\r
+\r
+  @param  Packet                 The OACK packet to parse\r
+  @param  PacketLen              The length of the packet\r
+  @param  MtftpOption            The MTFTP_OPTION for easy access.\r
+\r
+  @retval EFI_INVALID_PARAMETER  The packet option is mal-formated\r
+  @retval EFI_UNSUPPORTED        Some option isn't supported\r
+  @retval EFI_SUCCESS            The option are OK and has been parsed.\r
+\r
+**/\r
+EFI_STATUS\r
+Mtftp4ParseOptionOack (\r
+  IN     EFI_MTFTP4_PACKET     *Packet,\r
+  IN     UINT32                PacketLen,\r
+     OUT MTFTP4_OPTION         *MtftpOption\r
+  );\r
+\r
+extern CHAR8  *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];\r
+\r
+#endif\r