This repository has been archived by the owner on Oct 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslpv2.rflx
320 lines (300 loc) · 11.5 KB
/
slpv2.rflx
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
package SLPv2 is
-- RFC 2608
type U8 is mod 2 ** 8;
type U16 is mod 2 ** 16;
type U24 is mod 2 ** 24;
type U32 is mod 2 ** 32;
-- 7. Errors
type Error is (
ERR_LANGUAGE_NOT_SUPPORTED => 1,
ERR_PARSE_ERROR => 2,
ERR_INVALID_REGISTRATION => 3,
ERR_SCOPE_NOT_SUPPORTED => 4,
ERR_AUTHENTICATION_UNKNOWN => 5,
ERR_AUTHENTICATION_ABSENT => 6,
ERR_AUTHENTICATION_FAILED => 7,
ERR_VER_NOT_SUPPORTED => 9,
ERR_INTERNAL_ERROR => 10,
ERR_DA_BUSY_NOW => 11,
ERR_OPTION_NOT_UNDERSTOOD => 12,
ERR_INVALID_UPDATE => 13,
ERR_MSG_NOT_SUPPORTED => 14,
ERR_REFRESH_REJECTED => 15
) with Size => 16;
type Function_ID is (
FI_SERVICE_REQUEST => 1,
FI_SERVICE_REPLY => 2,
FI_SERVICE_REGISTRATION => 3,
FI_SERVICE_DEREGISTER => 4,
FI_SERVICE_ACKNOWLEDGE => 5,
FI_ATTRIBUTE_REQUEST => 6,
FI_ATTRIBUTE_REPLY => 7,
FI_DA_ADVERTISEMENT => 8,
FI_SERVICE_TYPE_REQUEST => 9,
FI_SERVICE_TYPE_REPLY => 10,
FI_SA_ADVERTISEMENT => 11
) with Size => 8;
-- 8. Required SLP Messages
type SLPv2_Version is range 2 .. 2 with Size => 8;
type SLPv2_Length is range 15 .. 2 ** 24 - 1 with Size => 24;
type SLPv2_Flag_Reserved is range 0 .. 0 with Size => 13;
type SLPv2 is
message
Version : SLPv2_Version;
Function_ID : Function_ID;
Length : SLPv2_Length;
Flag_O : Boolean;
Flag_F : Boolean;
Flag_R : Boolean;
Flag_Reserved : SLPv2_Flag_Reserved;
Next_Extension_Offset : U24;
XID : U16;
Language_Tag_Length : U16;
Language_Tag : Opaque
with Size => Language_Tag_Length * 8
then Payload
with Size => 8 * Length - (Language_Tag'Last - Version'First + 1)
if (8 * Length >= (Language_Tag'Last - Version'First + 1))
and (Next_Extension_Offset = 0)
then Payload
with Size => 8 * Next_Extension_Offset - (Language_Tag'Last - Version'First + 1)
if (Next_Extension_Offset > 0)
and (Next_Extension_Offset < Length)
and (8 * Next_Extension_Offset >= (Language_Tag'Last - Version'First + 1));
Payload : Opaque
then null
if (Next_Extension_Offset = 0)
or (Next_Extension_Offset >= Length)
then Extension
if (Next_Extension_Offset > 0)
and (Next_Extension_Offset < Length);
Extension : Opaque
with Size => (Length - Next_Extension_Offset) * 8;
end message;
-- 8.1. Service Request
type Service_Request is
message
Length_Of_PR_List : U16;
PR_List_String : Opaque
with Size => Length_Of_PR_List * 8;
Length_Of_Service_Type : U16;
Service_Type_String : Opaque
with Size => Length_Of_Service_Type * 8;
Length_Of_Scope_List : U16;
Scope_List_String : Opaque
with Size => Length_Of_Scope_List * 8;
Length_Of_Predicate_String : U16;
Service_Request_Predicate : Opaque
with Size => Length_Of_Predicate_String * 8;
Length_Of_SLP_SPI_String : U16;
SLP_SPI_String : Opaque
with Size => Length_Of_SLP_SPI_String * 8;
end message;
for SLPv2 use (Payload => Service_Request)
if Function_ID = FI_SERVICE_REQUEST;
-- 9.2. Authentication Blocks
type Authentication_Block_Authentication_Block_Length is range 10 .. 2 ** 16 - 1 with Size => 16;
type Authentication_Block is
message
Block_Structure_Descriptor : U16;
Authentication_Block_Length : Authentication_Block_Authentication_Block_Length;
Authentication_Block_Timestamp : U32;
SLP_SPI_String_Length : U16;
SLP_SPI_String : Opaque
with Size => SLP_SPI_String_Length * 8;
Structured_Authentication_Block : Opaque
with Size => 8 * Authentication_Block_Length - (SLP_SPI_String'Last - Block_Structure_Descriptor'First + 1)
if (8 * Authentication_Block_Length >= (SLP_SPI_String'Last - Block_Structure_Descriptor'First + 1));
end message;
type Authentication_Blocks is sequence of Authentication_Block;
-- 4.3. URL Entries
type URL_Entry_Reserved is range 0 .. 0 with Size => 8;
type URL_Entry is
message
Reserved : URL_Entry_Reserved;
Lifetime : U16;
URL_Length : U16;
URL : Opaque
with Size => URL_Length * 8;
Number_Of_URL_Authentications : U8;
Authentication_Blocks : Authentication_Blocks
with Size => Number_Of_URL_Authentications * 8;
end message;
type URL_Entries is sequence of URL_Entry;
-- 8.2. Service Reply
type Service_Reply is
message
Error_Code : Error;
URL_Entry_Count : U16;
URL_Entries : URL_Entries
with Size => URL_Entry_Count * 8;
end message;
for SLPv2 use (Payload => Service_Reply)
if Function_ID = FI_SERVICE_REPLY;
-- 8.3. Service Registration
type Service_Registration is
message
URL_Entry : URL_Entry;
Length_Of_Service_Type_String : U16;
Service_Type : Opaque
with Size => Length_Of_Service_Type_String * 8;
Length_Of_Scope_List : U16;
Scope_List : Opaque
with Size => Length_Of_Scope_List * 8;
Length_Of_Attribute_List_String : U16;
Attribute_List : Opaque
with Size => Length_Of_Attribute_List_String * 8;
Number_Of_Attribute_Authentication_Blocks : U8;
Attribute_Authentication_Blocks : Authentication_Blocks
with Size => Number_Of_Attribute_Authentication_Blocks * 8;
end message;
for SLPv2 use (Payload => Service_Registration)
if Function_ID = FI_SERVICE_REGISTRATION;
-- 8.4. Service Acknowledgement
type Service_Acknowledgement is
message
Error_Code : Error;
end message;
for SLPv2 use (Payload => Service_Acknowledgement)
if Function_ID = FI_SERVICE_ACKNOWLEDGE;
-- 8.5. Directory Agent Advertisement
type Directory_Agent_Advertisement is
message
Error_Code : Error;
DA_Stateless_Boot_Timestamp : U32;
Length_Of_URL : U16;
URL : Opaque
with Size => Length_Of_URL * 8;
Length_Of_Scope_List : U16;
Scope_List : Opaque
with Size => Length_Of_Scope_List * 8;
Length_Of_Attribute_List_String : U16;
Attribute_List : Opaque
with Size => Length_Of_Attribute_List_String * 8;
SLP_SPI_String_Length : U16;
SLP_SPI_String : Opaque
with Size => SLP_SPI_String_Length * 8;
Number_Of_Authentication_Blocks : U8;
Authentication_Blocks : Authentication_Blocks
with Size => Number_Of_Authentication_Blocks * 8;
end message;
for SLPv2 use (Payload => Directory_Agent_Advertisement)
if Function_ID = FI_DA_ADVERTISEMENT;
-- 8.6. Service Agent Advertisement
type Service_Agent_Advertisement is
message
Length_Of_URL : U16;
URL : Opaque
with Size => Length_Of_URL * 8;
Length_Of_Scope_List : U16;
Scope_List : Opaque
with Size => Length_Of_Scope_List * 8;
Length_Of_Attribute_List_String : U16;
Attribute_List : Opaque
with Size => Length_Of_Attribute_List_String * 8;
Number_Of_Authentication_Blocks : U8;
Authentication_Blocks : Authentication_Blocks
with Size => Number_Of_Authentication_Blocks * 8;
end message;
for SLPv2 use (Payload => Service_Agent_Advertisement)
if Function_ID = FI_SA_ADVERTISEMENT;
-- 9.1. Service Location Protocol Extensions
-- https://github.com/Componolit/RecordFlux/issues/598
type Extension_Id is range 16#0000# .. 16#8FFF# with Size => 16;
type Service_Location_Extension is
message
Extension_Id : Extension_Id;
Next_Extension_Offset : U24;
Extension_Data : Opaque
with Size => 0; -- Extensions not supported
end message;
-- 10.1. Service Type Request
type Service_Type_Request is
message
Length_Of_PR_List : U16;
Previous_Responder_List : Opaque
with Size => Length_Of_PR_List * 8;
Length_Of_Naming_Authority : U16
then Naming_Authority
with Size => Length_Of_Naming_Authority * 8
if Length_Of_Naming_Authority < 16#FFFF#
then Naming_Authority
with Size => 0
if Length_Of_Naming_Authority = 16#FFFF#;
Naming_Authority : Opaque;
Length_Of_Scope_List : U16;
Scope_List : Opaque
with Size => Length_Of_Scope_List * 8;
end message;
for SLPv2 use (Payload => Service_Type_Request)
if Function_ID = FI_SERVICE_TYPE_REQUEST;
-- 10.2 Service Type Reply
type Service_Type_Reply is
message
Error_Code : Error;
Length_Of_Service_Type_String : U16;
Service_Type : Opaque
with Size => Length_Of_Service_Type_String * 8;
end message;
for SLPv2 use (Payload => Service_Type_Reply)
if Function_ID = FI_SERVICE_TYPE_REPLY;
-- 10.3. Attribute Request
type Attribute_Request is
message
Length_Of_PR_List : U16;
Previous_Responder_List : Opaque
with Size => Length_Of_PR_List * 8;
Length_Of_URL : U16;
URL : Opaque
with Size => Length_Of_URL * 8;
Length_Of_Scope_List : U16;
Scope_List : Opaque
with Size => Length_Of_Scope_List * 8;
Length_Of_Tag_List_String : U16;
Tag_List_string : Opaque
with Size => Length_Of_Tag_List_String * 8;
SLP_SPI_String_Length : U16;
SLP_SPI_String : Opaque
with Size => SLP_SPI_String_Length * 8;
end message;
for SLPv2 use (Payload => Attribute_Request)
if Function_ID = FI_ATTRIBUTE_REQUEST;
-- 10.4. Attribute Reply
type Attribute_Reply is
message
Error_Code : Error;
Length_Of_Attribute_List_String : U16;
Attribute_List : Opaque
with Size => Length_Of_Attribute_List_String * 8;
Number_Of_Authentication_Blocks : U8;
Authentication_Blocks : Authentication_Blocks
with Size => Number_Of_Authentication_Blocks * 8;
end message;
for SLPv2 use (Payload => Attribute_Reply)
if Function_ID = FI_ATTRIBUTE_REPLY;
-- 10.6. Service Deregistration
type Service_Deregistration is
message
Length_Of_Scope_List : U16;
Scope_List : Opaque
with Size => Length_Of_Scope_List * 8;
URL_Entry : URL_Entry;
Length_Of_Tag_List_String : U16;
Tag_List_string : Opaque
with Size => Length_Of_Tag_List_String * 8;
end message;
for SLPv2 use (Payload => Service_Deregistration)
if Function_ID = FI_SERVICE_DEREGISTER;
-- D.1. Required Attribute Missing Option
type Attribute_Missing_Option_Extension_Type is range 1 .. 1 with Size => 16;
type Attribute_Missing_Option is
message
Extension_Length : U16;
Template_IDVer_Length : U16;
Template_IDVer_String : Opaque
with Size => Template_IDVer_Length * 8;
Required_Attribute_Tag_List_Length : U16;
Required_Attribute_Tag_List : Opaque
with Size => Required_Attribute_Tag_List_Length * 8;
end message;
end SLPv2;