bgpkit-parser 0.16.0

MRT/BGP/BMP data processing library
Documentation
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
//! BGP Extended Communities Attribute
//!
//! RFC4360: <https://datatracker.ietf.org/doc/html/rfc4360#section-4.5>
//! IANA Codes: <https://www.iana.org/assignments/bgp-extended-communities/bgp-extended-communities.xhtml>

use crate::models::*;
use crate::parser::ReadUtils;
use crate::ParserError;

use bytes::{Buf, BufMut, Bytes, BytesMut};
use std::net::Ipv4Addr;

pub fn parse_extended_community(mut input: Bytes) -> Result<AttributeValue, ParserError> {
    // RFC 4360, section 2: Each Extended Community is encoded as an 8-octet quantity [..]
    let num_communities = input.remaining() / 8;

    let mut communities = Vec::with_capacity(num_communities);

    while input.remaining() > 0 {
        let ec_type_u8 = input.read_u8()?;
        let ec: ExtendedCommunity = match ExtendedCommunityType::from(ec_type_u8) {
            ExtendedCommunityType::TransitiveTwoOctetAs => {
                let sub_type = input.read_u8()?;
                let global = input.read_u16()?;
                let mut local: [u8; 4] = [0; 4];
                input.read_exact(&mut local[..])?;
                ExtendedCommunity::TransitiveTwoOctetAs(TwoOctetAsExtCommunity {
                    subtype: sub_type,
                    global_admin: Asn::new_16bit(global),
                    local_admin: local,
                })
            }
            ExtendedCommunityType::NonTransitiveTwoOctetAs => {
                let sub_type = input.read_u8()?;
                match sub_type {
                    0x06 => {
                        // Flow-Spec Traffic Rate
                        let as_number = input.read_u16()?;
                        let rate_bytes = input.read_u32()?;
                        let rate = f32::from_bits(rate_bytes);
                        ExtendedCommunity::FlowSpecTrafficRate(FlowSpecTrafficRate::new(
                            as_number, rate,
                        ))
                    }
                    0x07 => {
                        // Flow-Spec Traffic Action
                        let as_number = input.read_u16()?;
                        let flags = input.read_u32()?;
                        let terminal = (flags & 0x01) != 0;
                        let sample = (flags & 0x02) != 0;
                        ExtendedCommunity::FlowSpecTrafficAction(FlowSpecTrafficAction::new(
                            as_number, terminal, sample,
                        ))
                    }
                    0x08 => {
                        // Flow-Spec Redirect (same as TwoOctetAsExtCommunity but different variant)
                        let global = input.read_u16()?;
                        let mut local: [u8; 4] = [0; 4];
                        input.read_exact(&mut local)?;
                        ExtendedCommunity::FlowSpecRedirect(TwoOctetAsExtCommunity {
                            subtype: sub_type,
                            global_admin: Asn::new_16bit(global),
                            local_admin: local,
                        })
                    }
                    0x09 => {
                        // Flow-Spec Traffic Marking
                        let as_number = input.read_u16()?;
                        let dscp = input.read_u8()?;
                        let _reserved1 = input.read_u8()?; // reserved
                        let _reserved2 = input.read_u16()?; // reserved
                        ExtendedCommunity::FlowSpecTrafficMarking(FlowSpecTrafficMarking::new(
                            as_number, dscp,
                        ))
                    }
                    _ => {
                        // Standard NonTransitiveTwoOctetAs
                        let global = input.read_u16()?;
                        let mut local: [u8; 4] = [0; 4];
                        input.read_exact(&mut local)?;
                        ExtendedCommunity::NonTransitiveTwoOctetAs(TwoOctetAsExtCommunity {
                            subtype: sub_type,
                            global_admin: Asn::new_16bit(global),
                            local_admin: local,
                        })
                    }
                }
            }

            ExtendedCommunityType::TransitiveIpv4Addr => {
                let sub_type = input.read_u8()?;
                let global = Ipv4Addr::from(input.read_u32()?);
                let mut local: [u8; 2] = [0; 2];
                input.read_exact(&mut local)?;
                ExtendedCommunity::TransitiveIpv4Addr(Ipv4AddrExtCommunity {
                    subtype: sub_type,
                    global_admin: global,
                    local_admin: local,
                })
            }
            ExtendedCommunityType::NonTransitiveIpv4Addr => {
                let sub_type = input.read_u8()?;
                let global = Ipv4Addr::from(input.read_u32()?);
                let mut local: [u8; 2] = [0; 2];
                input.read_exact(&mut local)?;
                ExtendedCommunity::NonTransitiveIpv4Addr(Ipv4AddrExtCommunity {
                    subtype: sub_type,
                    global_admin: global,
                    local_admin: local,
                })
            }
            ExtendedCommunityType::TransitiveFourOctetAs => {
                let sub_type = input.read_u8()?;
                let global = input.read_u32()?;
                let mut local: [u8; 2] = [0; 2];
                input.read_exact(&mut local)?;
                ExtendedCommunity::TransitiveFourOctetAs(FourOctetAsExtCommunity {
                    subtype: sub_type,
                    global_admin: Asn::new_32bit(global),
                    local_admin: local,
                })
            }
            ExtendedCommunityType::NonTransitiveFourOctetAs => {
                let sub_type = input.read_u8()?;
                let global = input.read_u32()?;
                let mut local: [u8; 2] = [0; 2];
                input.read_exact(&mut local)?;
                ExtendedCommunity::NonTransitiveFourOctetAs(FourOctetAsExtCommunity {
                    subtype: sub_type,
                    global_admin: Asn::new_32bit(global),
                    local_admin: local,
                })
            }

            ExtendedCommunityType::TransitiveOpaque => {
                let sub_type = input.read_u8()?;
                let mut value: [u8; 6] = [0; 6];
                input.read_exact(&mut value)?;
                ExtendedCommunity::TransitiveOpaque(OpaqueExtCommunity {
                    subtype: sub_type,
                    value,
                })
            }
            ExtendedCommunityType::NonTransitiveOpaque => {
                let sub_type = input.read_u8()?;
                let mut value: [u8; 6] = [0; 6];
                input.read_exact(&mut value)?;
                ExtendedCommunity::NonTransitiveOpaque(OpaqueExtCommunity {
                    subtype: sub_type,
                    value,
                })
            }
            ExtendedCommunityType::Unknown(_) => {
                let mut buffer: [u8; 8] = [0; 8];
                buffer[0] = ec_type_u8;
                input.read_exact(&mut buffer[1..])?;

                ExtendedCommunity::Raw(buffer)
            }
        };

        communities.push(ec);
    }

    debug_assert!(communities.len() == num_communities);
    Ok(AttributeValue::ExtendedCommunities(communities))
}

