mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-14 18:34:29 -05:00
add new method for external upnp address
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1752 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
938c2edef2
commit
04ecbc5514
@ -170,6 +170,8 @@ void CUPnPLib::ProcessActionResponse(
|
||||
std::cerr << "\n " <<
|
||||
childTag << "='" <<
|
||||
childValue << "'";
|
||||
//add the variable to the wanservice property map
|
||||
(m_ctrlPoint.m_WanService->propertyMap)[std::string(childTag)] = std::string(childValue);
|
||||
child = Element_GetNextSibling(child);
|
||||
}
|
||||
} else {
|
||||
@ -1021,8 +1023,12 @@ std::string CUPnPControlPoint::getExternalAddress()
|
||||
"WAN Service not detected." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_WanService->GetStateVariable("ExternalIPAddress");
|
||||
PrivateGetExternalIpAdress();
|
||||
std::string result = m_WanService->GetStateVariable("NewExternalIPAddress");
|
||||
if (result == "") {
|
||||
result = m_WanService->GetStateVariable("ExternalIPAddress");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void CUPnPControlPoint::RefreshPortMappings()
|
||||
@ -1137,6 +1143,22 @@ bool CUPnPControlPoint::PrivateDeletePortMapping(
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CUPnPControlPoint::PrivateGetExternalIpAdress()
|
||||
{
|
||||
// Start building the action
|
||||
std::string actionName("GetExternalIPAddress");
|
||||
std::vector<CUPnPArgumentValue> argval(0);
|
||||
|
||||
// Execute
|
||||
bool ret = true;
|
||||
for (ServiceMap::iterator it = m_ServiceMap.begin();
|
||||
it != m_ServiceMap.end(); ++it) {
|
||||
ret &= it->second->Execute(actionName, argval);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// This function is static
|
||||
int CUPnPControlPoint::Callback(Upnp_EventType EventType, void *Event, void * /*Cookie*/)
|
||||
@ -1362,15 +1384,6 @@ upnpEventSubscriptionExpired:
|
||||
} else {
|
||||
//add the variable to the wanservice property map
|
||||
(upnpCP->m_WanService->propertyMap)[std::string(sv_event->StateVarName)] = std::string(sv_event->CurrentVal);
|
||||
#if 0
|
||||
// Warning: The use of UpnpGetServiceVarStatus and
|
||||
// UpnpGetServiceVarStatusAsync is deprecated by the
|
||||
// UPnP forum.
|
||||
TvCtrlPointHandleGetVar(
|
||||
sv_event->CtrlUrl,
|
||||
sv_event->StateVarName,
|
||||
sv_event->CurrentVal );
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -569,10 +569,10 @@ private:
|
||||
PortMappingMap m_ActivePortMappingsMap;
|
||||
RsMutex m_RootDeviceListMutex;
|
||||
bool m_IGWDeviceDetected;
|
||||
CUPnPService *m_WanService;
|
||||
RsMutex m_WaitForSearchTimeoutMutex;
|
||||
|
||||
public:
|
||||
CUPnPService *m_WanService;
|
||||
RsMutex m_getStateVariableMutex;
|
||||
std::string m_getStateVariableLastResult;
|
||||
static CUPnPControlPoint *s_CtrlPoint;
|
||||
@ -586,7 +586,7 @@ public:
|
||||
std::vector<CUPnPPortMapping> &upnpPortMapping);
|
||||
bool DeletePortMappings(
|
||||
std::vector<CUPnPPortMapping> &upnpPortMapping);
|
||||
|
||||
|
||||
UpnpClient_Handle GetUPnPClientHandle() const
|
||||
{ return m_UPnPClientHandle; }
|
||||
|
||||
@ -622,6 +622,7 @@ private:
|
||||
CUPnPPortMapping &upnpPortMapping);
|
||||
bool PrivateDeletePortMapping(
|
||||
CUPnPPortMapping &upnpPortMapping);
|
||||
bool PrivateGetExternalIpAdress();
|
||||
};
|
||||
|
||||
// File_checked_for_headers
|
||||
|
Loading…
Reference in New Issue
Block a user