Changeset 77662 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Include/Library/NetLib.h
- Timestamp:
- Mar 12, 2019 12:40:12 PM (6 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776 /vendor/edk2/current 103735-103757,103769-103776,129194-129237
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Include/Library/NetLib.h
r58466 r77662 3 3 It provides basic functions for the UEFI network stack. 4 4 5 Copyright (c) 2005 - 201 2, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR> 6 6 This program and the accompanying materials 7 7 are licensed and made available under the terms and conditions of the BSD License … … 38 38 #define IP4_PROTO_IGMP 0x02 39 39 #define IP6_ICMP 58 40 #define DNS_MAX_NAME_SIZE 255 41 #define DNS_MAX_MESSAGE_SIZE 512 40 42 41 43 // 42 44 // The address classification 43 45 // 44 #define IP4_ADDR_CLASSA 1 45 #define IP4_ADDR_CLASSB 2 46 #define IP4_ADDR_CLASSC 3 46 #define IP4_ADDR_CLASSA 1 // Deprecated 47 #define IP4_ADDR_CLASSB 2 // Deprecated 48 #define IP4_ADDR_CLASSC 3 // Deprecated 47 49 #define IP4_ADDR_CLASSD 4 48 50 #define IP4_ADDR_CLASSE 5 … … 50 52 #define IP4_MASK_NUM 33 51 53 #define IP6_PREFIX_NUM 129 54 55 #define IP4_MASK_MAX 32 56 #define IP6_PREFIX_MAX 128 52 57 53 58 #define IP6_HOP_BY_HOP 0 … … 63 68 64 69 #define IP6_PREFIX_LENGTH 64 70 71 // 72 // DNS QTYPE values 73 // 74 #define DNS_TYPE_A 1 75 #define DNS_TYPE_NS 2 76 #define DNS_TYPE_CNAME 5 77 #define DNS_TYPE_SOA 6 78 #define DNS_TYPE_WKS 11 79 #define DNS_TYPE_PTR 12 80 #define DNS_TYPE_HINFO 13 81 #define DNS_TYPE_MINFO 14 82 #define DNS_TYPE_MX 15 83 #define DNS_TYPE_TXT 16 84 #define DNS_TYPE_AAAA 28 85 #define DNS_TYPE_SRV_RR 33 86 #define DNS_TYPE_AXFR 252 87 #define DNS_TYPE_MAILB 253 88 #define DNS_TYPE_ANY 255 89 90 // 91 // DNS QCLASS values 92 // 93 #define DNS_CLASS_INET 1 94 #define DNS_CLASS_CH 3 95 #define DNS_CLASS_HS 4 96 #define DNS_CLASS_ANY 255 97 98 // 99 // Number of 100ns units time Interval for network media state detect 100 // 101 #define MEDIA_STATE_DETECT_TIME_INTERVAL 1000000U 102 65 103 66 104 #pragma pack(1) … … 200 238 // 201 239 #define IP4_IS_MULTICAST(Ip) (((Ip) & 0xF0000000) == 0xE0000000) 240 #define IP4_IS_UNSPECIFIED(Ip) ((Ip) == 0) 202 241 #define IP4_IS_LOCAL_BROADCAST(Ip) ((Ip) == 0xFFFFFFFF) 203 242 #define IP4_NET_EQUAL(Ip1, Ip2, NetMask) (((Ip1) & (NetMask)) == ((Ip2) & (NetMask))) 204 #define IP4_IS_VALID_NETMASK(Ip) (NetGetMaskLength (Ip) != IP4_MASK_NUM)243 #define IP4_IS_VALID_NETMASK(Ip) (NetGetMaskLength (Ip) != (IP4_MASK_MAX + 1)) 205 244 206 245 #define IP6_IS_MULTICAST(Ip6) (((Ip6)->Addr[0]) == 0xFF) … … 221 260 // 222 261 // The debug level definition. This value is also used as the 223 // syslog's se rvity level. Don't change it.262 // syslog's severity level. Don't change it. 224 263 // 225 264 #define NETDEBUG_LEVEL_TRACE 5 … … 304 343 Because it isn't open the SNP BY_DRIVER, apply caution when using it. 305 344 306 @param Level The se rvity level of the message.307 @param Module The Mo udle that generates the log.345 @param Level The severity level of the message. 346 @param Module The Module that generates the log. 308 347 @param File The file that contains the log. 309 348 @param Line The exact line that contains the log. … … 347 386 Return the class of the IP address, such as class A, B, C. 348 387 Addr is in host byte order. 388 389 [ATTENTION] 390 Classful addressing (IP class A/B/C) has been deprecated according to RFC4632. 391 Caller of this function could only check the returned value against 392 IP4_ADDR_CLASSD (multicast) or IP4_ADDR_CLASSE (reserved) now. 349 393 350 394 The address of class A starts with 0. … … 373 417 /** 374 418 Check whether the IP is a valid unicast address according to 375 the netmask. If NetMask is zero, use the IP address's class to get the default mask. 376 377 If Ip is 0, IP is not a valid unicast address. 378 Class D address is used for multicasting and class E address is reserved for future. If Ip 379 belongs to class D or class E, Ip is not a valid unicast address. 380 If all bits of the host address of Ip are 0 or 1, Ip is not a valid unicast address. 419 the netmask. 420 421 ASSERT if NetMask is zero. 422 423 If all bits of the host address of IP are 0 or 1, IP is also not a valid unicast address, 424 except when the originator is one of the endpoints of a point-to-point link with a 31-bit 425 mask (RFC3021). 381 426 382 427 @param[in] Ip The IP to check against. 383 428 @param[in] NetMask The mask of the IP. 384 429 385 @return TRUE if I pis a valid unicast address on the network, otherwise FALSE.430 @return TRUE if IP is a valid unicast address on the network, otherwise FALSE. 386 431 387 432 **/ … … 395 440 /** 396 441 Check whether the incoming IPv6 address is a valid unicast address. 442 443 ASSERT if Ip6 is NULL. 397 444 398 445 If the address is a multicast address has binary 0xFF at the start, it is not … … 417 464 Check whether the incoming Ipv6 address is the unspecified address or not. 418 465 466 ASSERT if Ip6 is NULL. 467 419 468 @param[in] Ip6 - Ip6 address, in network order. 420 469 … … 432 481 Check whether the incoming Ipv6 address is a link-local address. 433 482 483 ASSERT if Ip6 is NULL. 484 434 485 @param[in] Ip6 - Ip6 address, in network order. 435 486 … … 446 497 /** 447 498 Check whether the Ipv6 address1 and address2 are on the connected network. 499 500 ASSERT if Ip1 or Ip2 is NULL. 501 ASSERT if PrefixLength exceeds or equals to IP6_PREFIX_MAX. 448 502 449 503 @param[in] Ip1 - Ip6 address1, in network order. … … 466 520 Switches the endianess of an IPv6 address. 467 521 522 ASSERT if Ip6 is NULL. 523 468 524 This function swaps the bytes in a 128-bit IPv6 address to switch the value 469 525 from little endian to big endian or vice versa. The byte swapped value is … … 487 543 488 544 #define NET_IS_DIGIT(Ch) (('0' <= (Ch)) && ((Ch) <= '9')) 545 #define NET_IS_HEX(Ch) ((('0' <= (Ch)) && ((Ch) <= '9')) || (('A' <= (Ch)) && ((Ch) <= 'F')) || (('a' <= (Ch)) && ((Ch) <= 'f'))) 489 546 #define NET_ROUNDUP(size, unit) (((size) + (unit) - 1) & (~((unit) - 1))) 490 547 #define NET_IS_LOWER_CASE_CHAR(Ch) (('a' <= (Ch)) && ((Ch) <= 'z')) … … 499 556 Extract a UINT32 from a byte stream. 500 557 558 ASSERT if Buf is NULL. 559 501 560 This function copies a UINT32 from a byte stream, and then converts it from Network 502 561 byte order to host byte order. Use this function to avoid alignment error. … … 515 574 /** 516 575 Puts a UINT32 into the byte stream in network byte order. 576 577 ASSERT if Buf is NULL. 517 578 518 579 Converts a UINT32 from host byte order to network byte order, then copies it to the … … 531 592 532 593 /** 533 Initialize a random seed using current time .534 535 Get current time first. Then initialize a random seed based on some basic536 mathematical operations on the hour, day, minute, second, nanosecond and year537 of the current time.538 539 @return The random seed ,initialized with current time.594 Initialize a random seed using current time and monotonic count. 595 596 Get current time and monotonic count first. Then initialize a random seed 597 based on some basic mathematics operation on the hour, day, minute, second, 598 nanosecond and year of the current time and the monotonic count value. 599 600 @return The random seed initialized with current time. 540 601 541 602 **/ … … 632 693 Insert a new node entry after a designated node entry of a doubly linked list. 633 694 695 ASSERT if PrevEntry or NewEntry is NULL. 696 634 697 Inserts a new node entry designated by NewEntry after the node entry designated by PrevEntry 635 698 of the doubly linked list. … … 648 711 /** 649 712 Insert a new node entry before a designated node entry of a doubly linked list. 713 714 ASSERT if PostEntry or NewEntry is NULL. 650 715 651 716 Inserts a new node entry designated by NewEntry before the node entry designated by PostEntry … … 719 784 if NumberOfChildren is 0. 720 785 721 @retval T URE Found the input Handle in ChildHandleBuffer.786 @retval TRUE Found the input Handle in ChildHandleBuffer. 722 787 @retval FALSE Can't find the input Handle in ChildHandleBuffer. 723 788 … … 794 859 If Map is NULL, then ASSERT(). 795 860 796 797 861 @param[in] Map The net map to test. 798 862 … … 808 872 /** 809 873 Return the number of the <Key, Value> pairs in the netmap. 874 875 If Map is NULL, then ASSERT(). 810 876 811 877 @param[in] Map The netmap to get the entry number. … … 828 894 829 895 If Map is NULL, then ASSERT(). 896 If Key is NULL, then ASSERT(). 830 897 831 898 @param[in, out] Map The netmap to insert into. … … 853 920 854 921 If Map is NULL, then ASSERT(). 922 If Key is NULL, then ASSERT(). 855 923 856 924 @param[in, out] Map The netmap to insert into. … … 877 945 878 946 If Map is NULL, then ASSERT(). 947 If Key is NULL, then ASSERT(). 879 948 880 949 @param[in] Map The netmap to search within. … … 977 1046 Iterate through the netmap and call CallBack for each item. 978 1047 979 It will conti ue the traverse if CallBack returns EFI_SUCCESS, otherwise, break1048 It will continue the traverse if CallBack returns EFI_SUCCESS, otherwise, break 980 1049 from the loop. It returns the CallBack's last return value. This function is 981 1050 delete safe for the current item. … … 1122 1191 Get MAC address associated with the network service handle. 1123 1192 1193 If MacAddress is NULL, then ASSERT(). 1194 If AddressSize is NULL, then ASSERT(). 1195 1124 1196 There should be MNP Service Binding Protocol installed on the input ServiceHandle. 1125 1197 If SNP is installed on the ServiceHandle or its parent handle, MAC address will … … 1146 1218 Convert MAC address of the NIC associated with specified Service Binding Handle 1147 1219 to a unicode string. Callers are responsible for freeing the string storage. 1220 1221 If MacString is NULL, then ASSERT(). 1148 1222 1149 1223 Locate simple network protocol associated with the Service Binding Handle and … … 1175 1249 /** 1176 1250 Detect media status for specified network device. 1251 1252 If MediaPresent is NULL, then ASSERT(). 1177 1253 1178 1254 The underlying UNDI driver may or may not support reporting media status from … … 1209 1285 1210 1286 /** 1287 Detect media state for a network device. This routine will wait for a period of time at 1288 a specified checking interval when a certain network is under connecting until connection 1289 process finishes or timeout. If Aip protocol is supported by low layer drivers, three kinds 1290 of media states can be detected: EFI_SUCCESS, EFI_NOT_READY and EFI_NO_MEDIA, represents 1291 connected state, connecting state and no media state respectively. When function detects 1292 the current state is EFI_NOT_READY, it will loop to wait for next time's check until state 1293 turns to be EFI_SUCCESS or EFI_NO_MEDIA. If Aip protocol is not supported, function will 1294 call NetLibDetectMedia() and return state directly. 1295 1296 @param[in] ServiceHandle The handle where network service binding protocols are 1297 installed on. 1298 @param[in] Timeout The maximum number of 100ns units to wait when network 1299 is connecting. Zero value means detect once and return 1300 immediately. 1301 @param[out] MediaState The pointer to the detected media state. 1302 1303 @retval EFI_SUCCESS Media detection success. 1304 @retval EFI_INVALID_PARAMETER ServiceHandle is not a valid network device handle or 1305 MediaState pointer is NULL. 1306 @retval EFI_DEVICE_ERROR A device error occurred. 1307 @retval EFI_TIMEOUT Network is connecting but timeout. 1308 1309 **/ 1310 EFI_STATUS 1311 EFIAPI 1312 NetLibDetectMediaWaitTimeout ( 1313 IN EFI_HANDLE ServiceHandle, 1314 IN UINT64 Timeout, 1315 OUT EFI_STATUS *MediaState 1316 ); 1317 1318 1319 /** 1211 1320 Create an IPv4 device path node. 1321 1322 If Node is NULL, then ASSERT(). 1212 1323 1213 1324 The header type of IPv4 device path node is MESSAGING_DEVICE_PATH. … … 1242 1353 Create an IPv6 device path node. 1243 1354 1355 If Node is NULL, then ASSERT(). 1356 If LocalIp is NULL, then ASSERT(). 1357 If RemoteIp is NULL, then ASSERT(). 1358 1244 1359 The header type of IPv6 device path node is MESSAGING_DEVICE_PATH. 1245 1360 The header subtype of IPv6 device path node is MSG_IPv6_DP. … … 1272 1387 Find the UNDI/SNP handle from controller and protocol GUID. 1273 1388 1389 If ProtocolGuid is NULL, then ASSERT(). 1390 1274 1391 For example, IP will open an MNP child to transmit/receive 1275 1392 packets. When MNP is stopped, IP should also be stopped. IP … … 1277 1394 service binding instance that is installed on the UNDI/SNP handle. 1278 1395 The controller is then either an MNP or an ARP child handle. Note that 1279 IP opens these handles using BY_DRIVER. Use that info mation to get the1396 IP opens these handles using BY_DRIVER. Use that information to get the 1280 1397 UNDI/SNP handle. 1281 1398 … … 1318 1435 1319 1436 @retval EFI_SUCCESS Converted to an IPv4 address successfully. 1320 @retval EFI_INVALID_PARAMETER The string is malformat ed, or Ip4Address is NULL.1437 @retval EFI_INVALID_PARAMETER The string is malformatted, or Ip4Address is NULL. 1321 1438 1322 1439 **/ … … 1330 1447 /** 1331 1448 Convert one Null-terminated ASCII string to EFI_IPv6_ADDRESS. The format of the 1332 string is defined in RFC 4291 - Text Pepresentation of Addresses.1449 string is defined in RFC 4291 - Text Representation of Addresses. 1333 1450 1334 1451 @param[in] String The pointer to the Ascii string. … … 1336 1453 1337 1454 @retval EFI_SUCCESS Converted to an IPv6 address successfully. 1338 @retval EFI_INVALID_PARAMETER The string is malformat ed, or Ip6Address is NULL.1455 @retval EFI_INVALID_PARAMETER The string is malformatted, or Ip6Address is NULL. 1339 1456 1340 1457 **/ … … 1353 1470 1354 1471 @retval EFI_SUCCESS Converted to an IPv4 address successfully. 1355 @retval EFI_INVALID_PARAMETER The string is mal-formated or Ip4Address is NULL. 1356 @retval EFI_OUT_OF_RESOURCES Failed to perform the operation due to lack of resources. 1472 @retval EFI_INVALID_PARAMETER The string is mal-formatted or Ip4Address is NULL. 1357 1473 1358 1474 **/ … … 1366 1482 /** 1367 1483 Convert one Null-terminated Unicode string to EFI_IPv6_ADDRESS. The format of 1368 the string is defined in RFC 4291 - Text Pepresentation of Addresses.1484 the string is defined in RFC 4291 - Text Representation of Addresses. 1369 1485 1370 1486 @param[in] String The pointer to the Ascii string. … … 1372 1488 1373 1489 @retval EFI_SUCCESS Converted to an IPv6 address successfully. 1374 @retval EFI_INVALID_PARAMETER The string is malformated or Ip6Address is NULL. 1375 @retval EFI_OUT_OF_RESOURCES Failed to perform the operation due to a lack of resources. 1490 @retval EFI_INVALID_PARAMETER The string is malformatted or Ip6Address is NULL. 1376 1491 1377 1492 **/ … … 1385 1500 /** 1386 1501 Convert one Null-terminated Unicode string to EFI_IPv6_ADDRESS and prefix length. 1387 The format of the string is defined in RFC 4291 - Text Pepresentation of Addresses1502 The format of the string is defined in RFC 4291 - Text Representation of Addresses 1388 1503 Prefixes: ipv6-address/prefix-length. 1389 1504 … … 1393 1508 1394 1509 @retval EFI_SUCCESS Converted to an IPv6 address successfully. 1395 @retval EFI_INVALID_PARAMETER The string is malformated, or Ip6Address is NULL. 1396 @retval EFI_OUT_OF_RESOURCES Failed to perform the operation due to a lack of resources. 1510 @retval EFI_INVALID_PARAMETER The string is malformatted, or Ip6Address is NULL. 1397 1511 1398 1512 **/ … … 1462 1576 INTN RefCnt; // Reference count to share NET_VECTOR. 1463 1577 NET_VECTOR_EXT_FREE Free; // external function to free NET_VECTOR 1464 VOID *Arg; // op eque argument to Free1578 VOID *Arg; // opaque argument to Free 1465 1579 UINT32 Flag; // Flags, NET_VECTOR_OWN_FIRST 1466 UINT32 Len; // Total length of the assoc ated BLOCKs1580 UINT32 Len; // Total length of the associated BLOCKs 1467 1581 1468 1582 UINT32 BlockNum; … … 1573 1687 1574 1688 #define NET_HEADSPACE(BlockOp) \ 1575 ( UINTN)((BlockOp)->Head - (BlockOp)->BlockHead)1689 ((UINTN)((BlockOp)->Head) - (UINTN)((BlockOp)->BlockHead)) 1576 1690 1577 1691 #define NET_TAILSPACE(BlockOp) \ 1578 ( UINTN)((BlockOp)->BlockTail - (BlockOp)->Tail)1692 ((UINTN)((BlockOp)->BlockTail) - (UINTN)((BlockOp)->Tail)) 1579 1693 1580 1694 /** … … 2118 2232 This function obtains the system guid from the smbios table. 2119 2233 2234 If SystemGuid is NULL, then ASSERT(). 2235 2120 2236 @param[out] SystemGuid The pointer of the returned system guid. 2121 2237 … … 2130 2246 ); 2131 2247 2248 /** 2249 Create Dns QName according the queried domain name. 2250 2251 If DomainName is NULL, then ASSERT(). 2252 2253 QName is a domain name represented as a sequence of labels, 2254 where each label consists of a length octet followed by that 2255 number of octets. The QName terminates with the zero 2256 length octet for the null label of the root. Caller should 2257 take responsibility to free the buffer in returned pointer. 2258 2259 @param DomainName The pointer to the queried domain name string. 2260 2261 @retval NULL Failed to fill QName. 2262 @return QName filled successfully. 2263 2264 **/ 2265 CHAR8 * 2266 EFIAPI 2267 NetLibCreateDnsQName ( 2268 IN CHAR16 *DomainName 2269 ); 2270 2132 2271 #endif
Note:
See TracChangeset
for help on using the changeset viewer.