]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.h
BaseTools:Change the path of the file that Binary Cache
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Mtftp4Dxe / Mtftp4Option.h
1 /** @file
2 Routines to process MTFTP4 options.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9
10 #ifndef __EFI_MTFTP4_OPTION_H__
11 #define __EFI_MTFTP4_OPTION_H__
12
13 #define MTFTP4_SUPPORTED_OPTIONS 5
14 #define MTFTP4_OPCODE_LEN 2
15 #define MTFTP4_ERRCODE_LEN 2
16 #define MTFTP4_BLKNO_LEN 2
17 #define MTFTP4_DATA_HEAD_LEN 4
18
19 #define MTFTP4_BLKSIZE_EXIST 0x01
20 #define MTFTP4_TIMEOUT_EXIST 0x02
21 #define MTFTP4_TSIZE_EXIST 0x04
22 #define MTFTP4_MCAST_EXIST 0x08
23 #define MTFTP4_WINDOWSIZE_EXIST 0x10
24
25 typedef struct {
26 UINT16 BlkSize;
27 UINT16 WindowSize;
28 UINT8 Timeout;
29 UINT32 Tsize;
30 IP4_ADDR McastIp;
31 UINT16 McastPort;
32 BOOLEAN Master;
33 UINT32 Exist;
34 } MTFTP4_OPTION;
35
36 /**
37 Allocate and fill in a array of Mtftp options from the Packet.
38
39 It first calls Mtftp4FillOption to get the option number, then allocate
40 the array, at last, call Mtftp4FillOption again to save the options.
41
42 @param Packet The packet to parse
43 @param PacketLen The length of the packet
44 @param OptionCount The number of options in the packet
45 @param OptionList The point to get the option array.
46
47 @retval EFI_INVALID_PARAMETER The parametera are invalid or packet isn't a
48 well-formated OACK packet.
49 @retval EFI_SUCCESS The option array is build
50 @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array
51
52 **/
53 EFI_STATUS
54 Mtftp4ExtractOptions (
55 IN EFI_MTFTP4_PACKET *Packet,
56 IN UINT32 PacketLen,
57 OUT UINT32 *OptionCount,
58 OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL
59 );
60
61 /**
62 Parse the option in Options array to MTFTP4_OPTION which program
63 can access directly.
64
65 @param Options The option array, which contains addresses of each
66 option's name/value string.
67 @param Count The number of options in the Options
68 @param Request Whether this is a request or OACK. The format of
69 multicast is different according to this setting.
70 @param Operation The current performed operation.
71 @param MtftpOption The MTFTP4_OPTION for easy access.
72
73 @retval EFI_INVALID_PARAMETER The option is mal-formated
74 @retval EFI_UNSUPPORTED Some option isn't supported
75 @retval EFI_SUCCESS The option are OK and has been parsed.
76
77 **/
78 EFI_STATUS
79 Mtftp4ParseOption (
80 IN EFI_MTFTP4_OPTION *Options,
81 IN UINT32 Count,
82 IN BOOLEAN Request,
83 IN UINT16 Operation,
84 OUT MTFTP4_OPTION *MtftpOption
85 );
86
87 /**
88 Parse the options in the OACK packet to MTFTP4_OPTION which program
89 can access directly.
90
91 @param Packet The OACK packet to parse
92 @param PacketLen The length of the packet
93 @param Operation The current performed operation.
94 @param MtftpOption The MTFTP_OPTION for easy access.
95
96 @retval EFI_INVALID_PARAMETER The packet option is mal-formated
97 @retval EFI_UNSUPPORTED Some option isn't supported
98 @retval EFI_SUCCESS The option are OK and has been parsed.
99
100 **/
101 EFI_STATUS
102 Mtftp4ParseOptionOack (
103 IN EFI_MTFTP4_PACKET *Packet,
104 IN UINT32 PacketLen,
105 IN UINT16 Operation,
106 OUT MTFTP4_OPTION *MtftpOption
107 );
108
109 extern CHAR8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];
110
111 #endif