OpenShot Audio Library | OpenShotAudio 0.3.2
Loading...
Searching...
No Matches
juce_NetworkServiceDiscovery.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
35{
44 struct Advertiser : private Thread
45 {
53 Advertiser (const String& serviceTypeUID,
55 int broadcastPort,
58
60 ~Advertiser() override;
61
62 private:
63 XmlElement message;
64 const int broadcastPort;
65 const RelativeTime minInterval;
66 DatagramSocket socket { true };
67
68 void run() override;
69 void sendBroadcast();
70 };
71
72 //==============================================================================
88
89 //==============================================================================
102 struct AvailableServiceList : private Thread,
103 private AsyncUpdater
104 {
111 AvailableServiceList (const String& serviceTypeUID, int broadcastPort);
112
114 ~AvailableServiceList() override;
115
117 std::function<void()> onChange;
118
120 std::vector<Service> getServices() const;
121
122 private:
123 DatagramSocket socket { true };
124 String serviceTypeUID;
125 CriticalSection listLock;
126 std::vector<Service> services;
127
128 void run() override;
129 void handleAsyncUpdate() override;
130 void handleMessage (const XmlElement&);
131 void handleMessage (const Service&);
132 void removeTimedOutServices();
133
134 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AvailableServiceList)
135 };
136};
137
138} // namespace juce
static RelativeTime seconds(double seconds) noexcept