Added support for LogonResponseDescriptor, LowerLayerServiceDescriptor, HigherLayersInitializeDescriptor.
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 2m2s

This commit is contained in:
feyris-tan 2025-11-10 20:04:56 +01:00
parent e4d861ef6e
commit 2c4bc0a558
15 changed files with 424 additions and 8 deletions

View File

@ -986,6 +986,17 @@ namespace skyscraper5.Data.PostgreSql
throw new NotImplementedException();
}
public bool TestForTimCorrectionMessageExtension(PhysicalAddress macAddress)
{
throw new NotImplementedException();
}
public void InsertTimCorrectionMessageExtension(PhysicalAddress macAddress,
_0xb1_CorrectionMessageExtensionDescriptor descriptor)
{
throw new NotImplementedException();
}
private bool AreArraysEqual(byte[] l, byte[] r)
{
if (l.Length != r.Length)

View File

@ -40,5 +40,7 @@ namespace skyscraper5.src.InteractionChannel
void OnRcs2Tdt(ushort interactiveNetworkId, Rcs2Tdt tdt);
void OnTransmissionModeSupport2(ushort interactiveNetworkId, Tmst2 tmst2);
void OnFramePayloadFormatAnnouncement(ushort networkId, _0xb7_FramePayloadFormatDescriptor descriptor);
void OnCorrectionMessageExtension(PhysicalAddress macAddress, _0xb1_CorrectionMessageExtensionDescriptor descriptor);
void OnControlAssignment(PhysicalAddress macAddress, _0xa4_SyncAssignDescriptor descriptor);
}
}

View File

