2 Mtftp6 option parse functions declaration.
4 Copyright (c) 2009 - 2010, 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 4
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
43 extern CHAR8
*mMtftp6SupportedOptions
[MTFTP6_SUPPORTED_OPTIONS_NUM
];
49 EFI_IPv6_ADDRESS McastIp
;
53 } MTFTP6_EXT_OPTION_INFO
;
56 Parse the Ascii string of multi-cast option.
58 @param[in] Str The pointer to the Ascii string of multi-cast option.
59 @param[in] ExtInfo The pointer to the option information to be filled.
61 @retval EFI_SUCCESS Parse the multicast option successfully.
62 @retval EFI_INVALID_PARAMETER The string is malformatted.
66 Mtftp6ParseMcastOption (
68 IN MTFTP6_EXT_OPTION_INFO
*ExtInfo
73 Parse the MTFTP6 extesion options.
75 @param[in] Options The pointer to the extension options list.
76 @param[in] Count The num of the extension options.
77 @param[in] IsRequest If FALSE, the extension options is included
79 @param[in] ExtInfo The pointer to the option information to be filled.
81 @retval EFI_SUCCESS Parse the multi-cast option successfully.
82 @retval EFI_INVALID_PARAMETER An option is malformatted.
83 @retval EFI_UNSUPPORTED An option is not supported.
87 Mtftp6ParseExtensionOption (
88 IN EFI_MTFTP6_OPTION
*Options
,
91 IN MTFTP6_EXT_OPTION_INFO
*ExtInfo
96 Go through the packet to fill the options array with the start
97 addresses of each MTFTP option name/value pair.
99 @param[in] Packet The packet to be checked.
100 @param[in] PacketLen The length of the packet.
101 @param[in, out] Count The num of the Options on input.
102 The actual one on output.
103 @param[in] Options The option array to be filled
106 @retval EFI_SUCCESS The packet has been parsed successfully.
107 @retval EFI_INVALID_PARAMETER The packet is malformatted
108 @retval EFI_BUFFER_TOO_SMALL The Options array is too small
109 @retval EFI_PROTOCOL_ERROR An unexpected MTFTPv6 packet was received.
113 Mtftp6ParsePacketOption (
114 IN EFI_MTFTP6_PACKET
*Packet
,
116 IN OUT UINT32
*Count
,
117 IN EFI_MTFTP6_OPTION
*Options OPTIONAL
122 Go through the packet, generate option list array and fill it
123 by the result of parse options.
125 @param[in] Packet The packet to be checked.
126 @param[in] PacketLen The length of the packet.
127 @param[in, out] OptionCount The num of the Options on input.
128 The actual one on output.
129 @param[out] OptionList The option list array to be generated
130 and filled. It is optional.
132 @retval EFI_SUCCESS The packet has been parsed successfully.
133 @retval EFI_INVALID_PARAMETER The packet is malformatted.
134 @retval EFI_PROTOCOL_ERROR An option is malformatted.
135 @retval EFI_NOT_FOUND The packet has no options.
136 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array.
137 @retval EFI_BUFFER_TOO_SMALL The size of option list array is too small.
142 IN EFI_MTFTP6_PACKET
*Packet
,
144 IN OUT UINT32
*OptionCount
,
145 OUT EFI_MTFTP6_OPTION
**OptionList OPTIONAL