2 Mtftp6 option parse functions declaration.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __EFI_MTFTP6_OPTION_H__
17 #define __EFI_MTFTP6_OPTION_H__
21 #include <Protocol/ServiceBinding.h>
23 #include <Library/NetLib.h>
24 #include <Library/UdpIoLib.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/UefiRuntimeServicesTableLib.h>
29 #define MTFTP6_SUPPORTED_OPTIONS_NUM 5
30 #define MTFTP6_OPCODE_LEN 2
31 #define MTFTP6_ERRCODE_LEN 2
32 #define MTFTP6_BLKNO_LEN 2
33 #define MTFTP6_DATA_HEAD_LEN 4
36 // The bit map definition for Mtftp6 extension options.
38 #define MTFTP6_OPT_BLKSIZE_BIT 0x01
39 #define MTFTP6_OPT_TIMEOUT_BIT 0x02
40 #define MTFTP6_OPT_TSIZE_BIT 0x04
41 #define MTFTP6_OPT_MCAST_BIT 0x08
42 #define MTFTP6_OPT_WINDOWSIZE_BIT 0X10
44 extern CHAR8
*mMtftp6SupportedOptions
[MTFTP6_SUPPORTED_OPTIONS_NUM
];
51 EFI_IPv6_ADDRESS McastIp
;
55 } MTFTP6_EXT_OPTION_INFO
;
58 Parse the Ascii string of multi-cast option.
60 @param[in] Str The pointer to the Ascii string of multi-cast option.
61 @param[in] ExtInfo The pointer to the option information to be filled.
63 @retval EFI_SUCCESS Parse the multicast option successfully.
64 @retval EFI_INVALID_PARAMETER The string is malformatted.
68 Mtftp6ParseMcastOption (
70 IN MTFTP6_EXT_OPTION_INFO
*ExtInfo
75 Parse the MTFTP6 extesion options.
77 @param[in] Options The pointer to the extension options list.
78 @param[in] Count The num of the extension options.
79 @param[in] IsRequest If FALSE, the extension options is included
81 @param[in] Operation The current performed operation.
82 @param[in] ExtInfo The pointer to the option information to be filled.
84 @retval EFI_SUCCESS Parse the multicast option successfully.
85 @retval EFI_INVALID_PARAMETER There is one option is malformatted at least.
86 @retval EFI_UNSUPPORTED There is one option is not supported at least.
90 Mtftp6ParseExtensionOption (
91 IN EFI_MTFTP6_OPTION
*Options
,
95 IN MTFTP6_EXT_OPTION_INFO
*ExtInfo
100 Go through the packet to fill the options array with the start
101 addresses of each MTFTP option name/value pair.
103 @param[in] Packet The packet to be checked.
104 @param[in] PacketLen The length of the packet.
105 @param[in, out] Count The num of the Options on input.
106 The actual one on output.
107 @param[in] Options The option array to be filled
110 @retval EFI_SUCCESS The packet has been parsed successfully.
111 @retval EFI_INVALID_PARAMETER The packet is malformatted
112 @retval EFI_BUFFER_TOO_SMALL The Options array is too small
113 @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received.
117 Mtftp6ParsePacketOption (
118 IN EFI_MTFTP6_PACKET
*Packet
,
120 IN OUT UINT32
*Count
,
121 IN EFI_MTFTP6_OPTION
*Options OPTIONAL
126 Go through the packet, generate option list array and fill it
127 by the result of parse options.
129 @param[in] Packet The packet to be checked.
130 @param[in] PacketLen The length of the packet.
131 @param[in, out] OptionCount The num of the Options on input.
132 The actual one on output.
133 @param[out] OptionList The option list array to be generated
134 and filled. It is optional.
136 @retval EFI_SUCCESS The packet has been parsed successfully.
137 @retval EFI_INVALID_PARAMETER The packet is malformatted.
138 @retval EFI_PROTOCOL_ERROR An option is malformatted.
139 @retval EFI_NOT_FOUND The packet has no options.
140 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array.
141 @retval EFI_BUFFER_TOO_SMALL The size of option list array is too small.
146 IN EFI_MTFTP6_PACKET
*Packet
,
148 IN OUT UINT32
*OptionCount
,
149 OUT EFI_MTFTP6_OPTION
**OptionList OPTIONAL