1 /* Copyright 2016, Ableton AG, Berlin. All rights reserved.
2  *
3  *  This program is free software: you can redistribute it and/or modify
4  *  it under the terms of the GNU General Public License as published by
5  *  the Free Software Foundation, either version 2 of the License, or
6  *  (at your option) any later version.
7  *
8  *  This program is distributed in the hope that it will be useful,
9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *  GNU General Public License for more details.
12  *
13  *  You should have received a copy of the GNU General Public License
14  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  *
16  *  If you would like to incorporate Link into a proprietary software application,
17  *  please contact <link-devs@ableton.com>.
18  */
19 
20 #pragma once
21 
22 namespace ableton
23 {
24 namespace discovery
25 {
26 
27 // Message types used in the Ableton service discovery protocol. There
28 // are two logical messages: a state dump and a bye bye.
29 //
30 // A state dump provides all relevant information about the peer's
31 // current state as well as a Time To Live (TTL) value that indicates
32 // how many seconds this state should be considered valid.
33 //
34 // The bye bye indicates that the sender is leaving the session.
35 
36 template <typename NodeState>
37 struct PeerState
38 {
39   NodeState peerState;
40   int ttl;
41 };
42 
43 template <typename NodeId>
44 struct ByeBye
45 {
46   NodeId peerId;
47 };
48 
49 } // namespace discovery
50 } // namespace ableton
51