Changeset 87710 in vbox for trunk/src/VBox/NetworkServices/NetLib
- Timestamp:
- Feb 11, 2021 2:14:40 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142754
- Location:
- trunk/src/VBox/NetworkServices/NetLib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp
r87698 r87710 73 73 74 74 VBOX_LISTENER_DECLARE(NATNetworkListenerImpl) 75 76 77 int localMappings(const ComNatPtr& nat, AddressToOffsetMapping& mapping)78 {79 mapping.clear();80 81 ComBstrArray strs;82 size_t cStrs;83 HRESULT hrc = nat->COMGETTER(LocalMappings)(ComSafeArrayAsOutParam(strs));84 if ( SUCCEEDED(hrc)85 && (cStrs = strs.size()))86 {87 for (size_t i = 0; i < cStrs; ++i)88 {89 char szAddr[17];90 RTNETADDRIPV4 ip4addr;91 char *pszTerm;92 uint32_t u32Off;93 com::Utf8Str strLo2Off(strs[i]);94 const char *pszLo2Off = strLo2Off.c_str();95 96 RT_ZERO(szAddr);97 98 pszTerm = RTStrStr(pszLo2Off, "=");99 100 if ( pszTerm101 && (pszTerm - pszLo2Off) <= INET_ADDRSTRLEN)102 {103 memcpy(szAddr, pszLo2Off, (pszTerm - pszLo2Off));104 int rc = RTNetStrToIPv4Addr(szAddr, &ip4addr);105 if (RT_SUCCESS(rc))106 {107 u32Off = RTStrToUInt32(pszTerm + 1);108 if (u32Off != 0)109 mapping.insert(110 AddressToOffsetMapping::value_type(ip4addr, u32Off));111 }112 }113 }114 }115 else116 return VERR_NOT_FOUND;117 118 return VINF_SUCCESS;119 }120 75 121 76 -
trunk/src/VBox/NetworkServices/NetLib/utils.h
r87698 r87710 34 34 typedef ComPtr<INATNetwork> ComNatPtr; 35 35 typedef com::SafeArray<BSTR> ComBstrArray; 36 37 typedef std::vector<RTNETADDRIPV4> AddressList;38 typedef std::map<RTNETADDRIPV4, int> AddressToOffsetMapping;39 40 41 int localMappings(const ComNatPtr&, AddressToOffsetMapping&);42 36 43 37
Note:
See TracChangeset
for help on using the changeset viewer.