Commit 4eb13ec8 authored by garciay's avatar garciay
Browse files

Enhance support of offline pcap capture

Bug fixed in FacilitiesInd.java
parent 3be668bc
......@@ -39,7 +39,7 @@ public class PcapMultiplexer implements Runnable {
private StringBuilder errbuf = new StringBuilder(); // For any error msgs
private long timestampOffset = 0;
private String timestampOffset = "";
private PcapMultiplexer() {
......@@ -81,10 +81,7 @@ public class PcapMultiplexer implements Runnable {
if ((file == null) || file.isEmpty()) {
throw new RuntimeException(String.format("PcapMultiplexer: failed to open '%s'", file));
}
String tmp = ((CharstringValue)TERFactory.getInstance().getTaParameter("OffsetTime")).getString().toLowerCase();
if (!tmp.isEmpty()) {
timestampOffset = Long.parseLong(tmp);
}
timestampOffset = ((CharstringValue)TERFactory.getInstance().getTaParameter("OffsetTime")).getString().toLowerCase();
}
}
......@@ -128,7 +125,9 @@ public class PcapMultiplexer implements Runnable {
}
captureThread = new Thread(this);
captureThread.start();
filter = "";
if (!timestampOffset.isEmpty()) {
filter = "frame time_delta " + timestampOffset + " and ";
}
}
else {
//TERFactory.getInstance().logDebug("Another Client !");
......@@ -186,7 +185,6 @@ public class PcapMultiplexer implements Runnable {
public void run() {
ByteBufferHandler<Object> handler = new ByteBufferHandler<Object>() {
private boolean couldStart = false;
@Override
public void nextPacket(PcapHeader pcapHeader, ByteBuffer byteBuffer, Object user) {
......@@ -194,18 +192,6 @@ public class PcapMultiplexer implements Runnable {
return;
}
if (!couldStart) {
if (offlineMode) {
if (pcapHeader.timestampInMillis() < timestampOffset) {
return; // Skip it
} else {
couldStart = true;
}
} else {
couldStart = true;
}
} // continue
Map<String, Object> lowerInfo = new HashMap<String, Object>();
// Extract Dst info
......
......@@ -130,7 +130,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
strMacAddress += String.format(":%02x", localMacAddress[i]);
}
//udp dst port 74 && wlan src 8b:ad:f0:0d:01:02
pcapFilter = pcapFilter + "not wlan src " + "8b:ad:f0:0d:01:03";//strMacAddress;
pcapFilter = pcapFilter + "not wlan src " + strMacAddress;
// Reset filter
PcapMultiplexer.getInstance().resetFilter(pcapFilter);
// Register client
......
......@@ -22,7 +22,7 @@ public class FacilitiesInd extends Record {
protected void preDecode(CodecBuffer buf, Type decodingHypothesis) {
// System.out.println(">>> FacilitiesInd.preDecode: " + decodingHypothesis);
int msgLen = buf.getNbBits() - 8 - 8 - 8 - 32 - 8 - 16 - 16 - 256 - 32; // FIXME Add support of SSP (Bit128) & ITS-AID (UInt32) extra fields: fixed size (256) is not nice!
int msgLen = buf.getNbBits() - 8 - 8 - 8 - 32 - 8 - 16 - 16 - 256 - 32; // FIXME Add support of SSP (Bit256) & ITS-AID (UInt32) extra fields: fixed size (256) is not nice!
int offset = 0;
messageBuffer = buf.getBuffer(offset, msgLen); offset += msgLen;
......
......@@ -22,12 +22,14 @@ public class GnIndReq extends Record {
protected void preDecode(CodecBuffer buf, Type decodingHypothesis) {
// TERFactory.getInstance().logDebug(">>> GnIndReq.preDecode: " + decodingHypothesis);
int msgLen = buf.getNbBits() - 48 - 128/*SSP*/ - 32/*ItsAid*/;
int msgLen = buf.getNbBits() - 48 - 256/*SSP*/ - 32/*ItsAid*/;
messageBuffer = buf.getBuffer(0, msgLen);
macBuffer = buf.getBuffer(msgLen, 48);
sspBuffer = buf.getBuffer(msgLen + 48, 128/*SSP*/);
itsaidBuffer = buf.getBuffer(msgLen + 48 + 128/*SSP*/, 32/*ItsAid*/);
msgLen += 48;
sspBuffer = buf.getBuffer(msgLen, 256/*SSP*/);
msgLen += 256/*SSP*/;
itsaidBuffer = buf.getBuffer(msgLen, 32/*ItsAid*/);
}
@Override
......
......@@ -89,11 +89,11 @@ public class Its_CodecProvider implements TciCDProvided, ChannelEventHandler, IT
}
} // End of 'for' loop
// try {
// _cf.setExternalCodec("per-basic-unaligned:1997", (TciCDProvided) Class.forName("org.etsi.its.tool.elvior.LibIts_asn1").newInstance());
// } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
// e.printStackTrace();
// }
try {
_cf.setExternalCodec("per-basic-unaligned:1997", (TciCDProvided) Class.forName("org.etsi.its.tool.elvior.LibIts_asn1").newInstance());
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
}
}
public void run() {
......
......@@ -60,48 +60,48 @@ public class LibIts_asn1 implements TciCDProvided {
if (_logger.isLoggable(Level.ALL)) ByteHelper.dump("LibIts_asn1.decode: ", msg.getEncodedMessage());
String type = "";
// if (decodingHypothesis.getTypeEncoding().equals("per-basic-unaligned:1997")) {
// switch (message.getEncodedMessage()[1]) { // messageID INTEGER{ denm(1), cam(2), poi(3), spatem(4), mapem(5), ivim(6), ev-rsr(7), tistpgtransaction(8), srem(9), ssem(10), evcsn(11) } (0..255), -- Mantis #7209, #7005
// case (byte)0x01:
// if (decodingHypothesis.getName().equals("DENM")) {
// type = String.format("%s.%s", "DENM_PDU_Descriptions", decodingHypothesis.getName());
// }
// break;
// case (byte)0x02:
// if (decodingHypothesis.getName().equals("CAM")) {
// type = String.format("%s.%s", "CAM_PDU_Descriptions", decodingHypothesis.getName());
// }
// break;
// case (byte)0x05:
// if (decodingHypothesis.getName().equals("MAPEM")) {
// type = String.format("%s.%s", "MAPEM_PDU_Descriptions", decodingHypothesis.getName());
// }
// break;
// case (byte)0x04:
// if (decodingHypothesis.getName().equals("SPATEM")) {
// type = String.format("%s.%s", "SPATEM_PDU_Descriptions", decodingHypothesis.getName());
// }
// break;
// case (byte)0x06:
// if (decodingHypothesis.getName().equals("IVIM")) {
// type = String.format("%s.%s", "IVIM_PDU_Descriptions", decodingHypothesis.getName());
// }
// case (byte)0x09:
// if (decodingHypothesis.getName().equals("SREM")) {
// type = String.format("%s.%s", "SREM_PDU_Descriptions", decodingHypothesis.getName());
// }
// break;
// case (byte)0x0a:
// if (decodingHypothesis.getName().equals("SSEM")) {
// type = String.format("%s.%s", "SSEM_PDU_Descriptions", decodingHypothesis.getName());
// }
// break;
// default:
// // Nothing to do
// } // End of 'switch' statement
// } else {
if (decodingHypothesis.getTypeEncoding().equals("per-basic-unaligned:1997")) {
switch (message.getEncodedMessage()[1]) { // messageID INTEGER{ denm(1), cam(2), poi(3), spatem(4), mapem(5), ivim(6), ev-rsr(7), tistpgtransaction(8), srem(9), ssem(10), evcsn(11) } (0..255), -- Mantis #7209, #7005
case (byte)0x01:
if (decodingHypothesis.getName().equals("DENM")) {
type = String.format("%s.%s", "DENM_PDU_Descriptions", decodingHypothesis.getName());
}
break;
case (byte)0x02:
if (decodingHypothesis.getName().equals("CAM")) {
type = String.format("%s.%s", "CAM_PDU_Descriptions", decodingHypothesis.getName());
}
break;
case (byte)0x05:
if (decodingHypothesis.getName().equals("MAPEM")) {
type = String.format("%s.%s", "MAPEM_PDU_Descriptions", decodingHypothesis.getName());
}
break;
case (byte)0x04:
if (decodingHypothesis.getName().equals("SPATEM")) {
type = String.format("%s.%s", "SPATEM_PDU_Descriptions", decodingHypothesis.getName());
}
break;
case (byte)0x06:
if (decodingHypothesis.getName().equals("IVIM")) {
type = String.format("%s.%s", "IVIM_PDU_Descriptions", decodingHypothesis.getName());
}
case (byte)0x09:
if (decodingHypothesis.getName().equals("SREM")) {
type = String.format("%s.%s", "SREM_PDU_Descriptions", decodingHypothesis.getName());
}
break;
case (byte)0x0a:
if (decodingHypothesis.getName().equals("SSEM")) {
type = String.format("%s.%s", "SSEM_PDU_Descriptions", decodingHypothesis.getName());
}
break;
default:
// Nothing to do
} // End of 'switch' statement
} else {
type = String.format("%s.%s", _encodingName, decodingHypothesis.getName());
// }
}
_logger.info("Type: " + type);
if (type.isEmpty()) {
return null; // Abort decoding
......
# Debug level - Authorized values: OFF, ALL, INFO, SEVERE
DEBUG_ENABLED=ALL
DEBUG_ENABLED=OFF
ASN.1Codecs=CAM,DENM,CDD,MAPEM_SPATEM,IVIM,SREM_SSEM
CAM=LibItsCam_asn1,org.etsi.its.tool.elvior.LibItsCam_asn1
......
# Debug level - Authorized values: OFF, ALL, INFO, SEVERE
DEBUG_ENABLED=ALL
DEBUG_ENABLED=OFF
# Define the port/layer configuration for CAM
camPort=BTP/GN/ETH
#camPort=BTP/GN/CSG
......@@ -18,8 +18,8 @@ sremSsemPort=BTP/GN/ETH
# Define the port/layer configuration for BTP
btpPort=GN/ETH
# Define the port/layer configuration for GeoNetworking
#geoNetworkingPort=ETH
geoNetworkingPort=CSG
geoNetworkingPort=ETH
#geoNetworkingPort=CSG
# Define the port/layer configuration for GeoNetworking over IPv6
ipv6OverGeoNetworkingPort=Debug
# Define the port/layer configuration for CALM FNTP
......@@ -47,9 +47,9 @@ ConfigTesterSettings=172.17.15.39:12346
LocalEthernetMAC=00E08F008855
# Post-mortem ATS execution mode
OfflineMode=false
PcapFile=pcap/vendor/uc1.pcappng
OffsetTime=30 # Start at +30 seconds
OffsetFrame=
PcapFile=pcap/vendor/TC_CAM_MSD_FMT_BV_01.pcap
# Start at time in seconds since 1970-01-01, e.g. 1421661427.233361
OffsetTime=1421661427.233361
# Define the Ethernet type value used by the IUT
IutEthernetTypeValue=0x8947
# Node Ethernet addresses
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment