Vidalia
0.3.1
|
#include <UPNPControl.h>
Signals | |
void | stateChanged (UPNPControl::UPNPState state) |
void | error (UPNPControl::UPNPError error) |
Public Member Functions | |
void | getDesiredState (quint16 *desiredDirPort, quint16 *desiredOrPort) |
void | setDesiredState (quint16 desiredDirPort, quint16 desiredOrPort) |
UPNPError | error () const |
QString | errorString () const |
int | discoverTimeout () const |
Static Public Member Functions | |
static UPNPControl * | instance () |
static void | cleanup () |
Protected Member Functions | |
UPNPControl () | |
~UPNPControl () | |
void | setError (UPNPError error) |
void | setState (UPNPState state) |
Private Attributes | |
quint16 | _forwardedORPort |
quint16 | _forwardedDirPort |
QMutex * | _mutex |
UPNPError | _error |
UPNPState | _state |
UPNPControlThread * | _controlThread |
Static Private Attributes | |
static UPNPControl * | _instance = 0 |
Friends | |
class | UPNPControlThread |
Definition at line 26 of file UPNPControl.h.
UPnP-related error values.
Enumerator | |
---|---|
Success | |
NoUPNPDevicesFound | |
NoValidIGDsFound | |
WSAStartupFailed | |
AddPortMappingFailed | |
GetPortMappingFailed | |
DeletePortMappingFailed | |
UnknownError |
Definition at line 32 of file UPNPControl.h.
UPnP port forwarding state.
Enumerator | |
---|---|
IdleState | |
ErrorState | |
DiscoverState | |
UpdatingORPortState | |
UpdatingDirPortState | |
ForwardingCompleteState |
Definition at line 43 of file UPNPControl.h.
|
protected |
Constructor. Initializes and starts a thread in which all blocking UPnP operations will be performed.
Definition at line 42 of file UPNPControl.cpp.
References _controlThread, _error, _forwardedDirPort, _forwardedORPort, _mutex, _state, IdleState, UnknownError, and UPNPControlThread.
Referenced by instance().
|
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.
|
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().
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().
|
signal |
Emitted when a UPnP error occurs.
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().
|
static |
Returns a pointer to this object's singleton instance.
Definition at line 31 of file UPNPControl.cpp.
References _controlThread, _instance, and UPNPControl().
Referenced by ServerSettings::configurePortForwarding(), UPNPControlThread::configurePorts(), MainWindow::createConnections(), UPNPControlThread::initializeUPNP(), 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.
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().
Sets the most recent UPnP-related error to error and emits the error() signal.
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().
Sets the current UPnP state to state and emits the stateChanged() signal.
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().
|
signal |
Emitted when the UPnP control thread status changes.
Referenced by setState().
|
friend |
Definition at line 108 of file UPNPControl.h.
Referenced by UPNPControl().
|
private |
Thread used for UPnP operations.
Definition at line 109 of file UPNPControl.h.
Referenced by cleanup(), instance(), setDesiredState(), UPNPControl(), and ~UPNPControl().
|
private |
Most recent UPNP error.
Definition at line 105 of file UPNPControl.h.
Referenced by error(), setError(), and UPNPControl().
|
private |
Currently forwarded DirPort.
Definition at line 103 of file UPNPControl.h.
Referenced by getDesiredState(), setDesiredState(), and UPNPControl().
|
private |
Currently forwarded ORPort.
Definition at line 102 of file UPNPControl.h.
Referenced by getDesiredState(), setDesiredState(), and UPNPControl().
|
staticprivate |
UPNPControl singleton instance.
Definition at line 100 of file UPNPControl.h.
Referenced by cleanup(), and instance().
|
private |
Mutex around variables shared with UPNPControlThread.
Definition at line 104 of file UPNPControl.h.
Referenced by error(), getDesiredState(), setDesiredState(), setError(), setState(), UPNPControl(), and ~UPNPControl().
|
private |
Current UPNP status.
Definition at line 106 of file UPNPControl.h.
Referenced by setState(), and UPNPControl().