]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/Ip4Dxe/Ip4Option.h
NetworkPkg: Apply uncrustify changes
[mirror_edk2.git] / NetworkPkg / Ip4Dxe / Ip4Option.h
CommitLineData
83cbd279 1/** @file\r
3e8c18da 2 IP4 option support routines.\r
d1102dba
LG
3\r
4Copyright (c) 2005 - 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_IP4_OPTION_H__\r
10#define __EFI_IP4_OPTION_H__\r
11\r
d1050b9d
MK
12#define IP4_OPTION_EOP 0\r
13#define IP4_OPTION_NOP 1\r
14#define IP4_OPTION_LSRR 131 // Loss source and record routing, 10000011\r
15#define IP4_OPTION_SSRR 137 // Strict source and record routing, 10001001\r
16#define IP4_OPTION_RR 7 // Record routing, 00000111\r
83cbd279 17\r
f6b7393c 18#define IP4_OPTION_COPY_MASK 0x80\r
83cbd279 19\r
2ff29212 20/**\r
21 Validate the IP4 option format for both the packets we received\r
22 and will transmit. It will compute the ICMP error message fields\r
8d774c74 23 if the option is malformatted. But this information isn't used.\r
2ff29212 24\r
3e8c18da 25 @param[in] Option The first byte of the option\r
26 @param[in] OptionLen The length of the whole option\r
27 @param[in] Rcvd The option is from the packet we received if TRUE,\r
2ff29212 28 otherwise the option we wants to transmit.\r
29\r
30 @retval TRUE The option is properly formatted\r
8d774c74 31 @retval FALSE The option is malformatted\r
2ff29212 32\r
33**/\r
83cbd279 34BOOLEAN\r
35Ip4OptionIsValid (\r
d1050b9d
MK
36 IN UINT8 *Option,\r
37 IN UINT32 OptionLen,\r
38 IN BOOLEAN Rcvd\r
83cbd279 39 );\r
40\r
2ff29212 41/**\r
42 Copy the option from the original option to buffer. It\r
43 handles the details such as:\r
44 1. whether copy the single IP4 option to the first/non-first\r
45 fragments.\r
46 2. Pad the options copied over to aligned to 4 bytes.\r
47\r
3e8c18da 48 @param[in] Option The original option to copy from\r
49 @param[in] OptionLen The length of the original option\r
50 @param[in] FirstFragment Whether it is the first fragment\r
d1102dba 51 @param[in, out] Buf The buffer to copy options to. NULL\r
3e8c18da 52 @param[in, out] BufLen The length of the buffer\r
2ff29212 53\r
54 @retval EFI_SUCCESS The options are copied over\r
55 @retval EFI_BUFFER_TOO_SMALL Buf is NULL or BufLen provided is too small.\r
56\r
57**/\r
83cbd279 58EFI_STATUS\r
59Ip4CopyOption (\r
d1050b9d
MK
60 IN UINT8 *Option,\r
61 IN UINT32 OptionLen,\r
62 IN BOOLEAN FirstFragment,\r
63 IN OUT UINT8 *Buf OPTIONAL,\r
64 IN OUT UINT32 *BufLen\r
83cbd279 65 );\r
d1050b9d 66\r
83cbd279 67#endif\r