pub fn parse_ipv6_extended_community(mut input: Bytes) -> Result<AttributeValue, ParserError> {
    // RFC 5701, section 2: Each IPv6 Address Specific extended community is encoded as a 20-octet quantity [..]
    let num_communities = input.remaining() / 20;

    let mut communities = Vec::with_capacity(num_communities);
    while input.remaining() > 0 {
        let ec_type_u8 = input.read_u8()?;
        let sub_type = input.read_u8()?;
        let global = input.read_ipv6_address()?;
        let mut local: [u8; 2] = [0; 2];
        local[0] = input.read_u8()?;
        local[1] = input.read_u8()?;
        let ec = Ipv6AddrExtCommunity {
            community_type: ExtendedCommunityType::from(ec_type_u8),
            subtype: sub_type,
            global_admin: global,
            local_admin: local,
        };
        communities.push(ec);
    }

    debug_assert!(communities.len() == num_communities);
    Ok(AttributeValue::Ipv6AddressSpecificExtendedCommunities(
        communities,
    ))
}

pub fn encode_extended_communities(communities: &Vec<ExtendedCommunity>) -> Bytes {
    let expected_len = 8 * communities.len();
    let mut bytes = BytesMut::with_capacity(expected_len);

    for community in communities {
        let ec_type = u8::from(community.community_type());
        match community {
            ExtendedCommunity::TransitiveTwoOctetAs(two_octet)
            | ExtendedCommunity::NonTransitiveTwoOctetAs(two_octet) => {
                bytes.put_u8(ec_type);
                bytes.put_u8(two_octet.subtype);
                bytes.put_u16(two_octet.global_admin.into());
                bytes.put_slice(two_octet.local_admin.as_slice());
            }
            ExtendedCommunity::TransitiveIpv4Addr(ipv4)
            | ExtendedCommunity::NonTransitiveIpv4Addr(ipv4) => {
                bytes.put_u8(ec_type);
                bytes.put_u8(ipv4.subtype);
                bytes.put_u32(ipv4.global_admin.into());
                bytes.put_slice(ipv4.local_admin.as_slice());
            }

            ExtendedCommunity::TransitiveFourOctetAs(four_octet)
            | ExtendedCommunity::NonTransitiveFourOctetAs(four_octet) => {
                bytes.put_u8(ec_type);
                bytes.put_u8(four_octet.subtype);
                bytes.put_u32(four_octet.global_admin.into());
                bytes.put_slice(four_octet.local_admin.as_slice());
            }

            ExtendedCommunity::TransitiveOpaque(opaque)
            | ExtendedCommunity::NonTransitiveOpaque(opaque) => {
                bytes.put_u8(ec_type);
                bytes.put_u8(opaque.subtype);
                bytes.put_slice(&opaque.value);
            }

            ExtendedCommunity::FlowSpecTrafficRate(rate) => {
                bytes.put_u8(ec_type);
                bytes.put_u8(0x06); // subtype
                bytes.put_u16(rate.as_number);
                bytes.put_f32(rate.rate_bytes_per_sec);
            }
            ExtendedCommunity::FlowSpecTrafficAction(action) => {
                bytes.put_u8(ec_type);
                bytes.put_u8(0x07); // subtype
                bytes.put_u16(action.as_number);
                let mut flags = 0u32;
                if action.terminal {
                    flags |= 0x01;
                }
                if action.sample {
                    flags |= 0x02;
                }
                bytes.put_u32(flags);
            }
            ExtendedCommunity::FlowSpecRedirect(redirect) => {
                bytes.put_u8(ec_type);
                bytes.put_u8(0x08); // subtype
                bytes.put_u16(redirect.global_admin.into());
                bytes.put_slice(redirect.local_admin.as_slice());
            }
            ExtendedCommunity::FlowSpecTrafficMarking(marking) => {
                bytes.put_u8(ec_type);
                bytes.put_u8(0x09); // subtype
                bytes.put_u16(marking.as_number);
                bytes.put_u8(marking.dscp);
                bytes.put_u8(0); // reserved
                bytes.put_u16(0); // reserved
            }
            ExtendedCommunity::Raw(raw) => {
                bytes.put_slice(raw);
            }
        }
    }

    debug_assert!(bytes.len() == expected_len);
    bytes.freeze()
}

