Herqq
|
This class is used for sending and receiving SSDP messages defined by the UPnP Device Architecture specification. More...
#include <HSsdp>
Inherited by HControlPointSsdpHandler, and HDeviceHostSsdpHandler.
This class is used for sending and receiving SSDP messages defined by the UPnP Device Architecture specification.
Simple Service Discovery Protocol (SSDP) is an expired IETF Internet draft on which the UPnP discovery mechanism is built. This class implements only the SSDP functionality mandated by the UPnP Device Architecture specification. This class does not implement the SSDP draft in full.
To use this class, you only need to instantiate it and connect to the exposed signals to receive events when SSDP messages are received. You can also derive a sub-class and override the various virtual member functions to handle the received messages.
This enumeration specifies the different discovery methods the HSsdp class can run.
enum AllowedMessage |
This enum is used to define a "filter", which specifies which message types are to be processed when encountered.
HSsdp | ( | QObject * | parent = 0 | ) |
Creates a new instance.
parent | specifies the parent QObject . |
~HSsdp | ( | ) | [virtual] |
Destroys the instance.
bool incomingDiscoveryRequest | ( | const HDiscoveryRequest & | msg, |
const HEndpoint & | source, | ||
DiscoveryRequestMethod | requestType | ||
) | [protected, virtual] |
This method is called immediately after receiving a discovery request.
Override this method if you want to handle the message. You can also connect to the discoveryRequestReceived() signal.
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
requestType | specifies the type of the incoming discovery request. |
true | in case the message was handled successfully and the discoveryRequestReceived() signal should not be sent. |
false | in case the message was not handled and the discoveryRequestReceived() signal should be sent. |
bool incomingDiscoveryResponse | ( | const HDiscoveryResponse & | msg, |
const HEndpoint & | source | ||
) | [protected, virtual] |
This method is called immediately after receiving a discovery response.
Override this method if you want to handle message. You can also connect to the discoveryResponseReceived() signal.
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
true | in case the message was handled successfully and the discoveryResponseReceived() signal should not be sent. |
false | in case the message was not handled and the discoveryResponseReceived() signal should be sent. |
bool incomingDeviceAvailableAnnouncement | ( | const HResourceAvailable & | msg, |
const HEndpoint & | source | ||
) | [protected, virtual] |
This method is called immediately after receiving a device available announcement.
Override this method if you want to handle message. You can also connect to the discoveryRequestReceived() signal.
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
true | in case the message was handled successfully and the resourceAvailableReceived() signal should not be sent. |
false | in case the message was not handled and the resourceAvailableReceived() signal should be sent. |
bool incomingDeviceUnavailableAnnouncement | ( | const HResourceUnavailable & | msg, |
const HEndpoint & | source | ||
) | [protected, virtual] |
This method is called immediately after receiving a device unavailable announcement.
Override this method if you want to handle message. You can also connect to the resourceUnavailableReceived() signal.
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
true | in case the message was handled successfully and the resourceUnavailableReceived() signal should not be sent. |
false | in case the message was not handled and the resourceUnavailableReceived() signal should be sent. |
bool incomingDeviceUpdateAnnouncement | ( | const HResourceUpdate & | msg, |
const HEndpoint & | source | ||
) | [protected, virtual] |
This method is called immediately after receiving a device update announcement.
Override this method if you want to handle message. You can also connect to the deviceUpdateRecieved() signal.
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
true | in case the message was handled successfully and the deviceUpdateRecieved() signal should not be sent. |
false | in case the message was not handled and the deviceUpdateRecieved() signal should be sent. |
void setFilter | ( | AllowedMessages | allowedMessages | ) |
Sets the filter of what message types are accepted for processing.
The default is HSsdp::All.
allowedMessages | defines the message types the instance should accept for further processing. Other message types will be silently ignored. |
HSsdp::AllowedMessages filter | ( | ) | const |
Returns the message types that are currently accepted for processing.
Default is HSsdp::All.
bool init | ( | ) |
Sets the instance to listen the network for SSDP messages and and attempts to init the unicast socket of the instance to the address of the first found network address that is up and that is not loopback.
If no such interface is found the loopback address is used.
true | in case the instances was successfully bound to some address. |
false | in case the instance could not be bound or the instance was already bound. |
HSsdp
has to be bound to receive messages of any type. bool init | ( | const QHostAddress & | unicastAddress | ) |
Sets the instance to listen the network for SSDP messages and attempts to init a unicast socket of the instance to the specified address.
unicastAddress | specifies the address that should be used for unicast messaging. |
true | in case the instance was successfully bound to the specified address. |
false | in case the instance could not be bound or the instance was already bound to the specified address. |
HSsdp
has to be bound to receive messages of any type. bool isInitialized | ( | ) | const |
Indicates if the instance is bound to listen for messages using one or more network interfaces.
HEndpoint unicastEndpoint | ( | ) | const |
Returns the UDP endpoint that is used for unicast communication.
qint32 announcePresence | ( | const HResourceAvailable & | msg, |
qint32 | count = 1 |
||
) |
Sends the specified device availability announcement.
msg | specifies the announcement to send. |
count | specifies how many times the announcement is send. The default is 1. |
qint32 announcePresence | ( | const HResourceUnavailable & | msg, |
qint32 | count = 1 |
||
) |
Sends the specified device availability announcement.
msg | specifies the announcement to send. |
count | specifies how many times the announcement is send. The default is 1. |
qint32 announceUpdate | ( | const HResourceUpdate & | msg, |
qint32 | count = 1 |
||
) |
Sends the specified device update announcement.
msg | specifies the message to send. |
count | specifies how many times the announcement is send. The default is 1. |
qint32 sendDiscoveryRequest | ( | const HDiscoveryRequest & | msg, |
qint32 | count = 1 |
||
) |
Sends the specified discovery request.
Sends the specified discovery request to a multicast address 239.255.255.250.
msg | specifies the announcement to send. |
count | specifies how many times the announcement is send. The default is 1. |
qint32 sendDiscoveryRequest | ( | const HDiscoveryRequest & | msg, |
const HEndpoint & | destination, | ||
qint32 | count = 1 |
||
) |
Sends the specified discovery request.
Sends the specified discovery request to a specified address. The address can be an unicast address or a multicast address.
msg | specifies the announcement to send. |
destination | specifies the target UDP endpoint of the message. If the port of the specified endpoint is set to zero the message is sent to the specified host address using the default port 1900. |
count | specifies how many times the announcement is send. The default is 1. |
qint32 sendDiscoveryResponse | ( | const HDiscoveryResponse & | msg, |
const HEndpoint & | destination, | ||
qint32 | count = 1 |
||
) |
Sends the specified discovery response.
msg | specifies the announcement to send. |
destination | specifies the target of the response. If the port of the specified endpoint is set to zero the message is sent to the specified host address using the default port 1900. |
count | specifies how many times the announcement is send. The default is 1. |
void discoveryRequestReceived | ( | const Herqq::Upnp::HDiscoveryRequest & | msg, |
const Herqq::Upnp::HEndpoint & | source, | ||
Herqq::Upnp::HSsdp::DiscoveryRequestMethod | requestType | ||
) | [signal] |
This signal is emitted when a discovery request is received.
msg | specifies the received discovery request message. |
source | specifies the location where the message came. |
requestType | specifies the type of the incoming discovery request. |
void discoveryResponseReceived | ( | const Herqq::Upnp::HDiscoveryResponse & | msg, |
const Herqq::Upnp::HEndpoint & | source | ||
) | [signal] |
This signal is emitted when a discovery response is received.
msg | specifies the received discovery response message. |
source | specifies the location where the message came. |
void resourceAvailableReceived | ( | const Herqq::Upnp::HResourceAvailable & | msg, |
const Herqq::Upnp::HEndpoint & | source | ||
) | [signal] |
This signal is emitted when a device announcement is received.
msg | specifies the device announcement message. |
source | specifies the location where the message came. |
void deviceUpdateReceived | ( | const Herqq::Upnp::HResourceUpdate & | msg, |
const Herqq::Upnp::HEndpoint & | source | ||
) | [signal] |
This signal is emitted when a device update is received.
msg | specifies the device update message. |
source | specifies the location where the message came. |
void resourceUnavailableReceived | ( | const Herqq::Upnp::HResourceUnavailable & | msg, |
const Herqq::Upnp::HEndpoint & | source | ||
) | [signal] |
This signal is emitted when a device announcement is received.
msg | specifies the device announcement message. |
source | specifies the location where the message came. |