Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9a32b2

Browse files
committed
Revert "Merge pull request #3940 from tyler-potyondy/6LoWPAN"
This reverts commit 86abc90, reversing changes made to 34352f7.
1 parent b2a3fdf commit c9a32b2

File tree

5 files changed

+5
-108
lines changed

5 files changed

+5
-108
lines changed

boards/components/src/ieee802154.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ impl<
325325
));
326326
mac_device.set_transmit_client(mux_mac);
327327
mac_device.set_receive_client(mux_mac);
328-
mac_device.set_receive_secured_frame_no_decrypt_client(mux_mac);
329328

330329
let userspace_mac =
331330
static_buffer
@@ -349,7 +348,6 @@ impl<
349348
mac_device.set_device_procedure(radio_driver);
350349
userspace_mac.set_transmit_client(radio_driver);
351350
userspace_mac.set_receive_client(radio_driver);
352-
userspace_mac.set_receive_secured_frame_no_decrypt_client(radio_driver);
353351
userspace_mac.set_pan(self.pan_id);
354352
userspace_mac.set_address(self.short_addr);
355353
userspace_mac.set_address_long(self.long_addr);

capsules/extra/src/ieee802154/device.rs

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ pub trait MacDevice<'a> {
2424
fn set_transmit_client(&self, client: &'a dyn TxClient);
2525
/// Sets the receive client of this MAC device
2626
fn set_receive_client(&self, client: &'a dyn RxClient);
27-
/// Sets the secure frame no decrypt receive client of this MAC device
28-
fn set_receive_secured_frame_no_decrypt_client(
29-
&self,
30-
client: &'a dyn SecuredFrameNoDecryptRxClient,
31-
);
3227

3328
/// The short 16-bit address of the MAC device
3429
fn get_address(&self) -> u16;
@@ -129,8 +124,8 @@ pub trait RxClient {
129124
/// unsecured frames that have passed the incoming security procedure are
130125
/// exposed to the client.
131126
///
132-
/// - `buf`: The entire buffer containing the frame, potentially also
133-
/// including extra bytes in front used for the physical layer.
127+
/// - `buf`: The entire buffer containing the frame, including extra bytes
128+
/// in front used for the physical layer.
134129
/// - `header`: A fully-parsed representation of the MAC header, with the
135130
/// caveat that the auxiliary security header is still included if the frame
136131
/// was previously secured.
@@ -148,34 +143,3 @@ pub trait RxClient {
148143
data_len: usize,
149144
);
150145
}
151-
152-
/// Trait to be implemented by users of the IEEE 802.15.4 device that wish to
153-
/// receive frames possessing link layer security that remain secured (i.e.
154-
/// have not been decrypted). This allows the client to perform decryption
155-
/// on the frame. The callback is trigger whenever a valid frame is received.
156-
/// In this context, raw refers to receiving frames without processing the
157-
/// security of the frame. The SecuredFrameNoDecryptRxClient should not be
158-
/// used to pass frames to the higher layers of the network stack that expect
159-
/// unsecured frames.
160-
pub trait SecuredFrameNoDecryptRxClient {
161-
/// When a frame is received, this callback is triggered. The client only
162-
/// receives an immutable borrow of the buffer. All frames, regardless of
163-
/// their secured state, are exposed to the client.
164-
///
165-
/// - `buf`: The entire buffer containing the frame, potentially also
166-
/// including extra bytes in front used for the physical layer.
167-
/// - `header`: A fully-parsed representation of the MAC header.
168-
/// - `lqi`: The link quality indicator of the received frame.
169-
/// - `data_offset`: Offset of the data payload relative to
170-
/// `buf`, so that the payload of the frame is contained in
171-
/// `buf[data_offset..data_offset + data_len]`.
172-
/// - `data_len`: Length of the data payload
173-
fn receive_secured_frame<'a>(
174-
&self,
175-
buf: &'a [u8],
176-
header: Header<'a>,
177-
lqi: u8,
178-
data_offset: usize,
179-
data_len: usize,
180-
);
181-
}

capsules/extra/src/ieee802154/driver.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
use crate::ieee802154::{device, framer};
5757
use crate::net::ieee802154::{Header, KeyId, MacAddress, SecurityLevel};
5858
use crate::net::stream::{decode_bytes, decode_u8, encode_bytes, encode_u8, SResult};
59-
use device::RxClient;
6059

6160
use core::cell::Cell;
6261

@@ -1068,22 +1067,6 @@ impl<'a, M: device::MacDevice<'a>> device::TxClient for RadioDriver<'a, M> {
10681067
}
10691068
}
10701069

1071-
impl<'a, M: device::MacDevice<'a>> device::SecuredFrameNoDecryptRxClient for RadioDriver<'a, M> {
1072-
fn receive_secured_frame<'b>(
1073-
&self,
1074-
buf: &'b [u8],
1075-
header: Header<'b>,
1076-
lqi: u8,
1077-
data_offset: usize,
1078-
data_len: usize,
1079-
) {
1080-
// The current 15.4 userspace receive accepts both secured and
1081-
// unsecured frames. As such, we can simply call the standard
1082-
// receive method of the RxClient trait.
1083-
self.receive(buf, header, lqi, data_offset, data_len)
1084-
}
1085-
}
1086-
10871070
impl<'a, M: device::MacDevice<'a>> device::RxClient for RadioDriver<'a, M> {
10881071
fn receive<'b>(
10891072
&self,

capsules/extra/src/ieee802154/framer.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
// TODO: Channel scanning
7676
//
7777

