Reworked the database handling for TIMs.
Some checks failed
🚀 Pack skyscraper8 / make-zip (push) Failing after 1m48s

This commit is contained in:
feyris-tan 2026-03-21 22:38:16 +01:00
parent 5d0da389a6
commit 7e7a3f86dd
36 changed files with 539 additions and 791 deletions

View File

@ -152,8 +152,8 @@ namespace skyscraper8.GS.GSE_BFBS
{
throw new NotImplementedException("Found a TIM-U Table with a 3-byte GSE Label in this stream. This is not supported yet, please share a sample of this stream.");
}
tim.Handle(physicalAddress, gseTableStructure.InteractiveNetworkId, Context.Rcs2Output);
Context.Rcs2Output.OnTerminalInformationMessage(gseTableStructure.InteractiveNetworkId, physicalAddress, tim);
return;
case 0xc0:
//User defined, we have no way of knowing what this is.

View File

@ -25,27 +25,14 @@ namespace skyscraper5.src.InteractionChannel
void OnSuperframeComposition(ushort interactiveNetworkId, Sct sct);
void OnTerminalBurstTimePlan(ushort interactiveNetworkId, Tbtp tbtp);
void OnTimeslotComposition(ushort interactiveNetworkId, Tct tct);
void OnCorrectionMessage(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd);
void OnContentionControl(PhysicalAddress macAddress, _0xab_ContentionControlDescriptor ccd);
void OnCorrectionControl(PhysicalAddress macAddress, _0xac_CorrectionControlDescriptor descriptor);
void OnNetworkLayerInfo(PhysicalAddress macAddress, _0xa0_NetworkLayerInfoDescriptor descriptor);
void OnTransmissionModeSupport(ushort interactiveNetworkId, Tmst tmst);
int GetRmtTransmissionStandard(ushort networkId);
void OnReturnTransmissionMOdes(PhysicalAddress macAddress, _0xb2_ReturnTransmissionModesDescriptor descriptor);
void OnConnectionControl(PhysicalAddress macAddress, _0xaf_ConnectionControlDescriptor descriptor);
void OnTerminalBurstTimePlan2(ushort interactiveNetworkId, Tbtp2 tbtp2);
void OnFrameComposition2(ushort networkId, Fct2 fct2);
void OnBroadcastConfiguration(ushort networkId, Bct bct);
void OnRcs2Nit(ushort interactiveNetworkId, RcsNit nit);
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);
void OnSatelliteReturnLink(PhysicalAddress macAddress, _0xa9_SatelliteReturnLinkDescriptor descriptor);
void OnLowerLayerService(PhysicalAddress macAddress, _0xbb_LowerLayerServiceDescriptor descriptor);
void OnHigherLayerInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor descriptor);
void LogonResponseDescriptor(PhysicalAddress macAddress, _0xb9_LogonResponseDescriptor descriptor);
void OnForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor descriptor);
void OnTerminalInformationMessage(ushort interactiveNetworkId, PhysicalAddress physicalAddress, Tim tim);
}
}

View File

@ -280,7 +280,11 @@ namespace skyscraper5.src.InteractionChannel
_handler.OnInteractionChannelError(InteractionChannelErrorState.TimInvalid);
return;
}
tim.Handle(timHeader.MacAddress, NetworkId, Handler);
if (!NetworkId.HasValue)
{
return;
}
_handler.OnTerminalInformationMessage(NetworkId.Value, timHeader.MacAddress, tim);
return;
case 0xB1: //LL_FEC_parity_data_table
throw new NotImplementedException("LL_FEC_parity_data_table");

View File

@ -1,4 +1,5 @@
using skyscraper5.Mpeg2;
using Newtonsoft.Json;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.Plugins;
using System;
using System.Collections.Generic;
@ -12,12 +13,35 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
[TsDescriptor(0xa0,"TIM")]
public class _0xa0_NetworkLayerInfoDescriptor : TsDescriptor
{
public _0xa0_NetworkLayerInfoDescriptor(byte[] buffer)
[JsonConstructor]
public _0xa0_NetworkLayerInfoDescriptor(byte[] MessageBuffer)
{
MessageBuffer = (byte[])buffer.Clone();
this.MessageBuffer = (byte[])MessageBuffer.Clone();
Valid = true;
}
public byte[] MessageBuffer { get; }
public override bool DescriptorEquals(TsDescriptor thatDescriptor)
{
_0xa0_NetworkLayerInfoDescriptor? that = thatDescriptor as _0xa0_NetworkLayerInfoDescriptor;
if (that == null)
return false;
if (this.MessageBuffer.Length != that.MessageBuffer.Length)
return false;
for (int i = 0; i < this.MessageBuffer.Length; i++)
{
if (this.MessageBuffer[i] != that.MessageBuffer[i])
return false;
}
return true;
}
public override string ToString()
{
return "Network Layer Info";
}
}
}

View File

@ -15,6 +15,11 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
[TsDescriptor(0xa1, "TIM")]
public class _0xa1_CorrectionMessageDescriptor : TsDescriptor, IEquatable<_0xa1_CorrectionMessageDescriptor?>
{
public _0xa1_CorrectionMessageDescriptor()
{
}
public _0xa1_CorrectionMessageDescriptor(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer, false);
@ -105,5 +110,19 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
{
return !(left == right);
}
public override bool DescriptorEquals(TsDescriptor thatDescriptor)
{
_0xa1_CorrectionMessageDescriptor that = thatDescriptor as _0xa1_CorrectionMessageDescriptor;
if (that == null)
return false;
return this.Equals(that);
}
public override string ToString()
{
return String.Format("Correction for Slot {0}", SlotType);
}
}
}

View File

@ -93,5 +93,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public uint? RbdcTimeout { get; }
public byte ForwardSignallingVPI { get; }
public ushort ForwardSignallingVCI { get; }
public override string ToString()
{
return String.Format("Login Init for Group {0}, Logon {1}", GroupId, LogonId);
}
}
}

View File

@ -34,5 +34,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public int FrameNumber { get; }
public int RepeatPeriod { get; }
public int SlotNumber { get; }
public override string ToString()
{
return String.Format("ACQ Assign Slot {0}", SlotNumber);
}
}
}

View File

@ -34,5 +34,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public int SyncFrameNumber { get; }
public ushort SyncRepeatPeriod { get; }
public int SyncSlotNumber { get; }
public override string ToString()
{
return String.Format("Sync Assign for Slot {0}", SyncSlotNumber);
}
}
}

View File

@ -38,5 +38,17 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public ushort IdStartTime { get; }
public ushort IdUpdatePeriod { get; }
public ushort[] EncryptedLoginId { get; }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("Encrypted Login Ids: ");
foreach(ushort u in EncryptedLoginId)
{
sb.Append(u);
sb.Append(',');
}
return sb.ToString();
}
}
}

View File

@ -132,7 +132,7 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public override string ToString()
{
return String.Format("{0} kHz,{1}, {2} sym/s", Frequency, Polarization.ToString()[0], SymbolRate);
return String.Format("Forward Link: {0} kHz,{1}, {2} sym/s", Frequency, Polarization.ToString()[0], SymbolRate);
}
protected bool Equals(_0xa8_SatelliteForwardLinkDescriptor other)

