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.
List of all members.
Public Types |
enum | AllowedMessage |
Signals |
void | discoveryRequestReceived (const Herqq::Upnp::HDiscoveryRequest &msg, const Herqq::Upnp::HEndpoint &source, Herqq::Upnp::HSsdp::DiscoveryRequestMethod requestType) |
void | discoveryResponseReceived (const Herqq::Upnp::HDiscoveryResponse &msg, const Herqq::Upnp::HEndpoint &source) |
void | resourceAvailableReceived (const Herqq::Upnp::HResourceAvailable &msg, const Herqq::Upnp::HEndpoint &source) |
void | deviceUpdateReceived (const Herqq::Upnp::HResourceUpdate &msg, const Herqq::Upnp::HEndpoint &source) |
void | resourceUnavailableReceived (const Herqq::Upnp::HResourceUnavailable &msg, const Herqq::Upnp::HEndpoint &source) |
Public Member Functions |
| HSsdp (QObject *parent=0) |
void | setFilter (AllowedMessages allowedMessages) |
AllowedMessages | filter () const |
bool | init () |
bool | init (const QHostAddress &unicastAddress) |
bool | isInitialized () const |
HEndpoint | unicastEndpoint () const |
qint32 | announcePresence (const HResourceAvailable &msg, qint32 count=1) |
qint32 | announcePresence (const HResourceUnavailable &msg, qint32 count=1) |
qint32 | announceUpdate (const HResourceUpdate &msg, qint32 count=1) |
qint32 | sendDiscoveryRequest (const HDiscoveryRequest &msg, qint32 count=1) |
qint32 | sendDiscoveryRequest (const HDiscoveryRequest &msg, const HEndpoint &destination, qint32 count=1) |
qint32 | sendDiscoveryResponse (const HDiscoveryResponse &msg, const HEndpoint &destination, qint32 count=1) |
Protected Member Functions |
virtual bool | incomingDiscoveryRequest (const HDiscoveryRequest &msg, const HEndpoint &source, DiscoveryRequestMethod requestType) |
virtual bool | incomingDiscoveryResponse (const HDiscoveryResponse &msg, const HEndpoint &source) |
virtual bool | incomingDeviceAvailableAnnouncement (const HResourceAvailable &msg, const HEndpoint &source) |
virtual bool | incomingDeviceUnavailableAnnouncement (const HResourceUnavailable &msg, const HEndpoint &source) |
virtual bool | incomingDeviceUpdateAnnouncement (const HResourceUpdate &msg, const HEndpoint &source) |
Detailed Description
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.
Member Enumeration Documentation
This enumeration specifies the different discovery methods the HSsdp class can run.
- Enumerator:
MulticastDiscovery |
This is the default multicast discovery supported both UDA v1.0 and UDA v1.1.
|
UnicastDiscovery |
The unicast discovery specified in UDA v1.1.
|
This enum is used to define a "filter", which specifies which message types are to be processed when encountered.
- See also:
- filter(), setFilter()
- Enumerator:
None |
No messages are processed.
|
DeviceAvailable |
Device available messages are processed.
|
DeviceUpdate |
Device update messages are processed.
|
DeviceUnavailable |
Device unavailable messages are processed.
|
DiscoveryRequest |
Discovery request messages are processed.
|
DiscoveryResponse |
Discovery response messages are processed.
|
All |
Discovery response messages are processed.
|
Constructor & Destructor Documentation
HSsdp |
( |
QObject * |
parent = 0 ) |
|
Creates a new instance.
- Parameters:
-
parent | specifies the parent QObject . |
Member Function Documentation
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.
- Parameters:
-
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. |
- Return values:
-
- See also:
- discoveryRequestReceived()
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.
- Parameters:
-
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
- Return values:
-
- See also:
- discoveryResponseReceived()
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.
- Parameters:
-
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
- Return values:
-
- See also:
- resourceAvailableReceived()
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.
- Parameters:
-
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
- Return values:
-
- See also:
- resourceUnavailableReceived()
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.
- Parameters:
-
msg | specifies the incoming message. |
source | specifies the source TCP/IP endpoint that sent the message. |
- Return values:
-
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. |
- See also:
- deviceUpdateRecieved()
void setFilter |
( |
AllowedMessages |
allowedMessages ) |
|
Sets the filter of what message types are accepted for processing.
The default is HSsdp::All.
- Parameters:
-
allowedMessages | defines the message types the instance should accept for further processing. Other message types will be silently ignored. |
- See also:
- filter()
HSsdp::AllowedMessages filter |
( |
) |
const |
Returns the message types that are currently accepted for processing.
Default is HSsdp::All.
- Returns:
- the message types that are currently accepted for processing.
- See also:
- setFilter()
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.
- Return values:
-
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. |
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.
- Parameters:
-
unicastAddress | specifies the address that should be used for unicast messaging. |
- Return values:
-
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. |
bool isInitialized |
( |
) |
const |
Indicates if the instance is bound to listen for messages using one or more network interfaces.
- Returns:
- true in case the instance is bound to listen for messages using one or more network interfaces.
Returns the UDP endpoint that is used for unicast communication.
- Returns:
- the UDP endpoint that is used for unicast communication.
Sends the specified device availability announcement.
- Parameters:
-
msg | specifies the announcement to send. |
count | specifies how many times the announcement is send. The default is 1. |
- Returns:
- the number of messages sent, 0 in case no messages was sent or -1 in case the provided message is not valid.
Sends the specified device availability announcement.
- Parameters:
-
msg | specifies the announcement to send. |
count | specifies how many times the announcement is send. The default is 1. |
- Returns:
- the number of messages sent, 0 in case no messages was sent or -1 in case the provided message is not valid.
Sends the specified device update announcement.
- Parameters:
-
msg | specifies the message to send. |
count | specifies how many times the announcement is send. The default is 1. |
- Returns:
- the number of messages sent, 0 in case no messages was sent or -1 in case the provided message is not valid.
Sends the specified discovery request.
Sends the specified discovery request to a multicast address 239.255.255.250.
- Parameters:
-
msg | specifies the announcement to send. |
count | specifies how many times the announcement is send. The default is 1. |
- Returns:
- the number of messages sent, 0 in case no messages was sent or -1 in case the provided message is not valid.
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.
- Parameters:
-
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. |
- Returns:
- the number of messages sent, 0 in case no messages was sent or -1 in case the provided message or the destination is not valid.
Sends the specified discovery response.
- Parameters:
-
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. |
- Returns:
- the number of messages sent, 0 in case no messages was sent or -1 in case the provided message is not valid.
This signal is emitted when a discovery request is received.
- Parameters:
-
msg | specifies the received discovery request message. |
source | specifies the location where the message came. |
requestType | specifies the type of the incoming discovery request. |
This signal is emitted when a discovery response is received.
- Parameters:
-
msg | specifies the received discovery response message. |
source | specifies the location where the message came. |
This signal is emitted when a device announcement is received.
- Parameters:
-
msg | specifies the device announcement message. |
source | specifies the location where the message came. |
This signal is emitted when a device update is received.
- Parameters:
-
msg | specifies the device update message. |
source | specifies the location where the message came. |
This signal is emitted when a device announcement is received.
- Parameters:
-
msg | specifies the device announcement message. |
source | specifies the location where the message came. |