#1416 Updates P25-P1 To Expose ICMP & Unknown Packet Events in Event History View (#1417)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2023-01-16 05:31:27 -05:00
committed by GitHub
parent e99aa3d3b4
commit c063cfb201
2 changed files with 82 additions and 34 deletions

View File

@@ -1,7 +1,6 @@
/* /*
* ****************************************************************************** * *****************************************************************************
* sdrtrunk * Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2018 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -15,7 +14,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* ***************************************************************************** * ****************************************************************************
*/ */
package io.github.dsheirer.module.decode.event; package io.github.dsheirer.module.decode.event;
@@ -50,6 +49,7 @@ public enum DecodeEventType
EMERGENCY("EMERGENCY"), EMERGENCY("EMERGENCY"),
FUNCTION("Function"), FUNCTION("Function"),
GPS("GPS"), GPS("GPS"),
ICMP_PACKET("ICMP Packet"),
ID_ANI("ANI"), ID_ANI("ANI"),
ID_UNIQUE("Unique ID"), ID_UNIQUE("Unique ID"),
IP_PACKET("IP Packet"), IP_PACKET("IP Packet"),
@@ -66,6 +66,7 @@ public enum DecodeEventType
STATION_ID("Station ID"), STATION_ID("Station ID"),
STATUS("Status"), STATUS("Status"),
UDP_PACKET("UDP/IP Packet"), UDP_PACKET("UDP/IP Packet"),
UNKNOWN_PACKET("Unknown Packet"),
UNKNOWN("Unknown"); UNKNOWN("Unknown");
private String mLabel; private String mLabel;

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer * Copyright (C) 2014-2023 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -43,8 +43,10 @@ import io.github.dsheirer.module.decode.event.DecodeEvent;
import io.github.dsheirer.module.decode.event.DecodeEventType; import io.github.dsheirer.module.decode.event.DecodeEventType;
import io.github.dsheirer.module.decode.event.PlottableDecodeEvent; import io.github.dsheirer.module.decode.event.PlottableDecodeEvent;
import io.github.dsheirer.module.decode.ip.IPacket; import io.github.dsheirer.module.decode.ip.IPacket;
import io.github.dsheirer.module.decode.ip.UnknownPacket;
import io.github.dsheirer.module.decode.ip.ars.ARSPacket; import io.github.dsheirer.module.decode.ip.ars.ARSPacket;
import io.github.dsheirer.module.decode.ip.cellocator.MCGPPacket; import io.github.dsheirer.module.decode.ip.cellocator.MCGPPacket;
import io.github.dsheirer.module.decode.ip.icmp.ICMPPacket;
import io.github.dsheirer.module.decode.ip.ipv4.IPV4Packet; import io.github.dsheirer.module.decode.ip.ipv4.IPV4Packet;
import io.github.dsheirer.module.decode.ip.lrrp.LRRPPacket; import io.github.dsheirer.module.decode.ip.lrrp.LRRPPacket;
import io.github.dsheirer.module.decode.ip.udp.UDPPacket; import io.github.dsheirer.module.decode.ip.udp.UDPPacket;
@@ -87,7 +89,6 @@ import io.github.dsheirer.module.decode.p25.phase1.message.pdu.ambtc.osp.AMBTCUn
import io.github.dsheirer.module.decode.p25.phase1.message.pdu.ambtc.osp.AMBTCUnitToUnitVoiceServiceChannelGrant; import io.github.dsheirer.module.decode.p25.phase1.message.pdu.ambtc.osp.AMBTCUnitToUnitVoiceServiceChannelGrant;
import io.github.dsheirer.module.decode.p25.phase1.message.pdu.ambtc.osp.AMBTCUnitToUnitVoiceServiceChannelGrantUpdate; import io.github.dsheirer.module.decode.p25.phase1.message.pdu.ambtc.osp.AMBTCUnitToUnitVoiceServiceChannelGrantUpdate;
import io.github.dsheirer.module.decode.p25.phase1.message.pdu.packet.PacketMessage; import io.github.dsheirer.module.decode.p25.phase1.message.pdu.packet.PacketMessage;
import io.github.dsheirer.module.decode.p25.phase1.message.pdu.packet.sndcp.SNDCPMessage;
import io.github.dsheirer.module.decode.p25.phase1.message.pdu.packet.sndcp.SNDCPPacketMessage; import io.github.dsheirer.module.decode.p25.phase1.message.pdu.packet.sndcp.SNDCPPacketMessage;
import io.github.dsheirer.module.decode.p25.phase1.message.pdu.umbtc.isp.UMBTCTelephoneInterconnectRequestExplicitDialing; import io.github.dsheirer.module.decode.p25.phase1.message.pdu.umbtc.isp.UMBTCTelephoneInterconnectRequestExplicitDialing;
import io.github.dsheirer.module.decode.p25.phase1.message.tdu.TDULinkControlMessage; import io.github.dsheirer.module.decode.p25.phase1.message.tdu.TDULinkControlMessage;
@@ -139,12 +140,11 @@ import io.github.dsheirer.module.decode.p25.reference.ServiceOptions;
import io.github.dsheirer.protocol.Protocol; import io.github.dsheirer.protocol.Protocol;
import io.github.dsheirer.sample.Listener; import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.util.PacketUtil; import io.github.dsheirer.util.PacketUtil;
import java.util.List;
import org.jdesktop.swingx.mapviewer.GeoPosition; import org.jdesktop.swingx.mapviewer.GeoPosition;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
/** /**
* Decoder state for an APCO25 channel. Maintains the call/data/idle state of the channel and produces events by * Decoder state for an APCO25 channel. Maintains the call/data/idle state of the channel and produces events by
* monitoring the decoded message stream. * monitoring the decoded message stream.
@@ -877,12 +877,12 @@ public class P25P1DecoderState extends DecoderState implements IChannelEventList
if(message instanceof SNDCPPacketMessage) if(message instanceof SNDCPPacketMessage)
{ {
SNDCPPacketMessage sndcp = (SNDCPPacketMessage)message; SNDCPPacketMessage sndcp = (SNDCPPacketMessage) message;
getIdentifierCollection().update(sndcp.getIdentifiers()); getIdentifierCollection().update(sndcp.getIdentifiers());
} }
else if(message instanceof PacketMessage) else if(message instanceof PacketMessage)
{ {
PacketMessage packetMessage = (PacketMessage)message; PacketMessage packetMessage = (PacketMessage) message;
getIdentifierCollection().remove(IdentifierClass.USER); getIdentifierCollection().remove(IdentifierClass.USER);
getIdentifierCollection().update(packetMessage.getIdentifiers()); getIdentifierCollection().update(packetMessage.getIdentifiers());
@@ -890,41 +890,41 @@ public class P25P1DecoderState extends DecoderState implements IChannelEventList
if(packet instanceof IPV4Packet) if(packet instanceof IPV4Packet)
{ {
IPV4Packet ipv4 = (IPV4Packet)packet; IPV4Packet ipv4 = (IPV4Packet) packet;
IPacket ipPayload = ipv4.getPayload(); IPacket ipPayload = ipv4.getPayload();
if(ipPayload instanceof UDPPacket) if(ipPayload instanceof UDPPacket)
{ {
UDPPacket udpPacket = (UDPPacket)ipPayload; UDPPacket udpPacket = (UDPPacket) ipPayload;
IPacket udpPayload = udpPacket.getPayload(); IPacket udpPayload = udpPacket.getPayload();
if(udpPayload instanceof ARSPacket) if(udpPayload instanceof ARSPacket)
{ {
ARSPacket arsPacket = (ARSPacket)udpPayload; ARSPacket arsPacket = (ARSPacket) udpPayload;
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers()); MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
for(Identifier identifier: packet.getIdentifiers()) for(Identifier identifier : packet.getIdentifiers())
{ {
ic.update(identifier); ic.update(identifier);
} }
DecodeEvent packetEvent = P25DecodeEvent.builder(message.getTimestamp()) DecodeEvent packetEvent = P25DecodeEvent.builder(message.getTimestamp())
.channel(getCurrentChannel()) .channel(getCurrentChannel())
.eventDescription(DecodeEventType.AUTOMATIC_REGISTRATION_SERVICE.toString()) .eventDescription(DecodeEventType.AUTOMATIC_REGISTRATION_SERVICE.toString())
.identifiers(ic) .identifiers(ic)
.details(arsPacket.toString() + " " + ipv4.toString()) .details(arsPacket.toString() + " " + ipv4.toString())
.build(); .build();
broadcast(packetEvent); broadcast(packetEvent);
} }
else if(udpPayload instanceof MCGPPacket) else if(udpPayload instanceof MCGPPacket)
{ {
MCGPPacket mcgpPacket = (MCGPPacket)udpPayload; MCGPPacket mcgpPacket = (MCGPPacket) udpPayload;
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers()); MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
for(Identifier identifier: packet.getIdentifiers()) for(Identifier identifier : packet.getIdentifiers())
{ {
ic.update(identifier); ic.update(identifier);
} }
@@ -954,7 +954,7 @@ public class P25P1DecoderState extends DecoderState implements IChannelEventList
GeoPosition geoPosition = PacketUtil.extractGeoPosition(lrrpPacket); GeoPosition geoPosition = PacketUtil.extractGeoPosition(lrrpPacket);
if (geoPosition != null) if(geoPosition != null)
{ {
PlottableDecodeEvent plottableDecodeEvent = PlottableDecodeEvent.plottableBuilder(message.getTimestamp()) PlottableDecodeEvent plottableDecodeEvent = PlottableDecodeEvent.plottableBuilder(message.getTimestamp())
.channel(getCurrentChannel()) .channel(getCurrentChannel())
@@ -970,21 +970,72 @@ public class P25P1DecoderState extends DecoderState implements IChannelEventList
else else
{ {
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers()); MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
for(Identifier identifier: packet.getIdentifiers()) for(Identifier identifier : packet.getIdentifiers())
{ {
ic.update(identifier); ic.update(identifier);
} }
DecodeEvent packetEvent = P25DecodeEvent.builder(message.getTimestamp()) DecodeEvent packetEvent = P25DecodeEvent.builder(message.getTimestamp())
.channel(getCurrentChannel()) .channel(getCurrentChannel())
.eventDescription(DecodeEventType.UDP_PACKET.toString()) .eventDescription(DecodeEventType.UDP_PACKET.toString())
.identifiers(ic) .identifiers(ic)
.details(ipv4.toString()) .details(ipv4.toString())
.build(); .build();
broadcast(packetEvent); broadcast(packetEvent);
} }
} }
else if(ipPayload instanceof ICMPPacket)
{
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
for(Identifier identifier : packet.getIdentifiers())
{
ic.update(identifier);
}
DecodeEvent packetEvent = P25DecodeEvent.builder(message.getTimestamp())
.channel(getCurrentChannel())
.eventDescription(DecodeEventType.ICMP_PACKET.toString())
.identifiers(ic)
.details(ipv4.toString())
.build();
broadcast(packetEvent);
}
else
{
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
for(Identifier identifier : packet.getIdentifiers())
{
ic.update(identifier);
}
DecodeEvent packetEvent = P25DecodeEvent.builder(message.getTimestamp())
.channel(getCurrentChannel())
.eventDescription(DecodeEventType.IP_PACKET.toString())
.identifiers(ic)
.details(ipv4.toString())
.build();
broadcast(packetEvent);
}
}
else if(packet instanceof UnknownPacket)
{
MutableIdentifierCollection ic = new MutableIdentifierCollection(getIdentifierCollection().getIdentifiers());
for(Identifier identifier : packet.getIdentifiers())
{
ic.update(identifier);
}
DecodeEvent packetEvent = P25DecodeEvent.builder(message.getTimestamp())
.channel(getCurrentChannel())
.eventDescription(DecodeEventType.UNKNOWN_PACKET.toString())
.identifiers(ic)
.details(packet.toString())
.build();
broadcast(packetEvent);
} }
} }
} }
@@ -992,18 +1043,14 @@ public class P25P1DecoderState extends DecoderState implements IChannelEventList
/** /**
* Sub-Network Dependent Convergence Protocol (SNDCP) * Sub-Network Dependent Convergence Protocol (SNDCP)
* *
* @param message * @param message to process
*/ */
private void processSNDCP(P25Message message) private void processSNDCP(P25Message message)
{ {
broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA)); broadcast(new DecoderStateEvent(this, Event.DECODE, State.DATA));
if(message.isValid() && message instanceof SNDCPPacketMessage) if(message.isValid() && message instanceof SNDCPPacketMessage sndcpPacket)
{ {
SNDCPPacketMessage sndcpPacket = (SNDCPPacketMessage)message;
SNDCPMessage sndcpMessage = sndcpPacket.getSNDCPMessage();
MutableIdentifierCollection ic = getMutableIdentifierCollection(sndcpPacket.getIdentifiers()); MutableIdentifierCollection ic = getMutableIdentifierCollection(sndcpPacket.getIdentifiers());
switch(sndcpPacket.getSNDCPPacketHeader().getPDUType()) switch(sndcpPacket.getSNDCPPacketHeader().getPDUType())