2007-09-30 05:08:02 +02:00
|
|
|
/** @file
|
2009-01-16 01:09:52 +01:00
|
|
|
IP4 option support routines.
|
2018-06-27 15:08:52 +02:00
|
|
|
|
|
|
|
Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
|
2010-04-24 11:33:45 +02:00
|
|
|
This program and the accompanying materials
|
2007-09-30 05:08:02 +02:00
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __EFI_IP4_OPTION_H__
|
|
|
|
#define __EFI_IP4_OPTION_H__
|
|
|
|
|
2009-11-04 09:18:34 +01:00
|
|
|
#define IP4_OPTION_EOP 0
|
|
|
|
#define IP4_OPTION_NOP 1
|
|
|
|
#define IP4_OPTION_LSRR 131 // Loss source and record routing, 10000011
|
|
|
|
#define IP4_OPTION_SSRR 137 // Strict source and record routing, 10001001
|
|
|
|
#define IP4_OPTION_RR 7 // Record routing, 00000111
|
2007-09-30 05:08:02 +02:00
|
|
|
|
2009-11-04 09:18:34 +01:00
|
|
|
#define IP4_OPTION_COPY_MASK 0x80
|
2007-09-30 05:08:02 +02:00
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Validate the IP4 option format for both the packets we received
|
|
|
|
and will transmit. It will compute the ICMP error message fields
|
|
|
|
if the option is mal-formated. But this information isn't used.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] Option The first byte of the option
|
|
|
|
@param[in] OptionLen The length of the whole option
|
|
|
|
@param[in] Rcvd The option is from the packet we received if TRUE,
|
2008-11-18 10:29:44 +01:00
|
|
|
otherwise the option we wants to transmit.
|
|
|
|
|
|
|
|
@retval TRUE The option is properly formatted
|
|
|
|
@retval FALSE The option is mal-formated
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
BOOLEAN
|
|
|
|
Ip4OptionIsValid (
|
|
|
|
IN UINT8 *Option,
|
2008-11-18 10:29:44 +01:00
|
|
|
IN UINT32 OptionLen,
|
2007-09-30 05:08:02 +02:00
|
|
|
IN BOOLEAN Rcvd
|
|
|
|
);
|
|
|
|
|
2008-11-18 10:29:44 +01:00
|
|
|
/**
|
|
|
|
Copy the option from the original option to buffer. It
|
|
|
|
handles the details such as:
|
|
|
|
1. whether copy the single IP4 option to the first/non-first
|
|
|
|
fragments.
|
|
|
|
2. Pad the options copied over to aligned to 4 bytes.
|
|
|
|
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in] Option The original option to copy from
|
|
|
|
@param[in] OptionLen The length of the original option
|
|
|
|
@param[in] FirstFragment Whether it is the first fragment
|
2018-06-27 15:08:52 +02:00
|
|
|
@param[in, out] Buf The buffer to copy options to. NULL
|
2009-01-16 01:09:52 +01:00
|
|
|
@param[in, out] BufLen The length of the buffer
|
2008-11-18 10:29:44 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The options are copied over
|
|
|
|
@retval EFI_BUFFER_TOO_SMALL Buf is NULL or BufLen provided is too small.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
Ip4CopyOption (
|
2008-11-18 10:29:44 +01:00
|
|
|
IN UINT8 *Option,
|
|
|
|
IN UINT32 OptionLen,
|
|
|
|
IN BOOLEAN FirstFragment,
|
|
|
|
IN OUT UINT8 *Buf, OPTIONAL
|
2007-09-30 05:08:02 +02:00
|
|
|
IN OUT UINT32 *BufLen
|
|
|
|
);
|
|
|
|
#endif
|