View File

@ -41,7 +41,7 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public override string ToString()
{
return String.Format("Sat-ID {0}, Beam-ID {1}, Gateway-ID {2}, Superframe-ID {3}, Freq-Offset {4}", SatelliteId, BeamId, GatewayId, SuperframeId, TxFrequencyOffset);
return String.Format("Return Link: Sat-ID {0}, Beam-ID {1}, Gateway-ID {2}, Superframe-ID {3}, Freq-Offset {4}", SatelliteId, BeamId, GatewayId, SuperframeId, TxFrequencyOffset);
}
protected bool Equals(_0xa9_SatelliteReturnLinkDescriptor other)

View File

@ -43,5 +43,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public byte TableId { get; internal set; }
public int NewVersion { get; internal set; }
}
public override string ToString()
{
return String.Format("{0} table updates.", Updates.Length);
}
}
}

View File

@ -14,6 +14,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
[TsDescriptor(0xab, "TIM")]
public class _0xab_ContentionControlDescriptor : TsDescriptor
{
public _0xab_ContentionControlDescriptor()
{
}
public _0xab_ContentionControlDescriptor(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer, false);
@ -24,10 +28,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
Valid = true;
}
public byte SuperframeId { get; }
public uint CscResponseTimeout { get; }
public byte CscMaxLosses { get; }
public uint MaxTimeBeforeRetry { get; }
public byte SuperframeId { get; set; }
public uint CscResponseTimeout { get; set; }
public byte CscMaxLosses { get; set; }
public uint MaxTimeBeforeRetry { get; set; }
public _0xab_ContentionControlDescriptor(byte superframeId, uint cscResponseTimeout, byte cscMaxLosses, uint maxTimeBeforeRetry)
{
@ -45,5 +49,15 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
CscMaxLosses == descriptor.CscMaxLosses &&
MaxTimeBeforeRetry == descriptor.MaxTimeBeforeRetry;
}
public override bool DescriptorEquals(TsDescriptor thatDescriptor)
{
return Equals(thatDescriptor);
}
public override string ToString()
{
return String.Format("Contention Control for Superframe {0}", SuperframeId);
}
}
}

View File

@ -1,4 +1,5 @@
using skyscraper5.Mpeg2;
using Newtonsoft.Json;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper;
using skyscraper5.Skyscraper.IO;
using skyscraper5.Skyscraper.Plugins;
@ -16,6 +17,16 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
[TsDescriptor(0xac,"TIM")]
public class _0xac_CorrectionControlDescriptor : TsDescriptor
{
[JsonConstructor]
public _0xac_CorrectionControlDescriptor(uint AcqResponseTimeout, uint SyncResponseTimeout, byte AcqMaxLosses, byte SyncMaxLosses)
{
this.AcqResponseTimeout = AcqResponseTimeout;
this.SyncResponseTimeout = SyncResponseTimeout;
this.AcqMaxLosses = AcqMaxLosses;
this.SyncMaxLosses = SyncMaxLosses;
Valid = true;
}
public _0xac_CorrectionControlDescriptor(byte[] buffer)
{
MemoryStream ms =new MemoryStream(buffer);
@ -31,13 +42,6 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public byte AcqMaxLosses { get; }
public byte SyncMaxLosses { get; }
public _0xac_CorrectionControlDescriptor(uint acqResponseTimeout, uint syncResponseTimeout, byte acqMaxLosses, byte syncMaxLosses)
{
AcqResponseTimeout = acqResponseTimeout;
SyncResponseTimeout = syncResponseTimeout;
AcqMaxLosses = acqMaxLosses;
SyncMaxLosses = syncMaxLosses;
}
public override bool Equals(object obj)
{
@ -47,5 +51,15 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
AcqMaxLosses == descriptor.AcqMaxLosses &&
SyncMaxLosses == descriptor.SyncMaxLosses;
}
public override bool DescriptorEquals(TsDescriptor thatDescriptor)
{
return Equals(thatDescriptor);
}
public override string ToString()
{
return "Correction Control";
}
}
}

View File

@ -104,5 +104,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
}
public List<ForwardInteractionPath> Paths { get; }
public override string ToString()
{
return String.Format("{0} Forward Interaction Paths", Paths.Count);
}
}
}

View File

@ -110,5 +110,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public byte VPI { get; internal set; }
public ushort VCI { get; internal set; }
}
public override string ToString()
{
return String.Format("{0} Return Interaction Paths", RoutingLabels.Length);
}
}
}

View File

@ -28,5 +28,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public uint CscResponseTimeout { get; }
public byte CscMaxLosses { get; }
public uint MaxTimeBeforeRetry { get; }
public override string ToString()
{
return String.Format("Connection Control for Superframe {0}", SuperframeId);
}
}
}

View File

@ -28,5 +28,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public ushort SuperframeCount { get; }
public int FrameNumber { get; }
public int SlotNumber { get; }
public override string ToString()
{
return String.Format("Correction Message Extension for Superframe {0}", SuperframeId);
}
}
}

View File

@ -70,5 +70,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public bool EsNoThresholdFlag { get; internal set; }
public int EsNoThreshold { get; internal set; }
}
public override string ToString()
{
return String.Format("Return Transmission Modes for {0} superframes.", Superframes.Length);
}
}
}

View File

@ -97,5 +97,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public uint VbdcMax { get; }
public uint RbdcMax { get; }
public uint RbdcTimeout { get; }
public override string ToString()
{
return String.Format("Mesh Logon Initalization for Group {0}, Logon {1}", GroupId, LogonId);
}
}
}

View File

@ -56,5 +56,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public uint HubTypeId { get; }
public uint HubSwId { get; }
public byte[] UserOptions { get; }
public override string ToString()
{
return String.Format("Implementation Type for Hub Type {0}", HubTypeId);
}
}
}

View File

@ -64,5 +64,10 @@ namespace skyscraper5.src.InteractionChannel.Model.Descriptors
public int BufferTimeout { get; internal set; }
public int Dscp { get; internal set; }
}
public override string ToString()
{
return String.Format("{0} LL-FEC Identifiers", LlFecIdentifiers.Length);
}
}
}

View File

