MedmodulePkg: Refine codes related to Dhcpv4 and Dhcpv6 configuration.

Add a new head file Dhcp.h in Mde/Include/IndustryStandard, normalize the
universal option numbers and other network number tags.

Cc: Sriram Subramanian <sriram-s@hpe.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
Zhang Lubo 2016-06-22 10:25:00 +08:00 committed by Jiaxin Wu
parent 8d648abc32
commit ac6c3d90ed
13 changed files with 182 additions and 333 deletions

View File

@ -6,7 +6,7 @@
RFC 1534: Interoperation Between DHCP and BOOTP
RFC 3396: Encoding Long Options in DHCP.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -26,7 +26,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/Dhcp4.h>
#include <Protocol/Udp4.h>
#include <IndustryStandard/Dhcp.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>

View File

@ -1,7 +1,7 @@
/** @file
EFI DHCP protocol implementation.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -1240,7 +1240,7 @@ DhcpSendMessage (
//
Packet->Dhcp4.Magik = DHCP_OPTION_MAGIC;
Buf = Packet->Dhcp4.Option;
Buf = DhcpAppendOption (Buf, DHCP_TAG_TYPE, 1, &Type);
Buf = DhcpAppendOption (Buf, DHCP4_TAG_MSG_TYPE, 1, &Type);
//
// Append the serverid option if necessary:
@ -1255,7 +1255,7 @@ DhcpSendMessage (
ASSERT ((Para != NULL) && (Para->ServerId != 0));
IpAddr = HTONL (Para->ServerId);
Buf = DhcpAppendOption (Buf, DHCP_TAG_SERVER_ID, 4, (UINT8 *) &IpAddr);
Buf = DhcpAppendOption (Buf, DHCP4_TAG_SERVER_ID, 4, (UINT8 *) &IpAddr);
}
//
@ -1281,7 +1281,7 @@ DhcpSendMessage (
}
if (IpAddr != 0) {
Buf = DhcpAppendOption (Buf, DHCP_TAG_REQUEST_IP, 4, (UINT8 *) &IpAddr);
Buf = DhcpAppendOption (Buf, DHCP4_TAG_REQUEST_IP, 4, (UINT8 *) &IpAddr);
}
//
@ -1291,7 +1291,7 @@ DhcpSendMessage (
//
if ((Type != DHCP_MSG_DECLINE) && (Type != DHCP_MSG_RELEASE)) {
MaxMsg = HTONS (0xFF00);
Buf = DhcpAppendOption (Buf, DHCP_TAG_MAXMSG, 2, (UINT8 *) &MaxMsg);
Buf = DhcpAppendOption (Buf, DHCP4_TAG_MAXMSG, 2, (UINT8 *) &MaxMsg);
}
//
@ -1299,7 +1299,7 @@ DhcpSendMessage (
//
if (Msg != NULL) {
Len = MIN ((UINT32) AsciiStrLen ((CHAR8 *) Msg), 255);
Buf = DhcpAppendOption (Buf, DHCP_TAG_MESSAGE, (UINT16) Len, Msg);
Buf = DhcpAppendOption (Buf, DHCP4_TAG_MESSAGE, (UINT16) Len, Msg);
}
//
@ -1312,7 +1312,7 @@ DhcpSendMessage (
// if it is a DHCP decline or DHCP release .
//
if (((Type == DHCP_MSG_DECLINE) || (Type == DHCP_MSG_RELEASE)) &&
(Config->OptionList[Index]->OpCode != DHCP_TAG_CLIENT_ID)) {
(Config->OptionList[Index]->OpCode != DHCP4_TAG_CLIENT_ID)) {
continue;
}
@ -1325,7 +1325,7 @@ DhcpSendMessage (
}
}
*(Buf++) = DHCP_TAG_EOP;
*(Buf++) = DHCP4_TAG_EOP;
Packet->Length += (UINT32) (Buf - Packet->Dhcp4.Option);
//

View File

@ -1,7 +1,7 @@
/** @file
Function to validate, parse, process the DHCP options.
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -20,91 +20,91 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/// DHCP_OPTION_FORMAT structure.
///
DHCP_OPTION_FORMAT DhcpOptionFormats[] = {
{DHCP_TAG_NETMASK, DHCP_OPTION_IP, 1, 1 , TRUE},
{DHCP_TAG_TIME_OFFSET, DHCP_OPTION_INT32, 1, 1 , FALSE},
{DHCP_TAG_ROUTER, DHCP_OPTION_IP, 1, -1 , TRUE},
{DHCP_TAG_TIME_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_NAME_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_DNS_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_LOG_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_COOKIE_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_LPR_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_IMPRESS_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_RL_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_HOSTNAME, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_BOOTFILE_LEN, DHCP_OPTION_INT16, 1, 1 , FALSE},
{DHCP_TAG_DUMP, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_DOMAINNAME, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_SWAP_SERVER, DHCP_OPTION_IP, 1, 1 , FALSE},
{DHCP_TAG_ROOTPATH, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_EXTEND_PATH, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_NETMASK, DHCP_OPTION_IP, 1, 1 , TRUE},
{DHCP4_TAG_TIME_OFFSET, DHCP_OPTION_INT32, 1, 1 , FALSE},
{DHCP4_TAG_ROUTER, DHCP_OPTION_IP, 1, -1 , TRUE},
{DHCP4_TAG_TIME_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_NAME_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_DNS_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_LOG_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_COOKIE_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_LPR_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_IMPRESS_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_RL_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_HOSTNAME, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_BOOTFILE_LEN, DHCP_OPTION_INT16, 1, 1 , FALSE},
{DHCP4_TAG_DUMP, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_DOMAINNAME, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_SWAP_SERVER, DHCP_OPTION_IP, 1, 1 , FALSE},
{DHCP4_TAG_ROOTPATH, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_EXTEND_PATH, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_IPFORWARD, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_NONLOCAL_SRR, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_POLICY_SRR, DHCP_OPTION_IPPAIR, 1, -1 , FALSE},
{DHCP_TAG_EMTU, DHCP_OPTION_INT16, 1, 1 , FALSE},
{DHCP_TAG_TTL, DHCP_OPTION_INT8, 1, 1 , FALSE},
{DHCP_TAG_PATHMTU_AGE, DHCP_OPTION_INT32, 1, 1 , FALSE},
{DHCP_TAG_PATHMTU_PLATEAU,DHCP_OPTION_INT16, 1, -1 , FALSE},
{DHCP4_TAG_IPFORWARD, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_NONLOCAL_SRR, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_POLICY_SRR, DHCP_OPTION_IPPAIR, 1, -1 , FALSE},
{DHCP4_TAG_EMTU, DHCP_OPTION_INT16, 1, 1 , FALSE},
{DHCP4_TAG_TTL, DHCP_OPTION_INT8, 1, 1 , FALSE},
{DHCP4_TAG_PATHMTU_AGE, DHCP_OPTION_INT32, 1, 1 , FALSE},
{DHCP4_TAG_PATHMTU_PLATEAU,DHCP_OPTION_INT16, 1, -1 , FALSE},
{DHCP_TAG_IFMTU, DHCP_OPTION_INT16, 1, 1 , FALSE},
{DHCP_TAG_SUBNET_LOCAL, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_BROADCAST, DHCP_OPTION_IP, 1, 1 , FALSE},
{DHCP_TAG_DISCOVER_MASK, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_SUPPLY_MASK, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_DISCOVER_ROUTE, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_ROUTER_SOLICIT, DHCP_OPTION_IP, 1, 1 , FALSE},
{DHCP_TAG_STATIC_ROUTE, DHCP_OPTION_IPPAIR, 1, -1 , FALSE},
{DHCP4_TAG_IFMTU, DHCP_OPTION_INT16, 1, 1 , FALSE},
{DHCP4_TAG_SUBNET_LOCAL, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_BROADCAST, DHCP_OPTION_IP, 1, 1 , FALSE},
{DHCP4_TAG_DISCOVER_MASK, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_SUPPLY_MASK, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_DISCOVER_ROUTE, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_ROUTER_SOLICIT, DHCP_OPTION_IP, 1, 1 , FALSE},
{DHCP4_TAG_STATIC_ROUTE, DHCP_OPTION_IPPAIR, 1, -1 , FALSE},
{DHCP_TAG_TRAILER, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_ARPAGE, DHCP_OPTION_INT32, 1, 1 , FALSE},
{DHCP_TAG_ETHER_ENCAP, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_TRAILER, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_ARPAGE, DHCP_OPTION_INT32, 1, 1 , FALSE},
{DHCP4_TAG_ETHER_ENCAP, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_TCP_TTL, DHCP_OPTION_INT8, 1, 1 , FALSE},
{DHCP_TAG_KEEP_INTERVAL, DHCP_OPTION_INT32, 1, 1 , FALSE},
{DHCP_TAG_KEEP_GARBAGE, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP4_TAG_TCP_TTL, DHCP_OPTION_INT8, 1, 1 , FALSE},
{DHCP4_TAG_KEEP_INTERVAL, DHCP_OPTION_INT32, 1, 1 , FALSE},
{DHCP4_TAG_KEEP_GARBAGE, DHCP_OPTION_SWITCH, 1, 1 , FALSE},
{DHCP_TAG_NIS_DOMAIN, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_NIS_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_NTP_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_VENDOR, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_NBNS, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_NBDD, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_NBTYPE, DHCP_OPTION_INT8, 1, 1 , FALSE},
{DHCP_TAG_NBSCOPE, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_XFONT, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_XDM, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_NIS_DOMAIN, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_NIS_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_NTP_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_VENDOR, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_NBNS, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_NBDD, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_NBTYPE, DHCP_OPTION_INT8, 1, 1 , FALSE},
{DHCP4_TAG_NBSCOPE, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_XFONT, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_XDM, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_REQUEST_IP, DHCP_OPTION_IP, 1, 1 , FALSE},
{DHCP_TAG_LEASE, DHCP_OPTION_INT32, 1, 1 , TRUE},
{DHCP_TAG_OVERLOAD, DHCP_OPTION_INT8, 1, 1 , TRUE},
{DHCP_TAG_TYPE, DHCP_OPTION_INT8, 1, 1 , TRUE},
{DHCP_TAG_SERVER_ID, DHCP_OPTION_IP, 1, 1 , TRUE},
{DHCP_TAG_PARA_LIST, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_MESSAGE, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_MAXMSG, DHCP_OPTION_INT16, 1, 1 , FALSE},
{DHCP_TAG_T1, DHCP_OPTION_INT32, 1, 1 , TRUE},
{DHCP_TAG_T2, DHCP_OPTION_INT32, 1, 1 , TRUE},
{DHCP_TAG_VENDOR_CLASS, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_CLIENT_ID, DHCP_OPTION_INT8, 2, -1 , FALSE},
{DHCP4_TAG_REQUEST_IP, DHCP_OPTION_IP, 1, 1 , FALSE},
{DHCP4_TAG_LEASE, DHCP_OPTION_INT32, 1, 1 , TRUE},
{DHCP4_TAG_OVERLOAD, DHCP_OPTION_INT8, 1, 1 , TRUE},
{DHCP4_TAG_MSG_TYPE, DHCP_OPTION_INT8, 1, 1 , TRUE},
{DHCP4_TAG_SERVER_ID, DHCP_OPTION_IP, 1, 1 , TRUE},
{DHCP4_TAG_PARA_LIST, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_MESSAGE, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_MAXMSG, DHCP_OPTION_INT16, 1, 1 , FALSE},
{DHCP4_TAG_T1, DHCP_OPTION_INT32, 1, 1 , TRUE},
{DHCP4_TAG_T2, DHCP_OPTION_INT32, 1, 1 , TRUE},
{DHCP4_TAG_VENDOR_CLASS_ID,DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_CLIENT_ID, DHCP_OPTION_INT8, 2, -1 , FALSE},
{DHCP_TAG_NISPLUS, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_NISPLUS_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_NISPLUS, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_NISPLUS_SERVER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_TFTP, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_BOOTFILE, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_TFTP, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP4_TAG_BOOTFILE, DHCP_OPTION_INT8, 1, -1 , FALSE},
{DHCP_TAG_MOBILEIP, DHCP_OPTION_IP, 0, -1 , FALSE},
{DHCP_TAG_SMTP, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_POP3, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_NNTP, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_WWW, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_FINGER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_IRC, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_STTALK, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_STDA, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_MOBILEIP, DHCP_OPTION_IP, 0, -1 , FALSE},
{DHCP4_TAG_SMTP, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_POP3, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_NNTP, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_WWW, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_FINGER, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_IRC, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_STTALK, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP4_TAG_STDA, DHCP_OPTION_IP, 1, -1 , FALSE},
{DHCP_TAG_CLASSLESS_ROUTE,DHCP_OPTION_INT8, 5, -1 , FALSE},
{DHCP4_TAG_CLASSLESS_ROUTE,DHCP_OPTION_INT8, 5, -1 , FALSE},
};
@ -248,22 +248,22 @@ DhcpGetParameter (
)
{
switch (Tag) {
case DHCP_TAG_NETMASK:
case DHCP4_TAG_NETMASK:
Para->NetMask = NetGetUint32 (Data);
break;
case DHCP_TAG_ROUTER:
case DHCP4_TAG_ROUTER:
//
// Return the first router to consumer which is the preferred one
//
Para->Router = NetGetUint32 (Data);
break;
case DHCP_TAG_LEASE:
case DHCP4_TAG_LEASE:
Para->Lease = NetGetUint32 (Data);
break;
case DHCP_TAG_OVERLOAD:
case DHCP4_TAG_OVERLOAD:
Para->Overload = *Data;
if ((Para->Overload < 1) || (Para->Overload > 3)) {
@ -271,7 +271,7 @@ DhcpGetParameter (
}
break;
case DHCP_TAG_TYPE:
case DHCP4_TAG_MSG_TYPE:
Para->DhcpType = *Data;
if ((Para->DhcpType < 1) || (Para->DhcpType > 9)) {
@ -279,15 +279,15 @@ DhcpGetParameter (
}
break;
case DHCP_TAG_SERVER_ID:
case DHCP4_TAG_SERVER_ID:
Para->ServerId = NetGetUint32 (Data);
break;
case DHCP_TAG_T1:
case DHCP4_TAG_T1:
Para->T1 = NetGetUint32 (Data);
break;
case DHCP_TAG_T2:
case DHCP4_TAG_T2:
Para->T2 = NetGetUint32 (Data);
break;
}
@ -299,13 +299,13 @@ DhcpGetParameter (
/**
Inspect all the options in a single buffer. DHCP options may be contained
in several buffers, such as the BOOTP options filed, boot file or server
name. Each option buffer is required to end with DHCP_TAG_EOP.
name. Each option buffer is required to end with DHCP4_TAG_EOP.
@param[in] Buffer The buffer which contains DHCP options
@param[in] BufLen The length of the buffer
@param[in] Check The callback function for each option found
@param[in] Context The opaque parameter for the Check
@param[out] Overload Variable to save the value of DHCP_TAG_OVERLOAD
@param[out] Overload Variable to save the value of DHCP4_TAG_OVERLOAD
option.
@retval EFI_SUCCESS All the options are valid
@ -330,10 +330,10 @@ DhcpIterateBufferOptions (
while (Cur < BufLen) {
Tag = Buffer[Cur];
if (Tag == DHCP_TAG_PAD) {
if (Tag == DHCP4_TAG_PAD) {
Cur++;
continue;
} else if (Tag == DHCP_TAG_EOP) {
} else if (Tag == DHCP4_TAG_EOP) {
return EFI_SUCCESS;
}
@ -349,7 +349,7 @@ DhcpIterateBufferOptions (
return EFI_INVALID_PARAMETER;
}
if ((Tag == DHCP_TAG_OVERLOAD) && (Overload != NULL)) {
if ((Tag == DHCP4_TAG_OVERLOAD) && (Overload != NULL)) {
if (Len != 1) {
return EFI_INVALID_PARAMETER;
}
@ -879,7 +879,7 @@ DhcpBuild (
}
}
*(Buf++) = DHCP_TAG_EOP;
*(Buf++) = DHCP4_TAG_EOP;
Packet->Length = sizeof (EFI_DHCP4_HEADER) + sizeof (UINT32)
+ (UINT32) (Buf - Packet->Dhcp4.Option);

View File

@ -1,7 +1,7 @@
/** @file
To validate, parse and process the DHCP options.
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -19,112 +19,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/// DHCP option tags (types)
///
//
// RFC1497 vendor extensions
//
#define DHCP_TAG_PAD 0 // Pad Option
#define DHCP_TAG_EOP 255 // End Option
#define DHCP_TAG_NETMASK 1 // Subnet Mask
#define DHCP_TAG_TIME_OFFSET 2 // Time Offset from UTC
#define DHCP_TAG_ROUTER 3 // Router option,
#define DHCP_TAG_TIME_SERVER 4 // Time Server
#define DHCP_TAG_NAME_SERVER 5 // Name Server
#define DHCP_TAG_DNS_SERVER 6 // Domain Name Server
#define DHCP_TAG_LOG_SERVER 7 // Log Server
#define DHCP_TAG_COOKIE_SERVER 8 // Cookie Server
#define DHCP_TAG_LPR_SERVER 9 // LPR Print Server
#define DHCP_TAG_IMPRESS_SERVER 10 // Impress Server
#define DHCP_TAG_RL_SERVER 11 // Resource Location Server
#define DHCP_TAG_HOSTNAME 12 // Host Name
#define DHCP_TAG_BOOTFILE_LEN 13 // Boot File Size
#define DHCP_TAG_DUMP 14 // Merit Dump File
#define DHCP_TAG_DOMAINNAME 15 // Domain Name
#define DHCP_TAG_SWAP_SERVER 16 // Swap Server
#define DHCP_TAG_ROOTPATH 17 // Root path
#define DHCP_TAG_EXTEND_PATH 18 // Extensions Path
//
// IP Layer Parameters per Host
//
#define DHCP_TAG_IPFORWARD 19 // IP Forwarding Enable/Disable
#define DHCP_TAG_NONLOCAL_SRR 20 // on-Local Source Routing Enable/Disable
#define DHCP_TAG_POLICY_SRR 21 // Policy Filter
#define DHCP_TAG_EMTU 22 // Maximum Datagram Reassembly Size
#define DHCP_TAG_TTL 23 // Default IP Time-to-live
#define DHCP_TAG_PATHMTU_AGE 24 // Path MTU Aging Timeout
#define DHCP_TAG_PATHMTU_PLATEAU 25 // Path MTU Plateau Table
//
// IP Layer Parameters per Interface
//
#define DHCP_TAG_IFMTU 26 // Interface MTU
#define DHCP_TAG_SUBNET_LOCAL 27 // All Subnets are Local
#define DHCP_TAG_BROADCAST 28 // Broadcast Address
#define DHCP_TAG_DISCOVER_MASK 29 // Perform Mask Discovery
#define DHCP_TAG_SUPPLY_MASK 30 // Mask Supplier
#define DHCP_TAG_DISCOVER_ROUTE 31 // Perform Router Discovery
#define DHCP_TAG_ROUTER_SOLICIT 32 // Router Solicitation Address
#define DHCP_TAG_STATIC_ROUTE 33 // Static Route
//
// Link Layer Parameters per Interface
//
#define DHCP_TAG_TRAILER 34 // Trailer Encapsulation
#define DHCP_TAG_ARPAGE 35 // ARP Cache Timeout
#define DHCP_TAG_ETHER_ENCAP 36 // Ethernet Encapsulation
//
// TCP Parameters
//
#define DHCP_TAG_TCP_TTL 37 // TCP Default TTL
#define DHCP_TAG_KEEP_INTERVAL 38 // TCP Keepalive Interval
#define DHCP_TAG_KEEP_GARBAGE 39 // TCP Keepalive Garbage
//
// Application and Service Parameters
//
#define DHCP_TAG_NIS_DOMAIN 40 // Network Information Service Domain
#define DHCP_TAG_NIS_SERVER 41 // Network Information Servers
#define DHCP_TAG_NTP_SERVER 42 // Network Time Protocol Servers
#define DHCP_TAG_VENDOR 43 // Vendor Specific Information
#define DHCP_TAG_NBNS 44 // NetBIOS over TCP/IP Name Server
#define DHCP_TAG_NBDD 45 // NetBIOS Datagram Distribution Server
#define DHCP_TAG_NBTYPE 46 // NetBIOS over TCP/IP Node Type
#define DHCP_TAG_NBSCOPE 47 // NetBIOS over TCP/IP Scope
#define DHCP_TAG_XFONT 48 // X Window System Font Server
#define DHCP_TAG_XDM 49 // X Window System Display Manager
#define DHCP_TAG_NISPLUS 64 // Network Information Service+ Domain
#define DHCP_TAG_NISPLUS_SERVER 65 // Network Information Service+ Servers
#define DHCP_TAG_MOBILEIP 68 // Mobile IP Home Agent
#define DHCP_TAG_SMTP 69 // Simple Mail Transport Protocol Server
#define DHCP_TAG_POP3 70 // Post Office Protocol (POP3) Server
#define DHCP_TAG_NNTP 71 // Network News Transport Protocol Server
#define DHCP_TAG_WWW 72 // Default World Wide Web (WWW) Server
#define DHCP_TAG_FINGER 73 // Default Finger Server
#define DHCP_TAG_IRC 74 // Default Internet Relay Chat (IRC) Server
#define DHCP_TAG_STTALK 75 // StreetTalk Server
#define DHCP_TAG_STDA 76 // StreetTalk Directory Assistance Server
#define DHCP_TAG_CLASSLESS_ROUTE 121 // Classless Route
//
// DHCP Extensions
//
#define DHCP_TAG_REQUEST_IP 50 // Requested IP Address
#define DHCP_TAG_LEASE 51 // IP Address Lease Time
#define DHCP_TAG_OVERLOAD 52 // Option Overload
#define DHCP_TAG_TFTP 66 // TFTP server name
#define DHCP_TAG_BOOTFILE 67 // Bootfile name
#define DHCP_TAG_TYPE 53 // DHCP Message Type
#define DHCP_TAG_SERVER_ID 54 // Server Identifier
#define DHCP_TAG_PARA_LIST 55 // Parameter Request List
#define DHCP_TAG_MESSAGE 56 // Message
#define DHCP_TAG_MAXMSG 57 // Maximum DHCP Message Size
#define DHCP_TAG_T1 58 // Renewal (T1) Time Value
#define DHCP_TAG_T2 59 // Rebinding (T2) Time Value
#define DHCP_TAG_VENDOR_CLASS 60 // Vendor class identifier
#define DHCP_TAG_CLIENT_ID 61 // Client-identifier
#define DHCP_OPTION_MAGIC 0x63538263 // Network byte order
#define DHCP_MAX_OPTIONS 256
@ -176,18 +70,18 @@ typedef struct {
/// classless route, who can parse the DHCP offer to get them.
///
typedef struct {
IP4_ADDR NetMask; // DHCP_TAG_NETMASK
IP4_ADDR Router; // DHCP_TAG_ROUTER, only the first router is used
IP4_ADDR NetMask; // DHCP4_TAG_NETMASK
IP4_ADDR Router; // DHCP4_TAG_ROUTER, only the first router is used
//
// DHCP specific options
//
UINT8 DhcpType; // DHCP_TAG_TYPE
UINT8 Overload; // DHCP_TAG_OVERLOAD
IP4_ADDR ServerId; // DHCP_TAG_SERVER_ID
UINT32 Lease; // DHCP_TAG_LEASE
UINT32 T1; // DHCP_TAG_T1
UINT32 T2; // DHCP_TAG_T2
UINT8 DhcpType; // DHCP4_TAG_MSG_TYPE
UINT8 Overload; // DHCP4_TAG_OVERLOAD
IP4_ADDR ServerId; // DHCP4_TAG_SERVER_ID
UINT32 Lease; // DHCP4_TAG_LEASE
UINT32 T1; // DHCP4_TAG_T1
UINT32 T2; // DHCP4_TAG_T2
} DHCP_PARAMETER;
///

View File

@ -1,7 +1,7 @@
/** @file
iSCSI DHCP related configuration routines.
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -222,7 +222,7 @@ IScsiDhcpSelectOffer (
}
for (Index = 0; Index < OptionCount; Index++) {
if (OptionList[Index]->OpCode != DHCP4_TAG_ROOT_PATH) {
if (OptionList[Index]->OpCode != DHCP4_TAG_ROOTPATH) {
continue;
}
@ -303,7 +303,7 @@ IScsiParseDhcpAck (
//
// Get DNS server addresses and DHCP server address from this offer.
//
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS) {
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS_SERVER) {
if (((OptionList[Index]->Length & 0x3) != 0) || (OptionList[Index]->Length == 0)) {
Status = EFI_INVALID_PARAMETER;
@ -414,8 +414,8 @@ IScsiDoDhcp (
Data = &ParaList->Data[0];
Data[0] = DHCP4_TAG_NETMASK;
Data[1] = DHCP4_TAG_ROUTER;
Data[2] = DHCP4_TAG_DNS;
Data[3] = DHCP4_TAG_ROOT_PATH;
Data[2] = DHCP4_TAG_DNS_SERVER;
Data[3] = DHCP4_TAG_ROOTPATH;
ZeroMem (&Dhcp4ConfigData, sizeof (EFI_DHCP4_CONFIG_DATA));
Dhcp4ConfigData.OptionCount = 1;

View File

@ -1,7 +1,7 @@
/** @file
The header file of IScsiDhcp.
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -17,12 +17,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/Dhcp4.h>
#define DHCP4_TAG_PARA_LIST 55
#define DHCP4_TAG_NETMASK 1
#define DHCP4_TAG_ROUTER 3
#define DHCP4_TAG_DNS 6
#define DHCP4_TAG_SERVER_ID 54
#define DHCP4_TAG_ROOT_PATH 17
#define ISCSI_ROOT_PATH_ID "iscsi:"
#define ISCSI_ROOT_PATH_FIELD_DELIMITER ':'

View File

@ -1,7 +1,7 @@
/** @file
The header file of IScsiImpl.c.
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -17,6 +17,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Uefi.h>
#include <IndustryStandard/Dhcp.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/NetLib.h>

View File

@ -874,7 +874,7 @@ Ip4Config2OnDhcp4Complete (
//
// Look for DNS Server opcode (6).
//
if (OptionList[Index]->OpCode == DHCP_TAG_DNS_SERVER) {
if (OptionList[Index]->OpCode == DHCP4_TAG_DNS_SERVER) {
if (((OptionList[Index]->Length & 0x3) != 0) || (OptionList[Index]->Length == 0)) {
break;
}
@ -992,11 +992,11 @@ Ip4StartAutoConfig (
// DHCP configuration to avoid problems if some DHCP client
// yields the control of this DHCP service to us.
//
ParaList.Head.OpCode = DHCP_TAG_PARA_LIST;
ParaList.Head.OpCode = DHCP4_TAG_PARA_LIST;
ParaList.Head.Length = 3;
ParaList.Head.Data[0] = DHCP_TAG_NETMASK;
ParaList.Route = DHCP_TAG_ROUTER;
ParaList.Dns = DHCP_TAG_DNS_SERVER;
ParaList.Head.Data[0] = DHCP4_TAG_NETMASK;
ParaList.Route = DHCP4_TAG_ROUTER;
ParaList.Dns = DHCP4_TAG_DNS_SERVER;
OptionList[0] = &ParaList.Head;
Dhcp4Mode.ConfigData.OptionCount = 1;
Dhcp4Mode.ConfigData.OptionList = OptionList;

View File

@ -25,11 +25,6 @@
#define DATA_ATTRIB_SIZE_FIXED 0x1
#define DATA_ATTRIB_VOLATILE 0x2
#define DHCP_TAG_PARA_LIST 55
#define DHCP_TAG_NETMASK 1
#define DHCP_TAG_ROUTER 3
#define DHCP_TAG_DNS_SERVER 6
#define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits))
#define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits))
@ -202,7 +197,7 @@ struct _IP4_CONFIG2_INSTANCE {
//
// Configure the DHCP to request the routers and netmask
// from server. The DHCP_TAG_NETMASK is included in Head.
// from server. The DHCP4_TAG_NETMASK is included in Head.
//
#pragma pack(1)
typedef struct {

View File

@ -1,7 +1,7 @@
/** @file
Ip4 internal functions and type defintions.
Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
@ -28,6 +28,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/HiiConfigAccess.h>
#include <IndustryStandard/Dhcp.h>
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>

View File

@ -20,13 +20,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// This is a map from the interested DHCP4 option tags' index to the tag value.
//
UINT8 mInterestedDhcp4Tags[PXEBC_DHCP4_TAG_INDEX_MAX] = {
PXEBC_DHCP4_TAG_BOOTFILE_LEN,
PXEBC_DHCP4_TAG_VENDOR,
PXEBC_DHCP4_TAG_OVERLOAD,
PXEBC_DHCP4_TAG_MSG_TYPE,
PXEBC_DHCP4_TAG_SERVER_ID,
PXEBC_DHCP4_TAG_CLASS_ID,
PXEBC_DHCP4_TAG_BOOTFILE
DHCP4_TAG_BOOTFILE_LEN,
DHCP4_TAG_VENDOR,
DHCP4_TAG_OVERLOAD,
DHCP4_TAG_MSG_TYPE,
DHCP4_TAG_SERVER_ID,
DHCP4_TAG_VENDOR_CLASS_ID,
DHCP4_TAG_BOOTFILE
};
@ -62,7 +62,7 @@ PxeBcInitSeedPacket (
CopyMem (Header->ClientHwAddr, &Mode.CurrentAddress, Header->HwAddrLen);
Seed->Dhcp4.Magik = PXEBC_DHCP4_MAGIC;
Seed->Dhcp4.Option[0] = PXEBC_DHCP4_TAG_EOP;
Seed->Dhcp4.Option[0] = DHCP4_TAG_EOP;
}
@ -885,7 +885,7 @@ PxeBcDhcpCallBack (
MaxMsgSize = PxeBcParseExtendOptions (
Packet->Dhcp4.Option,
GET_OPTION_BUFFER_LEN (Packet),
PXEBC_DHCP4_TAG_MAXMSG
DHCP4_TAG_MAXMSG
);
if (MaxMsgSize != NULL) {
Value = HTONS (PXEBC_DHCP4_MAX_PACKET_SIZE);
@ -1012,7 +1012,7 @@ PxeBcBuildDhcpOptions (
//
// Append message type.
//
OptList[Index]->OpCode = PXEBC_DHCP4_TAG_MSG_TYPE;
OptList[Index]->OpCode = DHCP4_TAG_MSG_TYPE;
OptList[Index]->Length = 1;
OptEnt.Mesg = (PXEBC_DHCP4_OPTION_MESG *) OptList[Index]->Data;
OptEnt.Mesg->Type = PXEBC_DHCP4_MSG_TYPE_REQUEST;
@ -1022,7 +1022,7 @@ PxeBcBuildDhcpOptions (
//
// Append max message size.
//
OptList[Index]->OpCode = PXEBC_DHCP4_TAG_MAXMSG;
OptList[Index]->OpCode = DHCP4_TAG_MAXMSG;
OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE);
OptEnt.MaxMesgSize = (PXEBC_DHCP4_OPTION_MAX_MESG_SIZE *) OptList[Index]->Data;
Value = NTOHS (PXEBC_DHCP4_MAX_PACKET_SIZE);
@ -1033,36 +1033,36 @@ PxeBcBuildDhcpOptions (
//
// Parameter request list option.
//
OptList[Index]->OpCode = PXEBC_DHCP4_TAG_PARA_LIST;
OptList[Index]->OpCode = DHCP4_TAG_PARA_LIST;
OptList[Index]->Length = 35;
OptEnt.Para = (PXEBC_DHCP4_OPTION_PARA *) OptList[Index]->Data;
OptEnt.Para->ParaList[0] = PXEBC_DHCP4_TAG_NETMASK;
OptEnt.Para->ParaList[1] = PXEBC_DHCP4_TAG_TIME_OFFSET;
OptEnt.Para->ParaList[2] = PXEBC_DHCP4_TAG_ROUTER;
OptEnt.Para->ParaList[3] = PXEBC_DHCP4_TAG_TIME_SERVER;
OptEnt.Para->ParaList[4] = PXEBC_DHCP4_TAG_NAME_SERVER;
OptEnt.Para->ParaList[5] = PXEBC_DHCP4_TAG_DNS_SERVER;
OptEnt.Para->ParaList[6] = PXEBC_DHCP4_TAG_HOSTNAME;
OptEnt.Para->ParaList[7] = PXEBC_DHCP4_TAG_BOOTFILE_LEN;
OptEnt.Para->ParaList[8] = PXEBC_DHCP4_TAG_DOMAINNAME;
OptEnt.Para->ParaList[9] = PXEBC_DHCP4_TAG_ROOTPATH;
OptEnt.Para->ParaList[10] = PXEBC_DHCP4_TAG_EXTEND_PATH;
OptEnt.Para->ParaList[11] = PXEBC_DHCP4_TAG_EMTU;
OptEnt.Para->ParaList[12] = PXEBC_DHCP4_TAG_TTL;
OptEnt.Para->ParaList[13] = PXEBC_DHCP4_TAG_BROADCAST;
OptEnt.Para->ParaList[14] = PXEBC_DHCP4_TAG_NIS_DOMAIN;
OptEnt.Para->ParaList[15] = PXEBC_DHCP4_TAG_NIS_SERVER;
OptEnt.Para->ParaList[16] = PXEBC_DHCP4_TAG_NTP_SERVER;
OptEnt.Para->ParaList[17] = PXEBC_DHCP4_TAG_VENDOR;
OptEnt.Para->ParaList[18] = PXEBC_DHCP4_TAG_REQUEST_IP;
OptEnt.Para->ParaList[19] = PXEBC_DHCP4_TAG_LEASE;
OptEnt.Para->ParaList[20] = PXEBC_DHCP4_TAG_SERVER_ID;
OptEnt.Para->ParaList[21] = PXEBC_DHCP4_TAG_T1;
OptEnt.Para->ParaList[22] = PXEBC_DHCP4_TAG_T2;
OptEnt.Para->ParaList[23] = PXEBC_DHCP4_TAG_CLASS_ID;
OptEnt.Para->ParaList[24] = PXEBC_DHCP4_TAG_TFTP;
OptEnt.Para->ParaList[25] = PXEBC_DHCP4_TAG_BOOTFILE;
OptEnt.Para->ParaList[26] = PXEBC_PXE_DHCP4_TAG_UUID;
OptEnt.Para->ParaList[0] = DHCP4_TAG_NETMASK;
OptEnt.Para->ParaList[1] = DHCP4_TAG_TIME_OFFSET;
OptEnt.Para->ParaList[2] = DHCP4_TAG_ROUTER;
OptEnt.Para->ParaList[3] = DHCP4_TAG_TIME_SERVER;
OptEnt.Para->ParaList[4] = DHCP4_TAG_NAME_SERVER;
OptEnt.Para->ParaList[5] = DHCP4_TAG_DNS_SERVER;
OptEnt.Para->ParaList[6] = DHCP4_TAG_HOSTNAME;
OptEnt.Para->ParaList[7] = DHCP4_TAG_BOOTFILE_LEN;
OptEnt.Para->ParaList[8] = DHCP4_TAG_DOMAINNAME;
OptEnt.Para->ParaList[9] = DHCP4_TAG_ROOTPATH;
OptEnt.Para->ParaList[10] = DHCP4_TAG_EXTEND_PATH;
OptEnt.Para->ParaList[11] = DHCP4_TAG_EMTU;
OptEnt.Para->ParaList[12] = DHCP4_TAG_TTL;
OptEnt.Para->ParaList[13] = DHCP4_TAG_BROADCAST;
OptEnt.Para->ParaList[14] = DHCP4_TAG_NIS_DOMAIN;
OptEnt.Para->ParaList[15] = DHCP4_TAG_NIS_SERVER;
OptEnt.Para->ParaList[16] = DHCP4_TAG_NTP_SERVER;
OptEnt.Para->ParaList[17] = DHCP4_TAG_VENDOR;
OptEnt.Para->ParaList[18] = DHCP4_TAG_REQUEST_IP;
OptEnt.Para->ParaList[19] = DHCP4_TAG_LEASE;
OptEnt.Para->ParaList[20] = DHCP4_TAG_SERVER_ID;
OptEnt.Para->ParaList[21] = DHCP4_TAG_T1;
OptEnt.Para->ParaList[22] = DHCP4_TAG_T2;
OptEnt.Para->ParaList[23] = DHCP4_TAG_VENDOR_CLASS_ID;
OptEnt.Para->ParaList[24] = DHCP4_TAG_TFTP;
OptEnt.Para->ParaList[25] = DHCP4_TAG_BOOTFILE;
OptEnt.Para->ParaList[26] = DHCP4_TAG_UUID;
OptEnt.Para->ParaList[27] = 0x80;
OptEnt.Para->ParaList[28] = 0x81;
OptEnt.Para->ParaList[29] = 0x82;
@ -1077,7 +1077,7 @@ PxeBcBuildDhcpOptions (
//
// Append UUID/Guid-based client identifier option
//
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_UUID;
OptList[Index]->OpCode = DHCP4_TAG_UUID;
OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_UUID);
OptEnt.Uuid = (PXEBC_DHCP4_OPTION_UUID *) OptList[Index]->Data;
OptEnt.Uuid->Type = 0;
@ -1096,7 +1096,7 @@ PxeBcBuildDhcpOptions (
//
// Append client network device interface option
//
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_UNDI;
OptList[Index]->OpCode = DHCP4_TAG_UNDI;
OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_UNDI);
OptEnt.Undi = (PXEBC_DHCP4_OPTION_UNDI *) OptList[Index]->Data;
if (Private->Nii != NULL) {
@ -1115,7 +1115,7 @@ PxeBcBuildDhcpOptions (
//
// Append client system architecture option
//
OptList[Index]->OpCode = PXEBC_PXE_DHCP4_TAG_ARCH;
OptList[Index]->OpCode = DHCP4_TAG_ARCH;
OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_ARCH);
OptEnt.Arch = (PXEBC_DHCP4_OPTION_ARCH *) OptList[Index]->Data;
Value = HTONS (EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE);
@ -1126,7 +1126,7 @@ PxeBcBuildDhcpOptions (
//
// Append client system architecture option
//
OptList[Index]->OpCode = PXEBC_DHCP4_TAG_CLASS_ID;
OptList[Index]->OpCode = DHCP4_TAG_VENDOR_CLASS_ID;
OptList[Index]->Length = (UINT8) sizeof (PXEBC_DHCP4_OPTION_CLID);
OptEnt.Clid = (PXEBC_DHCP4_OPTION_CLID *) OptList[Index]->Data;
CopyMem (OptEnt.Clid, DEFAULT_CLASS_ID_DATA, sizeof (PXEBC_DHCP4_OPTION_CLID));
@ -1229,7 +1229,7 @@ PxeBcDiscvBootService (
return EFI_OUT_OF_RESOURCES;
}
OptList[OptCount]->OpCode = PXEBC_DHCP4_TAG_VENDOR;
OptList[OptCount]->OpCode = DHCP4_TAG_VENDOR;
OptList[OptCount]->Length = (UINT8) (VendorOptLen - 2);
PxeOpt = (EFI_DHCP4_PACKET_OPTION *) OptList[OptCount]->Data;
PxeOpt->OpCode = PXEBC_VENDOR_TAG_BOOT_ITEM;
@ -1237,7 +1237,7 @@ PxeBcDiscvBootService (
PxeBootItem = (PXEBC_OPTION_BOOT_ITEM *) PxeOpt->Data;
PxeBootItem->Type = HTONS (Type);
PxeBootItem->Layer = HTONS (*Layer);
PxeOpt->Data[PxeOpt->Length] = PXEBC_DHCP4_TAG_EOP;
PxeOpt->Data[PxeOpt->Length] = DHCP4_TAG_EOP;
OptCount++;
}
@ -1382,7 +1382,7 @@ PxeBcDiscvBootService (
@param OptTag The option OpCode.
@return NULL if the buffer length is 0 and OpCode is not
PXEBC_DHCP4_TAG_EOP, or the pointer to the buffer.
DHCP4_TAG_EOP, or the pointer to the buffer.
**/
EFI_DHCP4_PACKET_OPTION *
@ -1398,14 +1398,14 @@ PxeBcParseExtendOptions (
Option = (EFI_DHCP4_PACKET_OPTION *) Buffer;
Offset = 0;
while (Offset < Length && Option->OpCode != PXEBC_DHCP4_TAG_EOP) {
while (Offset < Length && Option->OpCode != DHCP4_TAG_EOP) {
if (Option->OpCode == OptTag) {
return Option;
}
if (Option->OpCode == PXEBC_DHCP4_TAG_PAD) {
if (Option->OpCode == DHCP4_TAG_PAD) {
Offset++;
} else {
Offset += Option->Length + 2;
@ -1443,7 +1443,7 @@ PxeBcParseVendorOptions (
PxeOption = (EFI_DHCP4_PACKET_OPTION *) &Dhcp4Option->Data[0];
Offset = 0;
while ((Offset < VendorOptionLen) && (PxeOption->OpCode != PXEBC_DHCP4_TAG_EOP)) {
while ((Offset < VendorOptionLen) && (PxeOption->OpCode != DHCP4_TAG_EOP)) {
//
// Parse every Vendor Option and set its BitMap
//
@ -1524,7 +1524,7 @@ PxeBcParseVendorOptions (
SET_VENDOR_OPTION_BIT_MAP (BitMap, PxeOption->OpCode);
if (PxeOption->OpCode == PXEBC_DHCP4_TAG_PAD) {
if (PxeOption->OpCode == DHCP4_TAG_PAD) {
Offset++;
} else {
Offset = (UINT8) (Offset + PxeOption->Length + 2);

View File

@ -2,7 +2,7 @@
Dhcp and Discover routines for PxeBc.
Copyright (c) 2013, Red Hat, Inc.
Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -29,46 +29,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define PXEBC_DHCP4_OPCODE_REPLY 2
#define PXEBC_DHCP4_MSG_TYPE_REQUEST 3
#define PXEBC_DHCP4_MAGIC 0x63538263 // network byte order
//
// Dhcp Options
//
#define PXEBC_DHCP4_TAG_PAD 0 // Pad Option
#define PXEBC_DHCP4_TAG_EOP 255 // End Option
#define PXEBC_DHCP4_TAG_NETMASK 1 // Subnet Mask
#define PXEBC_DHCP4_TAG_TIME_OFFSET 2 // Time Offset from UTC
#define PXEBC_DHCP4_TAG_ROUTER 3 // Router option,
#define PXEBC_DHCP4_TAG_TIME_SERVER 4 // Time Server
#define PXEBC_DHCP4_TAG_NAME_SERVER 5 // Name Server
#define PXEBC_DHCP4_TAG_DNS_SERVER 6 // Domain Name Server
#define PXEBC_DHCP4_TAG_HOSTNAME 12 // Host Name
#define PXEBC_DHCP4_TAG_BOOTFILE_LEN 13 // Boot File Size
#define PXEBC_DHCP4_TAG_DUMP 14 // Merit Dump File
#define PXEBC_DHCP4_TAG_DOMAINNAME 15 // Domain Name
#define PXEBC_DHCP4_TAG_ROOTPATH 17 // Root path
#define PXEBC_DHCP4_TAG_EXTEND_PATH 18 // Extensions Path
#define PXEBC_DHCP4_TAG_EMTU 22 // Maximum Datagram Reassembly Size
#define PXEBC_DHCP4_TAG_TTL 23 // Default IP Time-to-live
#define PXEBC_DHCP4_TAG_BROADCAST 28 // Broadcast Address
#define PXEBC_DHCP4_TAG_NIS_DOMAIN 40 // Network Information Service Domain
#define PXEBC_DHCP4_TAG_NIS_SERVER 41 // Network Information Servers
#define PXEBC_DHCP4_TAG_NTP_SERVER 42 // Network Time Protocol Servers
#define PXEBC_DHCP4_TAG_VENDOR 43 // Vendor Specific Information
#define PXEBC_DHCP4_TAG_REQUEST_IP 50 // Requested IP Address
#define PXEBC_DHCP4_TAG_LEASE 51 // IP Address Lease Time
#define PXEBC_DHCP4_TAG_OVERLOAD 52 // Option Overload
#define PXEBC_DHCP4_TAG_MSG_TYPE 53 // DHCP Message Type
#define PXEBC_DHCP4_TAG_SERVER_ID 54 // Server Identifier
#define PXEBC_DHCP4_TAG_PARA_LIST 55 // Parameter Request List
#define PXEBC_DHCP4_TAG_MAXMSG 57 // Maximum DHCP Message Size
#define PXEBC_DHCP4_TAG_T1 58 // Renewal (T1) Time Value
#define PXEBC_DHCP4_TAG_T2 59 // Rebinding (T2) Time Value
#define PXEBC_DHCP4_TAG_CLASS_ID 60 // Vendor class identifier
#define PXEBC_DHCP4_TAG_CLIENT_ID 61 // Client-identifier
#define PXEBC_DHCP4_TAG_TFTP 66 // TFTP server name
#define PXEBC_DHCP4_TAG_BOOTFILE 67 // Bootfile name
#define PXEBC_PXE_DHCP4_TAG_ARCH 93
#define PXEBC_PXE_DHCP4_TAG_UNDI 94
#define PXEBC_PXE_DHCP4_TAG_UUID 97
//
// Sub-Options in Dhcp Vendor Option
//
@ -472,7 +433,7 @@ PxeBcCreateBootOptions (
@param OptTag The option OpCode.
@return NULL if the buffer length is 0 and OpCode is not
PXEBC_DHCP4_TAG_EOP, or the pointer to the buffer.
DHCP4_TAG_EOP, or the pointer to the buffer.
**/
EFI_DHCP4_PACKET_OPTION *

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@ -21,6 +21,7 @@ typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA;
#include <Guid/SmBios.h>
#include <IndustryStandard/SmBios.h>
#include <IndustryStandard/Dhcp.h>
#include <Protocol/Dhcp4.h>
#include <Protocol/PxeBaseCode.h>
#include <Protocol/Mtftp4.h>