Network Objects#
TCP/IP Interface, Ethernet Link, and Time Sync objects.
[ODVA CIP Vol 2] Wrapper for the CIP TCP/IP Interface Object (class 0xF5).
Instance attributes and the Get_Attributes_All reply layout are defined according to §5-4.3.2 and §5-4.4.2 (Tables 5-4.8 and 5-4.13).
- class icspacket.proto.cip.objects.tcpip.InterfaceConfiguration(ip_address: int, network_mask: int, gateway: int, name_server: int, name_server_2: int, domain_name: str)[source]#
TCP/IP Interface Object Attribute 5, Interface Configuration.
(See CIP Vol 2, §5-4.3.2.5, Table 5-4.8)
- ip_address: int#
This device’s own IPv4 address.
- network_mask: int#
This device’s IPv4 network mask.
- gateway: int#
Address of this device’s default gateway – the router it hands off traffic to for destinations outside the local subnet.
- name_server: int#
Address of the primary name server this device is configured to query.
- name_server_2: int#
Address of the secondary name server this device is configured to query.
- domain_name: str#
Default domain name configured on this device.
- class icspacket.proto.cip.objects.tcpip.TCPIPAttributes(status: int, configuration_capability: int, configuration_control: int, physical_link_object: EPATH, interface_configuration: InterfaceConfiguration | None, host_name: str, extra: bytes = b'')[source]#
Instance-level Get_Attributes_All reply (See CIP Vol 2, §5-4.4.2, Table 5-4.13).
Trailing attributes beyond
host_name(Safety Network Number, TTL, Mcast Config, ACD status, QuickConnect, Encapsulation Inactivity Timeout) are vendor/implementation dependent and are exposed verbatim viaextrarather than individually decoded.
- class icspacket.proto.cip.objects.tcpip.TCPIPInterfaceObject(connection: CIP_Connection, instance: int = 1)[source]#
Typed access to TCP/IP Interface attributes (See CIP Vol 2, §5-4.3.2, Table 5-4.3).
- status: CIPAttribute[int]#
Interface status (attribute 1).
- configuration_capability: CIPAttribute[int]#
Configuration capability flags (attribute 2).
- configuration_control: CIPAttribute[int]#
Configuration control flags (attribute 3).
- physical_link_object: CIPAttribute[EPATH]#
Physical Link Object path (attribute 4).
- interface_configuration: CIPAttribute[InterfaceConfiguration]#
Interface Configuration structure (attribute 5).
- host_name: CIPAttribute[str]#
Host Name string (attribute 6).
- get_attributes() TCPIPAttributes[source]#
Read and decode Get_Attributes_All for TCP/IP Interface.
[ODVA CIP Vol 2] Wrapper for the CIP Ethernet Link Object (class 0xF6).
Instance attributes and counter block layouts are defined according to §5-5.3.2 (Table 5-5.3) and §5-5.3.2.4/.5.
- class icspacket.proto.cip.objects.ethlink.EthernetLinkAttributes(interface_speed: int, interface_flags: int, physical_address: bytes, interface_counters: list[int] | None, media_counters: list[int] | None, extra: bytes = b'')[source]#
Instance-level Get_Attributes_All reply (See CIP Vol 2, §5-5.3.2, Table 5-5.3).
Attributes 6-11 (Interface Control, Interface Type, Interface State, Admin State, Interface Label, Interface Capability) are optional/ conditional and variably sized; they are exposed verbatim via
extrarather than individually decoded.
- class icspacket.proto.cip.objects.ethlink.EthernetLinkObject(connection: CIP_Connection, instance: int = 1)[source]#
Typed access to Ethernet Link attributes (See CIP Vol 2, §5-5.3.2, Table 5-5.3).
- interface_speed: CIPAttribute[int]#
Interface speed in Mbps (attribute 1).
- interface_flags: CIPAttribute[int]#
Interface flags (attribute 2).
- physical_address: CIPAttribute[bytes]#
Physical MAC address (attribute 3).
- interface_counters: CIPAttribute[Collection[int]]#
Interface counters block (attribute 4).
- media_counters: CIPAttribute[Collection[int]]#
Media counters block (attribute 5).
- interface_control: CIPAttribute[bytes]#
Interface control bytes (attribute 6).
- interface_type: CIPAttribute[int]#
Interface type (attribute 7).
- interface_state: CIPAttribute[int]#
Interface state (attribute 8).
- administrative_state: CIPAttribute[int]#
Administrative state (attribute 9).
- interface_label: CIPAttribute[str]#
Human-readable interface label (attribute 10).
- get_attributes() EthernetLinkAttributes[source]#
Read and decode Get_Attributes_All for Ethernet Link.
[ODVA CIP Vol 1] Wrapper for the Time Sync Object (class 0x43, §5-47).
Provides a CIP interface to the IEEE 1588 (PTP) clock of a CIP Sync capable device: clock synchronization status, offsets, and Grandmaster/Parent/Local clock property structs.
- class icspacket.proto.cip.objects.timesync.ClockInfo(identifier: bytes, stratum: int, variance: int, communication_technology: int, port_id: int, uuid: bytes)[source]#
Grandmaster/Local Clock Info payload shape (attributes 8 and 10, See §5-47.13.1.8/.10).
- identifier: bytes#
4-character clock identifier (e.g.
b"DFLT").
- communication_technology: int#
Clock communication technology specifier (See Table 5-47.5).
- uuid: bytes#
CommunicationTechnology + UUID + PortID make up the clock’s UUID (See Table 5-47.6).
- class icspacket.proto.cip.objects.timesync.ParentClockInfo(reserved: int, observed_drift: int, observed_variance: int, variance: int, communication_technology: int, port_id: int, uuid: bytes)[source]#
Parent Clock Info payload shape (attribute 9, See §5-47.13.1.9).
- class icspacket.proto.cip.objects.timesync.TimeSyncObject(connection: CIP_Connection, instance: int = 1)[source]#
Provides a CIP interface to an IEEE 1588 (PTP) clock (See CIP Vol 1, §5-47).
Any CIP Sync capable device provides a single instance (instance 1) of this object.
port_state/port_enable/port_burst_enableare INT-count-prefixed SINT arrays sized bynumber_of_ports, which caterpillar decodes directly (the count prefix lives inside the same attribute payload, unlike the cross-attribute-dependent fields seen in other objects).- enable_ptp: CIPAttribute[int]#
Enables (1) or disables (0) the Precision Time Protocol on this device (attribute 1).
- is_synchronized: CIPAttribute[int]#
1 if the local clock is synchronized with the reference clock (attribute 2).
- current_time_microseconds: CIPAttribute[int]#
Current local_time in microseconds since 1970-01-01 00:00 UTC (attribute 3).
- current_time_nanoseconds: CIPAttribute[int]#
Current local_time in nanoseconds since 1970-01-01 00:00 UTC (attribute 4).
- offset_to_master: CIPAttribute[int]#
Deviation between the local clock and the reference clock, in nanoseconds (attribute 5).
- max_offset_to_master: CIPAttribute[int]#
Maximum offset_to_master seen since last reinitialized; settable to reset it (attribute 6).
- delay_to_master: CIPAttribute[int]#
Path delay between the local clock and master clock, in nanoseconds (attribute 7).
- grandmaster_clock_info: CIPAttribute[ClockInfo]#
Property info of the Grandmaster PTP clock (attribute 8).
- parent_clock_info: CIPAttribute[ParentClockInfo]#
Property info of the Parent PTP clock (attribute 9).
- local_clock_info: CIPAttribute[ClockInfo]#
Property info of the Local PTP clock (attribute 10).
- number_of_ports: CIPAttribute[int]#
Number of PTP ports implemented by this clock (attribute 11).
- port_state: CIPAttribute[Collection[int]]#
Per-port PTP state, one entry per
number_of_ports(attribute 12).
- port_enable: CIPAttribute[Collection[int]]#
Per-port enable status, one entry per
number_of_ports(attribute 13).
- port_burst_enable: CIPAttribute[Collection[int]]#
Per-port burst-enable status, one entry per
number_of_ports(attribute 14).
- sync_interval: CIPAttribute[int]#
PTP Sync message interval (attribute 15).
- preferred_master: CIPAttribute[int]#
Designates this clock as a preferred PTP master when non-zero (attribute 16).
- subdomain: CIPAttribute[bytes]#
Fixed 16-byte PTP clock subdomain name (attribute 17).
- clock_mode: CIPAttribute[int]#
0=Slave Only/Ordinary, 1=Master Capable/Ordinary, 2=Master Capable/Boundary (attribute 18).
- steps_removed: CIPAttribute[int]#
Number of communication paths between the local clock and the grandmaster clock (attribute 19, optional).
- system_time_offset: CIPAttribute[int]#
Offset applied to the local clock under the CIP Sync offset clock model (attribute 20, optional).
- initialize() bytes[source]#
Invoke Initialize (service 0x4B), resetting the PTP clock to its power-up state and re-synchronizing.
- management_message(request_data: bytes) bytes[source]#
Invoke ManagementMessage (service 0x4A) with a caller-built native PTP management message payload.
The full set of PTP management commands (See Table 5-47.11, e.g.
ObtainIdentity,SetSyncInterval,EnablePort) is defined by the IEEE 1588 standard rather than this library, so the request/response payload is passed through unmodified.