2 Mtftp6 option parse functions declaration.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __EFI_MTFTP6_OPTION_H__
11 #define __EFI_MTFTP6_OPTION_H__
15 #include <Protocol/ServiceBinding.h>
17 #include <Library/NetLib.h>
18 #include <Library/UdpIoLib.h>
19 #include <Library/BaseMemoryLib.h>
20 #include <Library/MemoryAllocationLib.h>
21 #include <Library/UefiRuntimeServicesTableLib.h>
23 #define MTFTP6_SUPPORTED_OPTIONS_NUM 5
24 #define MTFTP6_OPCODE_LEN 2
25 #define MTFTP6_ERRCODE_LEN 2
26 #define MTFTP6_BLKNO_LEN 2
27 #define MTFTP6_DATA_HEAD_LEN 4
30 // The bit map definition for Mtftp6 extension options.
32 #define MTFTP6_OPT_BLKSIZE_BIT 0x01
33 #define MTFTP6_OPT_TIMEOUT_BIT 0x02
34 #define MTFTP6_OPT_TSIZE_BIT 0x04
35 #define MTFTP6_OPT_MCAST_BIT 0x08
36 #define MTFTP6_OPT_WINDOWSIZE_BIT 0X10
38 extern CHAR8
*mMtftp6SupportedOptions
[MTFTP6_SUPPORTED_OPTIONS_NUM
];
45 EFI_IPv6_ADDRESS McastIp
;
49 } MTFTP6_EXT_OPTION_INFO
;
52 Parse the Ascii string of multi-cast option.
54 @param[in] Str The pointer to the Ascii string of multi-cast option.
55 @param[in] ExtInfo The pointer to the option information to be filled.
57 @retval EFI_SUCCESS Parse the multicast option successfully.
58 @retval EFI_INVALID_PARAMETER The string is malformatted.
62 Mtftp6ParseMcastOption (
64 IN MTFTP6_EXT_OPTION_INFO
*ExtInfo
69 Parse the MTFTP6 extesion options.
71 @param[in] Options The pointer to the extension options list.
72 @param[in] Count The num of the extension options.
73 @param[in] IsRequest If FALSE, the extension options is included
75 @param[in] Operation The current performed operation.
76 @param[in] ExtInfo The pointer to the option information to be filled.
78 @retval EFI_SUCCESS Parse the multicast option successfully.
79 @retval EFI_INVALID_PARAMETER There is one option is malformatted at least.
80 @retval EFI_UNSUPPORTED There is one option is not supported at least.
84 Mtftp6ParseExtensionOption (
85 IN EFI_MTFTP6_OPTION
*Options
,
89 IN MTFTP6_EXT_OPTION_INFO
*ExtInfo
94 Go through the packet to fill the options array with the start
95 addresses of each MTFTP option name/value pair.
97 @param[in] Packet The packet to be checked.
98 @param[in] PacketLen The length of the packet.
99 @param[in, out] Count The num of the Options on input.
100 The actual one on output.
101 @param[in] Options The option array to be filled
104 @retval EFI_SUCCESS The packet has been parsed successfully.
105 @retval EFI_INVALID_PARAMETER The packet is malformatted
106 @retval EFI_BUFFER_TOO_SMALL The Options array is too small
107 @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received.
111 Mtftp6ParsePacketOption (
112 IN EFI_MTFTP6_PACKET
*Packet
,
114 IN OUT UINT32
*Count
,
115 IN EFI_MTFTP6_OPTION
*Options OPTIONAL
120 Go through the packet, generate option list array and fill it
121 by the result of parse options.
123 @param[in] Packet The packet to be checked.
124 @param[in] PacketLen The length of the packet.
125 @param[in, out] OptionCount The num of the Options on input.
126 The actual one on output.
127 @param[out] OptionList The option list array to be generated
128 and filled. It is optional.
130 @retval EFI_SUCCESS The packet has been parsed successfully.
131 @retval EFI_INVALID_PARAMETER The packet is malformatted.
132 @retval EFI_PROTOCOL_ERROR An option is malformatted.
133 @retval EFI_NOT_FOUND The packet has no options.
134 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array.
135 @retval EFI_BUFFER_TOO_SMALL The size of option list array is too small.
140 IN EFI_MTFTP6_PACKET
*Packet
,
142 IN OUT UINT32
*OptionCount
,
143 OUT EFI_MTFTP6_OPTION
**OptionList OPTIONAL