@ -12,11 +12,20 @@ using System.Text;
using System.Threading.Tasks;
using skyscraper8.GSE.GSE;
using skyscraper8.InteractionChannel.Model2.Descriptors;
using Ionic.Crc;
using Ionic.Zlib;
namespace skyscraper5.src.InteractionChannel.Model
{
public class Tim : Validatable
{
public Tim(bool broadcast, byte status, TsDescriptor[] descs)
{
this.Broadcast = broadcast;
this.Status = status;
this.Descriptors = descs;
}
public Tim(MemoryStream ms, bool broadcast)
{
Broadcast = broadcast;
@ -268,92 +277,53 @@ namespace skyscraper5.src.InteractionChannel.Model
public bool NccReceiveFailure => (Broadcast & ((Status & 0x02) != 0));
public bool SchedulerFailure => (Broadcast & ((Status & 0x01) != 0));
internal void Handle(PhysicalAddress macAddress, ushort? networkId, InteractionChannelHandler handler)
public override int GetHashCode()
{
foreach(TsDescriptor descriptor in Descriptors)
int hash = 17;
hash ^= HashCode.Combine(Broadcast, Status, Descriptors.Length);
foreach (TsDescriptor tsDescriptor in Descriptors)
{
if (descriptor == null)
{
continue;
}
if (descriptor is UserDefinedDescriptor)
{
continue;
}
if (!descriptor.Valid)
{
Valid = false;
return;
}
byte id = descriptor.GetDescriptorId();
switch(id)
{
case 0xa0:
handler.OnNetworkLayerInfo(macAddress, (_0xa0_NetworkLayerInfoDescriptor)descriptor);
break;
case 0xa1:
if (Broadcast)
{
if (networkId.HasValue)
{
handler.OnCorrectionMessage(networkId.Value, ToCmt((_0xa1_CorrectionMessageDescriptor)descriptor));
}
}
else
{
handler.OnCorrectionMessage(macAddress, ((_0xa1_CorrectionMessageDescriptor)descriptor));
}
break;
case 0xa4:
handler.OnControlAssignment(macAddress,(_0xa4_SyncAssignDescriptor)descriptor);
break;
case 0xa9:
handler.OnSatelliteReturnLink(macAddress, (_0xa9_SatelliteReturnLinkDescriptor)descriptor);
break;
case 0xab:
handler.OnContentionControl(macAddress, ((_0xab_ContentionControlDescriptor)descriptor));
break;
case 0xac:
handler.OnCorrectionControl(macAddress, (_0xac_CorrectionControlDescriptor)descriptor);
break;
case 0xad:
handler.OnForwardInteractionPath(macAddress, (_0xad_ForwardInteractionPathDescriptor)descriptor);
break;
case 0xaf:
handler.OnConnectionControl(macAddress, (_0xaf_ConnectionControlDescriptor)descriptor);
break;
case 0xb1:
handler.OnCorrectionMessageExtension(macAddress, (_0xb1_CorrectionMessageExtensionDescriptor)descriptor);
break;
case 0xb2:
handler.OnReturnTransmissionMOdes(macAddress, (_0xb2_ReturnTransmissionModesDescriptor)descriptor);
break;
case 0xb7:
if (networkId.HasValue)
{
handler.OnFramePayloadFormatAnnouncement(networkId.Value, (_0xb7_FramePayloadFormatDescriptor)descriptor);
}
break;
case 0xb9:
handler.LogonResponseDescriptor(macAddress, (_0xb9_LogonResponseDescriptor)descriptor);
break;
case 0xbb:
handler.OnLowerLayerService(macAddress, (_0xbb_LowerLayerServiceDescriptor)descriptor);
break;
case 0xc4:
handler.OnHigherLayerInitalization(macAddress, (_0xc4_HigherLayersInitializeDescriptor)descriptor);
break;
default:
if (id >= 0xe0 && id <= 0xfe)
break;
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));
}
hash ^= tsDescriptor.GetDescriptorHashCode();
}
return hash;
}
private Cmt ToCmt(_0xa1_CorrectionMessageDescriptor descriptor)
public override bool Equals(object? obj)
{
throw new NotImplementedException();
if (obj == null)
return false;
Tim that = obj as Tim;
if (that == null)
return false;
if (this.Status != that.Status)
return false;
bool thisHasDescriptors = this.Descriptors != null;
bool thatHasDescriptors = that.Descriptors != null;
if (thisHasDescriptors != thatHasDescriptors)
return false;
if (this.Descriptors.Length != that.Descriptors.Length)
return false;
for (int i = 0; i < this.Descriptors.Length; i++)
{
TsDescriptor thisDescriptor = this.Descriptors[i];
TsDescriptor thatDescriptor = that.Descriptors[i];
byte thisDescriptorId = thisDescriptor.GetDescriptorId();
byte thatDescriptorId = thatDescriptor.GetDescriptorId();
if (thisDescriptorId != thatDescriptorId)
return false;
if (!thisDescriptor.DescriptorEquals(thatDescriptor))
{
return false;
}
}
return true;
}
}
}

View File

@ -8,6 +8,11 @@ namespace skyscraper8.InteractionChannel.Model2.Descriptors;
[TsDescriptor(0xb7,"TIM")]
public class _0xb7_FramePayloadFormatDescriptor : TsDescriptor
{
public _0xb7_FramePayloadFormatDescriptor()
{
}
public _0xb7_FramePayloadFormatDescriptor(byte[] buffer)
{
InBitStream bitstream = new InBitStream(buffer);
@ -48,5 +53,64 @@ public class _0xb7_FramePayloadFormatDescriptor : TsDescriptor
public byte ImplicitPpduLabelSize { get; set; }
public byte ImplicitPayloadLabelSize { get; set; }
public byte Type0AlpduLabelSize { get; set; }
}
public override bool Equals(object? obj)
{
return obj is TransmissionContext context &&
TransmissionContextId == context.TransmissionContextId &&
AllowPTypeOmission == context.AllowPTypeOmission &&
UseCompressedPType == context.UseCompressedPType &&
AllowAlpduCrc == context.AllowAlpduCrc &&
AllowAlpduSequenceNumber == context.AllowAlpduSequenceNumber &&
UseExplicitPayloadHeaderMap == context.UseExplicitPayloadHeaderMap &&
ImplicitProtocolType == context.ImplicitProtocolType &&
ImplicitPpduLabelSize == context.ImplicitPpduLabelSize &&
ImplicitPayloadLabelSize == context.ImplicitPayloadLabelSize &&
Type0AlpduLabelSize == context.Type0AlpduLabelSize;
}
public override int GetHashCode()
{
HashCode hash = new HashCode();
hash.Add(TransmissionContextId);
hash.Add(AllowPTypeOmission);
hash.Add(UseCompressedPType);
hash.Add(AllowAlpduCrc);
hash.Add(AllowAlpduSequenceNumber);
hash.Add(UseExplicitPayloadHeaderMap);
hash.Add(ImplicitProtocolType);
hash.Add(ImplicitPpduLabelSize);
hash.Add(ImplicitPayloadLabelSize);
hash.Add(Type0AlpduLabelSize);
return hash.ToHashCode();
}
}
public override bool DescriptorEquals(TsDescriptor thatDescriptor)
{
_0xb7_FramePayloadFormatDescriptor that = thatDescriptor as _0xb7_FramePayloadFormatDescriptor;
if (that == null)
return false;
bool thisHasContexts = this.Contexts != null;
bool thatHasContexts = that.Contexts != null;
if (thisHasContexts != thatHasContexts)
return false;
if (this.Contexts.Length != that.Contexts.Length)
return false;
for (int i = 0; i < this.Contexts.Length; i++)
{
if (!this.Contexts[i].Equals(that.Contexts[i]))
return false;
}
return true;
}
public override string ToString()
{
return String.Format("{0} Frame Payload Formats", Contexts);
}
}

