#include <upnpcontrol.h>
Definition at line 27 of file upnpcontrol.h.
UPnP-related error values.
Success | |
NoUPNPDevicesFound | |
NoValidIGDsFound | |
WSAStartupFailed | |
AddPortMappingFailed | |
GetPortMappingFailed | |
DeletePortMappingFailed | |
UnknownError |
Definition at line 33 of file upnpcontrol.h.
UPnP port forwarding state.
IdleState | |
ErrorState | |
DiscoverState | |
UpdatingORPortState | |
UpdatingDirPortState | |
ForwardingCompleteState |
Definition at line 44 of file upnpcontrol.h.
UPNPControl::UPNPControl | ( | ) | [protected] |
Constructor. Initializes and starts a thread in which all blocking UPnP operations will be performed.
Definition at line 41 of file upnpcontrol.cpp.
References _controlThread, _error, _forwardedDirPort, _forwardedORPort, _mutex, _state, IdleState, UnknownError, and UPNPControlThread.
UPNPControl::~UPNPControl | ( | ) | [protected] |
Destructor. cleanup() should be called before the object is destroyed.
Destructor. cleanup() should be called before the object is destroyed.
Definition at line 59 of file upnpcontrol.cpp.
References _controlThread, and _mutex.
void UPNPControl::cleanup | ( | ) | [static] |
Terminates the UPnP control thread and frees memory allocated to this object's singleton instance.
Definition at line 68 of file upnpcontrol.cpp.
References _controlThread, _instance, and UPNPControlThread::stop().
Referenced by ServerSettings::cleanupPortForwarding().
int UPNPControl::discoverTimeout | ( | ) | const |
Returns the number of milliseconds to wait for devices to respond when attempting to discover UPnP-enabled IGDs.
Definition at line 160 of file upnpcontrol.cpp.
References UPNPControlThread::UPNPCONTROL_DISCOVER_TIMEOUT.
Referenced by UPNPTestDialog::UPNPTestDialog().
void UPNPControl::error | ( | UPNPControl::UPNPError | error | ) | [signal] |
Emitted when a UPnP error occurs.
UPNPControl::UPNPError UPNPControl::error | ( | ) | const |
Returns the type of error that occurred last.
Definition at line 125 of file upnpcontrol.cpp.
References _error, and _mutex.
Referenced by errorString(), and setError().
QString UPNPControl::errorString | ( | ) | const |
Returns a QString describing the type of error that occurred last.
Definition at line 133 of file upnpcontrol.cpp.
References AddPortMappingFailed, DeletePortMappingFailed, error(), GetPortMappingFailed, NoUPNPDevicesFound, NoValidIGDsFound, Success, and WSAStartupFailed.
void UPNPControl::getDesiredState | ( | quint16 * | desiredDirPort, | |
quint16 * | desiredOrPort | |||
) |
Sets desiredDirPort and desiredOrPort to the currently forwarded DirPort and ORPort values.
Definition at line 78 of file upnpcontrol.cpp.
References _forwardedDirPort, _forwardedORPort, and _mutex.
Referenced by UPNPControlThread::configurePorts(), and UPNPTestDialog::UPNPTestDialog().
UPNPControl * UPNPControl::instance | ( | ) | [static] |
Returns a pointer to this object's singleton instance.
Definition at line 32 of file upnpcontrol.cpp.
References _instance.
Referenced by ServerSettings::configurePortForwarding(), UPNPControlThread::configurePorts(), UPNPControlThread::initializeUPNP(), MainWindow::MainWindow(), UPNPControlThread::run(), UPNPTestDialog::startTest(), UPNPTestDialog::testFailed(), UPNPTestDialog::testSuccessful(), UPNPTestDialog::upnpStateChanged(), and UPNPTestDialog::UPNPTestDialog().
void UPNPControl::setDesiredState | ( | quint16 | desiredDirPort, | |
quint16 | desiredOrPort | |||
) |
Sets the desired DirPort and ORPort port mappings to desiredDirPort and desiredOrPort, respectively.
Sets the desired DirPort and ORPort port mappings to desiredDirPort and desiredOrPort, respectively.
Definition at line 89 of file upnpcontrol.cpp.
References _controlThread, _forwardedDirPort, _forwardedORPort, _mutex, and UPNPControlThread::wakeup().
Referenced by ServerSettings::configurePortForwarding(), UPNPTestDialog::setVisible(), and UPNPTestDialog::startTest().
void UPNPControl::setError | ( | UPNPError | upnpError | ) | [protected] |
Sets the most recent UPnP-related error to error and emits the error() signal.
Definition at line 102 of file upnpcontrol.cpp.
References _error, _mutex, and error().
Referenced by UPNPControlThread::configurePorts().
void UPNPControl::setState | ( | UPNPState | state | ) | [protected] |
Sets the current UPnP state to state and emits the stateChanged() signal.
Definition at line 114 of file upnpcontrol.cpp.
References _mutex, _state, and stateChanged().
Referenced by UPNPControlThread::configurePorts(), UPNPControlThread::initializeUPNP(), and UPNPControlThread::run().
void UPNPControl::stateChanged | ( | UPNPControl::UPNPState | state | ) | [signal] |
Emitted when the UPnP control thread status changes.
Referenced by setState().
friend class UPNPControlThread [friend] |
UPNPControlThread* UPNPControl::_controlThread [private] |
Thread used for UPnP operations.
Definition at line 110 of file upnpcontrol.h.
Referenced by cleanup(), setDesiredState(), UPNPControl(), and ~UPNPControl().
UPNPError UPNPControl::_error [private] |
Most recent UPNP error.
Definition at line 106 of file upnpcontrol.h.
Referenced by error(), setError(), and UPNPControl().
quint16 UPNPControl::_forwardedDirPort [private] |
Currently forwarded DirPort.
Definition at line 104 of file upnpcontrol.h.
Referenced by getDesiredState(), setDesiredState(), and UPNPControl().
quint16 UPNPControl::_forwardedORPort [private] |
Currently forwarded ORPort.
Definition at line 103 of file upnpcontrol.h.
Referenced by getDesiredState(), setDesiredState(), and UPNPControl().
UPNPControl * UPNPControl::_instance = 0 [static, private] |
UPNPControl singleton instance.
Definition at line 101 of file upnpcontrol.h.
Referenced by cleanup(), and instance().
QMutex* UPNPControl::_mutex [private] |
Mutex around variables shared with UPNPControlThread.
Definition at line 105 of file upnpcontrol.h.
Referenced by error(), getDesiredState(), setDesiredState(), setError(), setState(), UPNPControl(), and ~UPNPControl().
UPNPState UPNPControl::_state [private] |
Current UPNP status.
Definition at line 107 of file upnpcontrol.h.
Referenced by setState(), and UPNPControl().