Commit b5cfb26e authored by garciay's avatar garciay
Browse files

ITS-CMS5 Plugtest validation

Add Evcsn
parent 32c3e6d9
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -269,12 +269,13 @@ public class PcapMultiplexer implements Runnable {
        int r = pcap.compile(bpfFilter, filter, optimize, netmask);
        if (r != Pcap.OK) {
            TERFactory.getInstance().logError("Filter error: " + pcap.getErr());
        }
        } else {
            r = pcap. setFilter(bpfFilter);
            if (r != Pcap.OK) {
                TERFactory.getInstance().logError("Filter error: " + pcap.getErr());
            }
        }
    }
    
    /**
     * Jpcap capture device
+1 −0
Original line number Diff line number Diff line
@@ -370,6 +370,7 @@ public class SecurityHelper {
                        (p_headerfields[signerInfoTypeIndex] != 0x89) && // SPATEM
                        (p_headerfields[signerInfoTypeIndex] != 0x8a) && // MAPEM
                        (p_headerfields[signerInfoTypeIndex] != 0x8b) && // IVIM
                        (p_headerfields[signerInfoTypeIndex] != 0x8d) && // EVCSN TODO Use the correct value
                        (p_headerfields[signerInfoTypeIndex] != 0x8c)    // SREM/SSEM
                    ) {
                        if (p_enforceSecurityCheck) { 
+19 −13
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
    private static final int SourcePort = 7943; 
    private static final int ItsAid = 5; 
    private static final int InterfaceID = 2;
    private static final int TxPowerDbm = -31; // Max value: -33dBm, RSU: -30dBm, Lab: -10dBm
    private static final int TxPowerDbm = -32; // Max value: -33dBm, RSU: -30dBm, Lab: -10dBm
    private static String pcapFilter = null;
    
    /**
@@ -62,9 +62,9 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
        try {
            itsApplication.connect(1000);
            itsApplication.registerBlocking();
            itsApplication.setFacilityModuleStatus(FacilityModule.BSM, false);
            itsApplication.setFacilityModuleStatus(FacilityModule.CAM, false);
            itsApplication. gnBindBlocking(BTPType.NONE, 65535);
//            itsApplication.setFacilityModuleStatus(FacilityModule.BSM, false);
//            itsApplication.setFacilityModuleStatus(FacilityModule.CAM, false);
//            itsApplication. gnBindBlocking(BTPType.NONE, 65535);
        } catch (TimeoutException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
@@ -106,19 +106,25 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
        }
        
        if(ClientsToMacs.isEmpty()) {
            pcapFilter = "udp dst port " + SourcePort + " and ";
            pcapFilter = 
                "udp dst port " + SourcePort + 
//                " and not ether[0x56:4]==0x04e54800 and not ether[0x56:4]==0x04f02122 and not ether[0x56:4]==0xa60e3f16 and not ether[0x56:4]==0x04e54800 and not ether[0x56:4]==0x92232f44 and not ether[0x56:4]==0x4a74556d" + 
                 " and not ether[0x56:4]==0x4a74556d" + 
                 " and ";
        } else {
            TERFactory.getInstance().logDebug("CommsigniaLayer.register: Another Client !");
            pcapFilter = pcapFilter + " and ";
        }
        // Update Filter
        String strMacAddress = String.format("%02x", localMacAddress[0]);
        for(int i=1; i < localMacAddress.length; i++) {
            strMacAddress += String.format(":%02x", localMacAddress[i]);
        }
        String strMacAddress = String.format("%02x%02x%02x%02x", localMacAddress[0], localMacAddress[1], localMacAddress[2], localMacAddress[3]);
//        String strMacAddress = String.format("%02x", localMacAddress[0]);
//        for(int i=1; i < localMacAddress.length; i++) {
//            strMacAddress += String.format(":%02x", localMacAddress[i]);
//        }
        //udp dst port 7493 && wlan src 8b:ad:f0:0d:01:02
        pcapFilter = pcapFilter + "not wlan src " + strMacAddress;
        pcapFilter = pcapFilter + "not ether[0x56:4]==0x" + strMacAddress;
        // Reset filter
        System.out.println("Reset PCAP filter: " + pcapFilter);
        PcapMultiplexer.getInstance().resetFilter(pcapFilter);
        // Register client
        ClientsToMacs.put(this.toString(), localMacAddress);
@@ -143,7 +149,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
        byteBuffer.position(
            20 + // IP Layer:           45 00 01 1f 13 8c 00 00 80 11 6b 0b ac 11 0f 26 ff ff ff ff
            8  + // UDP Layer:          75 30 1f 07 01 0b a6 cd
            29 + // C2P Layer:          12 00 00 33 41 00 00 03 5c ac 00 02 0c 02 35 a4 e9 01 6b 49 d2 01 3f ff 00 00 7f ff 16
            34 + // C2P Layer:          12 00 00 33 41 00 00 03 5c ac 00 02 0c 02 35 a4 e9 01 6b 49 d2 01 3f ff 00 00 7f ff 16
            4   // IEEE 802.11L Layer: 88 00 00 00 00
        );
        
@@ -159,7 +165,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
        byteBuffer.position(byteBuffer.position() + 10);
        
        // Skip LLC header
        byteBuffer.position(byteBuffer.position() + 8);
        byteBuffer.position(byteBuffer.position() + 6);
        
        // Extract FrameType info
        byte[] rawFrameType = new byte[2];
@@ -254,7 +260,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
            if(ClientsToMacs.isEmpty()) {
                if (itsApplication != null) {
                    try {
                        itsApplication.gnCloseBlocking(BTPType.NONE, 65535);
//                        itsApplication.gnCloseBlocking(BTPType.NONE, 65535);
                        itsApplication.deregisterBlocking();
                    } catch (ClientException e) {
                        // TODO Auto-generated catch block
+3 −0
Original line number Diff line number Diff line
@@ -717,6 +717,9 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
            case 2008: 
                its_aid = 140;
                break;
            case 2010: 
                its_aid = 100; // FIXME Use the correct value
                break;
        } // End of 'switch' statement
        if (its_aid == 36) { // CAM
            headersField = ByteHelper.concat(
+4 −5
Original line number Diff line number Diff line
@@ -35,16 +35,13 @@ public class MainCodec extends ICodec {
    @Override
    public Value decode(CodecBuffer buf, Type decodingHypothesis) {
//        TERFactory.getInstance().logDebug(">>> MainCodec.decode: " + decodingHypothesis.getName());
        ByteHelper.dump(">>> MainCodec.decode: ", buf.getBytes());
//        ByteHelper.dump(">>> MainCodec.decode: ", buf.getBytes());
        
        CodecFactory cf = CodecFactory.getInstance();
        try {
            TciCDProvided extCodec = cf.getExternalCodec(decodingHypothesis.getTypeEncoding());
            if(extCodec != null) {
                Value v = extCodec.decode(new TriMessageImpl(buf.getBytes()), decodingHypothesis);
                if (v != null) {
                    return v;//extCodec.decode(new TriMessageImpl(buf.getBytes()), decodingHypothesis);
                } // else continue
                return extCodec.decode(new TriMessageImpl(buf.getBytes()), decodingHypothesis);
            }
            ICodec codec = cf.getCodec(
                    this,
@@ -67,6 +64,8 @@ public class MainCodec extends ICodec {

    @Override
    public CodecBuffer encode(Value value) {
        //TERFactory.getInstance().logDebug(">>> MainCodec.encode: " + value);
        //System.out.println(">>> MainCodec.encode: " + value);
        
        CodecFactory cf = CodecFactory.getInstance();
        TciCDProvided extCodec = cf.getExternalCodec(value.getValueEncoding());
Loading