@ -12,7 +12,7 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
{
[SkyscraperPlugin]
[TsDescriptor(0xa4,"TIM")]
internal class _0xa4_SyncAssignDescriptor : TsDescriptor
public class _0xa4_SyncAssignDescriptor : TsDescriptor
{
public _0xa4_SyncAssignDescriptor(byte[] buffer)
{

View File

@ -12,7 +12,7 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
{
[SkyscraperPlugin]
[TsDescriptor(0xb1,"TIM")]
internal class _0xb1_CorrectionMessageExtensionDescriptor : TsDescriptor
public class _0xb1_CorrectionMessageExtensionDescriptor : TsDescriptor
{
public _0xb1_CorrectionMessageExtensionDescriptor(byte[] buffer)
{

View File

@ -35,7 +35,7 @@ namespace skyscraper5.src.InteractionChannel.Model
//we don't have a way to read single descriptors so far
byte descriptorTag = ms.ReadUInt8();
byte descriptorLength = ms.ReadUInt8();
if (ms.GetAvailableBytes() < minimumRequiredLength)
if (ms.GetAvailableBytes() < descriptorLength)
{
Valid = false;
return;
@ -188,6 +188,30 @@ namespace skyscraper5.src.InteractionChannel.Model
return;
}
break;
case 0xb9:
Descriptors[i] = new _0xb9_LogonResponseDescriptor(descriptorBuffer);
if (!Descriptors[i].Valid)
{
Valid = false;
return;
}
break;
case 0xbb:
Descriptors[i] = new _0xbb_LowerLayerServiceDescriptor(descriptorBuffer);
if (!Descriptors[i].Valid)
{
Valid = false;
return;
}
break;
case 0xc4:
Descriptors[i] = new _0xc4_HigherLayersInitializeDescriptor(descriptorBuffer);
if (!Descriptors[i].Valid)
{
Valid = false;
return;
}
break;
default:
if (descriptorTag >= 0x00 && descriptorTag <= 0x49)
{
@ -264,6 +288,9 @@ namespace skyscraper5.src.InteractionChannel.Model
byte id = descriptor.GetDescriptorId();
switch(id)
{
case 0xa0:
handler.OnNetworkLayerInfo(macAddress, (_0xa0_NetworkLayerInfoDescriptor)descriptor);
break;
case 0xa1:
if (Broadcast)
{
@ -277,6 +304,9 @@ namespace skyscraper5.src.InteractionChannel.Model
handler.OnCorrectionMessage(macAddress, ((_0xa1_CorrectionMessageDescriptor)descriptor));
}
break;
case 0xa4:
handler.OnControlAssignment(macAddress,(_0xa4_SyncAssignDescriptor)descriptor);
break;
case 0xab:
handler.OnContentionControl(macAddress, ((_0xab_ContentionControlDescriptor)descriptor));
break;
@ -286,8 +316,8 @@ namespace skyscraper5.src.InteractionChannel.Model
case 0xaf:
handler.OnConnectionControl(macAddress, (_0xaf_ConnectionControlDescriptor)descriptor);
break;
case 0xa0:
handler.OnNetworkLayerInfo(macAddress, (_0xa0_NetworkLayerInfoDescriptor)descriptor);
case 0xb1:
handler.OnCorrectionMessageExtension(macAddress, (_0xb1_CorrectionMessageExtensionDescriptor)descriptor);
break;
case 0xb2:
handler.OnReturnTransmissionMOdes(macAddress, (_0xb2_ReturnTransmissionModesDescriptor)descriptor);
@ -298,7 +328,7 @@ namespace skyscraper5.src.InteractionChannel.Model
default:
if (id >= 0xe0 && id <= 0xfe)
break;
throw new NotImplementedException(String.Format("TIM Descriptor 0x{0:X2} is not fully implemented yet. Please share a sample of this stream.", id));
throw new NotImplementedException(String.Format("TIM Descriptor 0x{0:X2} ({1}) is not fully implemented yet. Please share a sample of this stream.", id, descriptor.GetType().Name));
}
}
}

View File

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.IO;
using skyscraper5.Skyscraper.Plugins;
namespace skyscraper8.InteractionChannel.Model2.Descriptors
{
[SkyscraperPlugin]
[TsDescriptor(0xb9,"TIM")]
internal class _0xb9_LogonResponseDescriptor : TsDescriptor
{
public _0xb9_LogonResponseDescriptor(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer, false);
byte byteA = ms.ReadUInt8();
KeepIdentifiersAfterLogoff = (byteA & 0x40) != 0;
PowerControlMode = (EirpControlModes)((byteA & 0x30) >> 4);
RcstAccessStatus = (byteA & 0x0f);
GroupId = ms.ReadUInt8();
LogonId = ms.ReadUInt16BE();
LowestAssignmentId = ms.ReadUInt24BE();
byte byteB = ms.ReadUInt8();
AssignmentIdCount = (byteB & 0xf0) >> 4;
int unicastMac24Count = (byteB & 0x0f);
UnicastMac24s = new Mac24[unicastMac24Count];
for (int i = 0; i < unicastMac24Count; i++)
{
Mac24 child = new Mac24();
UnicastMac24s[i] = child;
child.Mac24PrefixSize = ms.ReadUInt8() & 0x1f;
child.UnicastMac24 = ms.ReadBytes(3);
byte byteC = ms.ReadUInt8();
child.MulticastMappingMethod = (byteC & 0x40) != 0;
child.MulticastIpVersionIndicatorPresence = (byteC & 0x20) != 0;
child.MulticastSynthesisFieldSize = (byteC & 0x1f);
}
DefaultSvnNumber = ms.ReadUInt16BE();
byte reserved = ms.ReadUInt8();
Valid = true;
}
public ushort DefaultSvnNumber { get; set; }
public Mac24[] UnicastMac24s { get; private set; }
public class Mac24
{
public int Mac24PrefixSize { get; set; }
public byte[] UnicastMac24 { get; set; }
public bool MulticastMappingMethod { get; set; }
public bool MulticastIpVersionIndicatorPresence { get; set; }
public int MulticastSynthesisFieldSize { get; set; }
}
public int AssignmentIdCount { get; set; }
public uint LowestAssignmentId { get; set; }
public ushort LogonId { get; set; }
public byte GroupId { get; set; }
public int RcstAccessStatus { get; set; }
public EirpControlModes PowerControlMode { get; set; }
public bool KeepIdentifiersAfterLogoff { get; set; }
public enum EirpControlModes
{
ConstantEirp = 0,
AutonomousEirp = 1,
ConstantPowerSpectrum = 2,
}
}
}

View File

@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.IO;
using skyscraper5.Skyscraper.Plugins;
namespace skyscraper8.InteractionChannel.Model2.Descriptors
{
[SkyscraperPlugin]
[TsDescriptor(0xbb,"TIM")]
internal class _0xbb_LowerLayerServiceDescriptor : TsDescriptor
{
public _0xbb_LowerLayerServiceDescriptor(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer, false);
DefaultControlRandomizationInterval = ms.ReadUInt8();
DynamicRatePersistence = ms.ReadUInt8();
VolumeBacklogPersistence = ms.ReadUInt8();
int lowerLayerServiceCount = (ms.ReadUInt8() & 0x0f);
LowerLayerServices = new LowerLayerService[lowerLayerServiceCount];
for (int a = 0; a < lowerLayerServiceCount; a++)
{
LowerLayerService child = new LowerLayerService();
LowerLayerServices[a] = child;
byte byteA = ms.ReadUInt8();
child.LowerLayerServiceIndex = (byteA & 0x3c) >> 2;
bool randomAccess = (byteA & 0x02) != 0;
bool dedicatedAccess = (byteA & 0x01) != 0;
if (dedicatedAccess)
{
child.DedicatedAccess = new DedicatedAccessClass();
byteA = ms.ReadUInt8();
child.DedicatedAccess.NominalRcIndex = (byteA & 0xf0) >> 4;
child.DedicatedAccess.NominalDaAcIndex = (byteA & 0x0f);
child.DedicatedAccess.ConditionalDemandRcMap = ms.ReadUInt16BE();
child.DedicatedAccess.ConditionalSchedulerDaAcMap = ms.ReadUInt16BE();
}
if (randomAccess)
{
child.RandomAccess = new RandomAccessClass();
child.RandomAccess.NominalRaAcIndex = (byteA & 0x0f);
child.RandomAccess.ConditionalSchedulerRaAcMap = ms.ReadUInt8();
}
}
int rcCount = (ms.ReadUInt8() & 0x0f);
Rcs = new RcClass[rcCount];
for (int c = 0; c < rcCount; c++)
{
RcClass child = new RcClass();
Rcs[c] = child;
byte byteB = ms.ReadUInt8();
child.RcIndex = (byteB & 0xf0) >> 4;
bool constantAssignmentProvided = (byteB & 0x04) != 0;
bool volumeAllowed = (byteB & 0x02) != 0;
child.RbdcAllowed = (byteB & 0x01) != 0;
child.MaximumServiceRate = ms.ReadUInt16BE();
child.MinimumServiceRate = ms.ReadUInt16BE();
if (constantAssignmentProvided)
{
child.ConstantServiceRate = ms.ReadUInt16BE();
}
if (volumeAllowed)
{
child.MaximumBacklog = ms.ReadUInt8();
}
}
int raAcCount = (ms.ReadUInt8() & 0x0f);
RaRcs = new RaAcClass[raAcCount];
for (int b = 0; b < raAcCount; b++)
{
RaAcClass child = new RaAcClass();
RaRcs[b] = child;
child.RaAcIndex = (ms.ReadUInt8() & 0x0f);
child.MaxUniquePayloadPerBlock = ms.ReadUInt8();
child.MaxConsecutiveBlockAccessed = ms.ReadUInt8();
child.MinIdleBlock = ms.ReadUInt8();
byte defaultsFieldSize = ms.ReadUInt8();
child.DefaultsForRaLoadControl = ms.ReadBytes(defaultsFieldSize);
}
Valid = true;
}
public RaAcClass[] RaRcs { get; private set; }
public RcClass[] Rcs { get; private set; }
public LowerLayerService[] LowerLayerServices { get; set; }
public byte VolumeBacklogPersistence { get; set; }
public byte DynamicRatePersistence { get; set; }
public byte DefaultControlRandomizationInterval { get; set; }
public class LowerLayerService
{
public int LowerLayerServiceIndex { get; set; }
public DedicatedAccessClass DedicatedAccess { get; set; }
public RandomAccessClass RandomAccess { get; set; }
}
public class DedicatedAccessClass
{
public int NominalRcIndex { get; set; }
public int NominalDaAcIndex { get; set; }
public ushort ConditionalDemandRcMap { get; set; }
public ushort ConditionalSchedulerDaAcMap { get; set; }
}
public class RandomAccessClass
{
public int NominalRaAcIndex { get; set; }
public byte ConditionalSchedulerRaAcMap { get; set; }
}
public class RcClass
{
public int RcIndex { get; set; }
public bool RbdcAllowed { get; set; }
public ushort MaximumServiceRate { get; set; }
public ushort MinimumServiceRate { get; set; }
public ushort? ConstantServiceRate { get; set; }
public byte? MaximumBacklog { get; set; }
}
public class RaAcClass
{
public int RaAcIndex { get; set; }
public byte MaxUniquePayloadPerBlock { get; set; }
public byte MaxConsecutiveBlockAccessed { get; set; }
public byte MinIdleBlock { get; set; }
public byte[] DefaultsForRaLoadControl { get; set; }
}
}
}

View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.IO;
using skyscraper5.Skyscraper.Plugins;
using skyscraper8.GSE.GSE;
namespace skyscraper8.InteractionChannel.Model2.Descriptors
{
[SkyscraperPlugin]
[TsDescriptor(0xc4,"TIM")]
internal class _0xc4_HigherLayersInitializeDescriptor : TsDescriptor
{
public _0xc4_HigherLayersInitializeDescriptor(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer, false);
int satL2ifCount = (ms.ReadUInt8() & 0x0f);
Layer2Interfaces = new Layer2Interface[satL2ifCount];
for (int i = 0; i < satL2ifCount; i++)
{
Layer2Interface child = new Layer2Interface();
Layer2Interfaces[i] = child;
child.Mac24 = ms.ReadBytes(3);
child.Ipv4McAddress = new IPAddress(ms.ReadBytes(4));
child.OfferStreamIpv4Adress = new IPAddress(ms.ReadBytes(4));
child.OfferStreamPort = ms.ReadUInt16BE();
child.HigherLayerPepSwitchOff = (ms.ReadUInt8() & 0x01) != 0;
}
Valid = true;
}
public Layer2Interface[] Layer2Interfaces { get; set; }
public class Layer2Interface
{
public byte[] Mac24 { get; set; }
public IPAddress Ipv4McAddress { get; set; }
public IPAddress OfferStreamIpv4Adress { get; set; }
public ushort OfferStreamPort { get; set; }
public bool HigherLayerPepSwitchOff { get; set; }
}
}
}

View File

@ -59,6 +59,16 @@ namespace skyscraper5.src.InteractionChannel
}
public void OnCorrectionMessageExtension(PhysicalAddress macAddress, _0xb1_CorrectionMessageExtensionDescriptor descriptor)
{
}
public void OnControlAssignment(PhysicalAddress macAddress, _0xa4_SyncAssignDescriptor descriptor)
{
}
public void OnFrameComposition2(ushort? networkId, Fct2 fct2)
{

View File

@ -2534,7 +2534,26 @@ namespace skyscraper5.Skyscraper.Scraper
}
}
}
public void OnCorrectionMessage(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd)
public void OnCorrectionMessageExtension(PhysicalAddress macAddress, _0xb1_CorrectionMessageExtensionDescriptor descriptor)
{
if (!DataStorage.TestForTimCorrectionMessageExtension(macAddress))
{
LogEvent(SkyscraperContextEvent.TimCorrectionExtension, String.Format("For participant {0}", macAddress));
DataStorage.InsertTimCorrectionMessageExtension(macAddress, descriptor);
}
}
public void OnControlAssignment(PhysicalAddress macAddress, _0xa4_SyncAssignDescriptor descriptor)
{
if (!DataStorage.TestForTimControlAssignment(macAddress))
{
LogEvent(SkyscraperContextEvent.TimControlAssignment, String.Format("For participant {0}", macAddress));
DataStorage.InsertTimControlAssignment(macAddress, descriptor);
}
}
public void OnCorrectionMessage(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd)
{
if (!DataStorage.TestForTim(mac))
{

View File

@ -93,6 +93,8 @@
Rcs2Network,
Rcs2TdtTime,
TransmissionModeSupport2,
TimFramePayloadFormat
TimFramePayloadFormat,
TimCorrectionExtension,
TimControlAssignment
}
}

