]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Option.h
code scrub fix
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Ip4Dxe / Ip4Option.h
1 /** @file
2 IP4 option support routines.
3
4 Copyright (c) 2005 - 2006, Intel Corporation.<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __EFI_IP4_OPTION_H__
16 #define __EFI_IP4_OPTION_H__
17
18 typedef enum {
19 IP4_OPTION_EOP = 0,
20 IP4_OPTION_NOP = 1,
21 IP4_OPTION_LSRR = 131, // Loss source and record routing, 10000011
22 IP4_OPTION_SSRR = 137, // Strict source and record routing, 10001001
23 IP4_OPTION_RR = 7, // Record routing, 00000111
24
25 IP4_OPTION_COPY_MASK = 0x80
26 } IP4_OPTION_ENUM_TYPES;
27
28 /**
29 Validate the IP4 option format for both the packets we received
30 and will transmit. It will compute the ICMP error message fields
31 if the option is mal-formated. But this information isn't used.
32
33 @param[in] Option The first byte of the option
34 @param[in] OptionLen The length of the whole option
35 @param[in] Rcvd The option is from the packet we received if TRUE,
36 otherwise the option we wants to transmit.
37
38 @retval TRUE The option is properly formatted
39 @retval FALSE The option is mal-formated
40
41 **/
42 BOOLEAN
43 Ip4OptionIsValid (
44 IN UINT8 *Option,
45 IN UINT32 OptionLen,
46 IN BOOLEAN Rcvd
47 );
48
49 /**
50 Copy the option from the original option to buffer. It
51 handles the details such as:
52 1. whether copy the single IP4 option to the first/non-first
53 fragments.
54 2. Pad the options copied over to aligned to 4 bytes.
55
56 @param[in] Option The original option to copy from
57 @param[in] OptionLen The length of the original option
58 @param[in] FirstFragment Whether it is the first fragment
59 @param[in, out] Buf The buffer to copy options to. NULL
60 @param[in, out] BufLen The length of the buffer
61
62 @retval EFI_SUCCESS The options are copied over
63 @retval EFI_BUFFER_TOO_SMALL Buf is NULL or BufLen provided is too small.
64
65 **/
66 EFI_STATUS
67 Ip4CopyOption (
68 IN UINT8 *Option,
69 IN UINT32 OptionLen,
70 IN BOOLEAN FirstFragment,
71 IN OUT UINT8 *Buf, OPTIONAL
72 IN OUT UINT32 *BufLen
73 );
74 #endif