View File

@ -79,7 +79,7 @@ namespace skyscraper8.InteractionChannel.Model2.Descriptors
public override string ToString()
{
return $"{nameof(GroupId)}: {GroupId}, {nameof(LogonId)}: {LogonId}";
return $"Logon Response for {nameof(GroupId)}: {GroupId}, {nameof(LogonId)}: {LogonId}";
}
}
}

View File

@ -140,5 +140,10 @@ namespace skyscraper8.InteractionChannel.Model2.Descriptors
public byte MinIdleBlock { get; set; }
public byte[] DefaultsForRaLoadControl { get; set; }
}
public override string ToString()
{
return String.Format("{0} Lower Layer Services", LowerLayerServices.Length);
}
}
}

View File

@ -64,5 +64,10 @@ namespace skyscraper8.InteractionChannel.Model2.Descriptors
return HashCode.Combine(Mac24AsString, Ipv4McAddress, OfferStreamIpv4Adress, OfferStreamPort, HigherLayerPepSwitchOff);
}
}
public override string ToString()
{
return String.Format("{0} Higher Layer Initalizations", Layer2Interfaces.Length);
}
}
}

View File

@ -21,122 +21,39 @@ namespace skyscraper5.src.InteractionChannel
return 0;
}
public void OnConnectionControl(PhysicalAddress macAddress, _0xaf_ConnectionControlDescriptor descriptor)
{
}
public void OnTerminalBurstTimePlan2(ushort interactiveNetworkId, Tbtp2 tbtp2)
{
}
public void OnFrameComposition2(ushort networkId, Fct2 fct2)
{
}
public void OnBroadcastConfiguration(ushort networkId, Bct bct)
{
}
public void OnRcs2Nit(ushort interactiveNetworkId, RcsNit nit)
{
}
public void OnRcs2Tdt(ushort interactiveNetworkId, Rcs2Tdt tdt)
{
}
public void OnTransmissionModeSupport2(ushort interactiveNetworkId, Tmst2 tmst2)
{
}
public void OnFramePayloadFormatAnnouncement(ushort networkId, _0xb7_FramePayloadFormatDescriptor descriptor)
{
}
public void OnCorrectionMessageExtension(PhysicalAddress macAddress, _0xb1_CorrectionMessageExtensionDescriptor descriptor)
{
}
public void OnControlAssignment(PhysicalAddress macAddress, _0xa4_SyncAssignDescriptor descriptor)
{
}
public void OnSatelliteReturnLink(PhysicalAddress macAddress, _0xa9_SatelliteReturnLinkDescriptor descriptor)
{
}
public void OnLowerLayerService(PhysicalAddress macAddress, _0xbb_LowerLayerServiceDescriptor descriptor)
{
}
public void OnHigherLayerInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor descriptor)
{
}
public void LogonResponseDescriptor(PhysicalAddress macAddress, _0xb9_LogonResponseDescriptor descriptor)
{
}
public void OnForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor descriptor)
{
}
public void OnFrameComposition2(ushort? networkId, Fct2 fct2)
{
}
public void OnContentionControl(PhysicalAddress macAddress, _0xab_ContentionControlDescriptor ccd)
public void OnBroadcastConfiguration(ushort networkId, Bct bct)
{
}
public void OnCorrectionControl(PhysicalAddress macAddress, _0xac_CorrectionControlDescriptor descriptor)
{
}
public void OnNetworkLayerInfo(PhysicalAddress macAddress, _0xa0_NetworkLayerInfoDescriptor descriptor)
{
}
public void OnCorrectionMessage(ushort interactiveNetworkId, Cmt cmt)
{
}
public void OnCorrectionMessage(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd)
{
}
public void OnFrameComposition(ushort interactiveNetworkId, Fct fct)
{
}
public void OnFrameComposition2(ushort networkId, Fct2 fct2)
{
}
public void OnInteractionChannelError(InteractionChannelErrorState unexpectedTable)
{
}
public void OnRcs2Nit(ushort interactiveNetworkId, RcsNit nit)
{
}
public void OnRcs2Tdt(ushort interactiveNetworkId, Rcs2Tdt tdt)
{
}
public void OnRcsMap(Rmt rmt)
{
}
public void OnReturnTransmissionMOdes(PhysicalAddress macAddress, _0xb2_ReturnTransmissionModesDescriptor descriptor)
{
}
public void OnSatellitePosition(ushort interactiveNetworkId, Spt spt)
public void OnSatellitePosition(ushort interactiveNetworkId, Spt spt)
{
}
@ -147,13 +64,25 @@ namespace skyscraper5.src.InteractionChannel
public void OnTerminalBurstTimePlan(ushort interactiveNetworkId, Tbtp tbtp)
{
}
public void OnTerminalBurstTimePlan2(ushort interactiveNetworkId, Tbtp2 tbtp2)
{
}
public void OnTerminalInformationMessage(ushort interactiveNetworkId, PhysicalAddress physicalAddress, Tim tim)
{
}
public void OnTimeslotComposition(ushort interactiveNetworkId, Tct tct)
{
{
}
public void OnTransmissionModeSupport(ushort interactiveNetworkId, Tmst tmst)
{
}
public void OnTransmissionModeSupport2(ushort interactiveNetworkId, Tmst2 tmst2)
{
}
}
}

View File