View File

@ -210,5 +210,9 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
void InsertTmst2(ushort interactiveNetworkId, Tmst2.TransmissionMode mode);
bool TestForTimFramePayloadFormat(ushort networkId, _0xb7_FramePayloadFormatDescriptor.TransmissionContext transmissionContext);
void InsertTimFramePayloadFormat(ushort networkId, _0xb7_FramePayloadFormatDescriptor.TransmissionContext transmissionContext);
bool TestForTimCorrectionMessageExtension(PhysicalAddress macAddress);
void InsertTimCorrectionMessageExtension(PhysicalAddress macAddress, _0xb1_CorrectionMessageExtensionDescriptor descriptor);
bool TestForTimControlAssignment(PhysicalAddress macAddress);
void InsertTimControlAssignment(PhysicalAddress macAddress, _0xa4_SyncAssignDescriptor descriptor);
}
}

View File

@ -1224,6 +1224,27 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
throw new NotImplementedException();
}
public bool TestForTimCorrectionMessageExtension(PhysicalAddress macAddress)
{
throw new NotImplementedException();
}
public void InsertTimCorrectionMessageExtension(PhysicalAddress macAddress,
_0xb1_CorrectionMessageExtensionDescriptor descriptor)
{
throw new NotImplementedException();
}
public bool TestForTimControlAssignment(PhysicalAddress macAddress)
{
throw new NotImplementedException();
}
public void InsertTimControlAssignment(PhysicalAddress macAddress, _0xa4_SyncAssignDescriptor descriptor)
{
throw new NotImplementedException();
}
public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt()
{
throw new NotImplementedException();

View File

@ -1097,6 +1097,41 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
_timFramePayloadFormats.Add(key, transmissionContext);
}
private Dictionary<PhysicalAddress, _0xb1_CorrectionMessageExtensionDescriptor> _timCorrectionMessageExtensions;
public bool TestForTimCorrectionMessageExtension(PhysicalAddress macAddress)
{
if (_timCorrectionMessageExtensions == null)
return false;
return _timCorrectionMessageExtensions.ContainsKey(macAddress);
}
public void InsertTimCorrectionMessageExtension(PhysicalAddress macAddress,
_0xb1_CorrectionMessageExtensionDescriptor descriptor)
{
if (_timCorrectionMessageExtensions == null)
_timCorrectionMessageExtensions = new Dictionary<PhysicalAddress, _0xb1_CorrectionMessageExtensionDescriptor>();
_timCorrectionMessageExtensions.Add(macAddress, descriptor);
}
private Dictionary<PhysicalAddress, _0xa4_SyncAssignDescriptor> _timControlAssignments;
public bool TestForTimControlAssignment(PhysicalAddress macAddress)
{
if (_timControlAssignments == null)
return false;
return _timControlAssignments.ContainsKey(macAddress);
}
public void InsertTimControlAssignment(PhysicalAddress macAddress, _0xa4_SyncAssignDescriptor descriptor)
{
if (_timControlAssignments == null)
_timControlAssignments = new Dictionary<PhysicalAddress, _0xa4_SyncAssignDescriptor>();
_timControlAssignments.Add(macAddress, descriptor);
}
public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt()
{
for (int x = 0; x < pmtEntries.Length; x++)

View File

@ -236,6 +236,16 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
Score++;
}
public void OnCorrectionMessageExtension(PhysicalAddress macAddress, _0xb1_CorrectionMessageExtensionDescriptor descriptor)
{
//TODO: put some sensible validation logic in here.
}
public void OnControlAssignment(PhysicalAddress macAddress, _0xa4_SyncAssignDescriptor descriptor)
{
//TODO: put some sensible validation logic in here
}
public void OnFrameComposition2(ushort? networkId, Fct2 fct2)
{
if (fct2.FrameTypes.Length > 0)