TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip4Impl.h File Reference
#include <Uefi.h>
#include <Protocol/IpSec.h>
#include <Protocol/Ip4.h>
#include <Protocol/Ip4Config2.h>
#include <Protocol/Arp.h>
#include <Protocol/ManagedNetwork.h>
#include <Protocol/Dhcp4.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/HiiConfigAccess.h>
#include <IndustryStandard/Dhcp.h>
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>
#include <Library/NetLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DpcLib.h>
#include <Library/PrintLib.h>
#include <Library/DevicePathLib.h>
#include <Library/HiiLib.h>
#include <Library/UefiHiiServicesLib.h>
#include "Ip4Common.h"
#include "Ip4Driver.h"
#include "Ip4If.h"
#include "Ip4Icmp.h"
#include "Ip4Option.h"
#include "Ip4Igmp.h"
#include "Ip4Route.h"
#include "Ip4Input.h"
#include "Ip4Output.h"
#include "Ip4Config2Impl.h"
#include "Ip4Config2Nv.h"
#include "Ip4NvData.h"

Go to the source code of this file.

Data Structures

struct  IP4_TXTOKEN_WRAP
 
struct  IP4_IPSEC_WRAP
 
struct  IP4_RXDATA_WRAP
 
struct  _IP4_PROTOCOL
 
struct  _IP4_SERVICE
 

Macros

#define IP4_PROTOCOL_SIGNATURE   SIGNATURE_32 ('I', 'P', '4', 'P')
 
#define IP4_SERVICE_SIGNATURE   SIGNATURE_32 ('I', 'P', '4', 'S')
 
#define IP4_STATE_UNCONFIGED   0
 
#define IP4_STATE_CONFIGED   1
 
#define IP4_SERVICE_UNSTARTED   0
 
#define IP4_SERVICE_STARTED   1
 
#define IP4_SERVICE_CONFIGED   2
 
#define IP4_SERVICE_DESTROY   3
 
#define IP4_INSTANCE_FROM_PROTOCOL(Ip4)    CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)
 
#define IP4_SERVICE_FROM_PROTOCOL(Sb)    CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
 
#define IP4_SERVICE_FROM_CONFIG2_INSTANCE(This)    CR (This, IP4_SERVICE, Ip4Config2Instance, IP4_SERVICE_SIGNATURE)
 
#define IP4_NO_MAPPING(IpInstance)   (!(IpInstance)->Interface->Configured)
 

Functions

EFI_STATUS Ip4ServiceConfigMnp (IN IP4_SERVICE *IpSb, IN BOOLEAN Force)
 
VOID Ip4InitProtocol (IN IP4_SERVICE *IpSb, IN OUT IP4_PROTOCOL *IpInstance)
 
EFI_STATUS Ip4CleanProtocol (IN IP4_PROTOCOL *IpInstance)
 
EFI_STATUS Ip4Cancel (IN IP4_PROTOCOL *IpInstance, IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL)
 
EFI_STATUS Ip4Groups (IN IP4_PROTOCOL *IpInstance, IN BOOLEAN JoinFlag, IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL)
 
