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

Enhance support of offline pcap capture

Bug fixed in FacilitiesInd.java
parent 3be668bc
Loading
Loading
Loading
Loading
+5 −19
Original line number Diff line number Diff line
@@ -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                
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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;
+5 −3
Original line number Diff line number Diff line
@@ -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
+5 −5
Original line number Diff line number Diff line
@@ -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() { 
Loading