]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - NetworkPkg/Mtftp4Dxe/Mtftp4Option.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / Mtftp4Dxe / Mtftp4Option.h
... / ...
CommitLineData
1/** @file\r
2 Routines to process MTFTP4 options.\r
3\r
4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
5SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#ifndef __EFI_MTFTP4_OPTION_H__\r
10#define __EFI_MTFTP4_OPTION_H__\r
11\r
12#define MTFTP4_SUPPORTED_OPTIONS 5\r
13#define MTFTP4_OPCODE_LEN 2\r
14#define MTFTP4_ERRCODE_LEN 2\r
15#define MTFTP4_BLKNO_LEN 2\r
16#define MTFTP4_DATA_HEAD_LEN 4\r
17\r
18#define MTFTP4_BLKSIZE_EXIST 0x01\r
19#define MTFTP4_TIMEOUT_EXIST 0x02\r
20#define MTFTP4_TSIZE_EXIST 0x04\r
21#define MTFTP4_MCAST_EXIST 0x08\r
22#define MTFTP4_WINDOWSIZE_EXIST 0x10\r
23\r
24typedef struct {\r
25 UINT16 BlkSize;\r
26 UINT16 WindowSize;\r
27 UINT8 Timeout;\r
28 UINT32 Tsize;\r
29 IP4_ADDR McastIp;\r
30 UINT16 McastPort;\r
31 BOOLEAN Master;\r
32 UINT32 Exist;\r
33} MTFTP4_OPTION;\r
34\r
35/**\r
36 Allocate and fill in a array of Mtftp options from the Packet.\r
37\r
38 It first calls Mtftp4FillOption to get the option number, then allocate\r
39 the array, at last, call Mtftp4FillOption again to save the options.\r
40\r
41 @param Packet The packet to parse\r
42 @param PacketLen The length of the packet\r
43 @param OptionCount The number of options in the packet\r
44 @param OptionList The point to get the option array.\r
45\r
46 @retval EFI_INVALID_PARAMETER The parametera are invalid or packet isn't a\r
47 well-formatted OACK packet.\r
48 @retval EFI_SUCCESS The option array is build\r
49 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array\r
50\r
51**/\r
52EFI_STATUS\r
53Mtftp4ExtractOptions (\r
54 IN EFI_MTFTP4_PACKET *Packet,\r
55 IN UINT32 PacketLen,\r
56 OUT UINT32 *OptionCount,\r
57 OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL\r
58 );\r
59\r
60/**\r
61 Parse the option in Options array to MTFTP4_OPTION which program\r
62 can access directly.\r
63\r
64 @param Options The option array, which contains addresses of each\r
65 option's name/value string.\r
66 @param Count The number of options in the Options\r
67 @param Request Whether this is a request or OACK. The format of\r
68 multicast is different according to this setting.\r
69 @param Operation The current performed operation.\r
70 @param MtftpOption The MTFTP4_OPTION for easy access.\r
71\r
72 @retval EFI_INVALID_PARAMETER The option is malformatted\r
73 @retval EFI_UNSUPPORTED Some option isn't supported\r
74 @retval EFI_SUCCESS The option are OK and has been parsed.\r
75\r
76**/\r
77EFI_STATUS\r
78Mtftp4ParseOption (\r
79 IN EFI_MTFTP4_OPTION *Options,\r
80 IN UINT32 Count,\r
81 IN BOOLEAN Request,\r
82 IN UINT16 Operation,\r
83 OUT MTFTP4_OPTION *MtftpOption\r
84 );\r
85\r
86/**\r
87 Parse the options in the OACK packet to MTFTP4_OPTION which program\r
88 can access directly.\r
89\r
90 @param Packet The OACK packet to parse\r
91 @param PacketLen The length of the packet\r
92 @param Operation The current performed operation.\r
93 @param MtftpOption The MTFTP_OPTION for easy access.\r
94\r
95 @retval EFI_INVALID_PARAMETER The packet option is malformatted\r
96 @retval EFI_UNSUPPORTED Some option isn't supported\r
97 @retval EFI_SUCCESS The option are OK and has been parsed.\r
98\r
99**/\r
100EFI_STATUS\r
101Mtftp4ParseOptionOack (\r
102 IN EFI_MTFTP4_PACKET *Packet,\r
103 IN UINT32 PacketLen,\r
104 IN UINT16 Operation,\r
105 OUT MTFTP4_OPTION *MtftpOption\r
106 );\r
107\r
108extern CHAR8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];\r
109\r
110#endif\r