+#define EFI_IP6_EQUAL(Ip1, Ip2) (CompareMem ((Ip1), (Ip2), sizeof (EFI_IPv6_ADDRESS)) == 0)\r
+\r
+#define IP6_COPY_ADDRESS(Dest, Src) (CopyMem ((Dest), (Src), sizeof (EFI_IPv6_ADDRESS)))\r
+#define IP6_COPY_LINK_ADDRESS(Mac1, Mac2) (CopyMem ((Mac1), (Mac2), sizeof (EFI_MAC_ADDRESS)))\r
+\r
+//\r
+// The debug level definition. This value is also used as the\r
+// syslog's servity level. Don't change it.\r
+//\r
+#define NETDEBUG_LEVEL_TRACE 5\r
+#define NETDEBUG_LEVEL_WARNING 4\r
+#define NETDEBUG_LEVEL_ERROR 3\r
+\r
+//\r
+// Network debug message is sent out as syslog packet.\r
+//\r
+#define NET_SYSLOG_FACILITY 16 // Syslog local facility local use\r
+#define NET_SYSLOG_PACKET_LEN 512\r
+#define NET_SYSLOG_TX_TIMEOUT (500 * 1000 * 10) // 500ms\r
+#define NET_DEBUG_MSG_LEN 470 // 512 - (ether+ip4+udp4 head length)\r
+\r
+//\r
+// The debug output expects the ASCII format string, Use %a to print ASCII\r
+// string, and %s to print UNICODE string. PrintArg must be enclosed in ().\r
+// For example: NET_DEBUG_TRACE ("Tcp", ("State transit to %a\n", Name));\r
+//\r
+#define NET_DEBUG_TRACE(Module, PrintArg) \\r
+ NetDebugOutput ( \\r
+ NETDEBUG_LEVEL_TRACE, \\r
+ Module, \\r
+ __FILE__, \\r
+ __LINE__, \\r
+ NetDebugASPrint PrintArg \\r
+ )\r
+\r
+#define NET_DEBUG_WARNING(Module, PrintArg) \\r
+ NetDebugOutput ( \\r
+ NETDEBUG_LEVEL_WARNING, \\r
+ Module, \\r
+ __FILE__, \\r
+ __LINE__, \\r
+ NetDebugASPrint PrintArg \\r
+ )\r
+\r
+#define NET_DEBUG_ERROR(Module, PrintArg) \\r
+ NetDebugOutput ( \\r
+ NETDEBUG_LEVEL_ERROR, \\r
+ Module, \\r
+ __FILE__, \\r
+ __LINE__, \\r
+ NetDebugASPrint PrintArg \\r
+ )\r
+\r
+/**\r
+ Allocate a buffer, then format the message to it. This is a\r
+ help function for the NET_DEBUG_XXX macros. The PrintArg of\r
+ these macros treats the variable length print parameters as a\r
+ single parameter, and pass it to the NetDebugASPrint. For\r
+ example, NET_DEBUG_TRACE ("Tcp", ("State transit to %a\n", Name))\r
+ if extracted to:\r
+\r
+ NetDebugOutput (\r
+ NETDEBUG_LEVEL_TRACE,\r
+ "Tcp",\r
+ __FILE__,\r
+ __LINE__,\r
+ NetDebugASPrint ("State transit to %a\n", Name)\r
+ )\r
+\r
+ @param Format The ASCII format string.\r
+ @param ... The variable length parameter whose format is determined\r
+ by the Format string.\r
+\r
+ @return The buffer containing the formatted message,\r
+ or NULL if failed to allocate memory.\r
+\r
+**/\r
+CHAR8 *\r
+NetDebugASPrint (\r
+ IN CHAR8 *Format,\r
+ ...\r
+ );\r
+\r