summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library
diff options
context:
space:
mode:
authorxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-30 13:44:11 +0000
committerxdu2 <xdu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-30 13:44:11 +0000
commit1204fe8319e5e6f77df68c375ef403e9ffa9227e (patch)
tree0946ddf42875ba3243758f77097c06587727a6e1 /MdeModulePkg/Library
parent9ae650ef6ca9372199adb31fb3432ed8cde353ad (diff)
downloadedk2-platforms-1204fe8319e5e6f77df68c375ef403e9ffa9227e.tar.xz
Code clean up in NetLib:
1. Add GLOBAL_REMOVE_IF_UNREFERENCED to all globals 2. Update NTOHL and NTOHS to be BaseLib func SwapBytes32/SwapBytes16 3. Remove duplicate NET_SWAP_SHORT (to use NTOHS instead) git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9648 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r--MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c10
-rw-r--r--MdeModulePkg/Library/DxeNetLib/DxeNetLib.c341
-rw-r--r--MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf2
-rw-r--r--MdeModulePkg/Library/DxeNetLib/NetBuffer.c184
4 files changed, 268 insertions, 269 deletions
diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
index 4df49a5e7b..9ed7b8ddfb 100644
--- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
+++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
@@ -24,12 +24,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/DpcLib.h>
-LIST_ENTRY mActiveIpIoList = {
+GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY mActiveIpIoList = {
&mActiveIpIoList,
&mActiveIpIoList
};
-EFI_IP4_CONFIG_DATA mIp4IoDefaultIpConfigData = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_IP4_CONFIG_DATA mIp4IoDefaultIpConfigData = {
EFI_IP_PROTO_UDP,
FALSE,
TRUE,
@@ -46,7 +46,7 @@ EFI_IP4_CONFIG_DATA mIp4IoDefaultIpConfigData = {
0
};
-EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData = {
EFI_IP_PROTO_UDP,
FALSE,
TRUE,
@@ -60,7 +60,7 @@ EFI_IP6_CONFIG_DATA mIp6IoDefaultIpConfigData = {
0
};
-ICMP_ERROR_INFO mIcmpErrMap[10] = {
+GLOBAL_REMOVE_IF_UNREFERENCED ICMP_ERROR_INFO mIcmpErrMap[10] = {
{FALSE, TRUE }, // ICMP_ERR_UNREACH_NET
{FALSE, TRUE }, // ICMP_ERR_UNREACH_HOST
{TRUE, TRUE }, // ICMP_ERR_UNREACH_PROTOCOL
@@ -73,7 +73,7 @@ ICMP_ERROR_INFO mIcmpErrMap[10] = {
{FALSE, TRUE } // ICMP_ERR_PARAMPROB
};
-ICMP_ERROR_INFO mIcmp6ErrMap[10] = {
+GLOBAL_REMOVE_IF_UNREFERENCED ICMP_ERROR_INFO mIcmp6ErrMap[10] = {
{FALSE, TRUE}, // ICMP6_ERR_UNREACH_NET
{FALSE, TRUE}, // ICMP6_ERR_UNREACH_HOST
{TRUE, TRUE}, // ICMP6_ERR_UNREACH_PROTOCOL
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index b42054f544..ffcd70ca84 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -1,6 +1,6 @@
/** @file
Network library.
-
+
Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/DriverBinding.h>
#include <Protocol/ServiceBinding.h>
#include <Protocol/SimpleNetwork.h>
+#include <Protocol/ManagedNetwork.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/ComponentName.h>
#include <Protocol/ComponentName2.h>
@@ -33,14 +34,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/HiiLib.h>
#include <Library/PrintLib.h>
-GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 mNetLibHexStr[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
-
#define NIC_ITEM_CONFIG_SIZE sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * MAX_IP4_CONFIG_IN_VARIABLE
//
// All the supported IP4 maskes in host byte order.
//
-IP4_ADDR gIp4AllMasks[IP4_MASK_NUM] = {
+GLOBAL_REMOVE_IF_UNREFERENCED IP4_ADDR gIp4AllMasks[IP4_MASK_NUM] = {
0x00000000,
0x80000000,
0xC0000000,
@@ -79,26 +78,25 @@ IP4_ADDR gIp4AllMasks[IP4_MASK_NUM] = {
0xFFFFFFFF,
};
-EFI_IPv4_ADDRESS mZeroIp4Addr = {{0, 0, 0, 0}};
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_IPv4_ADDRESS mZeroIp4Addr = {{0, 0, 0, 0}};
//
-// Any error level digitally larger than mNetDebugLevelMax
+// Any error level digitally larger than mNetDebugLevelMax
// will be silently discarded.
//
-UINTN mNetDebugLevelMax = NETDEBUG_LEVEL_ERROR;
-UINT32 mSyslogPacketSeq = 0xDEADBEEF;
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN mNetDebugLevelMax = NETDEBUG_LEVEL_ERROR;
+GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mSyslogPacketSeq = 0xDEADBEEF;
-//
-// You can change mSyslogDstMac mSyslogDstIp and mSyslogSrcIp
-// here to direct the syslog packets to the syslog deamon. The
-// default is broadcast to both the ethernet and IP.
//
-UINT8 mSyslogDstMac[NET_ETHER_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-UINT32 mSyslogDstIp = 0xffffffff;
-UINT32 mSyslogSrcIp = 0;
+// You can change mSyslogDstMac mSyslogDstIp and mSyslogSrcIp
+// here to direct the syslog packets to the syslog deamon. The
+// default is broadcast to both the ethernet and IP.
+//
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 mSyslogDstMac[NET_ETHER_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mSyslogDstIp = 0xffffffff;
+GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mSyslogSrcIp = 0;
-CHAR8 *
-mMonthName[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *mMonthName[] = {
"Jan",
"Feb",
"Mar",
@@ -114,7 +112,7 @@ mMonthName[] = {
};
/**
- Locate the handles that support SNP, then open one of them
+ Locate the handles that support SNP, then open one of them
to send the syslog packets. The caller isn't required to close
the SNP after use because the SNP is opened by HandleProtocol.
@@ -147,12 +145,12 @@ SyslogLocateSnp (
if (EFI_ERROR (Status) || (HandleCount == 0)) {
return NULL;
}
-
+
//
// Try to open one of the ethernet SNP protocol to send packet
//
Snp = NULL;
-
+
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (
Handles[Index],
@@ -160,10 +158,10 @@ SyslogLocateSnp (
(VOID **) &Snp
);
- if ((Status == EFI_SUCCESS) && (Snp != NULL) &&
+ if ((Status == EFI_SUCCESS) && (Snp != NULL) &&
(Snp->Mode->IfType == NET_IFTYPE_ETHERNET) &&
(Snp->Mode->MaxPacketSize >= NET_SYSLOG_PACKET_LEN)) {
-
+
break;
}
@@ -176,18 +174,18 @@ SyslogLocateSnp (
/**
Transmit a syslog packet synchronously through SNP. The Packet
- already has the ethernet header prepended. This function should
+ already has the ethernet header prepended. This function should
fill in the source MAC because it will try to locate a SNP each
time it is called to avoid the problem if SNP is unloaded.
- This code snip is copied from MNP.
+ This code snip is copied from MNP.
+
+ @param[in] Packet The Syslog packet
+ @param[in] Length The length of the packet
- @param[in] Packet - The Syslog packet
- @param[in] Length - The length of the packet
+ @retval EFI_DEVICE_ERROR Failed to locate a usable SNP protocol
+ @retval EFI_TIMEOUT Timeout happened to send the packet.
+ @retval EFI_SUCCESS Packet is sent.
- @retval EFI_DEVICE_ERROR - Failed to locate a usable SNP protocol
- @retval EFI_TIMEOUT - Timeout happened to send the packet.
- @retval EFI_SUCCESS - Packet is sent.
-
**/
EFI_STATUS
SyslogSendPacket (
@@ -241,7 +239,7 @@ SyslogSendPacket (
Status = EFI_DEVICE_ERROR;
break;
}
-
+
//
// If Status is EFI_SUCCESS, the packet is put in the transmit queue.
// if Status is EFI_NOT_READY, the transmit engine of the network
@@ -265,7 +263,7 @@ SyslogSendPacket (
if ((Status == EFI_SUCCESS) || (Status == EFI_TIMEOUT)) {
break;
}
-
+
//
// Status is EFI_NOT_READY. Restart the timer event and
// call Snp->Transmit again.
@@ -281,20 +279,18 @@ ON_EXIT:
}
/**
- Build a syslog packet, including the Ethernet/Ip/Udp headers
- and user's message.
-
- @param[in] Level - Syslog servity level
- @param[in] Module - The module that generates the log
- @param[in] File - The file that contains the current log
- @param[in] Line - The line of code in the File that contains the current log
- @param[in] Message - The log message
- @param[in] BufLen - The lenght of the Buf
- @param[out] Buf - The buffer to put the packet data
+ Build a syslog packet, including the Ethernet/Ip/Udp headers
+ and user's message.
-Returns:
+ @param[in] Level Syslog servity level
+ @param[in] Module The module that generates the log
+ @param[in] File The file that contains the current log
+ @param[in] Line The line of code in the File that contains the current log
+ @param[in] Message The log message
+ @param[in] BufLen The lenght of the Buf
+ @param[out] Buf The buffer to put the packet data
- The length of the syslog packet built.
+ @return The length of the syslog packet built.
**/
UINT32
@@ -305,7 +301,7 @@ SyslogBuildPacket (
IN UINT32 Line,
IN UINT8 *Message,
IN UINT32 BufLen,
- OUT CHAR8 *Buf
+ OUT CHAR8 *Buf
)
{
ETHER_HEAD *Ether;
@@ -316,7 +312,7 @@ SyslogBuildPacket (
UINT32 Len;
//
- // Fill in the Ethernet header. Leave alone the source MAC.
+ // Fill in the Ethernet header. Leave alone the source MAC.
// SyslogSendPacket will fill in the address for us.
//
Ether = (ETHER_HEAD *) Buf;
@@ -374,7 +370,7 @@ SyslogBuildPacket (
BufLen,
"<%d> %a %d %d:%d:%d ",
Pri,
- mMonthName [Time.Month-1],
+ mMonthName [Time.Month-1],
Time.Day,
Time.Hour,
Time.Minute,
@@ -383,9 +379,9 @@ SyslogBuildPacket (
Len--;
Len += (UINT32) AsciiSPrint (
- Buf + Len,
- BufLen - Len,
- "Tiano %a: %a (Line: %d File: %a)",
+ Buf + Len,
+ BufLen - Len,
+ "Tiano %a: %a (Line: %d File: %a)",
Module,
Message,
Line,
@@ -407,23 +403,23 @@ SyslogBuildPacket (
}
/**
- Allocate a buffer, then format the message to it. This is a
- help function for the NET_DEBUG_XXX macros. The PrintArg of
- these macros treats the variable length print parameters as a
+ Allocate a buffer, then format the message to it. This is a
+ help function for the NET_DEBUG_XXX macros. The PrintArg of
+ these macros treats the variable length print parameters as a
single parameter, and pass it to the NetDebugASPrint. For
example, NET_DEBUG_TRACE ("Tcp", ("State transit to %a\n", Name))
- if extracted to:
-
+ if extracted to:
+
NetDebugOutput (
- NETDEBUG_LEVEL_TRACE,
- "Tcp",
+ NETDEBUG_LEVEL_TRACE,
+ "Tcp",
__FILE__,
__LINE__,
- NetDebugASPrint ("State transit to %a\n", Name)
- )
-
+ NetDebugASPrint ("State transit to %a\n", Name)
+ )
+
@param Format The ASCII format string.
- @param ... The variable length parameter whose format is determined
+ @param ... The variable length parameter whose format is determined
by the Format string.
@return The buffer containing the formatted message,
@@ -466,12 +462,12 @@ NetDebugASPrint (
@retval EFI_INVALID_PARAMETER Any input parameter is invalid.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory for the packet
- @retval EFI_SUCCESS The log is discard because that it is more verbose
+ @retval EFI_SUCCESS The log is discard because that it is more verbose
than the mNetDebugLevelMax. Or, it has been sent out.
-**/
+**/
EFI_STATUS
NetDebugOutput (
- IN UINT32 Level,
+ IN UINT32 Level,
IN UINT8 *Module,
IN UINT8 *File,
IN UINT32 Line,
@@ -493,7 +489,7 @@ NetDebugOutput (
Status = EFI_SUCCESS;
goto ON_EXIT;
}
-
+
//
// Allocate a maxium of 1024 bytes, the caller should ensure
// that the message plus the ethernet/ip/udp header is shorter
@@ -505,7 +501,7 @@ NetDebugOutput (
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
-
+
//
// Build the message: Ethernet header + IP header + Udp Header + user data
//
@@ -528,8 +524,8 @@ ON_EXIT:
return Status;
}
/**
- Return the length of the mask.
-
+ Return the length of the mask.
+
Return the length of the mask, the correct value is from 0 to 32.
If the mask is invalid, return the invalid length 33, which is IP4_MASK_NUM.
NetMask is in the host byte order.
@@ -537,7 +533,7 @@ ON_EXIT:
@param[in] NetMask The netmask to get the length from.
@return The length of the netmask, IP4_MASK_NUM if the mask is invalid.
-
+
**/
INTN
EFIAPI
@@ -561,19 +557,19 @@ NetGetMaskLength (
/**
Return the class of the IP address, such as class A, B, C.
Addr is in host byte order.
-
+
The address of class A starts with 0.
If the address belong to class A, return IP4_ADDR_CLASSA.
- The address of class B starts with 10.
+ The address of class B starts with 10.
If the address belong to class B, return IP4_ADDR_CLASSB.
- The address of class C starts with 110.
+ The address of class C starts with 110.
If the address belong to class C, return IP4_ADDR_CLASSC.
- The address of class D starts with 1110.
+ The address of class D starts with 1110.
If the address belong to class D, return IP4_ADDR_CLASSD.
The address of class E starts with 1111.
If the address belong to class E, return IP4_ADDR_CLASSE.
-
+
@param[in] Addr The address to get the class from.
@return IP address class, such as IP4_ADDR_CLASSA.
@@ -611,10 +607,10 @@ NetGetIpClass (
/**
Check whether the IP is a valid unicast address according to
the netmask. If NetMask is zero, use the IP address's class to get the default mask.
-
+
If Ip is 0, IP is not a valid unicast address.
Class D address is used for multicasting and class E address is reserved for future. If Ip
- belongs to class D or class E, IP is not a valid unicast address.
+ belongs to class D or class E, IP is not a valid unicast address.
If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address.
@param[in] Ip The IP to check against.
@@ -656,21 +652,21 @@ NetIp4IsUnicast (
a valid unicast address. If the address is unspecified ::, it is not a valid
unicast address to be assigned to any node. If the address is loopback address
::1, it is also not a valid unicast address to be assigned to any physical
- interface.
+ interface.
@param[in] Ip6 The IPv6 address to check against.
@return TRUE if Ip6 is a valid unicast address on the network, otherwise FALSE.
-**/
+**/
BOOLEAN
NetIp6IsValidUnicast (
IN EFI_IPv6_ADDRESS *Ip6
- )
+ )
{
UINT8 Byte;
UINT8 Index;
-
+
if (Ip6->Addr[0] == 0xFF) {
return FALSE;
}
@@ -687,7 +683,7 @@ NetIp6IsValidUnicast (
return FALSE;
}
- return TRUE;
+ return TRUE;
}
/**
@@ -697,7 +693,7 @@ NetIp6IsValidUnicast (
@retval TRUE - Yes, unspecified
@retval FALSE - No
-
+
**/
BOOLEAN
NetIp6IsUnspecifiedAddr (
@@ -722,7 +718,7 @@ NetIp6IsUnspecifiedAddr (
@retval TRUE - Yes, link-local address
@retval FALSE - No
-
+
**/
BOOLEAN
NetIp6IsLinkLocalAddr (
@@ -730,13 +726,13 @@ NetIp6IsLinkLocalAddr (
)
{
UINT8 Index;
-
+
ASSERT (Ip6 != NULL);
if (Ip6->Addr[0] != 0xFE) {
return FALSE;
}
-
+
if (Ip6->Addr[1] != 0x80) {
return FALSE;
}
@@ -759,7 +755,7 @@ NetIp6IsLinkLocalAddr (
@retval TRUE - Yes, connected.
@retval FALSE - No.
-
+
**/
BOOLEAN
NetIp6IsNetEqual (
@@ -773,14 +769,14 @@ NetIp6IsNetEqual (
UINT8 Mask;
ASSERT (Ip1 != NULL && Ip2 != NULL);
-
+
if (PrefixLength == 0) {
return TRUE;
}
Byte = (UINT8) (PrefixLength / 8);
Bit = (UINT8) (PrefixLength % 8);
-
+
if (CompareMem (Ip1, Ip2, Byte) != 0) {
return FALSE;
}
@@ -790,9 +786,9 @@ NetIp6IsNetEqual (
if ((Ip1->Addr[Byte] & Mask) != (Ip2->Addr[Byte] & Mask)) {
return FALSE;
- }
+ }
}
-
+
return TRUE;
}
@@ -831,11 +827,11 @@ Ip6Swap128 (
/**
Initialize a random seed using current time.
-
- Get current time first. Then initialize a random seed based on some basic
- mathematics operation on the hour, day, minute, second, nanosecond and year
+
+ Get current time first. Then initialize a random seed based on some basic
+ mathematics operation on the hour, day, minute, second, nanosecond and year
of the current time.
-
+
@return The random seed initialized with current time.
**/
@@ -859,8 +855,8 @@ NetRandomInitSeed (
/**
Extract a UINT32 from a byte stream.
-
- Copy a UINT32 from a byte stream, then converts it from Network
+
+ Copy a UINT32 from a byte stream, then converts it from Network
byte order to host byte order. Use this function to avoid alignment error.
@param[in] Buf The buffer to extract the UINT32.
@@ -882,14 +878,14 @@ NetGetUint32 (
/**
- Put a UINT32 to the byte stream in network byte order.
-
- Converts a UINT32 from host byte order to network byte order. Then copy it to the
+ Put a UINT32 to the byte stream in network byte order.
+
+ Converts a UINT32 from host byte order to network byte order. Then copy it to the
byte stream.
@param[in, out] Buf The buffer to put the UINT32.
@param[in] Data The data to put.
-
+
**/
VOID
EFIAPI
@@ -905,16 +901,16 @@ NetPutUint32 (
/**
Remove the first node entry on the list, and return the removed node entry.
-
+
Removes the first node Entry from a doubly linked list. It is up to the caller of
this function to release the memory used by the first node if that is required. On
- exit, the removed node is returned.
+ exit, the removed node is returned.
If Head is NULL, then ASSERT().
If Head was not initialized, then ASSERT().
If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
linked list including the head node is greater than or equal to PcdMaximumLinkedListLength,
- then ASSERT().
+ then ASSERT().
@param[in, out] Head The list header.
@@ -953,14 +949,14 @@ NetListRemoveHead (
Removes the last node entry from a doubly linked list. It is up to the caller of
this function to release the memory used by the first node if that is required. On
- exit, the removed node is returned.
+ exit, the removed node is returned.
If Head is NULL, then ASSERT().
If Head was not initialized, then ASSERT().
If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
linked list including the head node is greater than or equal to PcdMaximumLinkedListLength,
- then ASSERT().
-
+ then ASSERT().
+
@param[in, out] Head The list head.
@return The last node entry that is removed from the list, NULL if the list is empty.
@@ -995,10 +991,10 @@ NetListRemoveTail (
/**
Insert a new node entry after a designated node entry of a doubly linked list.
-
+
Inserts a new node entry donated by NewEntry after the node entry donated by PrevEntry
of the doubly linked list.
-
+
@param[in, out] PrevEntry The previous entry to insert after.
@param[in, out] NewEntry The new entry to insert.
@@ -1019,10 +1015,10 @@ NetListInsertAfter (
/**
Insert a new node entry before a designated node entry of a doubly linked list.
-
+
Inserts a new node entry donated by NewEntry after the node entry donated by PostEntry
of the doubly linked list.
-
+
@param[in, out] PostEntry The entry to insert before.
@param[in, out] NewEntry The new entry to insert.
@@ -1043,15 +1039,15 @@ NetListInsertBefore (
/**
Initialize the netmap. Netmap is a reposity to keep the <Key, Value> pairs.
-
- Initialize the forward and backward links of two head nodes donated by Map->Used
+
+ Initialize the forward and backward links of two head nodes donated by Map->Used
and Map->Recycled of two doubly linked lists.
Initializes the count of the <Key, Value> pairs in the netmap to zero.
-
+
If Map is NULL, then ASSERT().
If the address of Map->Used is NULL, then ASSERT().
If the address of Map->Recycled is NULl, then ASSERT().
-
+
@param[in, out] Map The netmap to initialize.
**/
@@ -1071,13 +1067,13 @@ NetMapInit (
/**
To clean up the netmap, that is, release allocated memories.
-
+
Removes all nodes of the Used doubly linked list and free memory of all related netmap items.
Removes all nodes of the Recycled doubly linked list and free memory of all related netmap items.
The number of the <Key, Value> pairs in the netmap is set to be zero.
-
+
If Map is NULL, then ASSERT().
-
+
@param[in, out] Map The netmap to clean up.
**/
@@ -1117,12 +1113,12 @@ NetMapClean (
/**
Test whether the netmap is empty and return true if it is.
-
+
If the number of the <Key, Value> pairs in the netmap is zero, return TRUE.
-
+
If Map is NULL, then ASSERT().
-
-
+
+
@param[in] Map The net map to test.
@return TRUE if the netmap is empty, otherwise FALSE.
@@ -1158,15 +1154,15 @@ NetMapGetCount (
/**
- Return one allocated item.
-
- If the Recycled doubly linked list of the netmap is empty, it will try to allocate
+ Return one allocated item.
+
+ If the Recycled doubly linked list of the netmap is empty, it will try to allocate
a batch of items if there are enough resources and add corresponding nodes to the begining
of the Recycled doubly linked list of the netmap. Otherwise, it will directly remove
the fist node entry of the Recycled doubly linked list and return the corresponding item.
-
+
If Map is NULL, then ASSERT().
-
+
@param[in, out] Map The netmap to allocate item for.
@return The allocated item. If NULL, the
@@ -1211,13 +1207,13 @@ NetMapAllocItem (
/**
Allocate an item to save the <Key, Value> pair to the head of the netmap.
-
+
Allocate an item to save the <Key, Value> pair and add corresponding node entry
- to the beginning of the Used doubly linked list. The number of the <Key, Value>
+ to the beginning of the Used doubly linked list. The number of the <Key, Value>
pairs in the netmap increase by 1.
If Map is NULL, then ASSERT().
-
+
@param[in, out] Map The netmap to insert into.
@param[in] Key The user's key.
@param[in] Value The user's value for the key.
@@ -1257,11 +1253,11 @@ NetMapInsertHead (
Allocate an item to save the <Key, Value> pair to the tail of the netmap.
Allocate an item to save the <Key, Value> pair and add corresponding node entry
- to the tail of the Used doubly linked list. The number of the <Key, Value>
+ to the tail of the Used doubly linked list. The number of the <Key, Value>
pairs in the netmap increase by 1.
If Map is NULL, then ASSERT().
-
+
@param[in, out] Map The netmap to insert into.
@param[in] Key The user's key.
@param[in] Value The user's value for the key.
@@ -1327,12 +1323,12 @@ NetItemInMap (
/**
Find the key in the netmap and returns the point to the item contains the Key.
-
- Iterate the Used doubly linked list of the netmap to get every item. Compare the key of every
+
+ Iterate the Used doubly linked list of the netmap to get every item. Compare the key of every
item with the key to search. It returns the point to the item contains the Key if found.
If Map is NULL, then ASSERT().
-
+
@param[in] Map The netmap to search within.
@param[in] Key The key to search.
@@ -1365,16 +1361,16 @@ NetMapFindKey (
/**
Remove the node entry of the item from the netmap and return the key of the removed item.
-
- Remove the node entry of the item from the Used doubly linked list of the netmap.
- The number of the <Key, Value> pairs in the netmap decrease by 1. Then add the node
+
+ Remove the node entry of the item from the Used doubly linked list of the netmap.
+ The number of the <Key, Value> pairs in the netmap decrease by 1. Then add the node
entry of the item to the Recycled doubly linked list of the netmap. If Value is not NULL,
Value will point to the value of the item. It returns the key of the removed item.
-
+
If Map is NULL, then ASSERT().
If Item is NULL, then ASSERT().
if item in not in the netmap, then ASSERT().
-
+
@param[in, out] Map The netmap to remove the item from.
@param[in, out] Item The item to remove.
@param[out] Value The variable to receive the value if not NULL.
@@ -1408,14 +1404,14 @@ NetMapRemoveItem (
/**
Remove the first node entry on the netmap and return the key of the removed item.
- Remove the first node entry from the Used doubly linked list of the netmap.
- The number of the <Key, Value> pairs in the netmap decrease by 1. Then add the node
+ Remove the first node entry from the Used doubly linked list of the netmap.
+ The number of the <Key, Value> pairs in the netmap decrease by 1. Then add the node
entry to the Recycled doubly linked list of the netmap. If parameter Value is not NULL,
parameter Value will point to the value of the item. It returns the key of the removed item.
-
+
If Map is NULL, then ASSERT().
If the Used doubly linked list is empty, then ASSERT().
-
+
@param[in, out] Map The netmap to remove the head from.
@param[out] Value The variable to receive the value if not NULL.
@@ -1453,14 +1449,14 @@ NetMapRemoveHead (
/**
Remove the last node entry on the netmap and return the key of the removed item.
- Remove the last node entry from the Used doubly linked list of the netmap.
- The number of the <Key, Value> pairs in the netmap decrease by 1. Then add the node
+ Remove the last node entry from the Used doubly linked list of the netmap.
+ The number of the <Key, Value> pairs in the netmap decrease by 1. Then add the node
entry to the Recycled doubly linked list of the netmap. If parameter Value is not NULL,
parameter Value will point to the value of the item. It returns the key of the removed item.
-
+
If Map is NULL, then ASSERT().
If the Used doubly linked list is empty, then ASSERT().
-
+
@param[in, out] Map The netmap to remove the tail from.
@param[out] Value The variable to receive the value if not NULL.
@@ -1497,14 +1493,14 @@ NetMapRemoveTail (
/**
Iterate through the netmap and call CallBack for each item.
-
+
It will contiue the traverse if CallBack returns EFI_SUCCESS, otherwise, break
- from the loop. It returns the CallBack's last return value. This function is
+ from the loop. It returns the CallBack's last return value. This function is
delete safe for the current item.
If Map is NULL, then ASSERT().
If CallBack is NULL, then ASSERT().
-
+
@param[in] Map The Map to iterate through.
@param[in] CallBack The callback function to call for each item.
@param[in] Arg The opaque parameter to the callback.
@@ -1555,7 +1551,7 @@ NetMapIterate (
Disconnect the driver specified by ImageHandle from all the devices in the handle database.
Uninstall all the protocols installed in the driver entry point.
-
+
@param[in] ImageHandle The drivers' driver image.
@retval EFI_SUCCESS The image is unloaded.
@@ -1669,12 +1665,12 @@ NetLibDefaultUnload (
/**
Create a child of the service that is identified by ServiceBindingGuid.
-
+
Get the ServiceBinding Protocol first, then use it to create a child.
If ServiceBindingGuid is NULL, then ASSERT().
If ChildHandle is NULL, then ASSERT().
-
+
@param[in] Controller The controller which has the service installed.
@param[in] Image The image handle used to open service.
@param[in] ServiceBindingGuid The service's Guid.
@@ -1725,11 +1721,11 @@ NetLibCreateServiceChild (
/**
Destory a child of the service that is identified by ServiceBindingGuid.
-
+
Get the ServiceBinding Protocol first, then use it to destroy a child.
-
+
If ServiceBindingGuid is NULL, then ASSERT().
-
+
@param[in] Controller The controller which has the service installed.
@param[in] Image The image handle used to open service.
@param[in] ServiceBindingGuid The service's Guid.
@@ -1793,7 +1789,7 @@ NetLibDestroyServiceChild (
get the simple network protocol.
@param[out] MacString The pointer to store the address of the string
representation of the mac address.
-
+
@retval EFI_SUCCESS Convert the mac address a unicode string successfully.
@retval EFI_OUT_OF_RESOURCES There are not enough memory resource.
@retval Others Failed to open the simple network protocol.
@@ -1811,6 +1807,7 @@ NetLibGetMacString (
EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
EFI_SIMPLE_NETWORK_MODE *Mode;
CHAR16 *MacAddress;
+ UINT8 *HwAddress;
UINTN Index;
*MacString = NULL;
@@ -1840,18 +1837,18 @@ NetLibGetMacString (
if (MacAddress == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+ *MacString = MacAddress;
//
// Convert the mac address into a unicode string.
//
+ HwAddress = Mode->CurrentAddress.Addr;
for (Index = 0; Index < Mode->HwAddressSize; Index++) {
- MacAddress[Index * 2] = (CHAR16) mNetLibHexStr[(Mode->CurrentAddress.Addr[Index] >> 4) & 0x0F];
- MacAddress[Index * 2 + 1] = (CHAR16) mNetLibHexStr[Mode->CurrentAddress.Addr[Index] & 0x0F];
+ MacAddress += UnicodeValueToString (MacAddress, PREFIX_ZERO | RADIX_HEX, *(HwAddress++), 2);
}
MacAddress[Mode->HwAddressSize * 2] = L'\0';
- *MacString = MacAddress;
return EFI_SUCCESS;
}
@@ -1860,11 +1857,11 @@ NetLibGetMacString (
Check the default address used by the IPv4 driver is static or dynamic (acquired
from DHCP).
- If the controller handle does not have the NIC Ip4 Config Protocol installed, the
+ If the controller handle does not have the NIC Ip4 Config Protocol installed, the
default address is static. If the EFI variable to save the configuration is not found,
- the default address is static. Otherwise, get the result from the EFI variable which
+ the default address is static. Otherwise, get the result from the EFI variable which
saving the configuration.
-
+
@param[in] Controller The controller handle which has the NIC Ip4 Config Protocol
relative with the default address to judge.
@@ -1911,7 +1908,7 @@ NetLibDefaultAddressIsStatic (
if (ConfigHdr == NULL) {
return TRUE;
}
-
+
Len = StrLen (ConfigHdr);
ConfigResp = AllocateZeroPool ((Len + NIC_ITEM_CONFIG_SIZE * 2 + 100) * sizeof (CHAR16));
if (ConfigResp == NULL) {
@@ -1921,10 +1918,10 @@ NetLibDefaultAddressIsStatic (
String = ConfigResp + Len;
UnicodeSPrint (
- String,
- (8 + 4 + 7 + 4 + 1) * sizeof (CHAR16),
- L"&OFFSET=%04X&WIDTH=%04X",
- OFFSET_OF (NIC_IP4_CONFIG_INFO, Source),
+ String,
+ (8 + 4 + 7 + 4 + 1) * sizeof (CHAR16),
+ L"&OFFSET=%04X&WIDTH=%04X",
+ OFFSET_OF (NIC_IP4_CONFIG_INFO, Source),
sizeof (UINT32)
);
@@ -1957,7 +1954,7 @@ NetLibDefaultAddressIsStatic (
}
IsStatic = (BOOLEAN) (ConfigInfo->Source == IP4_CONFIG_SOURCE_STATIC);
-
+
ON_EXIT:
if (AccessResults != NULL) {
@@ -1978,7 +1975,7 @@ ON_EXIT:
/**
Create an IPv4 device path node.
-
+
The header type of IPv4 device path node is MESSAGING_DEVICE_PATH.
The header subtype of IPv4 device path node is MSG_IPv4_DP.
The length of the IPv4 device path node in bytes is 19.
@@ -2028,7 +2025,7 @@ NetLibCreateIPv4DPathNode (
/**
Create an IPv6 device path node.
-
+
The header type of IPv6 device path node is MESSAGING_DEVICE_PATH.
The header subtype of IPv6 device path node is MSG_IPv6_DP.
Get other info from parameters to make up the whole IPv6 device path node.
@@ -2070,7 +2067,7 @@ NetLibCreateIPv6DPathNode (
/**
Find the UNDI/SNP handle from controller and protocol GUID.
-
+
For example, IP will open a MNP child to transmit/receive
packets, when MNP is stopped, IP should also be stopped. IP
needs to find its own private data which is related the IP's
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
index 05d68d70e0..00ac82157f 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
@@ -54,6 +54,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
[Protocols]
gEfiSimpleNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiManagedNetworkProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiManagedNetworkServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/MdeModulePkg/Library/DxeNetLib/NetBuffer.c b/MdeModulePkg/Library/DxeNetLib/NetBuffer.c
index 42e308a5a3..eadffbb45d 100644
--- a/MdeModulePkg/Library/DxeNetLib/NetBuffer.c
+++ b/MdeModulePkg/Library/DxeNetLib/NetBuffer.c
@@ -1,6 +1,6 @@
/** @file
Network library functions providing net buffer operation support.
-
+
Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -22,16 +22,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/**
- Allocate and build up the sketch for a NET_BUF.
-
- The net buffer allocated has the BlockOpNum's NET_BLOCK_OP, and its associated
+ Allocate and build up the sketch for a NET_BUF.
+
+ The net buffer allocated has the BlockOpNum's NET_BLOCK_OP, and its associated
NET_VECTOR has the BlockNum's NET_BLOCK. But all the NET_BLOCK_OP and
NET_BLOCK remain un-initialized.
@param[in] BlockNum The number of NET_BLOCK in the vector of net buffer
@param[in] BlockOpNum The number of NET_BLOCK_OP in the net buffer
- @return Pointer to the allocated NET_BUF, or NULL if the
+ @return Pointer to the allocated NET_BUF, or NULL if the
allocation failed due to resource limit.
**/
@@ -88,7 +88,7 @@ FreeNbuf:
@param[in] Len The length of the block.
- @return Pointer to the allocated NET_BUF, or NULL if the
+ @return Pointer to the allocated NET_BUF, or NULL if the
allocation failed due to resource limit.
**/
@@ -137,11 +137,11 @@ FreeNBuf:
}
/**
- Free the net vector.
-
- Decrease the reference count of the net vector by one. The real resource free
- operation isn't performed until the reference count of the net vector is
- decreased to 0.
+ Free the net vector.
+
+ Decrease the reference count of the net vector by one. The real resource free
+ operation isn't performed until the reference count of the net vector is
+ decreased to 0.
@param[in] Vector Pointer to the NET_VECTOR to be freed.
@@ -190,13 +190,13 @@ NetbufFreeVector (
/**
Free the net buffer and its associated NET_VECTOR.
-
+
Decrease the reference count of the net buffer by one. Free the associated net
- vector and itself if the reference count of the net buffer is decreased to 0.
- The net vector free operation just decrease the reference count of the net
+ vector and itself if the reference count of the net buffer is decreased to 0.
+ The net vector free operation just decrease the reference count of the net
vector by one and do the real resource free operation when the reference count
- of the net vector is 0.
-
+ of the net vector is 0.
+
@param[in] Nbuf Pointer to the NET_BUF to be freed.
**/
@@ -224,10 +224,10 @@ NetbufFree (
/**
- Create a copy of the net buffer that shares the associated net vector.
-
- The reference count of the newly created net buffer is set to 1. The reference
- count of the associated net vector is increased by one.
+ Create a copy of the net buffer that shares the associated net vector.
+
+ The reference count of the newly created net buffer is set to 1. The reference
+ count of the associated net vector is increased by one.
@param[in] Nbuf Pointer to the net buffer to be cloned.
@@ -274,12 +274,12 @@ NetbufClone (
/**
Create a duplicated copy of the net buffer with data copied and HeadSpace
bytes of head space reserved.
-
+
The duplicated net buffer will allocate its own memory to hold the data of the
source net buffer.
-
+
@param[in] Nbuf Pointer to the net buffer to be duplicated from.
- @param[in, out] Duplicate Pointer to the net buffer to duplicate to, if
+ @param[in, out] Duplicate Pointer to the net buffer to duplicate to, if
NULL a new net buffer is allocated.
@param[in] HeadSpace Length of the head space to reserve.
@@ -352,16 +352,16 @@ NetbufFreeList (
/**
- Get the index of NET_BLOCK_OP that contains the byte at Offset in the net
- buffer.
-
- This can be used to, for example, retrieve the IP header in the packet. It
- also can be used to get the fragment that contains the byte which is used
- mainly by the library implementation itself.
+ Get the index of NET_BLOCK_OP that contains the byte at Offset in the net
+ buffer.
+
+ This can be used to, for example, retrieve the IP header in the packet. It
+ also can be used to get the fragment that contains the byte which is used
+ mainly by the library implementation itself.
@param[in] Nbuf Pointer to the net buffer.
@param[in] Offset The offset of the byte.
- @param[out] Index Index of the NET_BLOCK_OP that contains the byte at
+ @param[out] Index Index of the NET_BLOCK_OP that contains the byte at
Offset.
@return Pointer to the Offset'th byte of data in the net buffer, or NULL
@@ -409,12 +409,12 @@ NetbufGetByte (
/**
- Set the NET_BLOCK and corresponding NET_BLOCK_OP in the net buffer and
+ Set the NET_BLOCK and corresponding NET_BLOCK_OP in the net buffer and
corresponding net vector according to the bulk pointer and bulk length.
-
- All the pointers in the Index'th NET_BLOCK and NET_BLOCK_OP are set to the
- bulk's head and tail respectively. So, this function alone can't be used by
- NetbufAlloc.
+
+ All the pointers in the Index'th NET_BLOCK and NET_BLOCK_OP are set to the
+ bulk's head and tail respectively. So, this function alone can't be used by
+ NetbufAlloc.
@param[in, out] Nbuf Pointer to the net buffer.
@param[in] Bulk Pointer to the data.
@@ -453,15 +453,15 @@ NetbufSetBlock (
/**
Set the NET_BLOCK_OP in the net buffer. The corresponding NET_BLOCK
- structure is left untouched.
-
- Some times, there is no 1:1 relationship between NET_BLOCK and NET_BLOCK_OP.
- For example, that in NetbufGetFragment.
+ structure is left untouched.
+
+ Some times, there is no 1:1 relationship between NET_BLOCK and NET_BLOCK_OP.
+ For example, that in NetbufGetFragment.
@param[in, out] Nbuf Pointer to the net buffer.
@param[in] Bulk Pointer to the data.
@param[in] Len Length of the bulk data.
- @param[in] Index The data block index in the net buffer the bulk
+ @param[in] Index The data block index in the net buffer the bulk
data should belong to.
**/
@@ -488,10 +488,10 @@ NetbufSetBlockOp (
/**
- Helper function for NetbufGetFragment. NetbufGetFragment may allocate the
- first block to reserve HeadSpace bytes header space. So it needs to create a
- new net vector for the first block and can avoid copy for the remaining data
- by sharing the old net vector.
+ Helper function for NetbufGetFragment. NetbufGetFragment may allocate the
+ first block to reserve HeadSpace bytes header space. So it needs to create a
+ new net vector for the first block and can avoid copy for the remaining data
+ by sharing the old net vector.
@param[in] Arg Point to the old NET_VECTOR.
@@ -510,19 +510,19 @@ NetbufGetFragmentFree (
/**
- Create a NET_BUF structure which contains Len byte data of Nbuf starting from
- Offset.
-
- A new NET_BUF structure will be created but the associated data in NET_VECTOR
- is shared. This function exists to do IP packet fragmentation.
+ Create a NET_BUF structure which contains Len byte data of Nbuf starting from
+ Offset.
+
+ A new NET_BUF structure will be created but the associated data in NET_VECTOR
+ is shared. This function exists to do IP packet fragmentation.
@param[in] Nbuf Pointer to the net buffer to be extracted.
- @param[in] Offset Starting point of the data to be included in the new
+ @param[in] Offset Starting point of the data to be included in the new
net buffer.
- @param[in] Len Bytes of data to be included in the new net buffer.
- @param[in] HeadSpace Bytes of head space to reserve for protocol header.
+ @param[in] Len Bytes of data to be included in the new net buffer.
+ @param[in] HeadSpace Bytes of head space to reserve for protocol header.
- @return Pointer to the cloned net buffer, or NULL if the
+ @return Pointer to the cloned net buffer, or NULL if the
allocation failed due to resource limit.
**/
@@ -694,8 +694,8 @@ FreeChild:
/**
- Build a NET_BUF from external blocks.
-
+ Build a NET_BUF from external blocks.
+
A new NET_BUF structure will be created from external blocks. Additional block
of memory will be allocated to hold reserved HeadSpace bytes of header room
and existing HeadLen bytes of header but the external blocks are shared by the
@@ -710,7 +710,7 @@ FreeChild:
@param[in] Arg The argument passed to ExtFree when ExtFree is
called.
- @return Pointer to the net buffer built from the data blocks,
+ @return Pointer to the net buffer built from the data blocks,
or NULL if the allocation failed due to resource
limit.
@@ -878,13 +878,13 @@ FreeFirstBlock:
/**
Build a fragment table to contain the fragments in the net buffer. This is the
- opposite operation of the NetbufFromExt.
-
+ opposite operation of the NetbufFromExt.
+
@param[in] Nbuf Point to the net buffer.
@param[in, out] ExtFragment Pointer to the data block.
@param[in, out] ExtNum The number of the data blocks.
- @retval EFI_BUFFER_TOO_SMALL The number of non-empty block is bigger than
+ @retval EFI_BUFFER_TOO_SMALL The number of non-empty block is bigger than
ExtNum.
@retval EFI_SUCCESS Fragment table is built successfully.
@@ -923,10 +923,10 @@ NetbufBuildExt (
/**
Build a net buffer from a list of net buffers.
-
- All the fragments will be collected from the list of NEW_BUF and then a new
- net buffer will be created through NetbufFromExt.
-
+
+ All the fragments will be collected from the list of NEW_BUF and then a new
+ net buffer will be created through NetbufFromExt.
+
@param[in] BufList A List of the net buffer.
@param[in] HeadSpace The head space to be reserved.
@param[in] HeaderLen The length of the protocol header, This function
@@ -934,7 +934,7 @@ NetbufBuildExt (
@param[in] ExtFree Pointer to the caller provided free function.
@param[in] Arg The argument passed to ExtFree when ExtFree is called.
- @return Pointer to the net buffer built from the list of net
+ @return Pointer to the net buffer built from the list of net
buffers.
**/
@@ -1000,10 +1000,10 @@ NetbufFromBufList (
/**
Reserve some space in the header room of the net buffer.
- Upon allocation, all the space are in the tail room of the buffer. Call this
+ Upon allocation, all the space are in the tail room of the buffer. Call this
function to move some space to the header room. This function is quite limited
- in that it can only reserve space from the first block of an empty NET_BUF not
- built from the external. But it should be enough for the network stack.
+ in that it can only reserve space from the first block of an empty NET_BUF not
+ built from the external. But it should be enough for the network stack.
@param[in, out] Nbuf Pointer to the net buffer.
@param[in] Len The length of buffer to be reserved from the header.
@@ -1030,14 +1030,14 @@ NetbufReserve (
/**
- Allocate Len bytes of space from the header or tail of the buffer.
+ Allocate Len bytes of space from the header or tail of the buffer.
@param[in, out] Nbuf Pointer to the net buffer.
@param[in] Len The length of the buffer to be allocated.
- @param[in] FromHead The flag to indicate whether reserve the data
+ @param[in] FromHead The flag to indicate whether reserve the data
from head (TRUE) or tail (FALSE).
- @return Pointer to the first byte of the allocated buffer,
+ @return Pointer to the first byte of the allocated buffer,
or NULL if there is no sufficient space.
**/
@@ -1126,7 +1126,7 @@ NetbufAllocSpace (
@param[in, out] BlockOp Pointer to the NET_BLOCK.
@param[in] Len The length of the data to be trimmed.
- @param[in] FromHead The flag to indicate whether trim data from head
+ @param[in] FromHead The flag to indicate whether trim data from head
(TRUE) or tail (FALSE).
**/
@@ -1150,14 +1150,14 @@ NetblockTrim (
/**
- Trim Len bytes from the header or tail of the net buffer.
+ Trim Len bytes from the header or tail of the net buffer.
@param[in, out] Nbuf Pointer to the net buffer.
@param[in] Len The length of the data to be trimmed.
- @param[in] FromHead The flag to indicate whether trim data from head
+ @param[in] FromHead The flag to indicate whether trim data from head
(TRUE) or tail (FALSE).
- @return Length of the actually trimmed data, which is possible to be less
+ @return Length of the actually trimmed data, which is possible to be less
than Len because the TotalSize of Nbuf is less than Len.
**/
@@ -1216,11 +1216,11 @@ NetbufTrim (
/**
- Copy Len bytes of data from the specific offset of the net buffer to the
+ Copy Len bytes of data from the specific offset of the net buffer to the
destination memory.
-
+
The Len bytes of data may cross the several fragments of the net buffer.
-
+
@param[in] Nbuf Pointer to the net buffer.
@param[in] Offset The sequence number of the first byte to copy.
@param[in] Len Length of the data to copy.
@@ -1368,10 +1368,10 @@ NetbufQueAlloc (
/**
- Free a net buffer queue.
-
+ Free a net buffer queue.
+
Decrease the reference count of the net buffer queue by one. The real resource
- free operation isn't performed until the reference count of the net buffer
+ free operation isn't performed until the reference count of the net buffer
queue is decreased to 0.
@param[in] NbufQue Pointer to the net buffer queue to be freed.
@@ -1424,7 +1424,7 @@ NetbufQueAppend (
@param[in, out] NbufQue Pointer to the net buffer queue.
- @return Pointer to the net buffer removed from the specific queue,
+ @return Pointer to the net buffer removed from the specific queue,
or NULL if there is no net buffer in the specific queue.
**/
@@ -1455,16 +1455,16 @@ NetbufQueRemove (
/**
Copy Len bytes of data from the net buffer queue at the specific offset to the
destination memory.
-
+
The copying operation is the same as NetbufCopy but applies to the net buffer
queue instead of the net buffer.
-
+
@param[in] NbufQue Pointer to the net buffer queue.
@param[in] Offset The sequence number of the first byte to copy.
@param[in] Len Length of the data to copy.
@param[out] Dest The destination of the data to copy to.
- @return The length of the actual copied data, or 0 if the offset
+ @return The length of the actual copied data, or 0 if the offset
specified exceeds the total size of net buffer queue.
**/
@@ -1557,9 +1557,9 @@ NetbufQueCopy (
/**
- Trim Len bytes of data from the queue header, release any of the net buffer
+ Trim Len bytes of data from the queue header, release any of the net buffer
whom is trimmed wholely.
-
+
The trimming operation is the same as NetbufTrim but applies to the net buffer
queue instead of the net buffer.
@@ -1756,7 +1756,7 @@ NetbufChecksum (
// The checksum starts with an odd byte, swap
// the checksum before added to total checksum
//
- BlockSum = (UINT16) NET_SWAP_SHORT (BlockSum);
+ BlockSum = SwapBytes16 (BlockSum);
}
TotalSum = NetAddChecksum (BlockSum, TotalSum);
@@ -1768,8 +1768,8 @@ NetbufChecksum (
/**
- Compute the checksum for TCP/UDP pseudo header.
-
+ Compute the checksum for TCP/UDP pseudo header.
+
Src and Dst are in network byte order, and Len is in host byte order.
@param[in] Src The source address of the packet.
@@ -1805,8 +1805,8 @@ NetPseudoHeadChecksum (
}
/**
- Compute the checksum for TCP6/UDP6 pseudo header.
-
+ Compute the checksum for TCP6/UDP6 pseudo header.
+
Src and Dst are in network byte order, and Len is in host byte order.
@param[in] Src The source address of the packet.
@@ -1836,7 +1836,7 @@ NetIp6PseudoHeadChecksum (
IP6_COPY_ADDRESS (&Hdr.DstIp, Dst);
Hdr.NextHeader = NextHeader;
- Hdr.Len = HTONL (Len);
+ Hdr.Len = HTONL (Len);
return NetblockChecksum ((UINT8 *) &Hdr, sizeof (Hdr));
}