@ -0,0 +1,89 @@
using Newtonsoft.Json;
using skyscraper5.Mpeg2;
using skyscraper5.Mpeg2.Descriptors;
using skyscraper5.src.InteractionChannel.Model;
using skyscraper5.src.InteractionChannel.Model.Descriptors;
using skyscraper8.InteractionChannel.Model2.Descriptors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace skyscraper8.InteractionChannel
{
public class TimJsonRepresentation
{
public TimJsonRepresentation() { }
public TimJsonRepresentation(Tim tim)
{
this.Broadcast = tim.Broadcast;
this.Status = tim.Status;
this.DescriptorTypes = new byte[tim.Descriptors.Length];
this.DescriptorsSerialized = new string[tim.Descriptors.Length];
for (int i = 0; i < tim.Descriptors.Length; i++)
{
this.DescriptorTypes[i] = tim.Descriptors[i].GetDescriptorId();
this.DescriptorsSerialized[i] = JsonConvert.SerializeObject(tim.Descriptors[i], Formatting.Indented);
}
}
public Tim ToTim()
{
TsDescriptor[] descs = new TsDescriptor[this.DescriptorTypes.Length];
for (int i = 0; i < this.DescriptorTypes.Length; i++)
{
TsDescriptor newChild = null;
switch (this.DescriptorTypes[i])
{
case 0xa0:
newChild = JsonConvert.DeserializeObject<_0xa0_NetworkLayerInfoDescriptor>(this.DescriptorsSerialized[i]);
break;
case 0xa1:
newChild = JsonConvert.DeserializeObject<_0xa1_CorrectionMessageDescriptor>(this.DescriptorsSerialized[i]);
break;
case 0xab:
newChild = JsonConvert.DeserializeObject<_0xab_ContentionControlDescriptor>(this.DescriptorsSerialized[i]);
break;
case 0xac:
newChild = JsonConvert.DeserializeObject<_0xac_CorrectionControlDescriptor>(this.DescriptorsSerialized[i]);
break;
case 0xb7:
newChild = JsonConvert.DeserializeObject<_0xb7_FramePayloadFormatDescriptor>(this.DescriptorsSerialized[i]);
break;
case 0xe1:
newChild = JsonConvert.DeserializeObject<UserDefinedDescriptor>(this.DescriptorsSerialized[i]);
break;
default:
throw new NotImplementedException(String.Format("Don't know how to deserialize TIM descriptor type _0x{0:X2}", this.DescriptorTypes[i]));
}
newChild.Valid = true;
descs[i] = newChild;
}
Tim result = new Tim(Broadcast, Status, descs);
return result;
}
public bool Broadcast { get; set; }
public byte Status { get; set; }
public byte[] DescriptorTypes { get; set; }
public string[] DescriptorsSerialized { get; set; }
public static TimJsonRepresentation FromTim(Tim tim)
{
return new TimJsonRepresentation(tim);
}
public static Tim ConvertJsonToTim(string json)
{
TimJsonRepresentation representation = JsonConvert.DeserializeObject<TimJsonRepresentation>(json);
return representation.ToTim();
}
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
}

View File

@ -1,19 +1,43 @@
namespace skyscraper5.Mpeg2.Descriptors
using Newtonsoft.Json;
namespace skyscraper5.Mpeg2.Descriptors
{
public class UserDefinedDescriptor : TsDescriptor
{
public byte DescriptorTag { get; }
public byte[] Data { get; }
public byte DescriptorTag { get; set; }
public byte[] Data { get; set; }
public UserDefinedDescriptor(byte descriptorTag, byte[] data)
[JsonConstructor]
public UserDefinedDescriptor(byte DescriptorTag, byte[] data)
{
DescriptorTag = descriptorTag;
Data = data;
this.DescriptorTag = DescriptorTag;
this.Data = data;
this.Valid = true;
}
public override byte GetDescriptorId()
{
return DescriptorTag;
}
public override bool DescriptorEquals(TsDescriptor thatDescriptor)
{
UserDefinedDescriptor that = thatDescriptor as UserDefinedDescriptor;
if (that == null)
return false;
if (this.DescriptorTag != that.DescriptorTag)
return false;
if (this.Data.Length != that.Data.Length)
return false;
for (int i = 0; i < this.Data.Length; i++)
{
if (this.Data[i] != that.Data[i])
return false;
}
return true;
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Configuration;
using skyscraper5.Dvb;
using skyscraper5.Skyscraper;
@ -35,5 +36,23 @@ namespace skyscraper5.Mpeg2
{
throw new NotImplementedException(String.Format("{0} does not implement Serialize()", this.GetType().Name));
}
}
public virtual int GetDescriptorHashCode()
{
string err = String.Format("{0} does not reveal a custom hash code.", this.GetType().Name);
throw new NotImplementedException(err);
}
/// <summary>
/// Tests if a descriptor is FUNCTIONALLY equivalent with another descriptor.
/// </summary>
/// <param name="thatDescriptorId">The other TS Descriptor to compare against</param>
/// <returns></returns>
/// <exception cref="NotImplementedException">Is thrown when a descriptor does not implement this method.</exception>
public virtual bool DescriptorEquals(TsDescriptor thatDescriptor)
{
string err = String.Format("{0} does not know wheter it is functionally equivalent to {1}.", this.GetType().Name, thatDescriptor.GetType().Name);
throw new NotImplementedException(err);
}
}
}

View File

@ -2582,148 +2582,6 @@ namespace skyscraper5.Skyscraper.Scraper
}
}
public void OnFramePayloadFormatAnnouncement(ushort networkId, _0xb7_FramePayloadFormatDescriptor descriptor)
{
foreach (_0xb7_FramePayloadFormatDescriptor.TransmissionContext transmissionContext in descriptor.Contexts)
{
if (!DataStorage.TestForTimFramePayloadFormat(networkId, transmissionContext))
{
LogEvent(SkyscraperContextEvent.TimFramePayloadFormat,String.Format("Network #{0}, Context ID #{1}",networkId,transmissionContext.TransmissionContextId));
DataStorage.InsertTimFramePayloadFormat(networkId, transmissionContext);
}
}
}
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 OnSatelliteReturnLink(PhysicalAddress macAddress, _0xa9_SatelliteReturnLinkDescriptor descriptor)
{
if (!DataStorage.TestForTimSatelliteReturnLink(macAddress))
{
LogEvent(SkyscraperContextEvent.TimSatelliteReturnLink, String.Format("For participant {0}: {1}", macAddress, descriptor));
DataStorage.InsertTimSatelliteReturnLink(macAddress, descriptor);
}
}
public void OnLowerLayerService(PhysicalAddress macAddress, _0xbb_LowerLayerServiceDescriptor descriptor)
{
if (!DataStorage.TestForLowerLayerService(macAddress))
{
LogEvent(SkyscraperContextEvent.TimLowerLayerService, String.Format("For participant {0}", macAddress));
DataStorage.InsertTimLowerLayerService(macAddress, descriptor);
}
}
public void OnHigherLayerInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor descriptor)
{
foreach (_0xc4_HigherLayersInitializeDescriptor.Layer2Interface layer2Interface in descriptor.Layer2Interfaces)
{
if (!DataStorage.TestForHigherLayerServiceInitalization(macAddress, layer2Interface))
{
LogEvent(SkyscraperContextEvent.TimHigherLayerInitalization, String.Format("For participant {0} -> {1}", macAddress, layer2Interface.Ipv4McAddress));
DataStorage.InsertHigherLayerServiceInitalization(macAddress, layer2Interface);
}
}
}
public void LogonResponseDescriptor(PhysicalAddress macAddress, _0xb9_LogonResponseDescriptor descriptor)
{
if (!DataStorage.TestForTimLogonResponse(macAddress))
{
LogEvent(SkyscraperContextEvent.TimLogonResponse, String.Format("For participant {0}: {1}", macAddress, descriptor.ToString()));
DataStorage.InsertTimLogonResponse(macAddress, descriptor);
}
}
public void OnForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor descriptor)
{
foreach (_0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath forwardInteractionPath in descriptor.Paths)
{
if (!DataStorage.TestForTimForwardInteractionPath(macAddress, forwardInteractionPath))
{
LogEvent(SkyscraperContextEvent.TimForwardInteractionPath, String.Format("For participant {0}: {1}", macAddress, forwardInteractionPath.ToString()));
DataStorage.InsertTimForwardInteractionPath(macAddress, forwardInteractionPath);
}
}
}
public void OnCorrectionMessage(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd)
{
if (!DataStorage.TestForTim(mac))
{
LogEvent(SkyscraperContextEvent.Tim, String.Format("for participant {0}", mac.ToString()));
DataStorage.CreateTim(mac);
}
if (DataStorage.CorrectTim(mac, cmd))
{
LogEvent(SkyscraperContextEvent.TimCorrection, String.Format("for participant {0}", mac.ToString()));
}
}
public void OnContentionControl(PhysicalAddress mac, _0xab_ContentionControlDescriptor ccdNew)
{
if (!DataStorage.TestForTim(mac))
{
LogEvent(SkyscraperContextEvent.Tim, String.Format("for participant {0}", mac.ToString()));
DataStorage.CreateTim(mac);
}
if (DataStorage.ContentionTim(mac,ccdNew))
{
LogEvent(SkyscraperContextEvent.TimContentionControl, String.Format("for participant {0}", mac.ToString()));
}
}
public void OnCorrectionControl(PhysicalAddress mac, _0xac_CorrectionControlDescriptor descriptor)
{
if (!DataStorage.TestForTim(mac))
{
LogEvent(SkyscraperContextEvent.Tim, String.Format("for participant {0}", mac.ToString()));
DataStorage.CreateTim(mac);
}
if (DataStorage.CorrectionControlTim(mac,descriptor))
{
LogEvent(SkyscraperContextEvent.TimCorrectionControl, String.Format("for participant {0}", mac.ToString()));
}
}
private List<PhysicalAddress> networkLayerInfos;
public void OnNetworkLayerInfo(PhysicalAddress mac, _0xa0_NetworkLayerInfoDescriptor nlid)
{
if (currentTimeForTim == null)
return;
if (!DataStorage.TestForTim(mac))
{
LogEvent(SkyscraperContextEvent.Tim, String.Format("for participant {0}", mac.ToString()));
DataStorage.CreateTim(mac);
}
if (DataStorage.NetworkLayerInfoTim(mac,nlid,currentTimeForTim.Value))
{
if (networkLayerInfos == null)
networkLayerInfos = new List<PhysicalAddress>();
if (!networkLayerInfos.Contains(mac))
{
LogEvent(SkyscraperContextEvent.TimNetworkLayerInfo, String.Format("for participant {0}", mac.ToString()));
networkLayerInfos.Add(mac);
}
}
}
void InteractionChannelHandler.OnTransmissionModeSupport(ushort interactiveNetworkId, Tmst tmst)
{
byte[] knownTmst = DataStorage.GetTmst(interactiveNetworkId);
@ -3330,17 +3188,6 @@ namespace skyscraper5.Skyscraper.Scraper
return ObjectStorage.NdsSsuTestFile(CurrentNetworkId, CurrentTransportStreamId, pid, tableIdExtension);
}
public void OnReturnTransmissionMOdes(PhysicalAddress macAddress, _0xb2_ReturnTransmissionModesDescriptor descriptor)
{
//TODO: Implement this.
}
public void OnConnectionControl(PhysicalAddress macAddress, _0xaf_ConnectionControlDescriptor descriptor)
{
//TODO: Implement this.
}
private HashSet<LldpFrame> lldpFrames;
public void OnLldpFrame(LldpFrame frame)
{
@ -3569,5 +3416,23 @@ namespace skyscraper5.Skyscraper.Scraper
context.OnTotTime(totContainer.UtcTime, totContainer.LocalTimeOffset);
}
}
}
public void OnTerminalInformationMessage(ushort interactiveNetworkId, PhysicalAddress physicalAddress, Tim currentTim)
{
Tim lastTim = DataStorage.GetLastTim(interactiveNetworkId, physicalAddress);
if (currentTim.Equals(lastTim))
{
return;
}
DataStorage.UpsertTim(interactiveNetworkId, physicalAddress, currentTim);
LogEvent(SkyscraperContextEvent.Tim, String.Format("Terminal Information Message for participant {0} on network {1}", physicalAddress, interactiveNetworkId));
foreach(TsDescriptor ts in currentTim.Descriptors)
{
LogEvent(SkyscraperContextEvent.Tim, String.Format(" -> {0}", ts.ToString()));
}
}
}
}