pub fn encode_ipv6_extended_communities(communities: &Vec<Ipv6AddrExtCommunity>) -> Bytes {
    let mut bytes = BytesMut::new();
    for community in communities {
        let ec_type = u8::from(community.community_type);
        bytes.put_u8(ec_type);
        bytes.put_u8(community.subtype);
        bytes.put_u128(community.global_admin.into());
        bytes.put_slice(community.local_admin.as_slice());
    }
    bytes.freeze()
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::net::Ipv6Addr;

    // TransitiveTwoOctetAsSpecific = 0x00,
    // TransitiveIpv4AddressSpecific = 0x01,
    // TransitiveFourOctetAsSpecific = 0x02,
    // TransitiveOpaque = 0x03,

    #[test]
    fn test_parse_extended_communities_two_octet_as() {
        // test Transitive Two Octet AS Specific
        let data: Vec<u8> = vec![
            0x00, // Transitive Two Octet AS Specific
            0x02, // Route Target
            0x00, 0x01, // AS 1
            0x00, 0x00, 0x00, 0x01, // Local Admin 1
        ];

        if let AttributeValue::ExtendedCommunities(communities) =
            parse_extended_community(Bytes::from(data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            if let ExtendedCommunity::TransitiveTwoOctetAs(community) = &communities[0] {
                assert_eq!(community.subtype, 0x02);
                assert_eq!(community.global_admin, Asn::new_16bit(1));
                assert_eq!(community.local_admin, [0x00, 0x00, 0x00, 0x01]);
            }
        }

        // test Nontransitive Two Octet AS Specific
        let data: Vec<u8> = vec![
            0x40, // Nontransitive Two Octet AS Specific
            0x02, // Route Target
            0x00, 0x01, // AS 1
            0x00, 0x00, 0x00, 0x01, // Local Admin 1
        ];

        if let AttributeValue::ExtendedCommunities(communities) =
            parse_extended_community(Bytes::from(data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            if let ExtendedCommunity::NonTransitiveTwoOctetAs(community) = &communities[0] {
                assert_eq!(community.subtype, 0x02);
                assert_eq!(community.global_admin, Asn::new_16bit(1));
                assert_eq!(community.local_admin, [0x00, 0x00, 0x00, 0x01]);
            }
        }
    }

    #[test]
    fn test_parse_extended_communities_ipv4() {
        let data: Vec<u8> = vec![
            0x01, // Transitive IPv4 Address Specific
            0x02, // Route Target
            0xC0, 0x00, 0x02, 0x01, // ipv4: 192.0.2.1
            0x00, 0x01, // Local Admin 1
        ];

        if let AttributeValue::ExtendedCommunities(communities) =
            parse_extended_community(Bytes::from(data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            if let ExtendedCommunity::TransitiveIpv4Addr(community) = &communities[0] {
                assert_eq!(community.subtype, 0x02);
                assert_eq!(community.global_admin, Ipv4Addr::new(192, 0, 2, 1));
                assert_eq!(community.local_admin, [0x00, 0x01]);
            } else {
                panic!("Unexpected community type");
            }
        } else {
            panic!("Unexpected attribute type");
        }
    }

    #[test]
    fn test_parse_extended_communities_four_octet_as() {
        let data: Vec<u8> = vec![
            0x02, // Transitive Four Octet AS Specific
            0x02, // Route Target
            0x00, 0x00, 0x00, 0x01, // AS 1
            0x00, 0x01, // Local Admin 1
        ];

        if let AttributeValue::ExtendedCommunities(communities) =
            parse_extended_community(Bytes::from(data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            if let ExtendedCommunity::TransitiveFourOctetAs(community) = &communities[0] {
                assert_eq!(community.subtype, 0x02);
                assert_eq!(community.global_admin, Asn::new_16bit(1));
                assert_eq!(community.local_admin, [0x00, 0x01]);
            } else {
                panic!("Unexpected community type");
            }
        } else {
            panic!("Unexpected attribute type");
        }
    }

    #[test]
    fn test_parse_extended_communities_opaque() {
        let data: Vec<u8> = vec![
            0x03, // Transitive Opaque
            0x02, // Route Target
            0x00, 0x01, 0x02, 0x03, 0x04, 0x05, // Opaque
        ];

        if let AttributeValue::ExtendedCommunities(communities) =
            parse_extended_community(Bytes::from(data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            if let ExtendedCommunity::TransitiveOpaque(community) = &communities[0] {
                assert_eq!(community.subtype, 0x02);
                assert_eq!(community.value, [0x00, 0x01, 0x02, 0x03, 0x04, 0x05]);
            } else {
                panic!("Unexpected community type");
            }
        } else {
            panic!("Unexpected attribute type");
        }
    }

    #[test]
    fn test_parse_extended_communities_ipv6() {
        let data: Vec<u8> = vec![
            0x40, // Transitive IPv6 Address Specific
            0x02, // Route Target
            0x20, 0x01, 0x0D, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x01, // ipv6: 2001:db8::1
            0x00, 0x01, // Local Admin 1
        ];

        if let AttributeValue::Ipv6AddressSpecificExtendedCommunities(communities) =
            parse_ipv6_extended_community(Bytes::from(data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            let community = communities[0];
            assert_eq!(
                community.community_type,
                ExtendedCommunityType::NonTransitiveTwoOctetAs
            );
            assert_eq!(community.subtype, 0x02);
            assert_eq!(
                community.global_admin,
                Ipv6Addr::new(0x2001, 0x0db8, 0, 0, 0, 0, 0, 1)
            );
            assert_eq!(community.local_admin, [0x00, 0x01]);
        } else {
            panic!("Unexpected attribute type");
        }
    }

    #[test]
    fn test_encode_raw_extended_community() {
        let community = ExtendedCommunity::Raw([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]);
        let bytes = encode_extended_communities(&vec![community]);
        assert_eq!(
            bytes,
            Bytes::from_static(&[0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07])
        );
    }

    #[test]
    fn test_encode_ipv6_extended_communites() {
        let community = Ipv6AddrExtCommunity {
            community_type: ExtendedCommunityType::NonTransitiveTwoOctetAs,
            subtype: 0x02,
            global_admin: Ipv6Addr::new(0x2001, 0x0db8, 0, 0, 0, 0, 0, 1),
            local_admin: [0x00, 0x01],
        };
        let _bytes = encode_ipv6_extended_communities(&vec![community]);
    }

    #[test]
    fn test_flowspec_extended_communities() {
        // Test Flow-Spec Traffic Rate community
        let rate_data = vec![
            0x40, // NonTransitiveTwoOctetAs
            0x06, // Traffic Rate subtype
            0xFC, 0x00, // AS 64512
            0x44, 0x7A, 0x00, 0x00, // 1000.0 as IEEE 754 float32
        ];

        if let AttributeValue::ExtendedCommunities(communities) =
            parse_extended_community(Bytes::from(rate_data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            if let ExtendedCommunity::FlowSpecTrafficRate(rate) = &communities[0] {
                assert_eq!(rate.as_number, 64512);
                assert_eq!(rate.rate_bytes_per_sec, 1000.0);
            } else {
                panic!("Expected FlowSpecTrafficRate community");
            }
        } else {
            panic!("Expected ExtendedCommunities attribute");
        }

        // Test Flow-Spec Traffic Action community
        let action_data = vec![
            0x40, // NonTransitiveTwoOctetAs
            0x07, // Traffic Action subtype
            0xFC, 0x00, // AS 64512
            0x00, 0x00, 0x00, 0x03, // terminal=1, sample=1
        ];

        if let AttributeValue::ExtendedCommunities(communities) =
            parse_extended_community(Bytes::from(action_data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            if let ExtendedCommunity::FlowSpecTrafficAction(action) = &communities[0] {
                assert_eq!(action.as_number, 64512);
                assert!(action.terminal);
                assert!(action.sample);
            } else {
                panic!("Expected FlowSpecTrafficAction community");
            }
        } else {
            panic!("Expected ExtendedCommunities attribute");
        }

        // Test Flow-Spec Traffic Marking community
        let marking_data = vec![
            0x40, // NonTransitiveTwoOctetAs
            0x09, // Traffic Marking subtype
            0xFC, 0x00, // AS 64512
            0x2E, // DSCP 46 (EF)
            0x00, // reserved
            0x00, 0x00, // reserved
        ];

        if let AttributeValue::ExtendedCommunities(communities) =
            parse_extended_community(Bytes::from(marking_data)).unwrap()
        {
            assert_eq!(communities.len(), 1);
            if let ExtendedCommunity::FlowSpecTrafficMarking(marking) = &communities[0] {
                assert_eq!(marking.as_number, 64512);
                assert_eq!(marking.dscp, 46);
            } else {
                panic!("Expected FlowSpecTrafficMarking community");
            }
        } else {
            panic!("Expected ExtendedCommunities attribute");
        }
    }

    #[test]
    fn test_flowspec_extended_communities_encoding() {
        // Test encoding of Flow-Spec communities
        let communities = vec![
            ExtendedCommunity::FlowSpecTrafficRate(FlowSpecTrafficRate::new(64512, 1000.0)),
            ExtendedCommunity::FlowSpecTrafficAction(FlowSpecTrafficAction::new(64512, true, true)),
            ExtendedCommunity::FlowSpecTrafficMarking(FlowSpecTrafficMarking::new(64512, 46)),
        ];

        let encoded = encode_extended_communities(&communities);

        // Parse it back to verify round-trip
        if let AttributeValue::ExtendedCommunities(parsed_communities) =
            parse_extended_community(encoded).unwrap()
        {
            assert_eq!(parsed_communities.len(), 3);

            // Verify traffic rate
            if let ExtendedCommunity::FlowSpecTrafficRate(rate) = &parsed_communities[0] {
                assert_eq!(rate.as_number, 64512);
                assert_eq!(rate.rate_bytes_per_sec, 1000.0);
            } else {
                panic!("Expected FlowSpecTrafficRate community");
            }

            // Verify traffic action
            if let ExtendedCommunity::FlowSpecTrafficAction(action) = &parsed_communities[1] {
                assert_eq!(action.as_number, 64512);
                assert!(action.terminal);
                assert!(action.sample);
            } else {
                panic!("Expected FlowSpecTrafficAction community");
            }

            // Verify traffic marking
            if let ExtendedCommunity::FlowSpecTrafficMarking(marking) = &parsed_communities[2] {
                assert_eq!(marking.as_number, 64512);
                assert_eq!(marking.dscp, 46);
            } else {
                panic!("Expected FlowSpecTrafficMarking community");
            }
        } else {
            panic!("Expected ExtendedCommunities attribute");
        }
    }
}