]>
Commit | Line | Data |
---|---|---|
83cbd279 | 1 | /** @file\r |
dab714aa | 2 | Routines to process MTFTP4 options.\r |
3 | \r | |
4 | Copyright (c) 2006 - 2007, Intel Corporation<BR>\r | |
83cbd279 | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
dab714aa | 8 | http://opensource.org/licenses/bsd-license.php<BR>\r |
83cbd279 | 9 | \r |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
83cbd279 | 13 | **/\r |
14 | \r | |
dab714aa | 15 | \r |
83cbd279 | 16 | #ifndef __EFI_MTFTP4_OPTION_H__\r |
17 | #define __EFI_MTFTP4_OPTION_H__\r | |
18 | \r | |
dab714aa | 19 | \r |
20 | \r | |
21 | typedef enum {\r | |
83cbd279 | 22 | MTFTP4_SUPPORTED_OPTIONS = 4,\r |
23 | MTFTP4_OPCODE_LEN = 2,\r | |
24 | MTFTP4_ERRCODE_LEN = 2,\r | |
25 | MTFTP4_BLKNO_LEN = 2,\r | |
26 | MTFTP4_DATA_HEAD_LEN = 4,\r | |
27 | \r | |
28 | MTFTP4_BLKSIZE_EXIST = 0x01,\r | |
29 | MTFTP4_TIMEOUT_EXIST = 0x02,\r | |
30 | MTFTP4_TSIZE_EXIST = 0x04,\r | |
31 | MTFTP4_MCAST_EXIST = 0x08\r | |
dab714aa | 32 | } MTFTP4_OPTION_CONST_VALUE;\r |
83cbd279 | 33 | \r |
34 | typedef struct {\r | |
35 | UINT16 BlkSize;\r | |
36 | UINT8 Timeout;\r | |
37 | UINT32 Tsize;\r | |
38 | IP4_ADDR McastIp;\r | |
39 | UINT16 McastPort;\r | |
40 | BOOLEAN Master;\r | |
41 | UINT32 Exist;\r | |
42 | } MTFTP4_OPTION;\r | |
43 | \r | |
dab714aa | 44 | /**\r |
45 | Allocate and fill in a array of Mtftp options from the Packet. \r | |
46 | \r | |
47 | It first calls Mtftp4FillOption to get the option number, then allocate\r | |
48 | the array, at last, call Mtftp4FillOption again to save the options.\r | |
49 | \r | |
50 | @param Packet The packet to parse\r | |
51 | @param PacketLen The length of the packet\r | |
52 | @param OptionCount The number of options in the packet\r | |
53 | @param OptionList The point to get the option array.\r | |
54 | \r | |
55 | @retval EFI_INVALID_PARAMETER The parametera are invalid or packet isn't a\r | |
56 | well-formated OACK packet.\r | |
57 | @retval EFI_SUCCESS The option array is build\r | |
58 | @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the array\r | |
59 | \r | |
60 | **/\r | |
83cbd279 | 61 | EFI_STATUS\r |
62 | Mtftp4ExtractOptions (\r | |
dab714aa | 63 | IN EFI_MTFTP4_PACKET *Packet,\r |
64 | IN UINT32 PacketLen,\r | |
65 | OUT UINT32 *OptionCount,\r | |
66 | OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL\r | |
83cbd279 | 67 | );\r |
68 | \r | |
dab714aa | 69 | /**\r |
70 | Parse the option in Options array to MTFTP4_OPTION which program\r | |
71 | can access directly.\r | |
72 | \r | |
73 | @param Options The option array, which contains addresses of each\r | |
74 | option's name/value string.\r | |
75 | @param Count The number of options in the Options\r | |
76 | @param Request Whether this is a request or OACK. The format of\r | |
77 | multicast is different according to this setting.\r | |
78 | @param MtftpOption The MTFTP4_OPTION for easy access.\r | |
79 | \r | |
80 | @retval EFI_INVALID_PARAMETER The option is mal-formated\r | |
81 | @retval EFI_UNSUPPORTED Some option isn't supported\r | |
82 | @retval EFI_SUCCESS The option are OK and has been parsed.\r | |
83 | \r | |
84 | **/\r | |
83cbd279 | 85 | EFI_STATUS\r |
86 | Mtftp4ParseOption (\r | |
dab714aa | 87 | IN EFI_MTFTP4_OPTION *Options,\r |
88 | IN UINT32 Count,\r | |
89 | IN BOOLEAN Request,\r | |
90 | OUT MTFTP4_OPTION *MtftpOption\r | |
83cbd279 | 91 | );\r |
92 | \r | |
dab714aa | 93 | /**\r |
94 | Parse the options in the OACK packet to MTFTP4_OPTION which program\r | |
95 | can access directly.\r | |
96 | \r | |
97 | @param Packet The OACK packet to parse\r | |
98 | @param PacketLen The length of the packet\r | |
99 | @param MtftpOption The MTFTP_OPTION for easy access.\r | |
100 | \r | |
101 | @retval EFI_INVALID_PARAMETER The packet option is mal-formated\r | |
102 | @retval EFI_UNSUPPORTED Some option isn't supported\r | |
103 | @retval EFI_SUCCESS The option are OK and has been parsed.\r | |
104 | \r | |
105 | **/\r | |
83cbd279 | 106 | EFI_STATUS\r |
107 | Mtftp4ParseOptionOack (\r | |
dab714aa | 108 | IN EFI_MTFTP4_PACKET *Packet,\r |
109 | IN UINT32 PacketLen,\r | |
110 | OUT MTFTP4_OPTION *MtftpOption\r | |
83cbd279 | 111 | );\r |
112 | \r | |
67a58d0f | 113 | extern CHAR8 *mMtftp4SupportedOptions[MTFTP4_SUPPORTED_OPTIONS];\r |
dab714aa | 114 | \r |
83cbd279 | 115 | #endif\r |