View File

@ -153,12 +153,6 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
void InsertFctFrame(ushort interactiveNetworkId, Fct.Frame frame);
bool TestForSatellitePosition(ushort interactiveNetworkId, Spt.Satellite satellite);
void StoreSatellitePosition(ushort interactiveNetworkId, Spt.Satellite satellite);
void CreateTim(PhysicalAddress mac);
bool TestForTim(PhysicalAddress mac);
bool CorrectTim(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd);
bool ContentionTim(PhysicalAddress mac, _0xab_ContentionControlDescriptor ccdNew);
bool CorrectionControlTim(PhysicalAddress mac, _0xac_CorrectionControlDescriptor descriptor);
bool NetworkLayerInfoTim(PhysicalAddress mac, _0xa0_NetworkLayerInfoDescriptor nlid, DateTime timestamp);
IEnumerable<DbBlindscanJob> GetDbBlindscanJobs();
bool TestForSgtList(SgtList list);
void InsertSgtList(SgtList list);
@ -210,23 +204,9 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
bool UpdateRcs2Tdt(ushort interactiveNetworkId, DateTime tdtTimestamp);
bool TestForTmst2(ushort interactiveNetworkId, Tmst2.TransmissionMode mode);
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);
bool TestForTimSatelliteReturnLink(PhysicalAddress macAddress);
void InsertTimSatelliteReturnLink(PhysicalAddress macAddress, _0xa9_SatelliteReturnLinkDescriptor descriptor);
bool TestForLowerLayerService(PhysicalAddress macAddress);
void InsertTimLowerLayerService(PhysicalAddress macAddress, _0xbb_LowerLayerServiceDescriptor descriptor);
bool TestForHigherLayerServiceInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface layer2Interface);
void InsertHigherLayerServiceInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface layer2Interface);
bool TestForTimLogonResponse(PhysicalAddress macAddress);
void InsertTimLogonResponse(PhysicalAddress macAddress, _0xb9_LogonResponseDescriptor descriptor);
bool TestForTimForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath forwardInteractionPath);
void InsertTimForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath forwardInteractionPath);
bool TestForRmt(Rmt rmt);
void InsertRmt(Rmt rmt);
Tim GetLastTim(ushort interactiveNetworkId, PhysicalAddress physicalAddress);
void UpsertTim(ushort interactiveNetworkId, PhysicalAddress physicalAddress, Tim currentTim);
}
}

View File

