]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/NetLib.h
MdeModulePkg: Fix typos in comments and variables
[mirror_edk2.git] / MdeModulePkg / Include / Library / NetLib.h
index d85c259b867de57764020518caac313e4c9429ca..87f393e2de045ff3020b80305294bded71f23e6a 100644 (file)
@@ -2,7 +2,7 @@
   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 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2016, 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
@@ -37,6 +37,8 @@ typedef UINT16          TCP_PORTNO;
 #define  EFI_IP_PROTO_ICMP     0x01\r
 #define  IP4_PROTO_IGMP        0x02\r
 #define  IP6_ICMP              58\r
+#define  DNS_MAX_NAME_SIZE     255\r
+#define  DNS_MAX_MESSAGE_SIZE  512\r
 \r
 //\r
 // The address classification\r
@@ -50,6 +52,9 @@ typedef UINT16          TCP_PORTNO;
 #define  IP4_MASK_NUM          33\r
 #define  IP6_PREFIX_NUM        129\r
 \r
+#define  IP4_MASK_MAX          32 \r
+#define  IP6_PREFIX_MAX        128\r
+\r
 #define  IP6_HOP_BY_HOP        0\r
 #define  IP6_DESTINATION       60\r
 #define  IP6_ROUTING           43\r
@@ -63,6 +68,33 @@ typedef UINT16          TCP_PORTNO;
 \r
 #define  IP6_PREFIX_LENGTH     64\r
 \r
+//\r
+// DNS QTYPE values\r
+//\r
+#define  DNS_TYPE_A            1\r
+#define  DNS_TYPE_NS           2\r
+#define  DNS_TYPE_CNAME        5\r
+#define  DNS_TYPE_SOA          6\r
+#define  DNS_TYPE_WKS          11\r
+#define  DNS_TYPE_PTR          12\r
+#define  DNS_TYPE_HINFO        13\r
+#define  DNS_TYPE_MINFO        14\r
+#define  DNS_TYPE_MX           15\r
+#define  DNS_TYPE_TXT          16\r
+#define  DNS_TYPE_AAAA         28\r
+#define  DNS_TYPE_SRV_RR       33\r
+#define  DNS_TYPE_AXFR         252\r
+#define  DNS_TYPE_MAILB        253\r
+#define  DNS_TYPE_ANY          255\r
+\r
+//\r
+// DNS QCLASS values\r
+//\r
+#define  DNS_CLASS_INET        1\r
+#define  DNS_CLASS_CH          3\r
+#define  DNS_CLASS_HS          4\r
+#define  DNS_CLASS_ANY         255\r
+\r
 #pragma pack(1)\r
 \r
 //\r
@@ -201,7 +233,7 @@ typedef struct {
 #define IP4_IS_MULTICAST(Ip)              (((Ip) & 0xF0000000) == 0xE0000000)\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_NUM)\r
+#define IP4_IS_VALID_NETMASK(Ip)          (NetGetMaskLength (Ip) != (IP4_MASK_MAX + 1))\r
 \r
 #define IP6_IS_MULTICAST(Ip6)             (((Ip6)->Addr[0]) == 0xFF)\r
 \r
@@ -530,13 +562,13 @@ NetPutUint32 (
   );\r
 \r
 /**\r
-  Initialize a random seed using current time.\r
+  Initialize a random seed using current time and monotonic count.\r
 \r
-  Get current time first. Then initialize a random seed based on some basic\r
-  mathematical operations on the hour, day, minute, second, nanosecond and year\r
-  of the current time.\r
+  Get current time and monotonic count first. Then initialize a random seed \r
+  based on some basic mathematics operation on the hour, day, minute, second,\r
+  nanosecond and year of the current time and the monotonic count value.\r
 \r
-  @return The random seed, initialized with current time.\r
+  @return The random seed initialized with current time.\r
 \r
 **/\r
 UINT32\r
@@ -677,7 +709,7 @@ EFI_STATUS
 (EFIAPI *NET_DESTROY_LINK_LIST_CALLBACK) (\r
   IN LIST_ENTRY         *Entry,\r
   IN VOID               *Context   OPTIONAL\r
-);\r
+  );\r
 \r
 /**\r
   Safe destroy nodes in a linked list, and return the length of the list after all possible operations finished.\r
@@ -708,7 +740,7 @@ NetDestroyLinkList (
   IN   NET_DESTROY_LINK_LIST_CALLBACK   CallBack,\r
   IN   VOID                             *Context,    OPTIONAL\r
   OUT  UINTN                            *ListLength  OPTIONAL\r
-);\r
+  );\r
 \r
 /**\r
   This function checks the input Handle to see if it's one of these handles in ChildHandleBuffer.\r
@@ -723,11 +755,12 @@ NetDestroyLinkList (
 \r
 **/\r
 BOOLEAN\r
+EFIAPI\r
 NetIsInHandleBuffer (\r
   IN  EFI_HANDLE          Handle,\r
   IN  UINTN               NumberOfChildren,\r
   IN  EFI_HANDLE          *ChildHandleBuffer OPTIONAL\r
-);\r
+  );\r
 \r
 //\r
 // Object container: EFI network stack spec defines various kinds of\r
@@ -2128,4 +2161,24 @@ NetLibGetSystemGuid (
   OUT EFI_GUID              *SystemGuid\r
   );\r
 \r
+/**\r
+  Create Dns QName according the queried domain name. \r
+  QName is a domain name represented as a sequence of labels, \r
+  where each label consists of a length octet followed by that \r
+  number of octets. The QName terminates with the zero \r
+  length octet for the null label of the root. Caller should \r
+  take responsibility to free the buffer in returned pointer.\r
+\r
+  @param  DomainName    The pointer to the queried domain name string.  \r
+\r
+  @retval NULL          Failed to fill QName.\r
+  @return               QName filled successfully.\r
+  \r
+**/ \r
+CHAR8 *\r
+EFIAPI\r
+NetLibCreateDnsQName (\r
+  IN  CHAR16              *DomainName\r
+  );\r
+\r
 #endif\r