[−][src]Module sacn_unofficial::packet
The packet module handles the sACN packets including parsing/packing and sACN related constants. Parsing of sacn network packets.
The packets live within the scope of the ACN protocol suite.
Examples
#[cfg(feature = "std")] let packet = AcnRootLayerProtocol { pdu: E131RootLayer { cid: Uuid::new_v4(), data: E131RootLayerData::DataPacket(DataPacketFramingLayer { source_name: "Source_A".into(), priority: 100, synchronization_address: 7962, sequence_number: 154, preview_data: false, stream_terminated: false, force_synchronization: false, universe: 1, data: DataPacketDmpLayer { property_values: vec![0, 1, 2, 3].into(), }, }), }, }; let mut buf = [0; 638]; packet.pack(&mut buf).unwrap(); assert_eq!( AcnRootLayerProtocol::parse(&buf).unwrap(), packet );
Structs
AcnRootLayerProtocol | Root layer protocol of the Architecture for Control Networks (ACN) protocol. |
DataPacketDmpLayer | Device Management Protocol PDU with SET PROPERTY vector. |
DataPacketFramingLayer | Framing layer PDU for sACN data packets. |
E131RootLayer | Root layer protocol data unit (PDU). |
SynchronizationPacketFramingLayer | sACN synchronization packet PDU. |
UniverseDiscoveryPacketFramingLayer | Framing layer PDU for sACN universe discovery packets. |
UniverseDiscoveryPacketUniverseDiscoveryLayer | Universe discovery layer PDU. |
Enums
E131RootLayerData | Payload of the Root Layer PDU. |
Constants
ACN_SDT_MULTICAST_PORT | The port number used for the ACN family of protocols and therefore the sACN protocol. As defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative) |
DISCOVERY_UNI_PER_PAGE | The maximum number of universes per page in a universe discovery packet. |
E131_CID_FIELD_LENGTH | The E131 CID field length in bytes as per ANSI E1.31-2018 Section 4 Table 4-1, 4-2, 4-3. |
E131_DEFAULT_PRIORITY | The default priority used for the E1.31 packet priority field, as per ANSI E1.31-2018 Section 4.1 Table 4-1 |
E131_DISCOVERY_UNIVERSE | The universe used for universe discovery as defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative) |
E131_FORCE_SYNCHRONISATION_OPTION_BIT_MASK | The bit mask used to get the force-synchronisation option within the packet option field as per ANSI E1.31-2018 Section 6.2.6 |
E131_FRAMING_LAYER_VECTOR_LENGTH | The length in bytes of the E1.31 framing layer vector field as per ANSI E1.31-2018 Section 4 Table 4-1, 4-2, 4-3. |
E131_MAX_MULTICAST_UNIVERSE | The maximum universe number that can be used with the E1.31 protocol as specified in section 9.1.1 of ANSI E1.31-2018. |
E131_MAX_PRIORITY | The maximum allowed priority for a E1.31 packet, as per ANSI E1.31-2018 Section 6.2.3 |
E131_MIN_MULTICAST_UNIVERSE | The lowest / minimum universe number that can be used with the E1.31 protocol as specified in section 9.1.1 of ANSI E1.31-2018. |
E131_MULTICAST_IPV4_HIGHEST_BYTE | Value of the highest byte of the IPV4 multicast address as specified in section 9.3.1 of ANSI E1.31-2018. |
E131_MULTICAST_IPV4_SECOND_BYTE | Value of the second highest byte of the IPV4 multicast address as specified in section 9.3.1 of ANSI E1.31-2018. |
E131_NETWORK_DATA_LOSS_TIMEOUT | The timeout before data loss is assumed for an E131 source, as defined in Appendix A of ANSI E1.31-2018. |
E131_NO_SYNC_ADDR | The synchronisation address used to indicate that there is no synchronisation required for the data packet. As defined in ANSI E1.31-2018 Section 6.2.4.1 |
E131_PDU_FLAGS | The pdu flags expected for an ANSI E1.31-2018 packet as per ANSI E1.31-2018 Section 4 Table 4-1, 4-2, 4-3. |
E131_PDU_LENGTH_FLAGS_LENGTH | The length of the pdu flags and length field in bytes. |
E131_PREVIEW_DATA_OPTION_BIT_MASK | The bit mask used to get the preview-data option within the packet option field as per ANSI E1.31-2018 Section 6.2.6 |
E131_ROOT_LAYER_VECTOR_LENGTH | The length in bytes of the root layer vector field as per ANSI E1.31-2018 Section 4 Table 4-1, 4-2, 4-3. |
E131_SEQ_DIFF_DISCARD_LOWER_BOUND | The exclusive lower bound on the different between the received and expected sequence numbers within which a packet will be discarded. Outside of the range specified by (E131_SEQ_DIFF_DISCARD_LOWER_BOUND, E131_SEQ_DIFF_DISCARD_UPPER_BOUND] the packet won't be discarded. |
E131_SEQ_DIFF_DISCARD_UPPER_BOUND | The inclusive upper bound on the different between the received and expected sequence numbers within which a packet will be discarded. Outside of the range specified by (E131_SEQ_DIFF_DISCARD_LOWER_BOUND, E131_SEQ_DIFF_DISCARD_UPPER_BOUND] the packet won't be discarded. |
E131_SOURCE_NAME_FIELD_LENGTH | The length of the Source Name field in bytes in an ANSI E1.31-2018 packet as per ANSI E1.31-2018 Section 4, Table 4-1, 4-2, 4-3. |
E131_STREAM_TERMINATION_OPTION_BIT_MASK | The bit mask used to get the stream-termination option within the packet option field as per ANSI E1.31-2018 Section 6.2.6 |
E131_SYNC_ADDR_FIELD_LENGTH | The length of the Synchronisation Address field in bytes in an ANSI E1.31-2018 packet as per ANSI E1.31-2018 Section 4, Table 4-1, 4-2, 4-3. |
E131_TERMINATE_STREAM_PACKET_COUNT | The number of stream termination packets sent when a source terminates a stream. Set to 3 as per section 6.2.6 , Stream_Terminated: Bit 6 of ANSI E1.31-2018. |
E131_UNIVERSE_DISCOVERY_FRAMING_LAYER_MIN_LENGTH | The minimum expected value of the framing layer length field for a discovery packet. 84 bytes as per ANSI E1.31-2018 Section 4.3 Table 4-3. |
E131_UNIVERSE_DISCOVERY_INTERVAL | The interval between universe discovery packets (adverts) as defined by ANSI E1.31-2018 Appendix A. |
E131_UNIVERSE_DISCOVERY_LAYER_MAX_LENGTH | The maximum allowed length of the discovery layer of an ANSI E1.31-2018 universe discovery packet. As per ANSI E1.31-2018 Section 8 Table 8-9. |
E131_UNIVERSE_DISCOVERY_LAYER_MIN_LENGTH | The minimum allowed length of the discovery layer of an ANSI E1.31-2018 universe discovery packet. As per ANSI E1.31-2018 Section 8 Table 8-9. |
E131_UNIVERSE_SYNC_PACKET_FRAMING_LAYER_LENGTH | The expected value of the framing layer length field for a synchronisation packet. 11 bytes as per ANSI E1.31-2018 Section 4.2 Table 4-2. |
E131_UNIVERSE_SYNC_PACKET_ROOT_LENGTH | The expected value of the root layer length field for a synchronisation packet. 33 bytes as per ANSI E1.31-2018 Section 4.2 Table 4-2. |
NO_SYNC_UNIVERSE | The synchronisation universe/address of packets which do not require synchronisation as specified in section 6.2.4.1 of ANSI E1.31-2018. |
STARTING_SEQUENCE_NUMBER | The initial/starting sequence number used. |
UNIVERSE_CHANNEL_CAPACITY | The payload capacity for a sacn packet, for DMX data this would translate to 512 frames + a startcode byte. |
UNIVERSE_DISCOVERY_SOURCE_TIMEOUT | The timeout before a discovered source is assumed to be lost as defined in section 12.2 of ANSI E1.31-2018. |
VECTOR_DMP_SET_PROPERTY | Used at the DMP layer in E1.31 data packets to identify the packet as a set property message. Not to be confused with the other VECTOR values used at the E1.31, ACN etc. layers. Value as defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative). |
VECTOR_E131_DATA_PACKET | The E1.31 packet vector field value used to identify the E1.31 packet as a data packet. This is used at the E1.31 layer and shouldn't be confused with the VECTOR values used for the ACN layer (i.e. VECTOR_ROOT_E131_DATA and VECTOR_ROOT_E131_EXTENDED). This VECTOR value is shared by E1.31 universe discovery packets, distinguished by the value of the ACN ROOT_VECTOR. Value as defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative). |
VECTOR_E131_EXTENDED_DISCOVERY | The E1.31 packet vector field value used to identify the E1.31 packet as a universe discovery packet. This is used at the E1.31 layer and shouldn't be confused with the VECTOR values used for the ACN layer (i.e. VECTOR_ROOT_E131_DATA and VECTOR_ROOT_E131_EXTENDED). This VECTOR value is shared by E1.31 data packets, distinguished by the value of the ACN ROOT_VECTOR. Value as defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative). |
VECTOR_E131_EXTENDED_SYNCHRONIZATION | The E1.31 packet vector field value used to identify the E1.31 packet as a synchronisation packet. This is used at the E1.31 layer and shouldn't be confused with the VECTOR values used for the ACN layer (i.e. VECTOR_ROOT_E131_DATA and VECTOR_ROOT_E131_EXTENDED). Value as defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative). |
VECTOR_ROOT_E131_DATA | The vector field value used to identify the ACN packet as an ANSI E1.31 data packet. This is used at the ACN packet layer not the E1.31 layer. Value as defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative). |
VECTOR_ROOT_E131_EXTENDED | The vector field value used to identify the packet as an ANSI E1.31 universe discovery or synchronisation packet. This is used at the ACN packet layer not the E1.31 layer. Value as defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative). |
VECTOR_UNIVERSE_DISCOVERY_UNIVERSE_LIST | Used at the universe discovery packet universe discovery layer to identify the packet as a universe discovery list of universes. Not to be confused with the other VECTOR values used at the E1.31, ACN, DMP, etc. layers. Value as defined in ANSI E1.31-2018 Appendix A: Defined Parameters (Normative). |
Functions
is_universe_in_range | Checks if the given universe is a valid universe to send on (within allowed range). |
universe_to_ipv4_multicast_addr | Converts the given ANSI E1.31-2018 universe into an Ipv4 multicast address with the port set to the acn multicast port as defined in packet::ACN_SDT_MULTICAST_PORT. |
universe_to_ipv6_multicast_addr | Converts the given ANSI E1.31-2018 universe into an Ipv6 multicast address with the port set to the acn multicast port as defined in packet::ACN_SDT_MULTICAST_PORT. |