Commit 01097524 authored by garciay's avatar garciay
Browse files

Merge with C2C project

Add AcSecPrimitive/AcSecResponse support for CAM (DENM & GN to be done)
parent 964ca145
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -60,4 +60,15 @@ public interface ITERequired {
	 * @return Value associated to the TA parameter
	 */
	Value getTaParameter(String param);
	
	/**
	 * Logs the debug message.
	 */
	void logDebug(String debugMessage);
	
	/**
	 * Logs the error message.
	 */
	void logError(String errorMessage);
	
}
+14 −13
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Observer;

import org.etsi.adapter.TERFactory;
import org.etsi.common.ITuple;
import org.etsi.common.Tuple;
import org.etsi.its.adapter.ports.IObservable;
@@ -58,7 +59,7 @@ public class ComponentMgr{
	public void addComponent(TriComponentId component) {
		// Sanity check
		if(component == null) {
			System.err.println("Error: Trying to add null component");
			TERFactory.getInstance().logError("Error: Trying to add null component");
			return;
		}		

@@ -81,11 +82,11 @@ public class ComponentMgr{
	public void addPort(final String componentName, final TriPortId ttcnPort, final IPort port) {
		// Sanity checks
		if(componentName.isEmpty() || (ttcnPort == null) || (port == null)) {
		    System.err.println("Wrong parameters");
		    TERFactory.getInstance().logError("Wrong parameters");
			return;
		}				
		if(!mapCompNameToTriComp.containsKey(componentName)) {
		    System.err.println("Error: Trying to add port to unknown component");
		    TERFactory.getInstance().logError("Error: Trying to add port to unknown component");
			return;
		}
		if(!mapTriPortToTuple.containsKey(componentName)) {
@@ -110,7 +111,7 @@ public class ComponentMgr{

		// Sanity checks
		if(componentName == null || componentName.isEmpty()) {
			System.err.println("Invalid component");
			TERFactory.getInstance().logError("Invalid component");
			return null;
		}

@@ -127,15 +128,15 @@ public class ComponentMgr{

		// Sanity checks
		if(componentName.isEmpty() || portName.isEmpty()) {
		    System.err.println("Wrong parameters");
		    TERFactory.getInstance().logError("Wrong parameters");
			return null;
		}
		if(!mapCompNameToTriComp.containsKey(componentName)) {
		    System.err.println("Unknown component");
		    TERFactory.getInstance().logError("Unknown component");
			return null;
		}
		if(!mapTriPortToTuple.containsKey(componentName)) {
		    System.err.println("No port list entry");
		    TERFactory.getInstance().logError("No port list entry");
			return null;
		}

@@ -160,15 +161,15 @@ public class ComponentMgr{

		// Sanity checks
		if(componentName.isEmpty() || portName.isEmpty()) {
		    System.err.println("Wrong parameters");
		    TERFactory.getInstance().logError("Wrong parameters");
			return null;
		}
		if(!mapCompNameToTriComp.containsKey(componentName)) {
		    System.err.println("Unknown component");
		    TERFactory.getInstance().logError("Unknown component");
			return null;
		}
		if(!mapTriPortToTuple.containsKey(componentName)) {
		    System.err.println("No port list entry");
		    TERFactory.getInstance().logError("No port list entry");
			return null;
		}

@@ -204,15 +205,15 @@ public class ComponentMgr{

		// Sanity checks
		if(componentName.isEmpty() || portName.isEmpty()) {
		    System.err.println("Wrong parameters");
		    TERFactory.getInstance().logError("Wrong parameters");
			return;
		}
		if(!mapCompNameToTriComp.containsKey(componentName)) {
		    System.err.println("Unknown component");
		    TERFactory.getInstance().logError("Unknown component");
			return;
		}
		if(!mapTriPortToTuple.containsKey(componentName)) {
		    System.err.println("No port list entry");
		    TERFactory.getInstance().logError("No port list entry");
			return;
		}
		
+3 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public class Management implements IManagementTA, IManagementLayers {
    /**
     * Maximum time for getting Long position vector (in seconds)
     */
    private static final int GET_LPV_TIMEOUT = 10;
    private static final int GET_LPV_TIMEOUT = 10; //FIXME: Might be a parameter rather than a constant

    /**
     * Interval for polling the location table during GetLpv (in ms)
@@ -353,6 +353,8 @@ public class Management implements IManagementTA, IManagementLayers {
        // Ensure that management settings are reset
        beaconHeader = null;
        enqueueBeacon = null;
        
        locTable.clear();
    }

    @Override
+7 −7
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public class PcapMultiplexer implements Runnable {
                          
        int r = Pcap.findAllDevs(alldevs, errbuf);  
        if (r == Pcap.NOT_OK || alldevs.isEmpty()) {  
          System.err.printf("Can't read list of devices, error is %s", errbuf.toString());  
          TERFactory.getInstance().logError("Can't read list of devices, error is %s" + errbuf.toString());  
          return;  
        }  

@@ -72,7 +72,7 @@ public class PcapMultiplexer implements Runnable {
        }
       
        device = alldevs.get(ifaceIndex);
        System.out.println("Listening: " + device.getName());
//        TERFactory.getInstance().logDebug("Listening: " + device.getName());
    }
    
    /**
@@ -84,7 +84,7 @@ public class PcapMultiplexer implements Runnable {
    }
    
    public synchronized void register(Layer client, byte[] macAddress, short frameType) {
        System.out.println(">>>PcapMultiplexer.registering: " + frameType);
//        TERFactory.getInstance().logDebug(">>>PcapMultiplexer.registering: " + frameType);
        
        if(clientsToMacs.isEmpty()) {
            // Open interface 
@@ -94,7 +94,7 @@ public class PcapMultiplexer implements Runnable {
            pcap = Pcap.openLive(device.getName(), snaplen, flags, timeout, errbuf);  
              
            if (pcap == null) {  
              System.err.printf("Error while opening device for capture: "  
              TERFactory.getInstance().logError("Error while opening device for capture: "  
                    + errbuf.toString());  
              return;  
            }  
@@ -103,7 +103,7 @@ public class PcapMultiplexer implements Runnable {
            filter = "";
        }
        else {
            System.out.println("Another Client !");
//            TERFactory.getInstance().logDebug("Another Client !");
            filter = filter + " and ";
        }

@@ -114,7 +114,7 @@ public class PcapMultiplexer implements Runnable {
        }
        
        filter = filter + "not ether src " + strMacAddress;
        System.out.println("New filter: " + filter);
//        TERFactory.getInstance().logDebug("New filter: " + filter);

        // Apply filter
        PcapBpfProgram bpfFilter = new PcapBpfProgram();
@@ -122,7 +122,7 @@ public class PcapMultiplexer implements Runnable {
        int netmask = 0;            
        int r = pcap.compile(bpfFilter, filter, optimize, netmask);
        if (r != Pcap.OK) {
            System.out.println("Filter error: " + pcap.getErr());
//            TERFactory.getInstance().logDebug("Filter error: " + pcap.getErr());
        }
        pcap.setFilter(bpfFilter);

+144 −124

File changed.

Preview size limit exceeded, changes collapsed.

Loading