mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
Scrubbed some files for IP4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6447 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
725c7e2257
commit
5405e9a66b
@ -23,7 +23,7 @@ Abstract:
|
||||
|
||||
|
||||
/**
|
||||
Return the cast type (Unicast/Boradcast) specific to a
|
||||
Return the cast type (Unicast/Boradcast) specific to an
|
||||
interface. All the addresses are host byte ordered.
|
||||
|
||||
@param IpAddr The IP address to classify in host byte order
|
||||
@ -34,6 +34,7 @@ Abstract:
|
||||
@retval IP4_SUBNET_BROADCAST The IpAddr is a directed subnet boradcast to the
|
||||
interface
|
||||
@retval IP4_NET_BROADCAST The IpAddr is a network broadcast to the interface
|
||||
@retval 0 Otherwise.
|
||||
|
||||
**/
|
||||
INTN
|
||||
@ -69,8 +70,8 @@ Ip4GetNetCast (
|
||||
@param Src The source address in the packet (host byte order)
|
||||
|
||||
@return The cast type for the Dst, it will return on the first non-promiscuous
|
||||
@return cast type to a configured interface. If the packet doesn't match any of
|
||||
@return the interface, multicast address and local broadcast address are checked.
|
||||
cast type to a configured interface. If the packet doesn't match any of
|
||||
the interface, multicast address and local broadcast address are checked.
|
||||
|
||||
**/
|
||||
INTN
|
||||
@ -119,11 +120,11 @@ Ip4GetHostCast (
|
||||
if (Dst == IP4_ALLONE_ADDRESS) {
|
||||
IpIf = Ip4FindNet (IpSb, Src);
|
||||
|
||||
if (IpIf && !IP4_IS_BROADCAST (Ip4GetNetCast (Src, IpIf))) {
|
||||
if (IpIf != NULL && !IP4_IS_BROADCAST (Ip4GetNetCast (Src, IpIf))) {
|
||||
return IP4_LOCAL_BROADCAST;
|
||||
}
|
||||
|
||||
} else if (IP4_IS_MULTICAST (Dst) && Ip4FindGroup (&IpSb->IgmpCtrl, Dst)) {
|
||||
} else if (IP4_IS_MULTICAST (Dst) && Ip4FindGroup (&IpSb->IgmpCtrl, Dst) != NULL) {
|
||||
return IP4_MULTICAST;
|
||||
}
|
||||
|
||||
@ -132,7 +133,7 @@ Ip4GetHostCast (
|
||||
|
||||
|
||||
/**
|
||||
Find an interface whose configured IP address is Ip
|
||||
Find an interface whose configured IP address is Ip.
|
||||
|
||||
@param IpSb The IP4 service binding instance
|
||||
@param Ip The Ip address (host byte order) to find
|
||||
@ -232,8 +233,9 @@ Ip4FindStationAddress (
|
||||
@param Multicast The multicast IP address to translate.
|
||||
@param Mac The buffer to hold the translated address.
|
||||
|
||||
@return Returns EFI_SUCCESS if the multicast IP is successfully
|
||||
@return translated to a multicast MAC address. Otherwise some error.
|
||||
@retval EFI_SUCCESS if the multicast IP is successfully translated to a
|
||||
multicast MAC address.
|
||||
@retval other Otherwise some error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -277,9 +279,13 @@ Ip4NtohHead (
|
||||
|
||||
/**
|
||||
Set the Ip4 variable data.
|
||||
|
||||
Save the list of all of the IPv4 addresses and subnet masks that are currently
|
||||
being used to volatile variable storage.
|
||||
|
||||
@param IpSb Ip4 service binding instance
|
||||
|
||||
@retval EFI_SUCCESS Successfully set variable.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the variable.
|
||||
@retval other Set variable failed.
|
||||
|
||||
|
@ -29,7 +29,7 @@ typedef struct _IP4_PROTOCOL IP4_PROTOCOL;
|
||||
typedef struct _IP4_SERVICE IP4_SERVICE;
|
||||
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
IP4_ETHER_PROTO = 0x0800,
|
||||
|
||||
IP4_PROTO_ICMP = 0x01,
|
||||
@ -59,7 +59,7 @@ enum {
|
||||
IP4_HEAD_DF_MASK = 0x4000,
|
||||
IP4_HEAD_MF_MASK = 0x2000,
|
||||
IP4_HEAD_OFFSET_MASK = 0x1fff
|
||||
};
|
||||
} IP_ENUM_TYPES;
|
||||
|
||||
#define IP4_ALLZERO_ADDRESS 0x00000000u
|
||||
#define IP4_ALLONE_ADDRESS 0xFFFFFFFFu
|
||||
|
@ -31,30 +31,27 @@ EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
This is the declaration of an EFI image entry point. This entry point is
|
||||
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
|
||||
both device drivers and bus drivers.
|
||||
|
||||
The entry point for IP4 driver which install the driver
|
||||
binding and component name protocol on its image.
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the UEFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@retval EFI_SUCCESS The operation completed successfully.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Ip4DriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
The entry point for IP4 driver which install the driver
|
||||
binding and component name protocol on its image.
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - The image handle of the driver
|
||||
SystemTable - The system table
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS if the driver binding and component name protocols
|
||||
are successfully installed, otherwise if failed.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EfiLibInstallDriverBindingComponentName2 (
|
||||
ImageHandle,
|
||||
@ -66,18 +63,22 @@ Returns:
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Test to see if this driver supports ControllerHandle.
|
||||
Test to see if this driver supports ControllerHandle. This service
|
||||
is called by the EFI boot service ConnectController(). In
|
||||
order to make drivers as small as possible, there are a few calling
|
||||
restrictions for this service. ConnectController() must
|
||||
follow these calling restrictions. If any other agent wishes to call
|
||||
Supported() it must also follow these calling restrictions.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to test
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to test
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
|
||||
@retval EFI_SUCCES This driver supports this device
|
||||
@retval EFI_ALREADY_STARTED This driver is already running on this device
|
||||
@retval other This driver does not support this device
|
||||
@retval EFI_SUCCESS This driver supports this device
|
||||
@retval EFI_ALREADY_STARTED This driver is already running on this device
|
||||
@retval other This driver does not support this device
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -128,7 +129,7 @@ Ip4CleanService (
|
||||
|
||||
|
||||
/**
|
||||
Create a new IP4 driver service binding protocol
|
||||
Create a new IP4 driver service binding private instance.
|
||||
|
||||
@param Controller The controller that has MNP service binding
|
||||
installed
|
||||
@ -138,6 +139,7 @@ Ip4CleanService (
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate some resource
|
||||
@retval EFI_SUCCESS A new IP4 service binding private is created.
|
||||
@retval other Other error occurs.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -299,14 +301,14 @@ ON_ERROR:
|
||||
/**
|
||||
Clean up a IP4 service binding instance. It will release all
|
||||
the resource allocated by the instance. The instance may be
|
||||
partly initialized, or partly destoried. If a resource is
|
||||
destoried, it is marked as that in case the destory failed and
|
||||
partly initialized, or partly destroyed. If a resource is
|
||||
destroyed, it is marked as that in case the destory failed and
|
||||
being called again later.
|
||||
|
||||
@param IpSb The IP4 serviceing binding instance to clean up
|
||||
|
||||
@retval EFI_SUCCESS The resource used by the instance are cleaned up
|
||||
@retval Others Failed to clean up some of the resources.
|
||||
@retval other Failed to clean up some of the resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -334,13 +336,13 @@ Ip4CleanService (
|
||||
Ip4CleanAssembleTable (&IpSb->Assemble);
|
||||
|
||||
if (IpSb->MnpChildHandle != NULL) {
|
||||
if (IpSb->Mnp) {
|
||||
if (IpSb->Mnp != NULL) {
|
||||
gBS->CloseProtocol (
|
||||
IpSb->MnpChildHandle,
|
||||
&gEfiManagedNetworkProtocolGuid,
|
||||
IpSb->Image,
|
||||
IpSb->Controller
|
||||
);
|
||||
IpSb->MnpChildHandle,
|
||||
&gEfiManagedNetworkProtocolGuid,
|
||||
IpSb->Image,
|
||||
IpSb->Controller
|
||||
);
|
||||
|
||||
IpSb->Mnp = NULL;
|
||||
}
|
||||
@ -383,16 +385,21 @@ Ip4CleanService (
|
||||
|
||||
|
||||
/**
|
||||
Start this driver on ControllerHandle.
|
||||
Start this driver on ControllerHandle. This service is called by the
|
||||
EFI boot service ConnectController(). In order to make
|
||||
drivers as small as possible, there are a few calling restrictions for
|
||||
this service. ConnectController() must follow these
|
||||
calling restrictions. If any other agent wishes to call Start() it
|
||||
must also follow these calling restrictions.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to bind driver to
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to bind driver to
|
||||
@param RemainingDevicePath Optional parameter use to pick a specific child
|
||||
device to start.
|
||||
|
||||
@retval EFI_SUCCES This driver is added to ControllerHandle
|
||||
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
|
||||
@retval other This driver does not support this device
|
||||
@retval EFI_SUCCESS This driver is added to ControllerHandle
|
||||
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
|
||||
@retval other This driver does not support this device
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -482,16 +489,21 @@ FREE_SERVICE:
|
||||
|
||||
|
||||
/**
|
||||
Stop this driver on ControllerHandle.
|
||||
Stop this driver on ControllerHandle. This service is called by the
|
||||
EFI boot service DisconnectController(). In order to
|
||||
make drivers as small as possible, there are a few calling
|
||||
restrictions for this service. DisconnectController()
|
||||
must follow these calling restrictions. If any other agent wishes
|
||||
to call Stop() it must also follow these calling restrictions.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to stop driver on
|
||||
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
|
||||
children is zero stop the entire bus driver.
|
||||
@param ChildHandleBuffer List of Child Handles to Stop.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ControllerHandle Handle of device to stop driver on
|
||||
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number
|
||||
of children is zero stop the entire bus driver.
|
||||
@param ChildHandleBuffer List of Child Handles to Stop.
|
||||
|
||||
@retval EFI_SUCCES This driver is removed ControllerHandle
|
||||
@retval other This driver was not removed from this device
|
||||
@retval EFI_SUCCESS This driver is removed ControllerHandle
|
||||
@retval other This driver was not removed from this device
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -555,7 +567,7 @@ Ip4DriverBindingStop (
|
||||
|
||||
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
|
||||
|
||||
if (IpSb->Ip4Config && (IpSb->State != IP4_SERVICE_DESTORY)) {
|
||||
if (IpSb->Ip4Config != NULL && (IpSb->State != IP4_SERVICE_DESTORY)) {
|
||||
|
||||
IpSb->Ip4Config->Stop (IpSb->Ip4Config);
|
||||
|
||||
@ -720,23 +732,23 @@ ON_ERROR:
|
||||
/**
|
||||
Creates a child handle with a set of I/O services.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ChildHandle Pointer to the handle of the child to create. If
|
||||
it is NULL, then a new handle is created. If it
|
||||
is not NULL, then the I/O services are added to
|
||||
the existing child handle.
|
||||
@param This Protocol instance pointer.
|
||||
@param ChildHandle Pointer to the handle of the child to create. If it is NULL,
|
||||
then a new handle is created. If it is not NULL, then the
|
||||
I/O services are added to the existing child handle.
|
||||
|
||||
@retval EFI_SUCCES The child handle was created with the I/O services
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
|
||||
the child
|
||||
@retval other The child handle was not created
|
||||
@retval EFI_SUCCES The child handle was created with the I/O services
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
|
||||
the child
|
||||
@retval other The child handle was not created
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Ip4ServiceBindingCreateChild (
|
||||
IN EFI_SERVICE_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE *ChildHandle
|
||||
IN OUT EFI_HANDLE *ChildHandle
|
||||
)
|
||||
{
|
||||
IP4_SERVICE *IpSb;
|
||||
@ -822,17 +834,16 @@ ON_ERROR:
|
||||
/**
|
||||
Destroys a child handle with a set of I/O services.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param ChildHandle Handle of the child to destroy
|
||||
@param This Protocol instance pointer.
|
||||
@param ChildHandle Handle of the child to destroy
|
||||
|
||||
@retval EFI_SUCCES The I/O services were removed from the child
|
||||
handle
|
||||
@retval EFI_UNSUPPORTED The child handle does not support the I/O services
|
||||
that are being removed
|
||||
@retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.
|
||||
@retval EFI_ACCESS_DENIED The child handle could not be destroyed because
|
||||
its I/O services are being used.
|
||||
@retval other The child handle was not destroyed
|
||||
@retval EFI_SUCCES The I/O services were removed from the child handle
|
||||
@retval EFI_UNSUPPORTED The child handle does not support the I/O services
|
||||
that are being removed.
|
||||
@retval EFI_INVALID_PARAMETER Child handle is not a valid EFI Handle.
|
||||
@retval EFI_ACCESS_DENIED The child handle could not be destroyed because its
|
||||
I/O services are being used.
|
||||
@retval other The child handle was not destroyed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -43,36 +43,36 @@ mIcmpClass[] = {
|
||||
};
|
||||
|
||||
EFI_IP4_ICMP_TYPE
|
||||
mIp4SupportedIcmp [23] = {
|
||||
{ICMP_ECHO_REPLY, ICMP_DEFAULT_CODE },
|
||||
mIp4SupportedIcmp[23] = {
|
||||
{ICMP_ECHO_REPLY, ICMP_DEFAULT_CODE },
|
||||
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_NET_UNREACHABLE },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_HOST_UNREACHABLE },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_PROTO_UNREACHABLE },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_PORT_UNREACHABLE },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_FRAGMENT_FAILED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_SOURCEROUTE_FAILED},
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_NET_UNKNOWN },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_HOST_UNKNOWN },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_SOURCE_ISOLATED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_NET_PROHIBITED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_HOST_PROHIBITED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_NET_UNREACHABLE },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_HOST_UNREACHABLE },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_PROTO_UNREACHABLE },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_PORT_UNREACHABLE },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_FRAGMENT_FAILED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_SOURCEROUTE_FAILED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_NET_UNKNOWN },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_HOST_UNKNOWN },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_SOURCE_ISOLATED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_NET_PROHIBITED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_HOST_PROHIBITED },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_NET_UNREACHABLE_TOS },
|
||||
{ICMP_DEST_UNREACHABLE, ICMP_HOST_UNREACHABLE_TOS},
|
||||
|
||||
{ICMP_SOURCE_QUENCH, ICMP_DEFAULT_CODE },
|
||||
{ICMP_SOURCE_QUENCH, ICMP_DEFAULT_CODE },
|
||||
|
||||
{ICMP_REDIRECT, ICMP_NET_REDIRECT },
|
||||
{ICMP_REDIRECT, ICMP_HOST_REDIRECT },
|
||||
{ICMP_REDIRECT, ICMP_NET_TOS_REDIRECT },
|
||||
{ICMP_REDIRECT, ICMP_HOST_TOS_REDIRECT },
|
||||
{ICMP_REDIRECT, ICMP_NET_REDIRECT },
|
||||
{ICMP_REDIRECT, ICMP_HOST_REDIRECT },
|
||||
{ICMP_REDIRECT, ICMP_NET_TOS_REDIRECT },
|
||||
{ICMP_REDIRECT, ICMP_HOST_TOS_REDIRECT },
|
||||
|
||||
{ICMP_ECHO_REQUEST, ICMP_DEFAULT_CODE },
|
||||
{ICMP_ECHO_REQUEST, ICMP_DEFAULT_CODE },
|
||||
|
||||
{ICMP_TIME_EXCEEDED, ICMP_TIMEOUT_IN_TRANSIT},
|
||||
{ICMP_TIME_EXCEEDED, ICMp_TIMEOUT_REASSEMBLE},
|
||||
{ICMP_TIME_EXCEEDED, ICMP_TIMEOUT_IN_TRANSIT },
|
||||
{ICMP_TIME_EXCEEDED, ICMp_TIMEOUT_REASSEMBLE },
|
||||
|
||||
{ICMP_PARAMETER_PROBLEM, ICMP_DEFAULT_CODE },
|
||||
{ICMP_PARAMETER_PROBLEM, ICMP_DEFAULT_CODE },
|
||||
};
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@ mIp4SupportedIcmp [23] = {
|
||||
/**
|
||||
Process the ICMP redirect. Find the instance then update
|
||||
its route cache.
|
||||
|
||||
All kinds of redirect is treated as host redirect as
|
||||
specified by RFC1122 3.3.1.2:
|
||||
"Since the subnet mask appropriate to the destination
|
||||
@ -170,10 +171,10 @@ Ip4ProcessIcmpRedirect (
|
||||
@param Packet The content of the ICMP error with IP head
|
||||
removed.
|
||||
|
||||
@retval EFI_SUCCESS The ICMP error is processed successfully.
|
||||
@retval EFI_INVALID_PARAMETER The packet is invalid
|
||||
@retval Others Failed to process the packet.
|
||||
@retval EFI_SUCCESS The ICMP error is processed successfully.
|
||||
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4ProcessIcmpError (
|
||||
@ -291,6 +292,7 @@ ON_EXIT:
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The packet is invalid
|
||||
@retval EFI_SUCCESS The ICMP query message is processed
|
||||
@retval Others Failed to process ICMP query.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -329,6 +331,7 @@ Ip4ProcessIcmpQuery (
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The packet is malformated.
|
||||
@retval EFI_SUCCESS The ICMP message is successfully processed.
|
||||
@retval Others Failed to handle ICMP packet.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -24,7 +24,7 @@ Abstract:
|
||||
#ifndef __EFI_IP4_ICMP_H__
|
||||
#define __EFI_IP4_ICMP_H__
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
//
|
||||
// ICMP type definations
|
||||
//
|
||||
@ -80,7 +80,7 @@ enum {
|
||||
ICMP_INVALID_MESSAGE = 0,
|
||||
ICMP_ERROR_MESSAGE = 1,
|
||||
ICMP_QUERY_MESSAGE = 2
|
||||
};
|
||||
} ICMP_ENUM_TYPES;
|
||||
|
||||
typedef struct {
|
||||
UINT8 IcmpType;
|
||||
|
@ -80,7 +80,7 @@ Ip4CancelFrameArp (
|
||||
/**
|
||||
Wrap a transmit request into a newly allocated IP4_LINK_TX_TOKEN.
|
||||
|
||||
@param Interface The interface to send out from
|
||||
@param Interface The interface to send out to.
|
||||
@param IpInstance The IpInstance that transmit the packet. NULL if
|
||||
the packet is sent by the IP4 driver itself.
|
||||
@param Packet The packet to transmit
|
||||
@ -511,9 +511,9 @@ Ip4CreateInterface (
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4SetAddress (
|
||||
IN IP4_INTERFACE *Interface,
|
||||
IN IP4_ADDR IpAddr,
|
||||
IN IP4_ADDR SubnetMask
|
||||
IN OUT IP4_INTERFACE *Interface,
|
||||
IN IP4_ADDR IpAddr,
|
||||
IN IP4_ADDR SubnetMask
|
||||
)
|
||||
{
|
||||
EFI_ARP_CONFIG_DATA ArpConfig;
|
||||
@ -613,7 +613,7 @@ ON_ERROR:
|
||||
|
||||
|
||||
/**
|
||||
Fileter function to cancel all the frame related to an IP instance.
|
||||
Filter function to cancel all the frame related to an IP instance.
|
||||
|
||||
@param Frame The transmit request to test whether to cancel
|
||||
@param Context The context which is the Ip instance that issued
|
||||
@ -681,7 +681,7 @@ Ip4CancelReceive (
|
||||
|
||||
@param Interface The interface used by the IpInstance
|
||||
@param IpInstance The Ip instance that free the interface. NULL if
|
||||
the Ip driver is releasing the default interface.
|
||||
the Ip driver is releasing the default interface.
|
||||
|
||||
@retval EFI_SUCCESS The interface use IpInstance is freed.
|
||||
|
||||
@ -815,28 +815,22 @@ Ip4OnArpResolvedDpc (
|
||||
Ip4FreeArpQue (ArpQue, EFI_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
Request Ip4OnArpResolvedDpc as a DPC at TPL_CALLBACK.
|
||||
|
||||
@param Event The Arp request event.
|
||||
@param Context The context of the callback, a point to the ARP
|
||||
queue.
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
Ip4OnArpResolved (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Request Ip4OnArpResolvedDpc as a DPC at TPL_CALLBACK
|
||||
|
||||
Arguments:
|
||||
|
||||
Event - The Arp request event
|
||||
Context - The context of the callback, a point to the ARP queue
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
//
|
||||
// Request Ip4OnArpResolvedDpc as a DPC at TPL_CALLBACK
|
||||
@ -879,28 +873,21 @@ Ip4OnFrameSentDpc (
|
||||
Ip4FreeLinkTxToken (Token);
|
||||
}
|
||||
|
||||
/**
|
||||
Request Ip4OnFrameSentDpc as a DPC at TPL_CALLBACK.
|
||||
|
||||
@param Event The transmit token's event.
|
||||
@param Context Context which is point to the token.
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
Ip4OnFrameSent (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Request Ip4OnFrameSentDpc as a DPC at TPL_CALLBACK
|
||||
|
||||
Arguments:
|
||||
|
||||
Event - The transmit token's event
|
||||
Context - Context which is point to the token.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
//
|
||||
// Request Ip4OnFrameSentDpc as a DPC at TPL_CALLBACK
|
||||
@ -929,6 +916,7 @@ Returns:
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource to send the frame
|
||||
@retval EFI_NO_MAPPING Can't resolve the MAC for the nexthop
|
||||
@retval EFI_SUCCESS The packet is successfully transmitted.
|
||||
@retval other Other error occurs.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -1196,6 +1184,7 @@ Returns:
|
||||
@retval EFI_ALREADY_STARTED There is already a pending receive request.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource to receive
|
||||
@retval EFI_SUCCESS The recieve request has been started.
|
||||
@retval other Other error occurs.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -24,36 +24,44 @@ Abstract:
|
||||
#ifndef __EFI_IP4_IF_H__
|
||||
#define __EFI_IP4_IF_H__
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
IP4_FRAME_RX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'R'),
|
||||
IP4_FRAME_TX_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'T'),
|
||||
IP4_FRAME_ARP_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'F', 'A'),
|
||||
IP4_INTERFACE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', 'I', 'F')
|
||||
};
|
||||
} IP4_IF_ENUM_TYPES;
|
||||
|
||||
//
|
||||
// This prototype is used by both receive and transmission.
|
||||
// When receiving Netbuf is allocated by IP4_INTERFACE, and
|
||||
// released by IP4. Flag shows whether the frame is received
|
||||
// as link broadcast/multicast...
|
||||
//
|
||||
// When transmitting, the Netbuf is from IP4, and provided
|
||||
// to the callback as a reference. Flag isn't used.
|
||||
//
|
||||
// IpInstance can be NULL which means that it is the IP4 driver
|
||||
// itself sending the packets. IP4 driver may send packets that
|
||||
// don't belong to any instance, such as ICMP errors, ICMP echo
|
||||
// responses, or IGMP packets. IpInstance is used as a tag in
|
||||
// this module.
|
||||
//
|
||||
/**
|
||||
This prototype is used by both receive and transmission.
|
||||
When receiving Netbuf is allocated by IP4_INTERFACE, and
|
||||
released by IP4. Flag shows whether the frame is received
|
||||
as link broadcast/multicast...
|
||||
|
||||
When transmitting, the Netbuf is from IP4, and provided
|
||||
to the callback as a reference. Flag isn't used.
|
||||
|
||||
@param IpInstance The instance that sent or received the packet.
|
||||
IpInstance can be NULL which means that it is the IP4 driver
|
||||
itself sending the packets. IP4 driver may send packets that
|
||||
don't belong to any instance, such as ICMP errors, ICMP echo
|
||||
responses, or IGMP packets. IpInstance is used as a tag in
|
||||
this module.
|
||||
@param Packet The sent or received packet.
|
||||
@param IoStatus Status of sending or receiving.
|
||||
@param LinkFlag Indicate if the frame is received as link broadcast/multicast.
|
||||
When transmitting, it is not used.
|
||||
@param Context Additional data for callback.
|
||||
|
||||
@return None.
|
||||
**/
|
||||
typedef
|
||||
VOID
|
||||
(*IP4_FRAME_CALLBACK) (
|
||||
IP4_PROTOCOL *IpInstance, OPTIONAL
|
||||
NET_BUF *Packet,
|
||||
EFI_STATUS IoStatus,
|
||||
UINT32 LinkFlag,
|
||||
VOID *Context
|
||||
(*IP4_FRAME_CALLBACK)(
|
||||
IN IP4_PROTOCOL *IpInstance, OPTIONAL
|
||||
IN NET_BUF *Packet,
|
||||
IN EFI_STATUS IoStatus,
|
||||
IN UINT32 LinkFlag,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
//
|
||||
@ -116,13 +124,19 @@ typedef struct {
|
||||
EFI_MAC_ADDRESS Mac;
|
||||
} IP4_ARP_QUE;
|
||||
|
||||
//
|
||||
// Callback to select which frame to cancel. Caller can cancel a
|
||||
// single frame, or all the frame from an IP instance.
|
||||
//
|
||||
/**
|
||||
Callback to select which frame to cancel. Caller can cancel a
|
||||
single frame, or all the frame from an IP instance.
|
||||
|
||||
@param Frame The sending frame to check for cancellation.
|
||||
@param Context Additional data for callback.
|
||||
|
||||
@retval TRUE The sending of the frame should be cancelled.
|
||||
@retval FALSE Do not cancel the frame sending.
|
||||
**/
|
||||
typedef
|
||||
BOOLEAN
|
||||
(*IP4_FRAME_TO_CANCEL) (
|
||||
(*IP4_FRAME_TO_CANCEL)(
|
||||
IP4_LINK_TX_TOKEN *Frame,
|
||||
VOID *Context
|
||||
);
|
||||
@ -134,7 +148,7 @@ BOOLEAN
|
||||
// Notice the special cases that DHCP can configure the interface
|
||||
// with 0.0.0.0/0.0.0.0.
|
||||
//
|
||||
struct _IP4_INTERFACE {
|
||||
typedef struct _IP4_INTERFACE {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
INTN RefCnt;
|
||||
@ -182,7 +196,7 @@ struct _IP4_INTERFACE {
|
||||
//
|
||||
LIST_ENTRY IpInstances;
|
||||
BOOLEAN PromiscRecv;
|
||||
};
|
||||
} IP4_INTERFACE;
|
||||
|
||||
IP4_INTERFACE *
|
||||
Ip4CreateInterface (
|
||||
|
@ -36,14 +36,14 @@ UINT32 mRouteAlertOption = 0x00000494;
|
||||
|
||||
@param IpSb The IP4 service whose IGMP is to be initialized.
|
||||
|
||||
@retval EFI_SUCCESS IGMP of the IpSb is successfully initialized.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource to initialize IGMP.
|
||||
@retval Others Failed to initialize the IGMP of IpSb.
|
||||
@retval EFI_SUCCESS IGMP of the IpSb is successfully initialized.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4InitIgmp (
|
||||
IN IP4_SERVICE *IpSb
|
||||
IN OUT IP4_SERVICE *IpSb
|
||||
)
|
||||
{
|
||||
IGMP_SERVICE_DATA *IgmpCtrl;
|
||||
@ -98,8 +98,8 @@ ON_ERROR:
|
||||
@param Address The multicast address to search
|
||||
|
||||
@return NULL if the multicast address isn't in the IGMP control block. Otherwise
|
||||
@return the point to the IGMP_GROUP which contains the status of multicast group
|
||||
@return for Address.
|
||||
the point to the IGMP_GROUP which contains the status of multicast group
|
||||
for Address.
|
||||
|
||||
**/
|
||||
IGMP_GROUP *
|
||||
@ -132,7 +132,7 @@ Ip4FindGroup (
|
||||
@param Mac The MAC address to search
|
||||
|
||||
@return The number of the IP4 multicast group that mapped to the same
|
||||
@return multicast group Mac.
|
||||
multicast group Mac.
|
||||
|
||||
**/
|
||||
INTN
|
||||
@ -165,7 +165,7 @@ Ip4FindMac (
|
||||
@param IpSb The IP4 service instance that requests the
|
||||
transmission
|
||||
@param Dst The destinaton to send to
|
||||
@param Type The IGMP message type, such as IGMP v2 membership
|
||||
@param Type The IGMP message type, such as IGMP v1 membership
|
||||
report
|
||||
@param Group The group address in the IGMP message head.
|
||||
|
||||
@ -257,7 +257,7 @@ Ip4SendIgmpReport (
|
||||
|
||||
|
||||
/**
|
||||
Join the multicast group on behavior of this IP4 child
|
||||
Join the multicast group on behalf of this IP4 child
|
||||
|
||||
@param IpInstance The IP4 child that wants to join the group
|
||||
@param Address The group to join
|
||||
@ -337,7 +337,7 @@ ON_ERROR:
|
||||
|
||||
|
||||
/**
|
||||
Leave the IP4 multicast group on behavior of IpInstance.
|
||||
Leave the IP4 multicast group on behalf of IpInstance.
|
||||
|
||||
@param IpInstance The IP4 child that wants to leave the group
|
||||
address
|
||||
@ -395,7 +395,7 @@ Ip4LeaveGroup (
|
||||
// Send a leave report if the membership is reported by us
|
||||
// and we are talking IGMPv2.
|
||||
//
|
||||
if (Group->ReportByUs && !IgmpCtrl->Igmpv1QuerySeen) {
|
||||
if (Group->ReportByUs && IgmpCtrl->Igmpv1QuerySeen == 0) {
|
||||
Ip4SendIgmpMessage (IpSb, IP4_ALLROUTER_ADDRESS, IGMP_LEAVE_GROUP, Group->Address);
|
||||
}
|
||||
|
||||
@ -450,7 +450,7 @@ Ip4IgmpHandle (
|
||||
switch (Igmp.Type) {
|
||||
case IGMP_MEMBERSHIP_QUERY:
|
||||
//
|
||||
// If MaxRespTIme is zero, it is most likely that we are
|
||||
// If MaxRespTime is zero, it is most likely that we are
|
||||
// talking to a V1 router
|
||||
//
|
||||
if (Igmp.MaxRespTime == 0) {
|
||||
@ -511,9 +511,9 @@ Ip4IgmpHandle (
|
||||
The periodical timer function for IGMP. It does the following
|
||||
things:
|
||||
1. Decrease the Igmpv1QuerySeen to make it possible to refresh
|
||||
the IGMP server type.
|
||||
the IGMP server type.
|
||||
2. Decrease the report timer for each IGMP group in "delaying
|
||||
member" state.
|
||||
member" state.
|
||||
|
||||
@param IpSb The IP4 service instance that is ticking
|
||||
|
||||
@ -566,7 +566,7 @@ Ip4IgmpTicking (
|
||||
@param Addr The IP4 multicast address to add
|
||||
|
||||
@return NULL if failed to allocate memory for the new groups,
|
||||
@return otherwise the new combined group addresses.
|
||||
otherwise the new combined group addresses.
|
||||
|
||||
**/
|
||||
IP4_ADDR *
|
||||
@ -592,7 +592,7 @@ Ip4CombineGroups (
|
||||
|
||||
|
||||
/**
|
||||
Remove a group address frome the array of group addresses.
|
||||
Remove a group address from the array of group addresses.
|
||||
Although the function doesn't assume the byte order of the
|
||||
both Groups and Addr, the network byte order is used by
|
||||
the caller.
|
||||
@ -602,14 +602,14 @@ Ip4CombineGroups (
|
||||
@param Addr The IP4 multicast address to remove
|
||||
|
||||
@return The nubmer of group addresses in the Groups after remove.
|
||||
@return It is Count if the Addr isn't in the Groups.
|
||||
It is Count if the Addr isn't in the Groups.
|
||||
|
||||
**/
|
||||
INTN
|
||||
Ip4RemoveGroupAddr (
|
||||
IN IP4_ADDR *Groups,
|
||||
IN UINT32 Count,
|
||||
IN IP4_ADDR Addr
|
||||
IN OUT IP4_ADDR *Groups,
|
||||
IN UINT32 Count,
|
||||
IN IP4_ADDR Addr
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
|
@ -56,7 +56,7 @@ typedef struct {
|
||||
LIST_ENTRY Groups;
|
||||
} IGMP_SERVICE_DATA;
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
//
|
||||
// IGMP message type
|
||||
//
|
||||
@ -67,7 +67,7 @@ enum {
|
||||
|
||||
IGMP_V1ROUTER_PRESENT = 400,
|
||||
IGMP_UNSOLICIATED_REPORT = 10
|
||||
};
|
||||
} IGMP_ENUM_TYPES;
|
||||
|
||||
EFI_STATUS
|
||||
Ip4InitIgmp (
|
||||
|
@ -21,19 +21,353 @@ Abstract:
|
||||
|
||||
#include "Ip4Impl.h"
|
||||
|
||||
/**
|
||||
Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
|
||||
|
||||
The GetModeData() function returns the current operational mode data for this
|
||||
driver instance. The data fields in EFI_IP4_MODE_DATA are read only. This
|
||||
function is used optionally to retrieve the operational mode data of underlying
|
||||
networks or drivers.
|
||||
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.
|
||||
@param MnpConfigData Pointer to the managed network configuration data structure.
|
||||
@param SnpModeData Pointer to the simple network mode data structure.
|
||||
|
||||
@retval EFI_SUCCESS The operation completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIp4GetModeData (
|
||||
IN CONST EFI_IP4_PROTOCOL *This,
|
||||
OUT EFI_IP4_MODE_DATA *Ip4ModeData, OPTIONAL
|
||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData, OPTIONAL
|
||||
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
|
||||
|
||||
The Configure() function is used to set, change, or reset the operational
|
||||
parameters and filter settings for this EFI IPv4 Protocol instance. Until these
|
||||
parameters have been set, no network traffic can be sent or received by this
|
||||
instance. Once the parameters have been reset (by calling this function with
|
||||
IpConfigData set to NULL), no more traffic can be sent or received until these
|
||||
parameters have been set again. Each EFI IPv4 Protocol instance can be started
|
||||
and stopped independently of each other by enabling or disabling their receive
|
||||
filter settings with the Configure() function.
|
||||
|
||||
When IpConfigData.UseDefaultAddress is set to FALSE, the new station address will
|
||||
be appended as an alias address into the addresses list in the EFI IPv4 Protocol
|
||||
driver. While set to TRUE, Configure() will trigger the EFI_IP4_CONFIG_PROTOCOL
|
||||
to retrieve the default IPv4 address if it is not available yet. Clients could
|
||||
frequently call GetModeData() to check the status to ensure that the default IPv4
|
||||
address is ready.
|
||||
|
||||
If operational parameters are reset or changed, any pending transmit and receive
|
||||
requests will be cancelled. Their completion token status will be set to EFI_ABORTED
|
||||
and their events will be signaled.
|
||||
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.
|
||||
|
||||
@retval EFI_SUCCESS The driver instance was successfully opened.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
||||
@retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:
|
||||
A configuration protocol (DHCP, BOOTP, RARP, etc.) could
|
||||
not be located when clients choose to use the default IPv4
|
||||
address. This EFI IPv4 Protocol implementation does not
|
||||
support this requested filter or timeout setting.
|
||||
@retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.
|
||||
@retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the
|
||||
IPv4 address or subnet mask can be changed. The interface must
|
||||
also be stopped when switching to/from raw packet mode.
|
||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4
|
||||
Protocol driver instance is not opened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIp4Configure (
|
||||
IN EFI_IP4_PROTOCOL *This,
|
||||
IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Joins and leaves multicast groups.
|
||||
|
||||
The Groups() function is used to join and leave multicast group sessions. Joining
|
||||
a group will enable reception of matching multicast packets. Leaving a group will
|
||||
disable the multicast packet reception.
|
||||
|
||||
If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.
|
||||
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
|
||||
@param GroupAddress Pointer to the IPv4 multicast address.
|
||||
|
||||
@retval EFI_SUCCESS The operation completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
|
||||
- This is NULL.
|
||||
- JoinFlag is TRUE and GroupAddress is NULL.
|
||||
- GroupAddress is not NULL and *GroupAddress is
|
||||
not a multicast IPv4 address.
|
||||
@retval EFI_NOT_STARTED This instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
|
||||
@retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.
|
||||
@retval EFI_ALREADY_STARTED The group address is already in the group table (when
|
||||
JoinFlag is TRUE).
|
||||
@retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
|
||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIp4Groups (
|
||||
IN EFI_IP4_PROTOCOL *This,
|
||||
IN BOOLEAN JoinFlag,
|
||||
IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Adds and deletes routing table entries.
|
||||
|
||||
The Routes() function adds a route to or deletes a route from the routing table.
|
||||
|
||||
Routes are determined by comparing the SubnetAddress with the destination IPv4
|
||||
address arithmetically AND-ed with the SubnetMask. The gateway address must be
|
||||
on the same subnet as the configured station address.
|
||||
|
||||
The default route is added with SubnetAddress and SubnetMask both set to 0.0.0.0.
|
||||
The default route matches all destination IPv4 addresses that do not match any
|
||||
other routes.
|
||||
|
||||
A GatewayAddress that is zero is a nonroute. Packets are sent to the destination
|
||||
IP address if it can be found in the ARP cache or on the local subnet. One automatic
|
||||
nonroute entry will be inserted into the routing table for outgoing packets that
|
||||
are addressed to a local subnet (gateway address of 0.0.0.0).
|
||||
|
||||
Each EFI IPv4 Protocol instance has its own independent routing table. Those EFI
|
||||
IPv4 Protocol instances that use the default IPv4 address will also have copies
|
||||
of the routing table that was provided by the EFI_IP4_CONFIG_PROTOCOL, and these
|
||||
copies will be updated whenever the EIF IPv4 Protocol driver reconfigures its
|
||||
instances. As a result, client modification to the routing table will be lost.
|
||||
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param DeleteRoute Set to TRUE to delete this route from the routing table. Set to
|
||||
FALSE to add this route to the routing table. SubnetAddress
|
||||
and SubnetMask are used as the key to each route entry.
|
||||
@param SubnetAddress The address of the subnet that needs to be routed.
|
||||
@param SubnetMask The subnet mask of SubnetAddress.
|
||||
@param GatewayAddress The unicast gateway IPv4 address for this route.
|
||||
|
||||
@retval EFI_SUCCESS The operation completed successfully.
|
||||
@retval EFI_NOT_STARTED The driver instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
||||
- This is NULL.
|
||||
- SubnetAddress is NULL.
|
||||
- SubnetMask is NULL.
|
||||
- GatewayAddress is NULL.
|
||||
- *SubnetAddress is not a valid subnet address.
|
||||
- *SubnetMask is not a valid subnet mask.
|
||||
- *GatewayAddress is not a valid unicast IPv4 address.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
|
||||
@retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
|
||||
@retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
|
||||
DeleteRoute is FALSE).
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIp4Routes (
|
||||
IN EFI_IP4_PROTOCOL *This,
|
||||
IN BOOLEAN DeleteRoute,
|
||||
IN EFI_IPv4_ADDRESS *SubnetAddress,
|
||||
IN EFI_IPv4_ADDRESS *SubnetMask,
|
||||
IN EFI_IPv4_ADDRESS *GatewayAddress
|
||||
);
|
||||
|
||||
/**
|
||||
Places outgoing data packets into the transmit queue.
|
||||
|
||||
The Transmit() function places a sending request in the transmit queue of this
|
||||
EFI IPv4 Protocol instance. Whenever the packet in the token is sent out or some
|
||||
errors occur, the event in the token will be signaled and the status is updated.
|
||||
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param Token Pointer to the transmit token.
|
||||
|
||||
@retval EFI_SUCCESS The data has been queued for transmission.
|
||||
@retval EFI_NOT_STARTED This instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER One or more pameters are invalid.
|
||||
@retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
|
||||
was already in the transmit queue.
|
||||
@retval EFI_NOT_READY The completion token could not be queued because the transmit
|
||||
queue is full.
|
||||
@retval EFI_NOT_FOUND Not route is found to destination address.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
|
||||
@retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
|
||||
short to transmit.
|
||||
@retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
|
||||
greater than MTU (or greater than the maximum packet size if
|
||||
Token.Packet.TxData.OverrideData.
|
||||
DoNotFragment is TRUE.)
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIp4Transmit (
|
||||
IN EFI_IP4_PROTOCOL *This,
|
||||
IN EFI_IP4_COMPLETION_TOKEN *Token
|
||||
);
|
||||
|
||||
/**
|
||||
Places a receiving request into the receiving queue.
|
||||
|
||||
The Receive() function places a completion token into the receive packet queue.
|
||||
This function is always asynchronous.
|
||||
|
||||
The Token.Event field in the completion token must be filled in by the caller
|
||||
and cannot be NULL. When the receive operation completes, the EFI IPv4 Protocol
|
||||
driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
|
||||
is signaled.
|
||||
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param Token Pointer to a token that is associated with the receive data descriptor.
|
||||
|
||||
@retval EFI_SUCCESS The receive completion token was cached.
|
||||
@retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.)
|
||||
is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
||||
- This is NULL.
|
||||
- Token is NULL.
|
||||
- Token.Event is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
|
||||
resources (usually memory).
|
||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
||||
The EFI IPv4 Protocol instance has been reset to startup defaults.
|
||||
EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
|
||||
in the receive queue.
|
||||
@retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
|
||||
@retval EFI_ICMP_ERROR An ICMP error packet was received.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIp4Receive (
|
||||
IN EFI_IP4_PROTOCOL *This,
|
||||
IN EFI_IP4_COMPLETION_TOKEN *Token
|
||||
);
|
||||
|
||||
/**
|
||||
Abort an asynchronous transmit or receive request.
|
||||
|
||||
The Cancel() function is used to abort a pending transmit or receive request.
|
||||
If the token is in the transmit or receive request queues, after calling this
|
||||
function, Token->Status will be set to EFI_ABORTED and then Token->Event will
|
||||
be signaled. If the token is not in one of the queues, which usually means the
|
||||
asynchronous operation has completed, this function will not signal the token
|
||||
and EFI_NOT_FOUND is returned.
|
||||
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param Token Pointer to a token that has been issued by
|
||||
EFI_IP4_PROTOCOL.Transmit() or
|
||||
EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
|
||||
tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
|
||||
defined in EFI_IP4_PROTOCOL.Transmit().
|
||||
|
||||
@retval EFI_SUCCESS The asynchronous I/O request was aborted and
|
||||
Token.->Event was signaled. When Token is NULL, all
|
||||
pending requests were aborted and their events were signaled.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_NOT_STARTED This instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
|
||||
not found in the transmit or receive queue. It has either completed
|
||||
or was not issued by Transmit() and Receive().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIp4Cancel (
|
||||
IN EFI_IP4_PROTOCOL *This,
|
||||
IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Polls for incoming data packets and processes outgoing data packets.
|
||||
|
||||
The Poll() function polls for incoming data packets and processes outgoing data
|
||||
packets. Network drivers and applications can call the EFI_IP4_PROTOCOL.Poll()
|
||||
function to increase the rate that data packets are moved between the communications
|
||||
device and the transmit and receive queues.
|
||||
|
||||
In some systems the periodic timer event may not poll the underlying communications
|
||||
device fast enough to transmit and/or receive all data packets without missing
|
||||
incoming packets or dropping outgoing packets. Drivers and applications that are
|
||||
experiencing packet loss should try calling the EFI_IP4_PROTOCOL.Poll() function
|
||||
more often.
|
||||
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
|
||||
@retval EFI_SUCCESS Incoming or outgoing data was processed.
|
||||
@retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
||||
@retval EFI_NOT_READY No incoming or outgoing data is processed.
|
||||
@retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
|
||||
Consider increasing the polling rate.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiIp4Poll (
|
||||
IN EFI_IP4_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_IP4_PROTOCOL
|
||||
mEfiIp4ProtocolTemplete = {
|
||||
EfiIp4GetModeData,
|
||||
EfiIp4Configure,
|
||||
EfiIp4Groups,
|
||||
EfiIp4Routes,
|
||||
EfiIp4Transmit,
|
||||
EfiIp4Receive,
|
||||
EfiIp4Cancel,
|
||||
EfiIp4Poll
|
||||
};
|
||||
|
||||
/**
|
||||
Get the IP child's current operational data. This can
|
||||
all be used to get the underlying MNP and SNP data.
|
||||
Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
|
||||
|
||||
The GetModeData() function returns the current operational mode data for this
|
||||
driver instance. The data fields in EFI_IP4_MODE_DATA are read only. This
|
||||
function is used optionally to retrieve the operational mode data of underlying
|
||||
networks or drivers.
|
||||
|
||||
@param This The IP4 protocol instance
|
||||
@param Ip4ModeData The IP4 operation data
|
||||
@param MnpConfigData The MNP configure data
|
||||
@param SnpModeData The SNP operation data
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param Ip4ModeData Pointer to the EFI IPv4 Protocol mode data structure.
|
||||
@param MnpConfigData Pointer to the managed network configuration data structure.
|
||||
@param SnpModeData Pointer to the simple network mode data structure.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The parameter is invalid because This == NULL
|
||||
@retval EFI_SUCCESS The operational parameter is returned.
|
||||
@retval Others Failed to retrieve the IP4 route table.
|
||||
@retval EFI_SUCCESS The operation completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The required mode data could not be allocated.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -128,10 +462,10 @@ EfiIp4GetModeData (
|
||||
child to transmit/receive frames. By default, it configures MNP
|
||||
to receive unicast/multicast/broadcast. And it will enable/disable
|
||||
the promiscous receive according to whether there is IP child
|
||||
enable that or not. If Force isn't false, it will iterate through
|
||||
enable that or not. If Force is FALSE, it will iterate through
|
||||
all the IP children to check whether the promiscuous receive
|
||||
setting has been changed. If it hasn't been changed, it won't
|
||||
reconfigure the MNP. If Force is true, the MNP is configured no
|
||||
reconfigure the MNP. If Force is TRUE, the MNP is configured no
|
||||
matter whether that is changed or not.
|
||||
|
||||
@param IpSb The IP4 service instance that is to be changed.
|
||||
@ -357,28 +691,21 @@ ON_EXIT:
|
||||
gBS->FreePool (Data);
|
||||
}
|
||||
|
||||
/*++
|
||||
Request Ip4AutoConfigCallBackDpc as a DPC at TPL_CALLBACK.
|
||||
|
||||
@param Event The event that is signalled.
|
||||
@param Context The IP4 service binding instance.
|
||||
|
||||
@return None.
|
||||
|
||||
++*/
|
||||
VOID
|
||||
EFIAPI
|
||||
Ip4AutoConfigCallBack (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Request Ip4AutoConfigCallBackDpc as a DPC at TPL_CALLBACK
|
||||
|
||||
Arguments:
|
||||
|
||||
Event - The event that is signalled.
|
||||
Context - The IP4 service binding instance.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
IP4_SERVICE *IpSb;
|
||||
|
||||
@ -499,8 +826,8 @@ CLOSE_DONE_EVENT:
|
||||
**/
|
||||
VOID
|
||||
Ip4InitProtocol (
|
||||
IN IP4_SERVICE *IpSb,
|
||||
IN IP4_PROTOCOL *IpInstance
|
||||
IN IP4_SERVICE *IpSb,
|
||||
IN OUT IP4_PROTOCOL *IpInstance
|
||||
)
|
||||
{
|
||||
ASSERT ((IpSb != NULL) && (IpInstance != NULL));
|
||||
@ -539,12 +866,14 @@ Ip4InitProtocol (
|
||||
address, but the default address hasn't been
|
||||
configured. The IP4 child doesn't need to be
|
||||
reconfigured when default address is configured.
|
||||
@retval EFI_OUT_OF_RESOURCES No more memory space is available.
|
||||
@retval other Other error occurs.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
Ip4ConfigProtocol (
|
||||
IN IP4_PROTOCOL *IpInstance,
|
||||
IN EFI_IP4_CONFIG_DATA *Config
|
||||
IN OUT IP4_PROTOCOL *IpInstance,
|
||||
IN EFI_IP4_CONFIG_DATA *Config
|
||||
)
|
||||
{
|
||||
IP4_SERVICE *IpSb;
|
||||
@ -754,7 +1083,7 @@ Ip4CleanProtocol (
|
||||
@param Netmask The netmaks of the IP
|
||||
|
||||
@retval TRUE The Ip/Netmask pair is valid
|
||||
@retval FALSE The
|
||||
@retval FALSE The Ip/Netmask pair is invalid
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
@ -806,18 +1135,46 @@ Ip4StationAddressValid (
|
||||
|
||||
|
||||
/**
|
||||
Configure the EFI_IP4_PROTOCOL instance. If IpConfigData is NULL,
|
||||
the instance is cleaned up. If the instance hasn't been configure
|
||||
before, it will be initialized. Otherwise, the filter setting of
|
||||
the instance is updated.
|
||||
Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
|
||||
|
||||
The Configure() function is used to set, change, or reset the operational
|
||||
parameters and filter settings for this EFI IPv4 Protocol instance. Until these
|
||||
parameters have been set, no network traffic can be sent or received by this
|
||||
instance. Once the parameters have been reset (by calling this function with
|
||||
IpConfigData set to NULL), no more traffic can be sent or received until these
|
||||
parameters have been set again. Each EFI IPv4 Protocol instance can be started
|
||||
and stopped independently of each other by enabling or disabling their receive
|
||||
filter settings with the Configure() function.
|
||||
|
||||
When IpConfigData.UseDefaultAddress is set to FALSE, the new station address will
|
||||
be appended as an alias address into the addresses list in the EFI IPv4 Protocol
|
||||
driver. While set to TRUE, Configure() will trigger the EFI_IP4_CONFIG_PROTOCOL
|
||||
to retrieve the default IPv4 address if it is not available yet. Clients could
|
||||
frequently call GetModeData() to check the status to ensure that the default IPv4
|
||||
address is ready.
|
||||
|
||||
If operational parameters are reset or changed, any pending transmit and receive
|
||||
requests will be cancelled. Their completion token status will be set to EFI_ABORTED
|
||||
and their events will be signaled.
|
||||
|
||||
@param This The IP4 child to configure
|
||||
@param IpConfigData The configuration to apply. If NULL, clean it up.
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param IpConfigData Pointer to the EFI IPv4 Protocol configuration data structure.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The parameter is invalid
|
||||
@retval EFI_NO_MAPPING The default address hasn't been configured and the
|
||||
instance wants to use it.
|
||||
@retval EFI_SUCCESS The instance is configured.
|
||||
@retval EFI_SUCCESS The driver instance was successfully opened.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
||||
@retval EFI_UNSUPPORTED One or more of the following conditions is TRUE:
|
||||
A configuration protocol (DHCP, BOOTP, RARP, etc.) could
|
||||
not be located when clients choose to use the default IPv4
|
||||
address. This EFI IPv4 Protocol implementation does not
|
||||
support this requested filter or timeout setting.
|
||||
@retval EFI_OUT_OF_RESOURCES The EFI IPv4 Protocol driver instance data could not be allocated.
|
||||
@retval EFI_ALREADY_STARTED The interface is already open and must be stopped before the
|
||||
IPv4 address or subnet mask can be changed. The interface must
|
||||
also be stopped when switching to/from raw packet mode.
|
||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred. The EFI IPv4
|
||||
Protocol driver instance is not opened.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -1034,18 +1391,33 @@ Ip4Groups (
|
||||
|
||||
|
||||
/**
|
||||
Change the IP4 child's multicast setting. If JoinFlag is true,
|
||||
the child wants to join the group. Otherwise it wants to leave
|
||||
the group. If JoinFlag is false, and GroupAddress is NULL,
|
||||
it will leave all the groups which is a member.
|
||||
Joins and leaves multicast groups.
|
||||
|
||||
The Groups() function is used to join and leave multicast group sessions. Joining
|
||||
a group will enable reception of matching multicast packets. Leaving a group will
|
||||
disable the multicast packet reception.
|
||||
|
||||
If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.
|
||||
|
||||
@param This The IP4 child to change the setting.
|
||||
@param JoinFlag TRUE to join the group, otherwise leave it.
|
||||
@param GroupAddress The target group address
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param JoinFlag Set to TRUE to join the multicast group session and FALSE to leave.
|
||||
@param GroupAddress Pointer to the IPv4 multicast address.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The parameters are invalid
|
||||
@retval EFI_SUCCESS The group setting has been changed.
|
||||
@retval Otherwise It failed to change the setting.
|
||||
@retval EFI_SUCCESS The operation completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the following is TRUE:
|
||||
- This is NULL.
|
||||
- JoinFlag is TRUE and GroupAddress is NULL.
|
||||
- GroupAddress is not NULL and *GroupAddress is
|
||||
not a multicast IPv4 address.
|
||||
@retval EFI_NOT_STARTED This instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_OUT_OF_RESOURCES System resources could not be allocated.
|
||||
@retval EFI_UNSUPPORTED This EFI IPv4 Protocol implementation does not support multicast groups.
|
||||
@retval EFI_ALREADY_STARTED The group address is already in the group table (when
|
||||
JoinFlag is TRUE).
|
||||
@retval EFI_NOT_FOUND The group address is not in the group table (when JoinFlag is FALSE).
|
||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -1095,19 +1467,54 @@ ON_EXIT:
|
||||
|
||||
|
||||
/**
|
||||
Modify the IP child's route table. Each instance has its own
|
||||
route table.
|
||||
Adds and deletes routing table entries.
|
||||
|
||||
@param This The IP4 child to modify the route
|
||||
@param DeleteRoute TRUE to delete the route, otherwise add it
|
||||
@param SubnetAddress The destination network
|
||||
@param SubnetMask The destination network's mask
|
||||
@param GatewayAddress The next hop address.
|
||||
The Routes() function adds a route to or deletes a route from the routing table.
|
||||
|
||||
Routes are determined by comparing the SubnetAddress with the destination IPv4
|
||||
address arithmetically AND-ed with the SubnetMask. The gateway address must be
|
||||
on the same subnet as the configured station address.
|
||||
|
||||
The default route is added with SubnetAddress and SubnetMask both set to 0.0.0.0.
|
||||
The default route matches all destination IPv4 addresses that do not match any
|
||||
other routes.
|
||||
|
||||
A GatewayAddress that is zero is a nonroute. Packets are sent to the destination
|
||||
IP address if it can be found in the ARP cache or on the local subnet. One automatic
|
||||
nonroute entry will be inserted into the routing table for outgoing packets that
|
||||
are addressed to a local subnet (gateway address of 0.0.0.0).
|
||||
|
||||
Each EFI IPv4 Protocol instance has its own independent routing table. Those EFI
|
||||
IPv4 Protocol instances that use the default IPv4 address will also have copies
|
||||
of the routing table that was provided by the EFI_IP4_CONFIG_PROTOCOL, and these
|
||||
copies will be updated whenever the EIF IPv4 Protocol driver reconfigures its
|
||||
instances. As a result, client modification to the routing table will be lost.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The parameter is invalid.
|
||||
@retval EFI_SUCCESS The route table is successfully modified.
|
||||
@retval Others Failed to modify the route table
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param DeleteRoute Set to TRUE to delete this route from the routing table. Set to
|
||||
FALSE to add this route to the routing table. SubnetAddress
|
||||
and SubnetMask are used as the key to each route entry.
|
||||
@param SubnetAddress The address of the subnet that needs to be routed.
|
||||
@param SubnetMask The subnet mask of SubnetAddress.
|
||||
@param GatewayAddress The unicast gateway IPv4 address for this route.
|
||||
|
||||
@retval EFI_SUCCESS The operation completed successfully.
|
||||
@retval EFI_NOT_STARTED The driver instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
||||
- This is NULL.
|
||||
- SubnetAddress is NULL.
|
||||
- SubnetMask is NULL.
|
||||
- GatewayAddress is NULL.
|
||||
- *SubnetAddress is not a valid subnet address.
|
||||
- *SubnetMask is not a valid subnet mask.
|
||||
- *GatewayAddress is not a valid unicast IPv4 address.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not add the entry to the routing table.
|
||||
@retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
|
||||
@retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
|
||||
DeleteRoute is FALSE).
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
@ -1188,7 +1595,7 @@ ON_EXIT:
|
||||
|
||||
/**
|
||||
Check whether the user's token or event has already
|
||||
been enqueue on IP4's list.
|
||||
been enqueued on IP4's list.
|
||||
|
||||
@param Map The container of either user's transmit or receive
|
||||
token.
|
||||
@ -1436,18 +1843,32 @@ Ip4OnPacketSent (
|
||||
|
||||
|
||||
/**
|
||||
Transmit the user's data asynchronously. When transmission
|
||||
completed,the Token's status is updated and its event signalled.
|
||||
Places outgoing data packets into the transmit queue.
|
||||
|
||||
@param This The IP4 child instance
|
||||
@param Token The user's transmit token, which contains user's
|
||||
data, the result and an event to signal when
|
||||
completed.
|
||||
The Transmit() function places a sending request in the transmit queue of this
|
||||
EFI IPv4 Protocol instance. Whenever the packet in the token is sent out or some
|
||||
errors occur, the event in the token will be signaled and the status is updated.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The parameter is invalid.
|
||||
@retval EFI_NOT_STARTED The IP4 child hasn't been started.
|
||||
@retval EFI_SUCCESS The user's data has been successfully enqueued
|
||||
for transmission.
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param Token Pointer to the transmit token.
|
||||
|
||||
@retval EFI_SUCCESS The data has been queued for transmission.
|
||||
@retval EFI_NOT_STARTED This instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER One or more pameters are invalid.
|
||||
@retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
|
||||
was already in the transmit queue.
|
||||
@retval EFI_NOT_READY The completion token could not be queued because the transmit
|
||||
queue is full.
|
||||
@retval EFI_NOT_FOUND Not route is found to destination address.
|
||||
@retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
|
||||
@retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
|
||||
short to transmit.
|
||||
@retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
|
||||
greater than MTU (or greater than the maximum packet size if
|
||||
Token.Packet.TxData.OverrideData.
|
||||
DoNotFragment is TRUE.)
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -1620,19 +2041,35 @@ ON_EXIT:
|
||||
|
||||
|
||||
/**
|
||||
Receive a packet for the upper layer. If there are packets
|
||||
pending on the child's receive queue, the receive request
|
||||
will be fulfilled immediately. Otherwise, the request is
|
||||
enqueued. When receive request is completed, the status in
|
||||
the Token is updated and its event is signalled.
|
||||
Places a receiving request into the receiving queue.
|
||||
|
||||
The Receive() function places a completion token into the receive packet queue.
|
||||
This function is always asynchronous.
|
||||
|
||||
The Token.Event field in the completion token must be filled in by the caller
|
||||
and cannot be NULL. When the receive operation completes, the EFI IPv4 Protocol
|
||||
driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
|
||||
is signaled.
|
||||
|
||||
@param This The IP4 child to receive packet.
|
||||
@param Token The user's receive token
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param Token Pointer to a token that is associated with the receive data descriptor.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The token is invalid.
|
||||
@retval EFI_NOT_STARTED The IP4 child hasn't been started
|
||||
@retval EFI_ACCESS_DENIED The token or event is already queued.
|
||||
@retval EFI_SUCCESS The receive request has been issued.
|
||||
@retval EFI_SUCCESS The receive completion token was cached.
|
||||
@retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP, RARP, etc.)
|
||||
is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
|
||||
- This is NULL.
|
||||
- Token is NULL.
|
||||
- Token.Event is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued due to a lack of system
|
||||
resources (usually memory).
|
||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
||||
The EFI IPv4 Protocol instance has been reset to startup defaults.
|
||||
EFI_ACCESS_DENIED The receive completion token with the same Token.Event was already
|
||||
in the receive queue.
|
||||
@retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.
|
||||
@retval EFI_ICMP_ERROR An ICMP error packet was received.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -1875,18 +2312,32 @@ Ip4Cancel (
|
||||
|
||||
|
||||
/**
|
||||
Cancel the queued receive/transmit requests. If Token is NULL,
|
||||
all the queued requests will be cancelled. It just validate
|
||||
the parameter then pass them to Ip4Cancel.
|
||||
Abort an asynchronous transmit or receive request.
|
||||
|
||||
The Cancel() function is used to abort a pending transmit or receive request.
|
||||
If the token is in the transmit or receive request queues, after calling this
|
||||
function, Token->Status will be set to EFI_ABORTED and then Token->Event will
|
||||
be signaled. If the token is not in one of the queues, which usually means the
|
||||
asynchronous operation has completed, this function will not signal the token
|
||||
and EFI_NOT_FOUND is returned.
|
||||
|
||||
@param This The IP4 child to cancel the request
|
||||
@param Token The token to cancel, if NULL, cancel all.
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
@param Token Pointer to a token that has been issued by
|
||||
EFI_IP4_PROTOCOL.Transmit() or
|
||||
EFI_IP4_PROTOCOL.Receive(). If NULL, all pending
|
||||
tokens are aborted. Type EFI_IP4_COMPLETION_TOKEN is
|
||||
defined in EFI_IP4_PROTOCOL.Transmit().
|
||||
|
||||
@retval EFI_INVALID_PARAMETER This is NULL
|
||||
@retval EFI_NOT_STARTED The IP4 child hasn't been configured.
|
||||
@retval EFI_NO_MAPPING The IP4 child is configured to use the default,
|
||||
but the default address hasn't been acquired.
|
||||
@retval EFI_SUCCESS The Token is cancelled.
|
||||
@retval EFI_SUCCESS The asynchronous I/O request was aborted and
|
||||
Token.->Event was signaled. When Token is NULL, all
|
||||
pending requests were aborted and their events were signaled.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_NOT_STARTED This instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was
|
||||
not found in the transmit or receive queue. It has either completed
|
||||
or was not issued by Transmit() and Receive().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -1927,13 +2378,30 @@ ON_EXIT:
|
||||
|
||||
|
||||
/**
|
||||
Poll the network stack. The EFI network stack is poll based. There
|
||||
is no interrupt support for the network interface card.
|
||||
Polls for incoming data packets and processes outgoing data packets.
|
||||
|
||||
The Poll() function polls for incoming data packets and processes outgoing data
|
||||
packets. Network drivers and applications can call the EFI_IP4_PROTOCOL.Poll()
|
||||
function to increase the rate that data packets are moved between the communications
|
||||
device and the transmit and receive queues.
|
||||
|
||||
In some systems the periodic timer event may not poll the underlying communications
|
||||
device fast enough to transmit and/or receive all data packets without missing
|
||||
incoming packets or dropping outgoing packets. Drivers and applications that are
|
||||
experiencing packet loss should try calling the EFI_IP4_PROTOCOL.Poll() function
|
||||
more often.
|
||||
|
||||
@param This The IP4 child to poll through
|
||||
@param This Pointer to the EFI_IP4_PROTOCOL instance.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The parameter is invalid
|
||||
@retval EFI_NOT_STARTED The IP4 child hasn't been configured.
|
||||
@retval EFI_SUCCESS Incoming or outgoing data was processed.
|
||||
@retval EFI_NOT_STARTED This EFI IPv4 Protocol instance has not been started.
|
||||
@retval EFI_NO_MAPPING When using the default address, configuration (DHCP, BOOTP,
|
||||
RARP, etc.) is not finished yet.
|
||||
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
||||
@retval EFI_NOT_READY No incoming or outgoing data is processed.
|
||||
@retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.
|
||||
Consider increasing the polling rate.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -1964,19 +2432,6 @@ EfiIp4Poll (
|
||||
return Mnp->Poll (Mnp);
|
||||
}
|
||||
|
||||
EFI_IP4_PROTOCOL
|
||||
mEfiIp4ProtocolTemplete = {
|
||||
EfiIp4GetModeData,
|
||||
EfiIp4Configure,
|
||||
EfiIp4Groups,
|
||||
EfiIp4Routes,
|
||||
EfiIp4Transmit,
|
||||
EfiIp4Receive,
|
||||
EfiIp4Cancel,
|
||||
EfiIp4Poll
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Decrease the life of the transmitted packets. If it is
|
||||
decreased to zero, cancel the packet. This function is
|
||||
|
@ -50,7 +50,7 @@ Abstract:
|
||||
#include "Ip4Input.h"
|
||||
#include "Ip4Output.h"
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
IP4_PROTOCOL_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'P'),
|
||||
IP4_SERVICE_SIGNATURE = EFI_SIGNATURE_32 ('I', 'P', '4', 'S'),
|
||||
|
||||
@ -74,7 +74,7 @@ enum {
|
||||
IP4_SERVICE_STARTED,
|
||||
IP4_SERVICE_CONFIGED,
|
||||
IP4_SERVICE_DESTORY
|
||||
};
|
||||
} IP4_IMPL_ENUM_TYPES;
|
||||
|
||||
//
|
||||
// IP4_TXTOKEN_WRAP wraps the upper layer's transmit token.
|
||||
@ -109,7 +109,7 @@ typedef struct {
|
||||
EFI_IP4_RECEIVE_DATA RxData;
|
||||
} IP4_RXDATA_WRAP;
|
||||
|
||||
struct _IP4_PROTOCOL {
|
||||
typedef struct _IP4_PROTOCOL {
|
||||
UINT32 Signature;
|
||||
|
||||
EFI_IP4_PROTOCOL Ip4Proto;
|
||||
@ -148,9 +148,9 @@ struct _IP4_PROTOCOL {
|
||||
|
||||
EFI_IP4_CONFIG_DATA ConfigData;
|
||||
|
||||
};
|
||||
} IP4_PROTOCOL;
|
||||
|
||||
struct _IP4_SERVICE {
|
||||
typedef struct _IP4_SERVICE {
|
||||
UINT32 Signature;
|
||||
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
||||
INTN State;
|
||||
@ -201,7 +201,7 @@ struct _IP4_SERVICE {
|
||||
// NIC this IP4_SERVICE works on.
|
||||
//
|
||||
CHAR16 *MacString;
|
||||
};
|
||||
} IP4_SERVICE;
|
||||
|
||||
#define IP4_INSTANCE_FROM_PROTOCOL(Ip4) \
|
||||
CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
|
||||
|
@ -180,7 +180,7 @@ Ip4CopyOption (
|
||||
//
|
||||
// don't copy options that is only valid for the first fragment
|
||||
//
|
||||
if (FirstFragment || (Type & IP4_OPTION_COPY_MASK)) {
|
||||
if (FirstFragment || (Type & IP4_OPTION_COPY_MASK) != 0) {
|
||||
CopyMem (OptBuf + Next, Option + Cur, Len);
|
||||
Next += Len;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ Abstract:
|
||||
#ifndef __EFI_IP4_OPTION_H__
|
||||
#define __EFI_IP4_OPTION_H__
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
IP4_OPTION_EOP = 0,
|
||||
IP4_OPTION_NOP = 1,
|
||||
IP4_OPTION_LSRR = 131, // Loss source and record routing, 10000011
|
||||
@ -32,7 +32,7 @@ enum {
|
||||
IP4_OPTION_RR = 7, // Record routing, 00000111
|
||||
|
||||
IP4_OPTION_COPY_MASK = 0x80
|
||||
};
|
||||
} IP4_OPTION_ENUM_TYPES;
|
||||
|
||||
BOOLEAN
|
||||
Ip4OptionIsValid (
|
||||
|
@ -566,7 +566,7 @@ Ip4Route (
|
||||
// network. Otherwise, it is an indirect route, the packet will be
|
||||
// send the next hop router.
|
||||
//
|
||||
if (RtEntry->Flag & IP4_DIRECT_ROUTE) {
|
||||
if ((RtEntry->Flag & IP4_DIRECT_ROUTE) != 0) {
|
||||
NextHop = Dest;
|
||||
} else {
|
||||
NextHop = RtEntry->NextHop;
|
||||
|
@ -26,12 +26,12 @@ Abstract:
|
||||
|
||||
#include "Ip4Common.h"
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
IP4_DIRECT_ROUTE = 0x00000001,
|
||||
|
||||
IP4_ROUTE_CACHE_HASH = 31,
|
||||
IP4_ROUTE_CACHE_MAX = 64 // Max NO. of cache entry per hash bucket
|
||||
};
|
||||
} IP4_ROUTE_ENUM_TYPES;
|
||||
|
||||
#define IP4_ROUTE_CACHE_HASH(Dst, Src) (((Dst) ^ (Src)) % IP4_ROUTE_CACHE_HASH)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user