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