@ -1216,87 +1216,6 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
throw new NotImplementedException();
}
public bool TestForTimFramePayloadFormat(ushort networkId, _0xb7_FramePayloadFormatDescriptor.TransmissionContext transmissionContext)
{
throw new NotImplementedException();
}
public void InsertTimFramePayloadFormat(ushort networkId, _0xb7_FramePayloadFormatDescriptor.TransmissionContext transmissionContext)
{
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 bool TestForTimSatelliteReturnLink(PhysicalAddress macAddress)
{
throw new NotImplementedException();
}
public void InsertTimSatelliteReturnLink(PhysicalAddress macAddress, _0xa9_SatelliteReturnLinkDescriptor descriptor)
{
throw new NotImplementedException();
}
public bool TestForLowerLayerService(PhysicalAddress macAddress)
{
throw new NotImplementedException();
}
public void InsertTimLowerLayerService(PhysicalAddress macAddress, _0xbb_LowerLayerServiceDescriptor descriptor)
{
throw new NotImplementedException();
}
public bool TestForHigherLayerServiceInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface layer2Interface)
{
throw new NotImplementedException();
}
public void InsertHigherLayerServiceInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface layer2Interface)
{
throw new NotImplementedException();
}
public bool TestForTimLogonResponse(PhysicalAddress macAddress)
{
throw new NotImplementedException();
}
public void InsertTimLogonResponse(PhysicalAddress macAddress, _0xb9_LogonResponseDescriptor descriptor)
{
throw new NotImplementedException();
}
public bool TestForTimForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath forwardInteractionPath)
{
throw new NotImplementedException();
}
public void InsertTimForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath forwardInteractionPath)
{
throw new NotImplementedException();
}
public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt()
{
throw new NotImplementedException();
@ -1524,26 +1443,6 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
throw new NotImplementedException();
}
public bool CorrectTim(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd)
{
throw new NotImplementedException();
}
public bool ContentionTim(PhysicalAddress mac, _0xab_ContentionControlDescriptor ccdNew)
{
throw new NotImplementedException();
}
public bool CorrectionControlTim(PhysicalAddress mac, _0xac_CorrectionControlDescriptor descriptor)
{
throw new NotImplementedException();
}
public bool NetworkLayerInfoTim(PhysicalAddress mac, _0xa0_NetworkLayerInfoDescriptor nlid, DateTime timestamped)
{
throw new NotImplementedException();
}
public IEnumerable<DbBlindscanJob> GetDbBlindscanJobs()
{
throw new NotImplementedException();
@ -2018,5 +1917,15 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
{
throw new NotImplementedException();
}
public Tim GetLastTim(ushort interactiveNetworkId, PhysicalAddress physicalAddress)
{
throw new NotImplementedException();
}
public void UpsertTim(ushort interactiveNetworkId, PhysicalAddress physicalAddress, Tim currentTim)
{
throw new NotImplementedException();
}
}
}

View File

@ -1078,142 +1078,6 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
_tmst2.Add(key, mode);
}
private Dictionary<Tuple<ushort, byte>, _0xb7_FramePayloadFormatDescriptor.TransmissionContext> _timFramePayloadFormats;
public bool TestForTimFramePayloadFormat(ushort networkId, _0xb7_FramePayloadFormatDescriptor.TransmissionContext transmissionContext)
{
if (_timFramePayloadFormats == null)
return false;
Tuple<ushort, byte> key = new Tuple<ushort, byte>(networkId, transmissionContext.TransmissionContextId);
return _timFramePayloadFormats.ContainsKey(key);
}
public void InsertTimFramePayloadFormat(ushort networkId, _0xb7_FramePayloadFormatDescriptor.TransmissionContext transmissionContext)
{
if (_timFramePayloadFormats == null)
_timFramePayloadFormats = new Dictionary<Tuple<ushort, byte>, _0xb7_FramePayloadFormatDescriptor.TransmissionContext>();
Tuple<ushort, byte> key = new Tuple<ushort, byte>(networkId, transmissionContext.TransmissionContextId);
_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);
}
private Dictionary<PhysicalAddress, _0xa9_SatelliteReturnLinkDescriptor> _timSatelliteReturnLinks;
public bool TestForTimSatelliteReturnLink(PhysicalAddress macAddress)
{
if (_timSatelliteReturnLinks == null)
return false;
return _timSatelliteReturnLinks.ContainsKey(macAddress);
}
public void InsertTimSatelliteReturnLink(PhysicalAddress macAddress, _0xa9_SatelliteReturnLinkDescriptor descriptor)
{
if (_timSatelliteReturnLinks == null)
_timSatelliteReturnLinks = new Dictionary<PhysicalAddress, _0xa9_SatelliteReturnLinkDescriptor>();
_timSatelliteReturnLinks.Add(macAddress, descriptor);
}
private Dictionary<PhysicalAddress, _0xbb_LowerLayerServiceDescriptor> _timLowerLayerServiceDescriptors;
public bool TestForLowerLayerService(PhysicalAddress macAddress)
{
if (_timLowerLayerServiceDescriptors == null)
return false;
return _timLowerLayerServiceDescriptors.ContainsKey(macAddress);
}
public void InsertTimLowerLayerService(PhysicalAddress macAddress, _0xbb_LowerLayerServiceDescriptor descriptor)
{
if (_timLowerLayerServiceDescriptors == null)
_timLowerLayerServiceDescriptors = new Dictionary<PhysicalAddress, _0xbb_LowerLayerServiceDescriptor>();
_timLowerLayerServiceDescriptors.Add(macAddress, descriptor);
}
private HashSet<Tuple<PhysicalAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface>> layer2interfaces;
public bool TestForHigherLayerServiceInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface layer2Interface)
{
if (layer2interfaces == null)
return false;
return layer2interfaces.Contains(new Tuple<PhysicalAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface>(macAddress, layer2Interface));
}
public void InsertHigherLayerServiceInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface layer2Interface)
{
layer2interfaces.Add(new Tuple<PhysicalAddress, _0xc4_HigherLayersInitializeDescriptor.Layer2Interface>(macAddress, layer2Interface));
}
private Dictionary<PhysicalAddress, _0xb9_LogonResponseDescriptor> _logonResponseDescriptors;
public bool TestForTimLogonResponse(PhysicalAddress macAddress)
{
if (_logonResponseDescriptors == null)
return false;
return _logonResponseDescriptors.ContainsKey(macAddress);
}
public void InsertTimLogonResponse(PhysicalAddress macAddress, _0xb9_LogonResponseDescriptor descriptor)
{
if (_logonResponseDescriptors == null)
_logonResponseDescriptors = new Dictionary<PhysicalAddress, _0xb9_LogonResponseDescriptor>();
_logonResponseDescriptors.Add(macAddress, descriptor);
}
private HashSet<Tuple<PhysicalAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath>> _forwardInteractionPaths;
public bool TestForTimForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath forwardInteractionPath)
{
if (_forwardInteractionPaths == null)
return false;
return _forwardInteractionPaths.Contains(new Tuple<PhysicalAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath>(macAddress, forwardInteractionPath));
}
public void InsertTimForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath forwardInteractionPath)
{
if (_forwardInteractionPaths == null)
_forwardInteractionPaths = new HashSet<Tuple<PhysicalAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath>>();
_forwardInteractionPaths.Add(new Tuple<PhysicalAddress, _0xad_ForwardInteractionPathDescriptor.ForwardInteractionPath>(macAddress, forwardInteractionPath));
}
public IEnumerable<Tuple<int, int, ProgramMapping>> SelectAllPmt()
{
for (int x = 0; x < pmtEntries.Length; x++)
@ -1553,78 +1417,6 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
_sptSatellites[interactiveNetworkId].Add(satellite);
}
class TimContainer
{
public _0xab_ContentionControlDescriptor ContentionControl { get; set; }
public _0xac_CorrectionControlDescriptor CorrectionControl { get; set; }
public DateTime NetworkLayerInfoTimestamp { get; set; }
public _0xa0_NetworkLayerInfoDescriptor NetworkLayerInfoDescriptor { get; set; }
}
private Dictionary<PhysicalAddress, TimContainer> _timContainers;
public bool TestForTim(PhysicalAddress mac)
{
if (_timContainers == null)
return false;
return _timContainers.ContainsKey(mac);
}
public void CreateTim(PhysicalAddress mac)
{
if (_timContainers == null)
_timContainers = new Dictionary<PhysicalAddress, TimContainer>();
_timContainers.Add(mac, new TimContainer());
}
private HashSet<Tuple<PhysicalAddress, _0xa1_CorrectionMessageDescriptor>> _timCorrections;
public bool CorrectTim(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd)
{
if (_timCorrections == null)
_timCorrections = new HashSet<Tuple<PhysicalAddress, _0xa1_CorrectionMessageDescriptor>>();
Tuple<PhysicalAddress, _0xa1_CorrectionMessageDescriptor> child = new Tuple<PhysicalAddress, _0xa1_CorrectionMessageDescriptor>(mac, cmd);
return _timCorrections.Add(child);
}
public bool ContentionTim(PhysicalAddress mac, _0xab_ContentionControlDescriptor ccdNew)
{
TimContainer container = _timContainers[mac];
if (container.ContentionControl == null)
{
container.ContentionControl = ccdNew;
return true;
}
return false;
}
public bool CorrectionControlTim(PhysicalAddress mac, _0xac_CorrectionControlDescriptor descriptor)
{
TimContainer container = _timContainers[mac];
if (container.CorrectionControl == null)
{
container.CorrectionControl = descriptor;
return true;
}
return false;
}
public bool NetworkLayerInfoTim(PhysicalAddress mac, _0xa0_NetworkLayerInfoDescriptor nlid,
DateTime timestamped)
{
TimContainer container = _timContainers[mac];
if (container.NetworkLayerInfoTimestamp < timestamped)
{
container.NetworkLayerInfoTimestamp = timestamped;
container.NetworkLayerInfoDescriptor = nlid;
return true;
}
return false;
}
public IEnumerable<DbBlindscanJob> GetDbBlindscanJobs()
{
throw new NotImplementedException();
@ -2113,5 +1905,27 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
rmts = new Rmt[ushort.MaxValue];
rmts[ushort.MaxValue] = rmt;
}
private Dictionary<Tuple<ushort, PhysicalAddress>, Tim> tims;
public Tim GetLastTim(ushort interactiveNetworkId, PhysicalAddress physicalAddress)
{
if (tims == null)
return null;
Tuple<ushort, PhysicalAddress> key = new Tuple<ushort, PhysicalAddress>(interactiveNetworkId, physicalAddress);
if (!tims.ContainsKey(key))
return null;
return tims[key];
}
public void UpsertTim(ushort interactiveNetworkId, PhysicalAddress physicalAddress, Tim currentTim)
{
if (tims == null)
tims = new Dictionary<Tuple<ushort, PhysicalAddress>, Tim>();
Tuple<ushort, PhysicalAddress> key = new Tuple<ushort, PhysicalAddress>(interactiveNetworkId, physicalAddress);
tims[key] = currentTim;
}
}
}

