@@ -247,6 +247,8 @@ pub struct InterfaceInner<'a> {
247
247
pan_id : Option < Ieee802154Pan > ,
248
248
#[ cfg( feature = "proto-ipv4-fragmentation" ) ]
249
249
ipv4_id : u16 ,
250
+ #[ cfg( feature = "proto-sixlowpan" ) ]
251
+ sixlowpan_address_context : & ' a [ SixlowpanAddressContext < ' a > ] ,
250
252
#[ cfg( feature = "proto-sixlowpan-fragmentation" ) ]
251
253
tag : u16 ,
252
254
ip_addrs : ManagedSlice < ' a , IpCidr > ,
@@ -289,6 +291,9 @@ pub struct InterfaceBuilder<'a> {
289
291
sixlowpan_reassembly_buffer_timeout : Duration ,
290
292
#[ cfg( feature = "proto-sixlowpan-fragmentation" ) ]
291
293
sixlowpan_out_buffer : ManagedSlice < ' a , u8 > ,
294
+
295
+ #[ cfg( feature = "proto-sixlowpan" ) ]
296
+ sixlowpan_address_context : & ' a [ SixlowpanAddressContext < ' a > ] ,
292
297
}
293
298
294
299
impl < ' a > InterfaceBuilder < ' a > {
@@ -362,6 +367,9 @@ let iface = builder.finalize(&mut device);
362
367
sixlowpan_reassembly_buffer_timeout : Duration :: from_secs ( 60 ) ,
363
368
#[ cfg( feature = "proto-sixlowpan-fragmentation" ) ]
364
369
sixlowpan_out_buffer : ManagedSlice :: Borrowed ( & mut [ ] [ ..] ) ,
370
+
371
+ #[ cfg( feature = "proto-sixlowpan" ) ]
372
+ sixlowpan_address_context : & [ ] ,
365
373
}
366
374
}
367
375
@@ -473,12 +481,14 @@ let iface = builder.finalize(&mut device);
473
481
self
474
482
}
475
483
484
+ /// Set the IPv4 reassembly buffer the interface will use.
476
485
#[ cfg( feature = "proto-ipv4-fragmentation" ) ]
477
486
pub fn ipv4_reassembly_buffer ( mut self , storage : PacketAssemblerSet < ' a , Ipv4FragKey > ) -> Self {
478
487
self . ipv4_fragments = storage;
479
488
self
480
489
}
481
490
491
+ /// Set the IPv4 fragments buffer the interface will use.
482
492
#[ cfg( feature = "proto-ipv4-fragmentation" ) ]
483
493
pub fn ipv4_fragmentation_buffer < T > ( mut self , storage : T ) -> Self
484
494
where
@@ -488,6 +498,17 @@ let iface = builder.finalize(&mut device);
488
498
self
489
499
}
490
500
501
+ /// Set the address contexts the interface will use.
502
+ #[ cfg( feature = "proto-sixlowpan" ) ]
503
+ pub fn sixlowpan_address_context (
504
+ mut self ,
505
+ sixlowpan_address_context : & ' a [ SixlowpanAddressContext < ' a > ] ,
506
+ ) -> Self {
507
+ self . sixlowpan_address_context = sixlowpan_address_context;
508
+ self
509
+ }
510
+
511
+ /// Set the 6LoWPAN reassembly buffer the interface will use.
491
512
#[ cfg( feature = "proto-sixlowpan-fragmentation" ) ]
492
513
pub fn sixlowpan_reassembly_buffer (
493
514
mut self ,
@@ -497,6 +518,7 @@ let iface = builder.finalize(&mut device);
497
518
self
498
519
}
499
520
521
+ /// Set the timeout value the 6LoWPAN reassembly buffer will use.
500
522
#[ cfg( feature = "proto-sixlowpan-fragmentation" ) ]
501
523
pub fn sixlowpan_reassembly_buffer_timeout ( mut self , timeout : Duration ) -> Self {
502
524
if timeout > Duration :: from_secs ( 60 ) {
@@ -506,6 +528,7 @@ let iface = builder.finalize(&mut device);
506
528
self
507
529
}
508
530
531
+ /// Set the 6LoWPAN fragments buffer the interface will use.
509
532
#[ cfg( feature = "proto-sixlowpan-fragmentation" ) ]
510
533
pub fn sixlowpan_fragmentation_buffer < T > ( mut self , storage : T ) -> Self
511
534
where
@@ -651,6 +674,8 @@ let iface = builder.finalize(&mut device);
651
674
tag,
652
675
#[ cfg( feature = "proto-ipv4-fragmentation" ) ]
653
676
ipv4_id,
677
+ #[ cfg( feature = "proto-sixlowpan" ) ]
678
+ sixlowpan_address_context : & [ ] ,
654
679
rand,
655
680
} ,
656
681
}
@@ -1534,6 +1559,9 @@ impl<'a> InterfaceInner<'a> {
1534
1559
#[ cfg( feature = "proto-sixlowpan-fragmentation" ) ]
1535
1560
tag : 1 ,
1536
1561
1562
+ #[ cfg( feature = "proto-sixlowpan" ) ]
1563
+ sixlowpan_address_context : & [ ] ,
1564
+
1537
1565
#[ cfg( feature = "proto-ipv4-fragmentation" ) ]
1538
1566
ipv4_id : 1 ,
1539
1567
@@ -1804,6 +1832,7 @@ impl<'a> InterfaceInner<'a> {
1804
1832
& iphc,
1805
1833
ieee802154_repr. src_addr,
1806
1834
ieee802154_repr. dst_addr,
1835
+ self . sixlowpan_address_context
1807
1836
) ) ;
1808
1837
1809
1838
// The uncompressed header size always starts with 40, since this is the size
@@ -1888,6 +1917,7 @@ impl<'a> InterfaceInner<'a> {
1888
1917
& iphc_packet,
1889
1918
ieee802154_repr. src_addr,
1890
1919
ieee802154_repr. dst_addr,
1920
+ self . sixlowpan_address_context,
1891
1921
) ) ;
1892
1922
1893
1923
let payload = iphc_packet. payload ( ) ;
0 commit comments