VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Mtftp6Dxe/Mtftp6Option.h@ 77599

Last change on this file since 77599 was 48674, checked in by vboxsync, 11 years ago

EFI: Export newly imported tinaocore UEFI sources to OSE.

  • Property svn:eol-style set to native
File size: 5.0 KB
Line 
1/** @file
2 Mtftp6 option parse functions declaration.
3
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
5
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.
10
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.
13
14**/
15
16#ifndef __EFI_MTFTP6_OPTION_H__
17#define __EFI_MTFTP6_OPTION_H__
18
19#include <Uefi.h>
20
21#include <Protocol/ServiceBinding.h>
22
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>
28
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
34
35//
36// The bit map definition for Mtftp6 extension options.
37//
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
43extern CHAR8 *mMtftp6SupportedOptions[MTFTP6_SUPPORTED_OPTIONS_NUM];
44
45typedef struct {
46 UINT16 BlkSize;
47 UINT8 Timeout;
48 UINT32 Tsize;
49 EFI_IPv6_ADDRESS McastIp;
50 UINT16 McastPort;
51 BOOLEAN IsMaster;
52 UINT32 BitMap;
53} MTFTP6_EXT_OPTION_INFO;
54
55/**
56 Parse the Ascii string of multi-cast option.
57
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.
60
61 @retval EFI_SUCCESS Parse the multicast option successfully.
62 @retval EFI_INVALID_PARAMETER The string is malformatted.
63
64**/
65EFI_STATUS
66Mtftp6ParseMcastOption (
67 IN UINT8 *Str,
68 IN MTFTP6_EXT_OPTION_INFO *ExtInfo
69 );
70
71
72/**
73 Parse the MTFTP6 extesion options.
74
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
78 by a request packet.
79 @param[in] ExtInfo The pointer to the option information to be filled.
80
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.
84
85**/
86EFI_STATUS
87Mtftp6ParseExtensionOption (
88 IN EFI_MTFTP6_OPTION *Options,
89 IN UINT32 Count,
90 IN BOOLEAN IsRequest,
91 IN MTFTP6_EXT_OPTION_INFO *ExtInfo
92 );
93
94
95/**
96 Go through the packet to fill the options array with the start
97 addresses of each MTFTP option name/value pair.
98
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
104 it's optional.
105
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.
110
111**/
112EFI_STATUS
113Mtftp6ParsePacketOption (
114 IN EFI_MTFTP6_PACKET *Packet,
115 IN UINT32 PacketLen,
116 IN OUT UINT32 *Count,
117 IN EFI_MTFTP6_OPTION *Options OPTIONAL
118 );
119
120
121/**
122 Go through the packet, generate option list array and fill it
123 by the result of parse options.
124
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.
131
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.
138
139**/
140EFI_STATUS
141Mtftp6ParseStart (
142 IN EFI_MTFTP6_PACKET *Packet,
143 IN UINT32 PacketLen,
144 IN OUT UINT32 *OptionCount,
145 OUT EFI_MTFTP6_OPTION **OptionList OPTIONAL
146 );
147
148#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette