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
#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
#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
\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
#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
);\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
(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
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
\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
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