View File

@ -51,16 +51,6 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
throw new NotImplementedException();
}
public void OnContentionControl(PhysicalAddress macAddress, _0xab_ContentionControlDescriptor descriptor)
{
Score++;
}
public void OnCorrectionControl(PhysicalAddress macAddress, _0xac_CorrectionControlDescriptor descriptor)
{
Score++;
}
public void OnCorrectionMessage(ushort interactiveNetworkId, Cmt cmt)
{
if (cmt.Entries.Length > 0)
@ -69,11 +59,6 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
}
}
public void OnCorrectionMessage(PhysicalAddress mac, _0xa1_CorrectionMessageDescriptor cmd)
{
Score++;
}
public void OnFrameComposition(ushort interactiveNetworkId, Fct fct)
{
if (fct.Frames.Length > 0)
@ -87,11 +72,6 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
Score--;
}
public void OnNetworkLayerInfo(PhysicalAddress macAddress, _0xa0_NetworkLayerInfoDescriptor descriptor)
{
Score++;
}
public void OnRcsMap(Rmt rmt)
{
if (rmt.Linkages != null)
@ -175,19 +155,6 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
}
}
public void OnReturnTransmissionMOdes(PhysicalAddress macAddress, _0xb2_ReturnTransmissionModesDescriptor descriptor)
{
if (descriptor.Superframes.Length > 0)
{
Score++;
}
}
public void OnConnectionControl(PhysicalAddress macAddress, _0xaf_ConnectionControlDescriptor descriptor)
{
Score++;
}
public void OnTerminalBurstTimePlan2(ushort interactiveNetworkId, Tbtp2 tbtp2)
{
if (tbtp2.Frames.Length > 0)
@ -230,56 +197,6 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
}
}
public void OnFramePayloadFormatAnnouncement(ushort networkId, _0xb7_FramePayloadFormatDescriptor descriptor)
{
if (descriptor.Contexts.Length > 0)
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 OnSatelliteReturnLink(PhysicalAddress macAddress, _0xa9_SatelliteReturnLinkDescriptor descriptor)
{
//TODO: put some sensible validation logic in here
}
public void OnLowerLayerService(PhysicalAddress macAddress, _0xbb_LowerLayerServiceDescriptor descriptor)
{
if (descriptor.LowerLayerServices.Length > 0)
{
Score++;
}
}
public void OnHigherLayerInitalization(PhysicalAddress macAddress, _0xc4_HigherLayersInitializeDescriptor descriptor)
{
if (descriptor.Layer2Interfaces.Length > 0)
{
Score++;
}
}
public void LogonResponseDescriptor(PhysicalAddress macAddress, _0xb9_LogonResponseDescriptor descriptor)
{
//TODO: put some sensible validation logic in here.
}
public void OnForwardInteractionPath(PhysicalAddress macAddress, _0xad_ForwardInteractionPathDescriptor descriptor)
{
if (descriptor.Paths.Count > 0)
{
Score++;
}
}
public void OnFrameComposition2(ushort? networkId, Fct2 fct2)
{
if (fct2.FrameTypes.Length > 0)
@ -287,5 +204,29 @@ namespace skyscraper5.src.Skyscraper.Scraper.StreamAutodetection.Contestants
Score++;
}
}
public void OnTerminalInformationMessage(ushort interactiveNetworkId, PhysicalAddress physicalAddress, Tim tim)
{
foreach(TsDescriptor tsDescriptor in tim.Descriptors)
{
bool valid = false;
try
{
valid = tsDescriptor.Valid;
}
catch (InvalidOperationException ioe)
{
continue;
}
if (!valid)
{
Score--;
}
}
if (tim.Descriptors.Length > 0)
{
Score++;
}
}
}
}