VOID EFIAPI Ip4TimerTicking (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI Ip4TimerReconfigChecking (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI Ip4SentPacketTicking (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
 
VOID EFIAPI Ip4FreeTxToken (IN VOID *Context)
 

Variables

EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete
 
EFI_IPSEC2_PROTOCOLmIpSec
 
BOOLEAN mIpSec2Installed
 

Detailed Description

Ip4 internal functions and type definitions.

Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Ip4Impl.h.

Macro Definition Documentation

◆ IP4_INSTANCE_FROM_PROTOCOL

#define IP4_INSTANCE_FROM_PROTOCOL (   Ip4)     CR ((Ip4), IP4_PROTOCOL, Ip4Proto, IP4_PROTOCOL_SIGNATURE)

Definition at line 221 of file Ip4Impl.h.

◆ IP4_NO_MAPPING

#define IP4_NO_MAPPING (   IpInstance)    (!(IpInstance)->Interface->Configured)

Definition at line 230 of file Ip4Impl.h.

◆ IP4_PROTOCOL_SIGNATURE

#define IP4_PROTOCOL_SIGNATURE   SIGNATURE_32 ('I', 'P', '4', 'P')

Definition at line 55 of file Ip4Impl.h.

◆ IP4_SERVICE_CONFIGED

#define IP4_SERVICE_CONFIGED   2

Definition at line 74 of file Ip4Impl.h.

◆ IP4_SERVICE_DESTROY

#define IP4_SERVICE_DESTROY   3

Definition at line 75 of file Ip4Impl.h.

◆ IP4_SERVICE_FROM_CONFIG2_INSTANCE

#define IP4_SERVICE_FROM_CONFIG2_INSTANCE (   This)     CR (This, IP4_SERVICE, Ip4Config2Instance, IP4_SERVICE_SIGNATURE)

Definition at line 227 of file Ip4Impl.h.

◆ IP4_SERVICE_FROM_PROTOCOL

#define IP4_SERVICE_FROM_PROTOCOL (   Sb)     CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)

Definition at line 224 of file Ip4Impl.h.

◆ IP4_SERVICE_SIGNATURE

#define IP4_SERVICE_SIGNATURE   SIGNATURE_32 ('I', 'P', '4', 'S')

Definition at line 56 of file Ip4Impl.h.

◆ IP4_SERVICE_STARTED

#define IP4_SERVICE_STARTED   1

Definition at line 73 of file Ip4Impl.h.

◆ IP4_SERVICE_UNSTARTED

#define IP4_SERVICE_UNSTARTED   0

Definition at line 72 of file Ip4Impl.h.

◆ IP4_STATE_CONFIGED

#define IP4_STATE_CONFIGED   1

Definition at line 64 of file Ip4Impl.h.

◆ IP4_STATE_UNCONFIGED

#define IP4_STATE_UNCONFIGED   0

Definition at line 63 of file Ip4Impl.h.

Function Documentation

◆ Ip4Cancel()

EFI_STATUS Ip4Cancel ( IN IP4_PROTOCOL IpInstance,
IN EFI_IP4_COMPLETION_TOKEN *Token  OPTIONAL 
)

Cancel the user's receive/transmit request.

Parameters
[in]IpInstanceThe IP4 child.
[in]TokenThe token to cancel. If NULL, all token will be cancelled.
Return values
EFI_SUCCESSThe token is cancelled.
EFI_NOT_FOUNDThe token isn't found on either the transmit/receive queue.
EFI_DEVICE_ERRORNot all token is cancelled when Token is NULL.

Definition at line 2016 of file Ip4Impl.c.

◆ Ip4CleanProtocol()

EFI_STATUS Ip4CleanProtocol ( IN IP4_PROTOCOL IpInstance)

Clean up the IP4 child, release all the resources used by it.

Parameters
[in]IpInstanceThe IP4 child to clean up.
Return values
EFI_SUCCESSThe IP4 child is cleaned up.
EFI_DEVICE_ERRORSome resources failed to be released.

Definition at line 760 of file Ip4Impl.c.

◆ Ip4FreeTxToken()

VOID EFIAPI Ip4FreeTxToken ( IN VOID *  Context)

The callback function for the net buffer which wraps the user's transmit token. Although it seems this function is pretty simple, there are some subtle things. When user requests the IP to transmit a packet by passing it a token, the token is wrapped in an IP4_TXTOKEN_WRAP and the data is wrapped in an net buffer. the net buffer's Free function is set to Ip4FreeTxToken. The Token and token wrap are added to the IP child's TxToken map. Then the buffer is passed to Ip4Output for transmission. If something error happened before that, the buffer is freed, which in turn will free the token wrap. The wrap may have been added to the TxToken map or not, and the user's event shouldn't be fired because we are still in the EfiIp4Transmit. If the buffer has been sent by Ip4Output, it should be removed from the TxToken map and user's event signaled. The token wrap and buffer are bound together. Check the comments in Ip4Output for information about IP fragmentation.

Parameters
[in]ContextThe token's wrap.

Definition at line 1455 of file Ip4Impl.c.

◆ Ip4Groups()

EFI_STATUS Ip4Groups ( IN IP4_PROTOCOL IpInstance,
IN BOOLEAN  JoinFlag,
IN EFI_IPv4_ADDRESS *GroupAddress  OPTIONAL 
)

Change the IP4 child's multicast setting. The caller should make sure that the parameters is valid.

Parameters
[in]IpInstanceThe IP4 child to change the setting.
[in]JoinFlagTRUE to join the group, otherwise leave it
[in]GroupAddressThe target group address
Return values
EFI_ALREADY_STARTEDWant to join the group, but already a member of it
EFI_OUT_OF_RESOURCESFailed to allocate some resources.
EFI_DEVICE_ERRORFailed to set the group configuration
EFI_SUCCESSSuccessfully updated the group setting.
EFI_NOT_FOUNDTry to leave the group which it isn't a member.

Change the IP4 child's multicast setting. The caller should make sure that the parameters is valid.

Parameters
[in]IpInstanceThe IP4 child to change the setting.
[in]JoinFlagTRUE to join the group, otherwise leave it.
[in]GroupAddressThe target group address.
Return values
EFI_ALREADY_STARTEDWant to join the group, but already a member of it.
EFI_OUT_OF_RESOURCESFailed to allocate some resources.
EFI_DEVICE_ERRORFailed to set the group configuration.
EFI_SUCCESSSuccessfully updated the group setting.
EFI_NOT_FOUNDTry to leave the group which it isn't a member.

Definition at line 986 of file Ip4Impl.c.

◆ Ip4InitProtocol()

VOID Ip4InitProtocol ( IN IP4_SERVICE IpSb,
IN OUT IP4_PROTOCOL IpInstance 
)

Initialize the IP4_PROTOCOL structure to the unconfigured states.

Parameters
IpSbThe IP4 service instance.
IpInstanceThe IP4 child instance.

Definition at line 532 of file Ip4Impl.c.

◆ Ip4SentPacketTicking()

EFI_STATUS EFIAPI Ip4SentPacketTicking ( IN NET_MAP Map,
IN NET_MAP_ITEM Item,
IN VOID *  Context 
)

Decrease the life of the transmitted packets. If it is decreased to zero, cancel the packet. This function is called by Ip4PacketTimerTicking which time out both the received-but-not-delivered and transmitted-but-not-recycle packets.

Parameters
[in]MapThe IP4 child's transmit map.
[in]ItemCurrent transmitted packet.
[in]ContextNot used.
Return values
EFI_SUCCESSAlways returns EFI_SUCCESS.

Definition at line 2213 of file Ip4Impl.c.

◆ Ip4ServiceConfigMnp()

EFI_STATUS Ip4ServiceConfigMnp ( IN IP4_SERVICE IpSb,
IN BOOLEAN  Force 
)

Config the MNP parameter used by IP. The IP driver use one MNP 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 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 matter whether that is changed or not.

Parameters
[in]IpSbThe IP4 service instance that is to be changed.
[in]ForceForce the configuration or not.
Return values
EFI_SUCCESSThe MNP is successfully configured/reconfigured.
OthersConfiguration failed.

Definition at line 465 of file Ip4Impl.c.

◆ Ip4TimerReconfigChecking()

VOID EFIAPI Ip4TimerReconfigChecking ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

This dedicated timer is used to poll underlying network media status. In case of cable swap or wireless network switch, a new round auto configuration will be initiated. The timer will signal the IP4 to run DHCP configuration again. IP4 driver will free old IP address related resource, such as route table and Interface, then initiate a DHCP process to acquire new IP, eventually create route table for new IP address.

Parameters
[in]EventThe IP4 service instance's heart beat timer.
[in]ContextThe IP4 service instance.

Definition at line 2270 of file Ip4Impl.c.

◆ Ip4TimerTicking()

VOID EFIAPI Ip4TimerTicking ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

This heart beat timer of IP4 service instance times out all of its IP4 children's received-but-not-delivered and transmitted-but-not-recycle packets, and provides time input for its IGMP protocol.

Parameters
[in]EventThe IP4 service instance's heart beat timer.
[in]ContextThe IP4 service instance.

Definition at line 2242 of file Ip4Impl.c.

Variable Documentation

◆ mEfiIp4ProtocolTemplete

EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete
extern

Definition at line 332 of file Ip4Impl.c.

◆ mIpSec

EFI_IPSEC2_PROTOCOL* mIpSec
extern

Definition at line 10 of file Ip4Impl.c.

◆ mIpSec2Installed

BOOLEAN mIpSec2Installed
extern

Definition at line 23 of file Ip4Driver.c.