78-
use crate::ieee802154::device::{MacDevice, RxClient, SecuredFrameNoDecryptRxClient, TxClient};
78+
use crate::ieee802154::device::{MacDevice, RxClient, TxClient};
7979
use crate::ieee802154::mac::Mac;
8080
use crate::net::ieee802154::{
8181
FrameType, FrameVersion, Header, KeyId, MacAddress, PanID, Security, SecurityLevel,
@@ -396,7 +396,6 @@ pub struct Framer<'a, M: Mac<'a>, A: AES128CCM<'a>> {
396396
/// `None`, except when transitioning between states.
397397
rx_state: MapCell<RxState>,
398398
rx_client: OptionalCell<&'a dyn RxClient>,
399-
secured_frame_no_decrypt_rx_client: OptionalCell<&'a dyn SecuredFrameNoDecryptRxClient>,
400399
crypt_buf: MapCell<SubSliceMut<'static, u8>>,
401400
}
402401

@@ -416,7 +415,6 @@ impl<'a, M: Mac<'a>, A: AES128CCM<'a>> Framer<'a, M, A> {
416415
tx_client: OptionalCell::empty(),
417416
rx_state: MapCell::new(RxState::Idle),
418417
rx_client: OptionalCell::empty(),
419-
secured_frame_no_decrypt_rx_client: OptionalCell::empty(),
420418
crypt_buf: MapCell::new(crypt_buf),
421419
}
422420
}
@@ -512,8 +510,8 @@ impl<'a, M: Mac<'a>, A: AES128CCM<'a>> Framer<'a, M, A> {
512510
Some(key) => key,
513511
None => {
514512
// Key not found -- pass raw encrypted packet to client
515-
self.secured_frame_no_decrypt_rx_client.map(|client| {
516-
client.receive_secured_frame(frame_buffer, header, lqi, data_offset, data_len);
513+
self.rx_client.map(|client| {
514+
client.receive(frame_buffer, header, lqi, data_offset, data_len);
517515
});
518516
return None;
519517
}
@@ -807,13 +805,6 @@ impl<'a, M: Mac<'a>, A: AES128CCM<'a>> MacDevice<'a> for Framer<'a, M, A> {
807805
self.rx_client.set(client);
808806
}
809807

810-
fn set_receive_secured_frame_no_decrypt_client(
811-
&self,
812-
client: &'a dyn super::device::SecuredFrameNoDecryptRxClient,
813-
) {
814-
self.secured_frame_no_decrypt_rx_client.set(client);
815-
}
816-
817808
fn get_address(&self) -> u16 {
818809
self.mac.get_address()
819810
}

capsules/extra/src/ieee802154/virtual_mac.rs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,6 @@ impl<'a, M: device::MacDevice<'a>> device::RxClient for MuxMac<'a, M> {
7272
}
7373
}
7474

75-
impl<'a, M: device::MacDevice<'a>> device::SecuredFrameNoDecryptRxClient for MuxMac<'a, M> {
76-
fn receive_secured_frame<'b>(
77-
&self,
78-
buf: &'b [u8],
79-
header: Header<'b>,
80-
lqi: u8,
81-
data_offset: usize,
82-
data_len: usize,
83-
) {
84-
for user in self.users.iter() {
85-
user.receive_secured_frame(buf, header, lqi, data_offset, data_len);
86-
}
87-
}
88-
}
89-
9075
impl<'a, M: device::MacDevice<'a>> MuxMac<'a, M> {
9176
pub const fn new(mac: &'a M) -> MuxMac<'a, M> {
9277
MuxMac {
@@ -218,7 +203,6 @@ pub struct MacUser<'a, M: device::MacDevice<'a>> {
218203
next: ListLink<'a, MacUser<'a, M>>,
219204
tx_client: OptionalCell<&'a dyn device::TxClient>,
220205
rx_client: OptionalCell<&'a dyn device::RxClient>,
221-
secure_frame_no_decrypt_rx_client: OptionalCell<&'a dyn device::SecuredFrameNoDecryptRxClient>,
222206
}
223207

224208
impl<'a, M: device::MacDevice<'a>> MacUser<'a, M> {
@@ -229,7 +213,6 @@ impl<'a, M: device::MacDevice<'a>> MacUser<'a, M> {
229213
next: ListLink::empty(),
230214
tx_client: OptionalCell::empty(),
231215
rx_client: OptionalCell::empty(),
232-
secure_frame_no_decrypt_rx_client: OptionalCell::empty(),
233216
}
234217
}
235218
}
@@ -253,21 +236,6 @@ impl<'a, M: device::MacDevice<'a>> MacUser<'a, M> {
253236
.get()
254237
.map(move |client| client.receive(buf, header, lqi, data_offset, data_len));
255238
}
256-
257-
fn receive_secured_frame<'b>(
258-
&self,
259-
buf: &'b [u8],
260-
header: Header<'b>,
261-
lqi: u8,
262-
data_offset: usize,
263-
data_len: usize,
264-
) {
265-
self.secure_frame_no_decrypt_rx_client
266-
.get()
267-
.map(move |client| {
268-
client.receive_secured_frame(buf, header, lqi, data_offset, data_len)
269-
});
270-
}
271239
}
272240

273241
impl<'a, M: device::MacDevice<'a>> ListNode<'a, MacUser<'a, M>> for MacUser<'a, M> {
@@ -285,13 +253,6 @@ impl<'a, M: device::MacDevice<'a>> device::MacDevice<'a> for MacUser<'a, M> {
285253
self.rx_client.set(client);
286254
}
287255

288-
fn set_receive_secured_frame_no_decrypt_client(
289-
&self,
290-
client: &'a dyn device::SecuredFrameNoDecryptRxClient,
291-
) {
292-
self.secure_frame_no_decrypt_rx_client.set(client);
293-
}
294-
295256
fn get_address(&self) -> u16 {
296257
self.mux.mac.get_address()
297258
}

0 commit comments

Comments
 (0)