-
Notifications
You must be signed in to change notification settings - Fork 7
Implement support for BACnet MS/TP frame encoding/decoding. #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
de-vri-es
wants to merge
8
commits into
ninjasource:main
Choose a base branch
from
de-vri-es:bacnet-mstp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
57b1b36
Make NPDU device addresses opaque byte blobs.
de-vri-es a0e82b4
Return error when decoding NPDU with the wrong protocol version.
de-vri-es 305329f
Rename `data_link` module to `ip` and `DataLink` to `IpFrame`.
de-vri-es abfb0d3
Add MS/TP frame encoder/decoder.
de-vri-es 5816fba
Add MstpFrame::scan to find frame boundaries.
de-vri-es 33341fe
MS/TP: implement support for COBS encoded frames.
de-vri-es f455862
Clean up MS/TP implementation somewhat.
de-vri-es f53bf68
Fix MS/TP frame length computation when data_len is zero.
LeandroMarceddu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,19 @@ | ||
| // use this example to troubleshoot an invalid BACnet packet | ||
| // RUST_BACKTRACE=1 cargo run --example troubleshoot | ||
|
|
||
| use embedded_bacnet::{common::io::Reader, network_protocol::data_link::DataLink}; | ||
| use embedded_bacnet::{common::io::Reader, network_protocol::ip::IpFrame}; | ||
|
|
||
| fn main() { | ||
| // a valid BACnet packet | ||
| let buf = vec![ | ||
| 129, 10, 0, 21, 1, 4, 2, 117, 1, 14, 12, 2, 0, 3, 243, 30, 9, 56, 9, 57, 31, | ||
| ]; | ||
|
|
||
| // use the DataLink codec to decode the bytes | ||
| // decode the bytes as BACnet/IP frame | ||
| let mut reader = Reader::default(); | ||
|
|
||
| // if the packet is invalid this should panid | ||
| let message = DataLink::decode(&mut reader, &buf).unwrap(); | ||
| let message = IpFrame::decode(&mut reader, &buf).unwrap(); | ||
|
|
||
| println!("{:?}", message) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,11 @@ | ||
| pub mod data_link; | ||
| pub mod ip; | ||
| pub mod mstp; | ||
| pub mod network_pdu; | ||
|
|
||
| pub mod data_link { | ||
| #[deprecated(note = "use IpFrame")] | ||
| pub type DataLink<'a> = super::ip::IpFrame<'a>; | ||
|
|
||
| #[deprecated(note = "use IpDataLinkFunction")] | ||
| pub type DataLinkFunction = super::ip::BvllFunction; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be a crates.io dependency rather