]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/NetLib.h
Clean up DEC files:
[mirror_edk2.git] / MdeModulePkg / Include / Library / NetLib.h
index a011bf7acb49211371a0db7547bbc0b7c4b956b9..102d7f1413844ef52bad68eb35e8d36fb9fa6507 100644 (file)
@@ -2,8 +2,8 @@
   This library is only intended to be used by UEFI network stack modules.\r
   It provides basic functions for the UEFI network stack.\r
 \r
-Copyright (c) 2005 - 2010, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at<BR>\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -19,6 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/Ip6.h>\r
 \r
 #include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
 \r
 typedef UINT32          IP4_ADDR;\r
 typedef UINT32          TCP_SEQNO;\r
@@ -51,6 +52,7 @@ typedef UINT16          TCP_PORTNO;
 \r
 #define  IP6_HOP_BY_HOP        0\r
 #define  IP6_DESTINATION       60\r
+#define  IP6_ROUTING           43\r
 #define  IP6_FRAGMENT          44\r
 #define  IP6_AH                51\r
 #define  IP6_ESP               50\r
@@ -286,6 +288,7 @@ typedef struct {
 \r
 **/\r
 CHAR8 *\r
+EFIAPI\r
 NetDebugASPrint (\r
   IN CHAR8                  *Format,\r
   ...\r
@@ -309,6 +312,7 @@ NetDebugASPrint (
                                 than the mNetDebugLevelMax. Or, it has been sent out.\r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetDebugOutput (\r
   IN UINT32                    Level,\r
   IN UINT8                     *Module,\r
@@ -400,6 +404,7 @@ NetIp4IsUnicast (
 \r
 **/\r
 BOOLEAN\r
+EFIAPI\r
 NetIp6IsValidUnicast (\r
   IN EFI_IPv6_ADDRESS       *Ip6\r
   );\r
@@ -415,6 +420,7 @@ NetIp6IsValidUnicast (
 \r
 **/\r
 BOOLEAN\r
+EFIAPI\r
 NetIp6IsUnspecifiedAddr (\r
   IN EFI_IPv6_ADDRESS       *Ip6\r
   );\r
@@ -429,6 +435,7 @@ NetIp6IsUnspecifiedAddr (
 \r
 **/\r
 BOOLEAN\r
+EFIAPI\r
 NetIp6IsLinkLocalAddr (\r
   IN EFI_IPv6_ADDRESS *Ip6\r
   );\r
@@ -445,6 +452,7 @@ NetIp6IsLinkLocalAddr (
 \r
 **/\r
 BOOLEAN\r
+EFIAPI\r
 NetIp6IsNetEqual (\r
   EFI_IPv6_ADDRESS *Ip1,\r
   EFI_IPv6_ADDRESS *Ip2,\r
@@ -464,6 +472,7 @@ NetIp6IsNetEqual (
 \r
 **/\r
 EFI_IPv6_ADDRESS *\r
+EFIAPI\r
 Ip6Swap128 (\r
   EFI_IPv6_ADDRESS *Ip6\r
   );\r
@@ -507,7 +516,7 @@ NetGetUint32 (
   byte stream.\r
 \r
   @param[in, out]  Buf          The buffer in which to put the UINT32.\r
-  @param[in]      Data          The data to put.\r
+  @param[in]       Data         The data to be converted and put into the byte stream.\r
 \r
 **/\r
 VOID\r
@@ -888,7 +897,7 @@ NetMapRemoveTail (
 \r
 typedef\r
 EFI_STATUS\r
-(*NET_MAP_CALLBACK) (\r
+(EFIAPI *NET_MAP_CALLBACK) (\r
   IN NET_MAP                *Map,\r
   IN NET_MAP_ITEM           *Item,\r
   IN VOID                   *Arg\r
@@ -1097,17 +1106,18 @@ NetLibGetMacString (
 \r
   The underlying UNDI driver may or may not support reporting media status from\r
   GET_STATUS command (PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED). This routine\r
-  will try to invoke Snp->GetStatus() to get the media status. Iif media is already\r
-  present, it returns directly. If media  isnot present, it will stop SNP and then\r
-  restart SNP to get the latest media status.  This provides an opportunity to get \r
+  will try to invoke Snp->GetStatus() to get the media status. If media is already\r
+  present, it returns directly. If media is not present, it will stop SNP and then\r
+  restart SNP to get the latest media status. This provides an opportunity to get \r
   the correct media status for old UNDI driver, which doesn't support reporting \r
   media status from GET_STATUS command.\r
   Note: there are two limitations for the current algorithm:\r
   1) For UNDI with this capability, when the cable is not attached, there will\r
      be an redundant Stop/Start() process.\r
-  2) For UNDI without this capability, when the cable is attached, the UNDI\r
-     initializes while unattached. Later, NetLibDetectMedia() will report\r
-     MediaPresent as TRUE, causing upper layer apps to wait for timeout time.\r
+  2) for UNDI without this capability, in case that network cable is attached when\r
+     Snp->Initialize() is invoked while network cable is unattached later,\r
+     NetLibDetectMedia() will report MediaPresent as TRUE, causing upper layer\r
+     apps to wait for timeout time.\r
 \r
   @param[in]   ServiceHandle    The handle where network service binding protocols are\r
                                 installed.\r
@@ -1240,6 +1250,7 @@ NetLibDefaultUnload (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetLibAsciiStrToIp4 (\r
   IN CONST CHAR8                 *String,\r
   OUT      EFI_IPv4_ADDRESS      *Ip4Address\r
@@ -1257,6 +1268,7 @@ NetLibAsciiStrToIp4 (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetLibAsciiStrToIp6 (\r
   IN CONST CHAR8                 *String,\r
   OUT      EFI_IPv6_ADDRESS      *Ip6Address\r
@@ -1274,6 +1286,7 @@ NetLibAsciiStrToIp6 (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetLibStrToIp4 (\r
   IN CONST CHAR16                *String,\r
   OUT      EFI_IPv4_ADDRESS      *Ip4Address\r
@@ -1292,6 +1305,7 @@ NetLibStrToIp4 (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetLibStrToIp6 (\r
   IN CONST CHAR16                *String,\r
   OUT      EFI_IPv6_ADDRESS      *Ip6Address\r
@@ -1312,6 +1326,7 @@ NetLibStrToIp6 (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 NetLibStrToIp6andPrefix (\r
   IN CONST CHAR16                *String,\r
   OUT      EFI_IPv6_ADDRESS      *Ip6Address,\r
@@ -1342,7 +1357,7 @@ typedef struct {
   UINT8               *Bulk;      // The block's Data\r
 } NET_BLOCK;\r
 \r
-typedef VOID (*NET_VECTOR_EXT_FREE) (VOID *Arg);\r
+typedef VOID (EFIAPI *NET_VECTOR_EXT_FREE) (VOID *Arg);\r
 \r
 //\r
 //NET_VECTOR contains several blocks to hold all packet's\r
@@ -1868,8 +1883,8 @@ NetbufQueCopy (
   );\r
 \r
 /**\r
-  Trim Len bytes of data from the queue header and release any net buffer\r
-  that is trimmed wholely.\r
+  Trim Len bytes of data from the buffer queue and free any net buffer\r
+  that is completely trimmed.\r
 \r
   The trimming operation is the same as NetbufTrim but applies to the net buffer\r
   queue instead of the net buffer.\r
@@ -1982,10 +1997,27 @@ NetPseudoHeadChecksum (
 \r
 **/\r
 UINT16\r
+EFIAPI\r
 NetIp6PseudoHeadChecksum (\r
   IN EFI_IPv6_ADDRESS       *Src,\r
   IN EFI_IPv6_ADDRESS       *Dst,\r
   IN UINT8                  NextHeader,\r
   IN UINT32                 Len\r
   );\r
+\r
+/**\r
+  The function frees the net buffer which allocated by the IP protocol. It releases \r
+  only the net buffer and doesn't call the external free function. \r
+\r
+  This function should be called after finishing the process of mIpSec->ProcessExt() \r
+  for outbound traffic. The (EFI_IPSEC2_PROTOCOL)->ProcessExt() allocates a new \r
+  buffer for the ESP, so there needs a function to free the old net buffer.\r
+\r
+  @param[in]  Nbuf       The network buffer to be freed.\r
+\r
+**/\r
+VOID\r
+NetIpSecNetbufFree (\r
+  NET_BUF   *Nbuf\r
+  );\r
 #endif\r