本文整理汇总了C++中EFI_PXE_BASE_CODE_PROTOCOL::Discover方法的典型用法代码示例。如果您正苦于以下问题:C++ EFI_PXE_BASE_CODE_PROTOCOL::Discover方法的具体用法?C++ EFI_PXE_BASE_CODE_PROTOCOL::Discover怎么用?C++ EFI_PXE_BASE_CODE_PROTOCOL::Discover使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EFI_PXE_BASE_CODE_PROTOCOL
的用法示例。
在下文中一共展示了EFI_PXE_BASE_CODE_PROTOCOL::Discover方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PxeBcSelectBootPrompt
/**
Discover all the boot information for boot file.
@param[in, out] Private Pointer to PxeBc private data.
@param[out] BufferSize Size of the boot file to be downloaded.
@retval EFI_SUCCESS Successfully obtained all the boot information .
@retval EFI_BUFFER_TOO_SMALL The buffer size is not enough for boot file.
@retval EFI_ABORTED User cancel current operation.
@retval Others Failed to parse out the boot information.
**/
EFI_STATUS
PxeBcDiscoverBootFile (
IN OUT PXEBC_PRIVATE_DATA *Private,
OUT UINT64 *BufferSize
)
{
EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
EFI_PXE_BASE_CODE_MODE *Mode;
EFI_STATUS Status;
UINT16 Type;
UINT16 Layer;
BOOLEAN UseBis;
PxeBc = &Private->PxeBc;
Mode = PxeBc->Mode;
Type = EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP;
Layer = EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL;
//
// Start D.O.R.A/S.A.R.R exchange to acquire station ip address and
// other pxe boot information.
//
Status = PxeBc->Dhcp (PxeBc, TRUE);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Select a boot server from boot server list.
//
Status = PxeBcSelectBootPrompt (Private);
if (Status == EFI_SUCCESS) {
//
// Choose by user's input.
//
Status = PxeBcSelectBootMenu (Private, &Type, FALSE);
} else if (Status == EFI_TIMEOUT) {
//
// Choose by default item.
//
Status = PxeBcSelectBootMenu (Private, &Type, TRUE);
}
if (!EFI_ERROR (Status)) {
if (Type == EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP) {
//
// Local boot(PXE bootstrap server) need abort
//
return EFI_ABORTED;
}
//
// Start to discover the boot server to get (m)tftp server ip address, bootfile
// name and bootfile size.
//
UseBis = (BOOLEAN) (Mode->BisSupported && Mode->BisDetected);
Status = PxeBc->Discover (PxeBc, Type, &Layer, UseBis, NULL);
if (EFI_ERROR (Status)) {
return Status;
}
if (Mode->PxeReplyReceived && !Mode->ProxyOfferReceived) {
//
// Some network boot loader only search the packet in Mode.ProxyOffer to get its server
// IP address, so we need to store a copy of Mode.PxeReply packet into Mode.ProxyOffer.
//
if (Mode->UsingIpv6) {
CopyMem (
&Mode->ProxyOffer.Dhcpv6,
&Mode->PxeReply.Dhcpv6,
Private->PxeReply.Dhcp6.Packet.Ack.Length
);
} else {
CopyMem (
&Mode->ProxyOffer.Dhcpv4,
&Mode->PxeReply.Dhcpv4,
Private->PxeReply.Dhcp4.Packet.Ack.Length
);
}
Mode->ProxyOfferReceived = TRUE;
}
}
//
// Parse the boot information.
//
//.........这里部分代码省略.........