]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.h
Add 'file not found' debug message to MTFTP.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Mtftp4Dxe / Mtftp4Option.h
CommitLineData
83cbd279 1/** @file\r
dab714aa 2 Routines to process MTFTP4 options.\r
3 \r
e5eed7d3
HT
4Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
83cbd279 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
dab714aa 8http://opensource.org/licenses/bsd-license.php<BR>\r
83cbd279 9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
83cbd279 13**/\r
14\r
dab714aa 15\r
83cbd279 16#ifndef __EFI_MTFTP4_OPTION_H__\r
17#define __EFI_MTFTP4_OPTION_H__\r
18\r
f6b7393c 19#define MTFTP4_SUPPORTED_OPTIONS 4\r
20#define MTFTP4_OPCODE_LEN 2\r
21#define MTFTP4_ERRCODE_LEN 2\r
22#define MTFTP4_BLKNO_LEN 2\r
23#define MTFTP4_DATA_HEAD_LEN 4\r
dab714aa 24\r
f6b7393c 25#define MTFTP4_BLKSIZE_EXIST 0x01\r
26#define MTFTP4_TIMEOUT_EXIST 0x02\r
27#define MTFTP4_TSIZE_EXIST 0x04\r
28#define MTFTP4_MCAST_EXIST 0x08\r
83cbd279 29\r
30typedef struct {\r
31 UINT16 BlkSize;\r
32 UINT8 Timeout;\r
33 UINT32 Tsize;\r
34 IP4_ADDR McastIp;\r
35 UINT16 McastPort;\r
36 BOOLEAN Master;\r
37 UINT32 Exist;\r
38} MTFTP4_OPTION;\r
39\r
dab714aa 40/**\r
41 Allocate and fill in a array of Mtftp options from the Packet. \r
42 \r
43 It first calls Mtftp4FillOption to get the option number, then allocate\r
44 the array, at last, call Mtftp4FillOption again to save the options.\r
45\r
46 @param Packet The packet to parse\r
47 @param PacketLen The length of the packet\r
48 @param OptionCount The number of options in the packet\r
49 @param OptionList The point to get the option array.\r
50\r
51 @retval EFI_INVALID_PARAMETER The parametera are invalid or packet isn't a\r
52 well-formated OACK packet.\r
53 @retval EFI_SUCCESS The option array is build\r
54 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array\r
55\r
56**/\r
83cbd279 57EFI_STATUS\r
58Mtftp4ExtractOptions (\r
dab714aa 59 IN EFI_MTFTP4_PACKET *Packet,\r
60 IN UINT32 PacketLen,\r
61 OUT UINT32 *OptionCount,\r
62 OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL\r
83cbd279 63 );\r
64\r
dab714aa 65/**\r
66 Parse the option in Options array to MTFTP4_OPTION which program\r
67 can access directly.\r
68\r
69 @param Options The option array, which contains addresses of each\r
70 option's name/value string.\r
71 @param Count The number of options in the Options\r
72 @param Request Whether this is a request or OACK. The format of\r
73 multicast is different according to this setting.\r
74 @param MtftpOption The MTFTP4_OPTION for easy access.\r
75\r
76 @retval EFI_INVALID_PARAMETER The option is mal-formated\r
77 @retval EFI_UNSUPPORTED Some option isn't supported\r
78 @retval EFI_SUCCESS The option are OK and has been parsed.\r
79\r
80**/\r
83cbd279 81EFI_STATUS\r
82Mtftp4ParseOption (\r
dab714aa 83 IN EFI_MTFTP4_OPTION *Options,\r
84 IN UINT32 Count,\r
85 IN BOOLEAN Request,\r
86 OUT MTFTP4_OPTION *MtftpOption\r
83cbd279 87 );\r
88\r
dab714aa 89/**\r
90 Parse the options in the OACK packet to MTFTP4_OPTION which program\r
91 can access directly.\r
92\r
93 @param Packet The OACK packet to parse\r
94 @param PacketLen The length of the packet\r
95 @param MtftpOption The MTFTP_OPTION for easy access.\r
96\r
97 @retval EFI_INVALID_PARAMETER The packet option is mal-formated\r
98 @retval EFI_UNSUPPORTED Some option isn't supported\r
99 @retval EFI_SUCCESS The option are OK and has been parsed.\r
100\r
101**/\r
83cbd279 102EFI_STATUS\r
103Mtftp4ParseOptionOack (\r
dab714aa 104 IN EFI_MTFTP4_PACKET *Packet,\r
105 IN UINT32 PacketLen,\r
106 OUT MTFTP4_OPTION *MtftpOption\r
83cbd279 107 );\r
108\r
67a58d0f 109extern CHAR8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];\r
dab714aa 110\r
83cbd279 111#endif\r