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
68 Parse the MTFTP6 extension options.
70 @param[in] Options The pointer to the extension options list.
71 @param[in] Count The num of the extension options.
72 @param[in] IsRequest If FALSE, the extension options is included
74 @param[in] Operation The current performed operation.
75 @param[in] ExtInfo The pointer to the option information to be filled.
77 @retval EFI_SUCCESS Parse the multicast option successfully.
78 @retval EFI_INVALID_PARAMETER There is one option is malformatted at least.
79 @retval EFI_UNSUPPORTED There is one option is not supported at least.
83 Mtftp6ParseExtensionOption (
84 IN EFI_MTFTP6_OPTION
*Options
,
88 IN MTFTP6_EXT_OPTION_INFO
*ExtInfo
92 Go through the packet to fill the options array with the start
93 addresses of each MTFTP option name/value pair.
95 @param[in] Packet The packet to be checked.
96 @param[in] PacketLen The length of the packet.
97 @param[in, out] Count The num of the Options on input.
98 The actual one on output.
99 @param[in] Options The option array to be filled
102 @retval EFI_SUCCESS The packet has been parsed successfully.
103 @retval EFI_INVALID_PARAMETER The packet is malformatted
104 @retval EFI_BUFFER_TOO_SMALL The Options array is too small
105 @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received.
109 Mtftp6ParsePacketOption (
110 IN EFI_MTFTP6_PACKET
*Packet
,
112 IN OUT UINT32
*Count
,
113 IN EFI_MTFTP6_OPTION
*Options OPTIONAL
117 Go through the packet, generate option list array and fill it
118 by the result of parse options.
120 @param[in] Packet The packet to be checked.
121 @param[in] PacketLen The length of the packet.
122 @param[in, out] OptionCount The num of the Options on input.
123 The actual one on output.
124 @param[out] OptionList The option list array to be generated
125 and filled. It is optional.
127 @retval EFI_SUCCESS The packet has been parsed successfully.
128 @retval EFI_INVALID_PARAMETER The packet is malformatted.
129 @retval EFI_PROTOCOL_ERROR An option is malformatted.
130 @retval EFI_NOT_FOUND The packet has no options.
131 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array.
132 @retval EFI_BUFFER_TOO_SMALL The size of option list array is too small.
137 IN EFI_MTFTP6_PACKET
*Packet
,
139 IN OUT UINT32
*OptionCount
,
140 OUT EFI_MTFTP6_OPTION
**OptionList OPTIONAL