]>
Commit | Line | Data |
---|---|---|
83cbd279 | 1 | /** @file\r |
3e8c18da | 2 | IP4 option support routines.\r |
3 | \r | |
4 | Copyright (c) 2005 - 2006, 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 | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
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 | |
15 | #ifndef __EFI_IP4_OPTION_H__\r | |
16 | #define __EFI_IP4_OPTION_H__\r | |
17 | \r | |
5405e9a6 | 18 | typedef enum {\r |
83cbd279 | 19 | IP4_OPTION_EOP = 0,\r |
20 | IP4_OPTION_NOP = 1,\r | |
21 | IP4_OPTION_LSRR = 131, // Loss source and record routing, 10000011\r | |
22 | IP4_OPTION_SSRR = 137, // Strict source and record routing, 10001001\r | |
23 | IP4_OPTION_RR = 7, // Record routing, 00000111\r | |
24 | \r | |
25 | IP4_OPTION_COPY_MASK = 0x80\r | |
5405e9a6 | 26 | } IP4_OPTION_ENUM_TYPES;\r |
83cbd279 | 27 | \r |
2ff29212 | 28 | /**\r |
29 | Validate the IP4 option format for both the packets we received\r | |
30 | and will transmit. It will compute the ICMP error message fields\r | |
31 | if the option is mal-formated. But this information isn't used.\r | |
32 | \r | |
3e8c18da | 33 | @param[in] Option The first byte of the option\r |
34 | @param[in] OptionLen The length of the whole option\r | |
35 | @param[in] Rcvd The option is from the packet we received if TRUE,\r | |
2ff29212 | 36 | otherwise the option we wants to transmit.\r |
37 | \r | |
38 | @retval TRUE The option is properly formatted\r | |
39 | @retval FALSE The option is mal-formated\r | |
40 | \r | |
41 | **/\r | |
83cbd279 | 42 | BOOLEAN\r |
43 | Ip4OptionIsValid (\r | |
44 | IN UINT8 *Option,\r | |
2ff29212 | 45 | IN UINT32 OptionLen,\r |
83cbd279 | 46 | IN BOOLEAN Rcvd\r |
47 | );\r | |
48 | \r | |
2ff29212 | 49 | /**\r |
50 | Copy the option from the original option to buffer. It\r | |
51 | handles the details such as:\r | |
52 | 1. whether copy the single IP4 option to the first/non-first\r | |
53 | fragments.\r | |
54 | 2. Pad the options copied over to aligned to 4 bytes.\r | |
55 | \r | |
3e8c18da | 56 | @param[in] Option The original option to copy from\r |
57 | @param[in] OptionLen The length of the original option\r | |
58 | @param[in] FirstFragment Whether it is the first fragment\r | |
59 | @param[in, out] Buf The buffer to copy options to. NULL \r | |
60 | @param[in, out] BufLen The length of the buffer\r | |
2ff29212 | 61 | \r |
62 | @retval EFI_SUCCESS The options are copied over\r | |
63 | @retval EFI_BUFFER_TOO_SMALL Buf is NULL or BufLen provided is too small.\r | |
64 | \r | |
65 | **/\r | |
83cbd279 | 66 | EFI_STATUS\r |
67 | Ip4CopyOption (\r | |
2ff29212 | 68 | IN UINT8 *Option,\r |
69 | IN UINT32 OptionLen,\r | |
70 | IN BOOLEAN FirstFragment,\r | |
71 | IN OUT UINT8 *Buf, OPTIONAL\r | |
83cbd279 | 72 | IN OUT UINT32 *BufLen\r |
73 | );\r | |
74 | #endif\r |