]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/Mtftp6Dxe/Mtftp6Option.h
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / NetworkPkg / Mtftp6Dxe / Mtftp6Option.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 Mtftp6 option parse functions declaration.\r
3\r
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __EFI_MTFTP6_OPTION_H__\r
17#define __EFI_MTFTP6_OPTION_H__\r
18\r
19#include <Uefi.h>\r
20\r
21#include <Protocol/ServiceBinding.h>\r
22\r
23#include <Library/NetLib.h>\r
24#include <Library/UdpIoLib.h>\r
25#include <Library/BaseMemoryLib.h>\r
26#include <Library/MemoryAllocationLib.h>\r
27#include <Library/UefiRuntimeServicesTableLib.h>\r
28\r
29#define MTFTP6_SUPPORTED_OPTIONS_NUM 4\r
30#define MTFTP6_OPCODE_LEN 2\r
31#define MTFTP6_ERRCODE_LEN 2\r
32#define MTFTP6_BLKNO_LEN 2\r
33#define MTFTP6_DATA_HEAD_LEN 4\r
34\r
35//\r
36// The bit map definition for Mtftp6 extension options.\r
37//\r
38#define MTFTP6_OPT_BLKSIZE_BIT 0x01\r
39#define MTFTP6_OPT_TIMEOUT_BIT 0x02\r
40#define MTFTP6_OPT_TSIZE_BIT 0x04\r
41#define MTFTP6_OPT_MCAST_BIT 0x08\r
42\r
43extern CHAR8 *mMtftp6SupportedOptions[MTFTP6_SUPPORTED_OPTIONS_NUM];\r
44\r
45typedef struct {\r
46 UINT16 BlkSize;\r
47 UINT8 Timeout;\r
48 UINT32 Tsize;\r
49 EFI_IPv6_ADDRESS McastIp;\r
50 UINT16 McastPort;\r
51 BOOLEAN IsMaster;\r
52 UINT32 BitMap;\r
53} MTFTP6_EXT_OPTION_INFO;\r
54\r
55/**\r
56 Parse the Ascii string of multi-cast option.\r
57\r
58 @param[in] Str The pointer to the Ascii string of multi-cast option.\r
59 @param[in] ExtInfo The pointer to the option information to be filled.\r
60\r
61 @retval EFI_SUCCESS Parse the multicast option successfully.\r
62 @retval EFI_INVALID_PARAMETER The string is malformatted.\r
63\r
64**/\r
65EFI_STATUS\r
66Mtftp6ParseMcastOption (\r
67 IN UINT8 *Str,\r
68 IN MTFTP6_EXT_OPTION_INFO *ExtInfo\r
69 );\r
70\r
71\r
72/**\r
73 Parse the MTFTP6 extesion options.\r
74\r
75 @param[in] Options The pointer to the extension options list.\r
76 @param[in] Count The num of the extension options.\r
77 @param[in] IsRequest If FALSE, the extension options is included\r
78 by a request packet.\r
79 @param[in] ExtInfo The pointer to the option information to be filled.\r
80\r
81 @retval EFI_SUCCESS Parse the multi-cast option successfully.\r
82 @retval EFI_INVALID_PARAMETER An option is malformatted.\r
83 @retval EFI_UNSUPPORTED An option is not supported.\r
84\r
85**/\r
86EFI_STATUS\r
87Mtftp6ParseExtensionOption (\r
88 IN EFI_MTFTP6_OPTION *Options,\r
89 IN UINT32 Count,\r
90 IN BOOLEAN IsRequest,\r
91 IN MTFTP6_EXT_OPTION_INFO *ExtInfo\r
92 );\r
93\r
94\r
95/**\r
96 Go through the packet to fill the options array with the start\r
97 addresses of each MTFTP option name/value pair.\r
98\r
99 @param[in] Packet The packet to be checked.\r
100 @param[in] PacketLen The length of the packet.\r
101 @param[in, out] Count The num of the Options on input.\r
102 The actual one on output.\r
103 @param[in] Options The option array to be filled\r
104 it's optional.\r
105\r
106 @retval EFI_SUCCESS The packet has been parsed successfully.\r
107 @retval EFI_INVALID_PARAMETER The packet is malformatted\r
108 @retval EFI_BUFFER_TOO_SMALL The Options array is too small\r
109 @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received.\r
110\r
111**/\r
112EFI_STATUS\r
113Mtftp6ParsePacketOption (\r
114 IN EFI_MTFTP6_PACKET *Packet,\r
115 IN UINT32 PacketLen,\r
116 IN OUT UINT32 *Count,\r
117 IN EFI_MTFTP6_OPTION *Options OPTIONAL\r
118 );\r
119\r
120\r
121/**\r
122 Go through the packet, generate option list array and fill it\r
123 by the result of parse options.\r
124\r
125 @param[in] Packet The packet to be checked.\r
126 @param[in] PacketLen The length of the packet.\r
127 @param[in, out] OptionCount The num of the Options on input.\r
128 The actual one on output.\r
129 @param[out] OptionList The option list array to be generated\r
130 and filled. It is optional.\r
131\r
132 @retval EFI_SUCCESS The packet has been parsed successfully.\r
133 @retval EFI_INVALID_PARAMETER The packet is malformatted.\r
134 @retval EFI_PROTOCOL_ERROR An option is malformatted.\r
135 @retval EFI_NOT_FOUND The packet has no options.\r
136 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array.\r
137 @retval EFI_BUFFER_TOO_SMALL The size of option list array is too small.\r
138\r
139**/\r
140EFI_STATUS\r
141Mtftp6ParseStart (\r
142 IN EFI_MTFTP6_PACKET *Packet,\r
143 IN UINT32 PacketLen,\r
144 IN OUT UINT32 *OptionCount,\r
145 OUT EFI_MTFTP6_OPTION **OptionList OPTIONAL\r
146 );\r
147\r
148#endif\r