Changeset 43213 in vbox
- Timestamp:
- Sep 6, 2012 8:37:56 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/iprt/mangling.h (modified) (1 diff)
-
include/iprt/socket.h (modified) (2 diffs)
-
src/VBox/ExtPacks/VNC/VBoxVNC.cpp (modified) (10 diffs)
-
src/VBox/Runtime/r3/socket.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mangling.h
r43171 r43213 1197 1197 # define RTSocketClose RT_MANGLER(RTSocketClose) 1198 1198 # define RTSocketFromNative RT_MANGLER(RTSocketFromNative) 1199 # define RTSocket GetAddrInfo RT_MANGLER(RTSocketGetAddrInfo)1199 # define RTSocketQueryAddressStr RT_MANGLER(RTSocketQueryAddressStr) 1200 1200 # define RTSocketGetLocalAddress RT_MANGLER(RTSocketGetLocalAddress) 1201 1201 # define RTSocketGetPeerAddress RT_MANGLER(RTSocketGetPeerAddress) -
trunk/include/iprt/socket.h
r43206 r43213 130 130 * Try resolve a host name, returning the first matching address. 131 131 * 132 * @remarks Gets the ip addresses of a hostname via getaddrinfo(). It returns133 * only the first result for the moment, but this will change with the134 * upcoming IPv6 struct.135 *136 132 * @returns IPRT status code. 137 133 * @param pszHost Name or IP address to look up. 138 * @param psz Result Where to return the result.139 * @param pcb ResultInput: The size of the @a pszResult buffer.134 * @param pszAddress Where to return the stringified address. 135 * @param pcbAddress Input: The size of the @a pszResult buffer. 140 136 * Output: size of the returned string. This is set on 141 137 * VERR_BUFFER_OVERFLOW and most other error statuses. … … 148 144 * Not modified on failure. 149 145 */ 150 RTDECL(int) RTSocket GetAddrInfo(const char *pszHost, char *pszResult, size_t *pcbResult, PRTNETADDRTYPE penmAddrType);146 RTDECL(int) RTSocketQueryAddressStr(const char *pszHost, char *pszAddress, size_t *pcbAddress, PRTNETADDRTYPE penmAddrType); 151 147 152 148 /** -
trunk/src/VBox/ExtPacks/VNC/VBoxVNC.cpp
r43171 r43213 337 337 uint32_t cbOut = 0; 338 338 size_t resSize = 0; 339 RTNETADDRTYPE iAddrType = RTNETADDRTYPE_INVALID;339 RTNETADDRTYPE enmAddrType; 340 340 char *pszTCPAddress = NULL; 341 341 char *pszTCPPort = NULL; … … 346 346 char *pszServerAddress4 = NULL; 347 347 char *pszServerAddress6 = NULL; 348 char *pszGetAddrInfo4 = NULL; // used to store the result of RTSocket GetAddrInfo()349 char *pszGetAddrInfo6 = NULL; // used to store the result of RTSocket GetAddrInfo()348 char *pszGetAddrInfo4 = NULL; // used to store the result of RTSocketQueryAddressStr() 349 char *pszGetAddrInfo6 = NULL; // used to store the result of RTSocketQueryAddressStr() 350 350 351 351 // get address … … 383 383 pVRDEFeature->u32ClientId = 0; 384 384 385 /** @todo r=bird: I believe this code is more than a little of confused 386 * about how to use RTStrCopy... The 2nd parameter is the size of the 387 * destination buffer, not the size of the source string!! */ 385 388 RTStrCopy(pVRDEFeature->achInfo, 19, "Property/TCP/Ports"); 386 389 … … 404 407 const uint32_t lVNCAddress4FeatureSize = sizeof(VRDEFEATURE) + 24; 405 408 406 pszVNCAddress4 = (char *) RTMemTmpAlloc(24); 407 memset(pszVNCAddress4,'\0',24); 409 pszVNCAddress4 = (char *) RTMemTmpAllocZ(24); 408 410 409 411 pVRDEFeature->u32ClientId = 0; … … 454 456 rc = -1; 455 457 456 pszVNCAddress6 = (char *) RTMemTmpAlloc(VNC_ADDRESS_OPTION_MAX); 457 memset(pszVNCAddress6,'\0',VNC_ADDRESS_OPTION_MAX); 458 pszVNCAddress6 = (char *) RTMemTmpAllocZ(VNC_ADDRESS_OPTION_MAX); 458 459 459 460 pVRDEFeature->u32ClientId = 0; … … 476 477 477 478 // VNCPort6 478 pszVNCPort6 = (char *) RTMemTmpAlloc(6); 479 memset(pszVNCPort6,'\0', 6); 479 pszVNCPort6 = (char *) RTMemTmpAllocZ(6); 480 480 481 481 pVRDEFeature->u32ClientId = 0; … … 573 573 { 574 574 // here we go, we prefer IPv6 over IPv4; 575 pszGetAddrInfo6 = (char *) RTMemTmpAlloc(42);576 memset(pszGetAddrInfo6, '\0', 42);577 575 resSize = 42; 578 iAddrType = RTNETADDRTYPE_IPV6; 579 580 rc = RTSocketGetAddrInfo(pszTCPAddress, pszGetAddrInfo6, &resSize, &iAddrType); 576 pszGetAddrInfo6 = (char *) RTMemTmpAllocZ(resSize); 577 enmAddrType = RTNETADDRTYPE_IPV6; 578 579 rc = RTSocketQueryAddressStr(pszTCPAddress, pszGetAddrInfo6, &resSize, &enmAddrType); 581 580 582 581 if (RT_SUCCESS(rc)) … … 593 592 if (!pszServerAddress6) 594 593 { 595 pszGetAddrInfo4 = (char *) RTMemTmpAlloc(16);596 memset(pszGetAddrInfo4,'\0',16);597 594 resSize = 16; 598 iAddrType = RTNETADDRTYPE_IPV4; 599 600 rc = RTSocketGetAddrInfo(pszTCPAddress, pszGetAddrInfo4, &resSize, &iAddrType); 595 pszGetAddrInfo4 = (char *) RTMemTmpAllocZ(resSize); 596 enmAddrType = RTNETADDRTYPE_IPV4; 597 598 rc = RTSocketQueryAddressStr(pszTCPAddress, pszGetAddrInfo4, &resSize, &enmAddrType); 601 599 602 600 if (RT_SUCCESS(rc)) … … 614 612 if (!pszServerAddress4 && strlen(pszVNCAddress4) > 0) 615 613 { 616 pszGetAddrInfo4 = (char *) RTMemTmpAlloc(16);617 memset(pszGetAddrInfo4,'\0',16);618 614 resSize = 16; 619 iAddrType = RTNETADDRTYPE_IPV4; 620 621 rc = RTSocketGetAddrInfo(pszVNCAddress4, pszGetAddrInfo4, &resSize, &iAddrType); 615 pszGetAddrInfo4 = (char *) RTMemTmpAllocZ(resSize); 616 enmAddrType = RTNETADDRTYPE_IPV4; 617 618 rc = RTSocketQueryAddressStr(pszVNCAddress4, pszGetAddrInfo4, &resSize, &enmAddrType); 622 619 623 620 if (RT_SUCCESS(rc)) … … 628 625 if (!pszServerAddress6 && strlen(pszVNCAddress6) > 0) 629 626 { 630 pszGetAddrInfo6 = (char *) RTMemTmpAlloc(42);631 memset(pszGetAddrInfo6, '\0', 42);632 627 resSize = 42; 633 iAddrType = RTNETADDRTYPE_IPV6; 634 635 rc = RTSocketGetAddrInfo(pszVNCAddress6, pszGetAddrInfo6, &resSize, &iAddrType); 628 pszGetAddrInfo6 = (char *) RTMemTmpAllocZ(resSize); 629 enmAddrType = RTNETADDRTYPE_IPV6; 630 631 rc = RTSocketQueryAddressStr(pszVNCAddress6, pszGetAddrInfo6, &resSize, &enmAddrType); 636 632 637 633 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Runtime/r3/socket.cpp
r43206 r43213 685 685 686 686 /* 687 * new function to allow both ipv4 and ipv6 addresses to be resolved. 688 * breaks compatibility with windows before 2000 689 * will change when the new ipv6 struct will be added 690 * temporary solution 691 */ 692 RTDECL(int) RTSocketGetAddrInfo(const char *pszHost, char *pszResult, size_t *pcbResult, PRTNETADDRTYPE penmAddrType) 687 * New function to allow both ipv4 and ipv6 addresses to be resolved. 688 * Breaks compatibility with windows before 2000. 689 */ 690 RTDECL(int) RTSocketQueryAddressStr(const char *pszHost, char *pszResult, size_t *pcbResult, PRTNETADDRTYPE penmAddrType) 693 691 { 694 692 AssertPtrReturn(pszHost, VERR_INVALID_POINTER);
Note:
See TracChangeset
for help on using the changeset viewer.

