Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scapy/contrib/pnio_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1353,8 +1353,9 @@ class PNIORealTimeAcyclicPDUHeader(Packet):
# IEC-61158-6-10:2021, Table 241
ShortField("AlarmDstEndpoint", 0),
ShortField("AlarmSrcEndpoint", 0),
BitEnumField("PDUTypeType", 0, 4, PDU_TYPE_TYPE),
# PDUType: Version in bits 4-7, Type in bits 0-3
BitEnumField("PDUTypeVersion", 0, 4, PDU_TYPE_VERSION),
BitEnumField("PDUTypeType", 0, 4, PDU_TYPE_TYPE),
BitField("AddFlags", 0, 8),
XShortField("SendSeqNum", 0),
XShortField("AckSeqNum", 0),
Expand Down
6 changes: 6 additions & 0 deletions test/contrib/pnio_rpc.uts
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,12 @@ p = Ether(b'\x00\x11\x22\x33\x44\x55' \
assert p[Alarm_Low].RTA_SDU is None
assert AlarmNotification_Low not in p
assert len(p[Padding].load) == 32
assert p[Alarm_Low].PDUTypeType == 3
assert p[Alarm_Low].PDUTypeVersion == 1

= PNIO Alarm building writes the PDU type in the low nibble
p = Alarm_Low(PDUTypeType=2, PDUTypeVersion=1)
assert raw(p)[4:5] == b'\x12'

= PNIO Alarm building computes VarPartLen
p = Alarm_High(RTA_SDU=AlarmNotification_High(AlarmType=3))
Expand Down
Loading