BaseTools:Change the path of the file that Binary Cache
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Option.h
1 /** @file
2 IP4 option support routines.
3
4 Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef __EFI_IP4_OPTION_H__
10 #define __EFI_IP4_OPTION_H__
11
12 #define IP4_OPTION_EOP 0
13 #define IP4_OPTION_NOP 1
14 #define IP4_OPTION_LSRR 131 // Loss source and record routing, 10000011
15 #define IP4_OPTION_SSRR 137 // Strict source and record routing, 10001001
16 #define IP4_OPTION_RR 7 // Record routing, 00000111
17
18 #define IP4_OPTION_COPY_MASK 0x80
19
20 /**
21 Validate the IP4 option format for both the packets we received
22 and will transmit. It will compute the ICMP error message fields
23 if the option is mal-formated. But this information isn't used.
24
25 @param[in] Option The first byte of the option
26 @param[in] OptionLen The length of the whole option
27 @param[in] Rcvd The option is from the packet we received if TRUE,
28 otherwise the option we wants to transmit.
29
30 @retval TRUE The option is properly formatted
31 @retval FALSE The option is mal-formated
32
33 **/
34 BOOLEAN
35 Ip4OptionIsValid (
36 IN UINT8 *Option,
37 IN UINT32 OptionLen,
38 IN BOOLEAN Rcvd
39 );
40
41 /**
42 Copy the option from the original option to buffer. It
43 handles the details such as:
44 1. whether copy the single IP4 option to the first/non-first
45 fragments.
46 2. Pad the options copied over to aligned to 4 bytes.
47
48 @param[in] Option The original option to copy from
49 @param[in] OptionLen The length of the original option
50 @param[in] FirstFragment Whether it is the first fragment
51 @param[in, out] Buf The buffer to copy options to. NULL
52 @param[in, out] BufLen The length of the buffer
53
54 @retval EFI_SUCCESS The options are copied over
55 @retval EFI_BUFFER_TOO_SMALL Buf is NULL or BufLen provided is too small.
56
57 **/
58 EFI_STATUS
59 Ip4CopyOption (
60 IN UINT8 *Option,
61 IN UINT32 OptionLen,
62 IN BOOLEAN FirstFragment,
63 IN OUT UINT8 *Buf, OPTIONAL
64 IN OUT UINT32 *BufLen
65 );
66 #endif