4#ifndef _Stroika_Frameworks_UPnP_SSDP_Advertisement_h_
5#define _Stroika_Frameworks_UPnP_SSDP_Advertisement_h_ 1
7#include "Stroika/Frameworks/StroikaPreComp.h"
13#include "Stroika/Foundation/Common/Common.h"
14#include "Stroika/Foundation/Containers/Mapping.h"
15#include "Stroika/Foundation/DataExchange/ObjectVariantMapper.h"
16#include "Stroika/Foundation/Execution/LazyInitialized.h"
18#include "Stroika/Foundation/IO/Network/SocketAddress.h"
31namespace Stroika::Frameworks::UPnP::SSDP {
33 using Foundation::Characters::String;
34 using Foundation::Containers::Mapping;
35 using Foundation::IO::Network::URI;
36 using Foundation::Memory::BLOB;
40 struct Advertisement {
41 optional<bool> fAlive;
46 Mapping<String, String> fRawHeaders;
47 optional<Foundation::Time::Duration> fMaxAge;
53 optional<Foundation::IO::Network::Interface::SystemIDType> fReceivedOn;
55 bool operator== (
const Advertisement&)
const =
default;
60 static const Foundation::Execution::LazyInitialized<Foundation::DataExchange::ObjectVariantMapper> kMapper;
68 static Foundation::DataExchange::ObjectVariantMapper kMapperGetter_ ();
70 inline const Foundation::Execution::LazyInitialized<Foundation::DataExchange::ObjectVariantMapper> Advertisement::kMapper{Advertisement::kMapperGetter_};
74 static const String kTarget_UPNPRootDevice{
"upnp:rootdevice"sv};
78 static const String kTarget_SSDPAll{
"ssdp:all"sv};
88 enum class SearchOrNotify {
101 BLOB Serialize (
const String& headLine, SearchOrNotify searchOrNotify,
const Advertisement& ad,
102 const optional<Foundation::IO::Network::SocketAddress>& notifyGroup = nullopt);
111 void DeSerialize (
const BLOB& b,
String* headLine, Advertisement* advertisement);
120#include "Advertisement.inl"
chrono::duration< double > DurationSeconds
chrono::duration<double> - a time span (length of time) measured in seconds, but high precision.
String is like std::u32string, except it is much easier to use, often much more space efficient,...
STRING_TYPE ToString(FLOAT_TYPE f, const ToStringOptions &options={})