NetworkPkg/DnsDxe/DnsImpl.c File Reference


Functions

EFI_STATUS Dns4RemoveTokenEntry (IN NET_MAP *TokenMap, IN DNS4_TOKEN_ENTRY *TokenEntry)
EFI_STATUS Dns6RemoveTokenEntry (IN NET_MAP *TokenMap, IN DNS6_TOKEN_ENTRY *TokenEntry)
EFI_STATUS EFIAPI Dns4CancelTokens (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg)
EFI_STATUS EFIAPI Dns6CancelTokens (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg)
EFI_STATUS EFIAPI GetDns4TokenEntry (IN NET_MAP *TokensMap, IN EFI_DNS4_COMPLETION_TOKEN *Token, OUT DNS4_TOKEN_ENTRY **TokenEntry)
EFI_STATUS EFIAPI GetDns6TokenEntry (IN NET_MAP *TokensMap, IN EFI_DNS6_COMPLETION_TOKEN *Token, OUT DNS6_TOKEN_ENTRY **TokenEntry)
EFI_STATUS Dns4InstanceCancelToken (IN DNS_INSTANCE *Instance, IN EFI_DNS4_COMPLETION_TOKEN *Token)
EFI_STATUS Dns6InstanceCancelToken (IN DNS_INSTANCE *Instance, IN EFI_DNS6_COMPLETION_TOKEN *Token)
VOID Dns4CleanConfigure (IN OUT EFI_DNS4_CONFIG_DATA *Config)
VOID Dns6CleanConfigure (IN OUT EFI_DNS6_CONFIG_DATA *Config)
EFI_STATUS Dns4CopyConfigure (OUT EFI_DNS4_CONFIG_DATA *Dst, IN EFI_DNS4_CONFIG_DATA *Src)
EFI_STATUS Dns6CopyConfigure (OUT EFI_DNS6_CONFIG_DATA *Dst, IN EFI_DNS6_CONFIG_DATA *Src)
VOID EFIAPI DnsDummyExtFree (IN VOID *Arg)
BOOLEAN Dns4GetMapping (IN DNS_INSTANCE *Instance, IN UDP_IO *UdpIo, IN EFI_UDP4_CONFIG_DATA *UdpCfgData)
BOOLEAN Dns6GetMapping (IN DNS_INSTANCE *Instance, IN UDP_IO *UdpIo, IN EFI_UDP6_CONFIG_DATA *UdpCfgData)
EFI_STATUS Dns4ConfigUdp (IN DNS_INSTANCE *Instance, IN UDP_IO *UdpIo)
EFI_STATUS Dns6ConfigUdp (IN DNS_INSTANCE *Instance, IN UDP_IO *UdpIo)
EFI_STATUS EFIAPI UpdateDns4Cache (IN LIST_ENTRY *Dns4CacheList, IN BOOLEAN DeleteFlag, IN BOOLEAN Override, IN EFI_DNS4_CACHE_ENTRY DnsCacheEntry)
EFI_STATUS EFIAPI UpdateDns6Cache (IN LIST_ENTRY *Dns6CacheList, IN BOOLEAN DeleteFlag, IN BOOLEAN Override, IN EFI_DNS6_CACHE_ENTRY DnsCacheEntry)
EFI_STATUS EFIAPI AddDns4ServerIp (IN LIST_ENTRY *Dns4ServerList, IN EFI_IPv4_ADDRESS ServerIp)
EFI_STATUS EFIAPI AddDns6ServerIp (IN LIST_ENTRY *Dns6ServerList, IN EFI_IPv6_ADDRESS ServerIp)
BOOLEAN IsValidDnsResponse (IN NET_MAP *TokensMap, IN UINT16 Identification, IN UINT16 Type, OUT NET_MAP_ITEM **Item)
EFI_STATUS ParseDnsResponse (IN OUT DNS_INSTANCE *Instance, IN UINT8 *RxString, OUT BOOLEAN *Completed)
VOID EFIAPI DnsOnPacketReceived (NET_BUF *Packet, UDP_END_POINT *EndPoint, EFI_STATUS IoStatus, VOID *Context)
VOID EFIAPI DnsOnPacketSent (NET_BUF *Packet, UDP_END_POINT *EndPoint, EFI_STATUS IoStatus, VOID *Context)
EFI_STATUS DoDnsQuery (IN DNS_INSTANCE *Instance, IN NET_BUF *Packet)
EFI_STATUS ConstructDNSQueryIp (IN DNS_INSTANCE *Instance, IN CHAR16 *HostName, IN UINT16 Type, OUT NET_BUF **Packet)
EFI_STATUS DnsRetransmit (IN DNS_INSTANCE *Instance, IN NET_BUF *Packet)
VOID EFIAPI DnsOnTimerRetransmit (IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI DnsOnTimerUpdate (IN EFI_EVENT Event, IN VOID *Context)

Detailed Description

DnsDxe support functions implementation.

Copyright (c) 2015, Intel Corporation. All rights reserved.
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 http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Function Documentation

EFI_STATUS EFIAPI AddDns4ServerIp ( IN LIST_ENTRY *  Dns4ServerList,
IN EFI_IPv4_ADDRESS  ServerIp 
)

Add Dns4 ServerIp to common list of addresses of all configured DNSv4 server.

Parameters:
Dns4ServerList Common list of addresses of all configured DNSv4 server.
ServerIp DNS server Ip.
Return values:
EFI_SUCCESS Add Dns4 ServerIp to common list successfully.
Others Failed to add Dns4 ServerIp to common list.

References DNS4_SERVER_IP::AllServerLink, and DNS4_SERVER_IP::Dns4ServerIp.

Referenced by Dns4Configure().

EFI_STATUS EFIAPI AddDns6ServerIp ( IN LIST_ENTRY *  Dns6ServerList,
IN EFI_IPv6_ADDRESS  ServerIp 
)

Add Dns6 ServerIp to common list of addresses of all configured DNSv6 server.

Parameters:
Dns6ServerList Common list of addresses of all configured DNSv6 server.
ServerIp DNS server Ip.
Return values:
EFI_SUCCESS Add Dns6 ServerIp to common list successfully.
Others Failed to add Dns6 ServerIp to common list.

References DNS6_SERVER_IP::AllServerLink, and DNS6_SERVER_IP::Dns6ServerIp.

Referenced by Dns6Configure().

EFI_STATUS ConstructDNSQueryIp ( IN DNS_INSTANCE Instance,
IN CHAR16 *  HostName,
IN UINT16  Type,
OUT NET_BUF **  Packet 
)

Construct the Packet to query Ip.

Parameters:
Instance The DNS instance
HostName Queried HostName
Type DNS query Type
Packet The packet for querying Ip
Return values:
EFI_SUCCESS The packet is constructed.
Others Failed to construct the Packet.

1 for header, 1 for tail.

References DNS_HEADER::AditionalNum, DNS_HEADER::AnswersNum, DNS_HEADER::AuthorityNum, _DNS_FLAGS::Bits, DNS_QUERY_SECTION::Class, DNS_CLASS_INET, DNS_DEFAULT_BLKSIZE, DNS_FLAGS_OPCODE_STANDARD, DNS_FLAGS_QR_QUERY, DnsDummyExtFree(), DNS_HEADER::Flags, DNS_HEADER::Identification, _DNS_FLAGS::OpCode, _DNS_FLAGS::QR, DNS_HEADER::QuestionsNum, _DNS_FLAGS::RD, DNS_QUERY_SECTION::Type, and _DNS_FLAGS::Uint16.

Referenced by Dns4HostNameToIp(), and Dns6HostNameToIp().

EFI_STATUS EFIAPI Dns4CancelTokens ( IN NET_MAP *  Map,
IN NET_MAP_ITEM *  Item,
IN VOID *  Arg 
)

This function cancle the token specified by Arg in the Map.

Parameters:
[in] Map Pointer to the NET_MAP.
[in] Item Pointer to the NET_MAP_ITEM.
[in] Arg Pointer to the token to be cancelled. If NULL, all the tokens in this Map will be cancelled. This parameter is optional and may be NULL.
Return values:
EFI_SUCCESS The token is cancelled if Arg is NULL, or the token is not the same as that in the Item, if Arg is not NULL.
EFI_ABORTED Arg is not NULL, and the token specified by Arg is cancelled.

References Dns4RemoveTokenEntry(), and DNS4_TOKEN_ENTRY::Token.

Referenced by Dns4InstanceCancelToken().

VOID Dns4CleanConfigure ( IN OUT EFI_DNS4_CONFIG_DATA *  Config  ) 

Free the resource related to the configure parameters.

Parameters:
Config The DNS configure data

Referenced by Dns4CopyConfigure().

EFI_STATUS Dns4ConfigUdp ( IN DNS_INSTANCE Instance,
IN UDP_IO *  UdpIo 
)

Configure the UDP.

Parameters:
Instance The DNS session
UdpIo The UDP_IO instance
Return values:
EFI_SUCCESS The UDP is successfully configured for the session.

References Dns4GetMapping(), and DNS_SERVER_PORT.

Referenced by Dns4Configure().

EFI_STATUS Dns4CopyConfigure ( OUT EFI_DNS4_CONFIG_DATA *  Dst,
IN EFI_DNS4_CONFIG_DATA *  Src 
)

Allocate memory for configure parameter such as timeout value for Dst, then copy the configure parameter from Src to Dst.

Parameters:
[out] Dst The destination DHCP configure data.
[in] Src The source DHCP configure data.
Return values:
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_SUCCESS The configure is copied.

References Dns4CleanConfigure().

Referenced by Dns4Configure(), and Dns4GetModeData().

BOOLEAN Dns4GetMapping ( IN DNS_INSTANCE Instance,
IN UDP_IO *  UdpIo,
IN EFI_UDP4_CONFIG_DATA *  UdpCfgData 
)

Poll the UDP to get the IP4 default address, which may be retrieved by DHCP.

The default time out value is 5 seconds. If IP has retrieved the default address, the UDP is reconfigured.

Parameters:
Instance The DNS instance
UdpIo The UDP_IO to poll
UdpCfgData The UDP configure data to reconfigure the UDP_IO
Return values:
TRUE The default address is retrieved and UDP is reconfigured.
FALSE Some error occured.

References DNS_TIME_TO_GETMAP, and _DNS_SERVICE::TimerToGetMap.

Referenced by Dns4ConfigUdp().

EFI_STATUS Dns4InstanceCancelToken ( IN DNS_INSTANCE Instance,
IN EFI_DNS4_COMPLETION_TOKEN *  Token 
)

Cancel DNS4 tokens from the DNS4 instance.

Parameters:
[in] Instance Pointer to the DNS instance context data.
[in] Token Pointer to the token to be canceled. If NULL, all tokens in this instance will be cancelled. This parameter is optional and may be NULL.
Return values:
EFI_SUCCESS The Token is cancelled.
EFI_NOT_FOUND The Token is not found.

References Dns4CancelTokens(), and GetDns4TokenEntry().

Referenced by Dns4Cancel(), Dns4Configure(), and DnsDestroyInstance().

EFI_STATUS Dns4RemoveTokenEntry ( IN NET_MAP *  TokenMap,
IN DNS4_TOKEN_ENTRY TokenEntry 
)

Remove TokenEntry from TokenMap.

Parameters:
[in] TokenMap All DNSv4 Token entrys.
[in] TokenEntry TokenEntry need to be removed.
Return values:
EFI_SUCCESS Remove TokenEntry from TokenMap sucessfully.
EFI_NOT_FOUND TokenEntry is not found in TokenMap.

Referenced by Dns4CancelTokens(), DnsOnTimerRetransmit(), and ParseDnsResponse().

EFI_STATUS EFIAPI Dns6CancelTokens ( IN NET_MAP *  Map,
IN NET_MAP_ITEM *  Item,
IN VOID *  Arg 
)

This function cancle the token specified by Arg in the Map.

Parameters:
[in] Map Pointer to the NET_MAP.
[in] Item Pointer to the NET_MAP_ITEM.
[in] Arg Pointer to the token to be cancelled. If NULL, all the tokens in this Map will be cancelled. This parameter is optional and may be NULL.
Return values:
EFI_SUCCESS The token is cancelled if Arg is NULL, or the token is not the same as that in the Item, if Arg is not NULL.
EFI_ABORTED Arg is not NULL, and the token specified by Arg is cancelled.

References Dns6RemoveTokenEntry(), and DNS6_TOKEN_ENTRY::Token.

Referenced by Dns6InstanceCancelToken().

VOID Dns6CleanConfigure ( IN OUT EFI_DNS6_CONFIG_DATA *  Config  ) 

Free the resource related to the configure parameters.

Parameters:
Config The DNS configure data

Referenced by Dns6CopyConfigure().

EFI_STATUS Dns6ConfigUdp ( IN DNS_INSTANCE Instance,
IN UDP_IO *  UdpIo 
)

Configure the UDP.

Parameters:
Instance The DNS session
UdpIo The UDP_IO instance
Return values:
EFI_SUCCESS The UDP is successfully configured for the session.

References Dns6GetMapping(), and DNS_SERVER_PORT.

Referenced by Dns6Configure().

EFI_STATUS Dns6CopyConfigure ( OUT EFI_DNS6_CONFIG_DATA *  Dst,
IN EFI_DNS6_CONFIG_DATA *  Src 
)

Allocate memory for configure parameter such as timeout value for Dst, then copy the configure parameter from Src to Dst.

Parameters:
[out] Dst The destination DHCP configure data.
[in] Src The source DHCP configure data.
Return values:
EFI_OUT_OF_RESOURCES Failed to allocate memory.
EFI_SUCCESS The configure is copied.

References Dns6CleanConfigure().

Referenced by Dns6Configure(), and Dns6GetModeData().

BOOLEAN Dns6GetMapping ( IN DNS_INSTANCE Instance,
IN UDP_IO *  UdpIo,
IN EFI_UDP6_CONFIG_DATA *  UdpCfgData 
)

Configure the opened Udp6 instance until the corresponding Ip6 instance has been configured.

Parameters:
Instance The DNS instance
UdpIo The UDP_IO to poll
UdpCfgData The UDP configure data to reconfigure the UDP_IO
Return values:
TRUE Configure the Udp6 instance successfully.
FALSE Some error occured.

References DNS_TIME_TO_GETMAP, and _DNS_SERVICE::TimerToGetMap.

Referenced by Dns6ConfigUdp().

EFI_STATUS Dns6InstanceCancelToken ( IN DNS_INSTANCE Instance,
IN EFI_DNS6_COMPLETION_TOKEN *  Token 
)

Cancel DNS6 tokens from the DNS6 instance.

Parameters:
[in] Instance Pointer to the DNS instance context data.
[in] Token Pointer to the token to be canceled. If NULL, all tokens in this instance will be cancelled. This parameter is optional and may be NULL.
Return values:
EFI_SUCCESS The Token is cancelled.
EFI_NOT_FOUND The Token is not found.

References Dns6CancelTokens(), and GetDns6TokenEntry().

Referenced by Dns6Cancel(), Dns6Configure(), and DnsDestroyInstance().

EFI_STATUS Dns6RemoveTokenEntry ( IN NET_MAP *  TokenMap,
IN DNS6_TOKEN_ENTRY TokenEntry 
)

Remove TokenEntry from TokenMap.

Parameters:
[in] TokenMap All DNSv6 Token entrys.
[in] TokenEntry TokenEntry need to be removed.
Return values:
EFI_SUCCESS Remove TokenEntry from TokenMap sucessfully.
EFI_NOT_FOUND TokenEntry is not found in TokenMap.

Referenced by Dns6CancelTokens(), DnsOnTimerRetransmit(), and ParseDnsResponse().

VOID EFIAPI DnsDummyExtFree ( IN VOID *  Arg  ) 

Callback of Dns packet. Does nothing.

Parameters:
Arg The context.

Referenced by ConstructDNSQueryIp().

VOID EFIAPI DnsOnPacketReceived ( NET_BUF *  Packet,
UDP_END_POINT *  EndPoint,
EFI_STATUS  IoStatus,
VOID *  Context 
)

Parse response packet.

Parameters:
Packet The packets received.
EndPoint The local/remote UDP access point
IoStatus The status of the UDP receive
Context The opaque parameter to the function.

References DNS_INSTANCE_SIGNATURE, DnsOnPacketReceived(), ParseDnsResponse(), and _DNS_INSTANCE::UdpIo.

Referenced by DnsOnPacketReceived(), and DoDnsQuery().

VOID EFIAPI DnsOnPacketSent ( NET_BUF *  Packet,
UDP_END_POINT *  EndPoint,
EFI_STATUS  IoStatus,
VOID *  Context 
)

Release the net buffer when packet is sent.

Parameters:
Packet The packets received.
EndPoint The local/remote UDP access point
IoStatus The status of the UDP receive
Context The opaque parameter to the function.

References _DNS_INSTANCE::Dns4TxTokens, _DNS_INSTANCE::Dns6TxTokens, DNS_INSTANCE_SIGNATURE, _DNS_SERVICE::IpVersion, DNS6_TOKEN_ENTRY::PacketToLive, DNS4_TOKEN_ENTRY::PacketToLive, _DNS_INSTANCE::Service, DNS6_TOKEN_ENTRY::Token, and DNS4_TOKEN_ENTRY::Token.

Referenced by DnsRetransmit(), and DoDnsQuery().

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

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

The timer ticking function for the DNS driver.

Parameters:
Event The ticking event
Context NULL

References DNS6_CACHE::AllCacheLink, DNS4_CACHE::AllCacheLink, _DNS_DRIVER_DATA::Dns4CacheList, _DNS_DRIVER_DATA::Dns6CacheList, DNS6_CACHE::DnsCache, DNS4_CACHE::DnsCache, and mDriverData.

Referenced by DnsDriverEntryPoint().

EFI_STATUS DnsRetransmit ( IN DNS_INSTANCE Instance,
IN NET_BUF *  Packet 
)

Retransmit the packet.

Parameters:
Instance The DNS instance
Packet Retransmit the packet
Return values:
EFI_SUCCESS The packet is retransmitted.
Others Failed to retransmit.

References DnsOnPacketSent().

Referenced by DnsOnTimerRetransmit().

EFI_STATUS DoDnsQuery ( IN DNS_INSTANCE Instance,
IN NET_BUF *  Packet 
)

Query request information.

Parameters:
Instance The DNS instance
Packet The packet for querying request information.
Return values:
EFI_SUCCESS Query request information successfully.
Others Failed to query request information.

References DnsOnPacketReceived(), and DnsOnPacketSent().

Referenced by Dns4HostNameToIp(), and Dns6HostNameToIp().

EFI_STATUS EFIAPI GetDns4TokenEntry ( IN NET_MAP *  TokensMap,
IN EFI_DNS4_COMPLETION_TOKEN *  Token,
OUT DNS4_TOKEN_ENTRY **  TokenEntry 
)

Get the TokenEntry from the TokensMap.

Parameters:
[in] TokensMap All DNSv4 Token entrys
[in] Token Pointer to the token to be get.
[out] TokenEntry Pointer to TokenEntry corresponding Token.
Return values:
EFI_SUCCESS Get the TokenEntry from the TokensMap sucessfully.
EFI_NOT_FOUND TokenEntry is not found in TokenMap.

Referenced by Dns4InstanceCancelToken().

EFI_STATUS EFIAPI GetDns6TokenEntry ( IN NET_MAP *  TokensMap,
IN EFI_DNS6_COMPLETION_TOKEN *  Token,
OUT DNS6_TOKEN_ENTRY **  TokenEntry 
)

Get the TokenEntry from the TokensMap.

Parameters:
[in] TokensMap All DNSv6 Token entrys
[in] Token Pointer to the token to be get.
[out] TokenEntry Pointer to TokenEntry corresponding Token.
Return values:
EFI_SUCCESS Get the TokenEntry from the TokensMap sucessfully.
EFI_NOT_FOUND TokenEntry is not found in TokenMap.

Referenced by Dns6InstanceCancelToken().

BOOLEAN IsValidDnsResponse ( IN NET_MAP *  TokensMap,
IN UINT16  Identification,
IN UINT16  Type,
OUT NET_MAP_ITEM **  Item 
)

Find out whether the response is valid or invalid.

Parameters:
TokensMap All DNS transmittal Tokens entry.
Identification Identification for queried packet.
Type Type for queried packet.
Item Return corresponding Token entry.
Return values:
TRUE The response is valid.
FALSE The response is invalid.

References DNS_HEADER::Identification, and DNS_QUERY_SECTION::Type.

Referenced by ParseDnsResponse().

EFI_STATUS ParseDnsResponse ( IN OUT DNS_INSTANCE Instance,
IN UINT8 *  RxString,
OUT BOOLEAN *  Completed 
)

EFI_STATUS EFIAPI UpdateDns4Cache ( IN LIST_ENTRY *  Dns4CacheList,
IN BOOLEAN  DeleteFlag,
IN BOOLEAN  Override,
IN EFI_DNS4_CACHE_ENTRY  DnsCacheEntry 
)

Update Dns4 cache to shared list of caches of all DNSv4 instances.

Parameters:
Dns4CacheList All Dns4 cache list.
DeleteFlag If FALSE, this function is to add one entry to the DNS Cache. If TRUE, this function will delete matching DNS Cache entry.
Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter. If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
DnsCacheEntry Entry Pointer to DNS Cache entry.
Return values:
EFI_SUCCESS Update Dns4 cache successfully.
Others Failed to update Dns4 cache.

References DNS4_CACHE::AllCacheLink, and DNS4_CACHE::DnsCache.

Referenced by Dns4UpdateDnsCache(), and ParseDnsResponse().

EFI_STATUS EFIAPI UpdateDns6Cache ( IN LIST_ENTRY *  Dns6CacheList,
IN BOOLEAN  DeleteFlag,
IN BOOLEAN  Override,
IN EFI_DNS6_CACHE_ENTRY  DnsCacheEntry 
)

Update Dns6 cache to shared list of caches of all DNSv6 instances.

Parameters:
Dns6CacheList All Dns6 cache list.
DeleteFlag If FALSE, this function is to add one entry to the DNS Cache. If TRUE, this function will delete matching DNS Cache entry.
Override If TRUE, the matching DNS cache entry will be overwritten with the supplied parameter. If FALSE, EFI_ACCESS_DENIED will be returned if the entry to be added is already exists.
DnsCacheEntry Entry Pointer to DNS Cache entry.
Return values:
EFI_SUCCESS Update Dns6 cache successfully.
Others Failed to update Dns6 cache.

References DNS6_CACHE::AllCacheLink, and DNS6_CACHE::DnsCache.

Referenced by Dns6UpdateDnsCache(), and ParseDnsResponse().


Generated on Mon Sep 28 08:49:05 2015 for NetworkPkg[ALL] by  doxygen 1.5.7.1