#include "Stroika/Frameworks/StroikaPreComp.h"#include <compare>#include <optional>#include "Stroika/Foundation/Characters/String.h"#include "Stroika/Foundation/Common/Common.h"#include "Stroika/Foundation/Containers/Mapping.h"#include "Stroika/Foundation/DataExchange/ObjectVariantMapper.h"#include "Stroika/Foundation/Execution/LazyInitialized.h"#include "Stroika/Foundation/IO/Network/Interface.h"#include "Stroika/Foundation/IO/Network/SocketAddress.h"#include "Stroika/Foundation/IO/Network/URI.h"#include "Stroika/Foundation/Memory/BLOB.h"#include "Stroika/Foundation/Time/Duration.h"#include "Advertisement.inl"Go to the source code of this file.
Functions | |
| BLOB | Stroika::Frameworks::UPnP::SSDP::Serialize (const String &headLine, SearchOrNotify searchOrNotify, const Advertisement &ad, const optional< Foundation::IO::Network::SocketAddress > ¬ifyGroup=nullopt) |
| The SSDP packet saying ad: a NOTIFY (ssdp:alive - or ssdp:byebye, given fAlive false), or an answer to a search (headLine "HTTP/1.1 200 OK") | |
| void | Stroika::Frameworks::UPnP::SSDP::DeSerialize (const BLOB &b, String *headLine, Advertisement *advertisement) |
| Parse any SSDP packet - a NOTIFY, an M-SEARCH, or a search response ("HTTP/1.1 200 OK") | |
Variables | |
| constexpr Foundation::Time::DurationSeconds | Stroika::Frameworks::UPnP::SSDP::kDefaultMaxAge {1800.0} |
See http://quimby.gnus.org/internet-drafts/draft-cai-ssdp-v1-03.txt for details on the SSDP specification.
And http://www.upnp-hacks.org/upnp.html for more hints.
Definition in file Advertisement.h.
| BLOB Stroika::Frameworks::UPnP::SSDP::Serialize | ( | const String & | headLine, |
| SearchOrNotify | searchOrNotify, | ||
| const Advertisement & | ad, | ||
| const optional< Foundation::IO::Network::SocketAddress > & | notifyGroup = nullopt |
||
| ) |
The SSDP packet saying ad: a NOTIFY (ssdp:alive - or ssdp:byebye, given fAlive false), or an answer to a search (headLine "HTTP/1.1 200 OK")
Each with the headers the UPnP Device Architecture gives it: a NOTIFY's HOST is notifyGroup - the multicast group it goes to, V4::kSocketAddress or V6::kSocketAddress (IPv4's if not given); an ssdp:byebye has no CACHE-CONTROL, LOCATION or SERVER; a search answer has EXT and DATE (now, as an HTTP date), and no HOST or NTS.
| void Stroika::Frameworks::UPnP::SSDP::DeSerialize | ( | const BLOB & | b, |
| String * | headLine, | ||
| Advertisement * | advertisement | ||
| ) |
Parse any SSDP packet - a NOTIFY, an M-SEARCH, or a search response ("HTTP/1.1 200 OK")
*headLine is the packet's first line - which says which of those it is; the caller checks it. fTarget is the NT header (a NOTIFY) or the ST header (a search or search response), fAlive the NTS header, and every header lands in fRawHeaders too. A Location that does not parse as a URI is treated as missing (traced, not thrown).
Definition at line 140 of file Advertisement.cpp.
|
constexpr |
The CACHE-CONTROL max-age Serialize writes when an Advertisement has no fMaxAge. The UPnP Device Architecture says it SHOULD be at least 1800 seconds.
Definition at line 84 of file Advertisement.h.