]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/NetLib.h
MdeModulePkg: Update NetLib interface to support classless addressing.
[mirror_edk2.git] / MdeModulePkg / Include / Library / NetLib.h
index c5c0fc212bd8191077c003a23e1d8df9505de2ac..26709af091d1a77214fa1aa3a2e7ed635f4da04a 100644 (file)
@@ -43,9 +43,9 @@ typedef UINT16          TCP_PORTNO;
 //\r
 // The address classification\r
 //\r
-#define  IP4_ADDR_CLASSA       1\r
-#define  IP4_ADDR_CLASSB       2\r
-#define  IP4_ADDR_CLASSC       3\r
+#define  IP4_ADDR_CLASSA       1     // Deprecated\r
+#define  IP4_ADDR_CLASSB       2     // Deprecated\r
+#define  IP4_ADDR_CLASSC       3     // Deprecated\r
 #define  IP4_ADDR_CLASSD       4\r
 #define  IP4_ADDR_CLASSE       5\r
 \r
@@ -231,6 +231,7 @@ typedef struct {
 // Test the IP's attribute, All the IPs are in host byte order.\r
 //\r
 #define IP4_IS_MULTICAST(Ip)              (((Ip) & 0xF0000000) == 0xE0000000)\r
+#define IP4_IS_UNSPECIFIED(Ip)            ((Ip) == 0)\r
 #define IP4_IS_LOCAL_BROADCAST(Ip)        ((Ip) == 0xFFFFFFFF)\r
 #define IP4_NET_EQUAL(Ip1, Ip2, NetMask)  (((Ip1) & (NetMask)) == ((Ip2) & (NetMask)))\r
 #define IP4_IS_VALID_NETMASK(Ip)          (NetGetMaskLength (Ip) != (IP4_MASK_MAX + 1))\r
@@ -379,6 +380,11 @@ NetGetMaskLength (
   Return the class of the IP address, such as class A, B, C.\r
   Addr is in host byte order.\r
 \r
+  [ATTENTION]\r
+  Classful addressing (IP class A/B/C) has been deprecated according to RFC4632.\r
+  Caller of this function could only check the returned value against\r
+  IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now.\r
+\r
   The address of class A  starts with 0.\r
   If the address belong to class A, return IP4_ADDR_CLASSA.\r
   The address of class B  starts with 10.\r
@@ -404,17 +410,16 @@ NetGetIpClass (
 \r
 /**\r
   Check whether the IP is a valid unicast address according to\r
-  the netmask. If NetMask is zero, use the IP address's class to get the default mask.\r
+  the netmask. \r
 \r
-  If Ip is 0, IP is not a valid unicast address.\r
-  Class D address is used for multicasting and class E address is reserved for future. If Ip\r
-  belongs to class D or class E, Ip is not a valid unicast address.\r
-  If all bits of the host address of Ip are 0 or 1, Ip is not a valid unicast address.\r
+  ASSERT if NetMask is zero.\r
+  \r
+  If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address.\r
 \r
   @param[in]  Ip                    The IP to check against.\r
   @param[in]  NetMask               The mask of the IP.\r
 \r
-  @return TRUE if Ip is a valid unicast address on the network, otherwise FALSE.\r
+  @return TRUE if IP is a valid unicast address on the network, otherwise FALSE.\r
 \r
 **/\r
 BOOLEAN\r