CIP codec (#564): PatchU16 bounds guard; CipReply content equality; CipPath port/length/ASCII/odd/oversize validation with ArgumentException for malformed tag names and routes; CipPath.MessageRouter/ConnectionManager are now ReadOnlySpan<byte>; refused Forward Open surfaces ForwardOpenRefusedException with structured general/extended status; test CaptureFile uses BinaryPrimitives. EncapsulationClient (#565): frame write bounded by the exchange timeout, which faults (never cancels) the connection; finite positive timeouts enforced at every entry point; gate wait bounded by the timeout; deterministic reorder of the 300 ms test; new dispose-during-drain, gate-wait and RegisterSession zero-context tests. Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Buffers.Binary;
|
||||
namespace ZB.MOM.WW.OtOpcUa.Driver.Ab.Transport.Tests.Captures;
|
||||
|
||||
/// <summary>One EtherNet/IP encapsulation frame from a golden capture.</summary>
|
||||
@@ -30,15 +31,15 @@ internal static class CaptureFile
|
||||
public static byte[] CipPayload(CapturedFrame f)
|
||||
{
|
||||
var b = f.Bytes;
|
||||
var cmd = BitConverter.ToUInt16(b, 0); // test-only; fixtures are LE on a LE host
|
||||
var cmd = BinaryPrimitives.ReadUInt16LittleEndian(b.AsSpan(0));
|
||||
if (cmd is not (0x6F or 0x70)) return []; // only SendRRData / SendUnitData carry CPF items
|
||||
var pos = 24 + 4 + 2; // header + interface handle + timeout
|
||||
var itemCount = BitConverter.ToUInt16(b, pos); pos += 2;
|
||||
var itemCount = BinaryPrimitives.ReadUInt16LittleEndian(b.AsSpan(pos)); pos += 2;
|
||||
byte[] last = [];
|
||||
for (var i = 0; i < itemCount; i++)
|
||||
{
|
||||
var type = BitConverter.ToUInt16(b, pos);
|
||||
var len = BitConverter.ToUInt16(b, pos + 2);
|
||||
var type = BinaryPrimitives.ReadUInt16LittleEndian(b.AsSpan(pos));
|
||||
var len = BinaryPrimitives.ReadUInt16LittleEndian(b.AsSpan(pos + 2));
|
||||
last = b.AsSpan(pos + 4, len).ToArray();
|
||||
if (type == 0x00B1) last = last[2..]; // strip connected sequence count
|
||||
pos += 4 + len;
|
||||
|
||||
Reference in New Issue
Block a user