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
//! `pnio` — pure-Rust PROFINET RT IO-Device stack.
//!
//! Community project, NOT affiliated with or endorsed by PROFIBUS & PROFINET
//! International. "PROFINET" is a registered trademark of PNO.
//!
//! # Example: answer a DCP Identify on the device side
//!
//! ```
//! use pnio::dcp::{handle_dcp_frame, DcpConfig, DeviceProperties};
//! use pnio::eth::MacAddr;
//!
//! let cfg = DcpConfig {
//! mac: MacAddr([0x02, 0xc0, 0xa8, 0x01, 0x0f, 0x02]),
//! properties: DeviceProperties {
//! name_of_station: "i-device".to_string(),
//! type_of_station: "demo".to_string(),
//! vendor_id: 0x002a,
//! device_id: 0x010e,
//! device_role: 0,
//! device_instance: 0x1064,
//! device_options: vec![0x02, 0x07],
//! ip: [192, 168, 1, 61],
//! subnet: [255, 255, 255, 0],
//! gateway: [192, 168, 1, 61],
//! ip_block_info: 1,
//! },
//! };
//!
//! // A DCP Identify request for "i-device" produces an Identify response.
//! let req = [
//! 0x01, 0x0e, 0xcf, 0x00, 0x00, 0x00, 0xec, 0x1c, 0x5d, 0x61, 0xe7, 0x3f, 0x88, 0x92,
//! 0xfe, 0xfe, 0x05, 0x00, 0x03, 0x00, 0x01, 0x52, 0x00, 0x01, 0x00, 0x0c, 0x02, 0x02,
//! 0x00, 0x08, 0x69, 0x2d, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65,
//! ];
//! let resp = handle_dcp_frame(&req, &cfg).unwrap();
//! assert!(resp.is_some());
//! ```
// `unsafe` is confined to the raw-socket / scheduler layer: `eth::afpacket`, `eth::poll`,
// `rt::sched`, `rt::runner`. Every other module is checked by the compiler to contain none.
pub
/// Crate version (foundations smoke test).