1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
//
// Copyright (c) 2023 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <zenoh@zettascale.tech>
//
use Duration;
use crate::;
/// # Join message
///
/// The JOIN message is sent on a multicast Locator to advertise the transport parameters.
///
/// The [`Join`] message flow is the following:
///
/// ```text
/// A B
/// | JOIN |
/// |------------------>|
/// | |
/// ... ...
/// | JOIN |
/// |------------------>|
/// | |
/// ```
///
/// The JOIN message structure is defined as follows:
///
/// ```text
/// Flags:
/// - T: Lease period if T==1 then the lease period is in seconds otherwise it is in milliseconds
/// - S: Size params If S==1 then size parameters are exchanged
/// - Z: Extensions If Z==1 then Zenoh extensions will follow.
///
/// 7 6 5 4 3 2 1 0
/// +-+-+-+-+-+-+-+-+
/// |Z|S|T| JOIN |
/// +-+-+-+---------+
/// | version |
/// +---------------+
/// |zid_len|x|x|wai| (#)(*)
/// +-------+-+-+---+
/// ~ [u8] ~ -- ZenohID of the sender of the JOIN message
/// +---------------+
/// |x|x|x|x|rid|fsn| \ -- SN/ID resolution (+)
/// +---------------+ | if Flag(S)==1
/// | u16 | | -- Batch Size ($)
/// | | /
/// +---------------+
/// % lease % -- Lease period of the sender of the JOIN message
/// +---------------+
/// % next_sn % -- Next SN to be sent by the sender of the JOIN message (^)
/// +---------------+
/// ~ [JoinExts] ~ -- if Flag(Z)==1
/// +---------------+
///
/// (*) WhatAmI. It indicates the role of the zenoh node sending the JOIN message.
/// The valid WhatAmI values are:
/// - 0b00: Router
/// - 0b01: Peer
/// - 0b10: Client
/// - 0b11: Reserved
///
/// (#) ZID length. It indicates how many bytes are used for the ZenohID bytes.
/// A ZenohID is minimum 1 byte and maximum 16 bytes. Therefore, the actual length is computed as:
/// real_zid_len := 1 + zid_len
///
/// (+) Sequence Number/ID resolution. It indicates the resolution and consequently the wire overhead
/// of various SN and ID in Zenoh.
/// - fsn: frame/fragment sequence number resolution. Used in Frame/Fragment messages.
/// - rid: request ID resolution. Used in Request/Response messages.
/// The valid SN/ID resolution values are:
/// - 0b00: 8 bits
/// - 0b01: 16 bits
/// - 0b10: 32 bits
/// - 0b11: 64 bits
///
/// ($) Batch Size. It indicates the maximum size of a batch the sender of the JOIN message is willing
/// to accept when reading from the network. Default on multicast: 8192.
///
/// (^) The next sequence number MUST be compatible with the adverstised Sequence Number resolution
/// ```
// Extensions
>;
}