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