-
Notifications
You must be signed in to change notification settings - Fork 7
modify dissect_packet function #69
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,9 +5,22 @@ | |
| extern crate wasm_bindgen_test; | ||
| use wasm_bindgen_test::*; | ||
|
|
||
| use web_sys::console::error_1; | ||
| use web_sys::console::log_1; | ||
|
|
||
| #[wasm_bindgen_test] | ||
| fn simple_dissect_test() { | ||
| let bytestream = "003096e6fc3900309605283888470001ddff45c0002800030000ff06a4e80a0102010a2200012af90017983210058dd58ea55010102099cd00000000"; | ||
| scalpel::dissect_packet(bytestream.to_string()); | ||
| let encap_type = scalpel::ENCAP_TYPE_ETH; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's indeed not possible to export constants we can ignore this one. I tried around a bit, but couldn't find an easy way to do it. |
||
|
|
||
| match scalpel::dissect_packet(encap_type, bytestream.to_string()) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also add another API something like |
||
| Ok(result) => { | ||
| log_1(&format!("Dissected packet result: {}", result).into()); | ||
| } | ||
| Err(err) => { | ||
| error_1(&format!("Dissect packet failed: {}", err).into()); | ||
| panic!("Dissect packet failed: {}", err); | ||
| } | ||
| } | ||
| assert!(true); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,11 +5,23 @@ | |
| extern crate wasm_bindgen_test; | ||
| use wasm_bindgen_test::*; | ||
|
|
||
| use web_sys::console::error_1; | ||
| use web_sys::console::log_1; | ||
| wasm_bindgen_test_configure!(run_in_browser); | ||
|
|
||
| #[wasm_bindgen_test] | ||
| fn simple_dissect_test() { | ||
| let bytestream = "003096e6fc3900309605283888470001ddff45c0002800030000ff06a4e80a0102010a2200012af90017983210058dd58ea55010102099cd00000000"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible try to add a test case or two for other encap types as well. |
||
| scalpel::dissect_packet(bytestream.to_string()); | ||
| let encap_type = scalpel::ENCAP_TYPE_ETH; | ||
|
|
||
| match scalpel::dissect_packet(encap_type, bytestream.to_string()) { | ||
| Ok(result) => { | ||
| log_1(&format!("Dissected packet result: {}", result).into()); | ||
| } | ||
| Err(err) => { | ||
| error_1(&format!("Dissect packet failed: {}", err).into()); | ||
| panic!("Dissect packet failed: {}", err); | ||
| } | ||
| } | ||
| assert!(true); | ||
| } | ||
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.
This and next
threetwo dependencies should be added only when featurewasmis used.