Commit 7c515cdb authored by berge's avatar berge
Browse files

/!\ FIXING BRANCH/MERGE ISSUES /!\

Reverting non STF455-specific changes trunk/javasrc (r1427 - r1432). 
Those changes:
 - have been manually duplicated in Security branch, causing massive conflicts upon merging the branch back in trunk. 
 - will be re-inserted by merging Security branch back in trunk (cf. next commit)
parent bac556d6
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
package org.etsi.its.adapter; package org.etsi.its.adapter;
import org.etsi.its.adapter.ports.FsapPort;
import org.etsi.its.adapter.ports.GnPort; import org.etsi.its.adapter.ports.GnPort;
/** /**
...@@ -28,12 +27,6 @@ public interface IManagementLayers { ...@@ -28,12 +27,6 @@ public interface IManagementLayers {
*/ */
public void registerGnPort(GnPort gnPort); public void registerGnPort(GnPort gnPort);
/**
* Registers a FSAP port
* @param The FSAP port to register
*/
public void registerFsapPort(final FsapPort fntpPort);
/** /**
* Gets the GeoNetworking beaconing interval * Gets the GeoNetworking beaconing interval
* @return GeoNetworking beaconing interval in ms * @return GeoNetworking beaconing interval in ms
......
...@@ -55,15 +55,4 @@ public interface IManagementTA { ...@@ -55,15 +55,4 @@ public interface IManagementTA {
*/ */
public byte[] getLongPositionVector(byte[] targetGnAddress); public byte[] getLongPositionVector(byte[] targetGnAddress);
/**
* Requests Test Adapter to trigger a Service Provider InSapPrimitiveUp/SAM message sending
* @param sam The SAM message to transmit
*/
public void startSamTransmission(final byte[] sam);
/**
* Requests Test Adapter to stop a Service Provider InSapPrimitiveUp/SAM message sending
* @param sam The SAM message to transmit
*/
public void stopSamTransmission();
} }
...@@ -19,7 +19,6 @@ import org.etsi.adapter.TERFactory; ...@@ -19,7 +19,6 @@ import org.etsi.adapter.TERFactory;
import org.etsi.common.ByteHelper; import org.etsi.common.ByteHelper;
import org.etsi.common.ITuple; import org.etsi.common.ITuple;
import org.etsi.common.Tuple; import org.etsi.common.Tuple;
import org.etsi.its.adapter.ports.FsapPort;
import org.etsi.its.adapter.ports.GnPort; import org.etsi.its.adapter.ports.GnPort;
import org.etsi.ttcn.tci.CharstringValue; import org.etsi.ttcn.tci.CharstringValue;
...@@ -70,11 +69,6 @@ public class Management implements IManagementTA, IManagementLayers { ...@@ -70,11 +69,6 @@ public class Management implements IManagementTA, IManagementLayers {
private GnPort gnPort = null; private GnPort gnPort = null;
/** /**
* Registered FSAP Port
*/
private FsapPort fsapPort = null; // FIXME Enhance this using Fsap.send() method
/**
* Private constructor (Multiton pattern) * Private constructor (Multiton pattern)
*/ */
private Management() { private Management() {
...@@ -287,27 +281,4 @@ public class Management implements IManagementTA, IManagementLayers { ...@@ -287,27 +281,4 @@ public class Management implements IManagementTA, IManagementLayers {
enqueueBeacon = null; enqueueBeacon = null;
} }
/**
* Registers a FSAP port
* @param The FSAP port to register
*/
@Override
public void registerFsapPort(final FsapPort fsapPort) {
this.fsapPort = fsapPort;
}
@Override
public void startSamTransmission(final byte[] sam) {
if(fsapPort != null) {
fsapPort.startSamTransmission(sam);
}
}
@Override
public void stopSamTransmission() {
if(fsapPort != null) {
fsapPort.stopSamTransmission();
}
}
} }
...@@ -46,13 +46,8 @@ public class PcapMultiplexer implements Runnable { ...@@ -46,13 +46,8 @@ public class PcapMultiplexer implements Runnable {
// Obtain the list of network interfaces // Obtain the list of network interfaces
List<PcapIf> alldevs = new ArrayList<PcapIf>(); // Will be filled with NICs List<PcapIf> alldevs = new ArrayList<PcapIf>(); // Will be filled with NICs
int r;
try { int r = Pcap.findAllDevs(alldevs, errbuf);
r = Pcap.findAllDevs(alldevs, errbuf);
} catch (java.lang.UnsatisfiedLinkError e) {
e.printStackTrace();
return;
}
if (r == Pcap.NOT_OK || alldevs.isEmpty()) { if (r == Pcap.NOT_OK || alldevs.isEmpty()) {
System.err.printf("Can't read list of devices, error is %s", errbuf.toString()); System.err.printf("Can't read list of devices, error is %s", errbuf.toString());
return; return;
......
...@@ -14,7 +14,6 @@ import java.util.Observer; ...@@ -14,7 +14,6 @@ import java.util.Observer;
import org.etsi.adapter.ITERequired; import org.etsi.adapter.ITERequired;
import org.etsi.adapter.TERFactory; import org.etsi.adapter.TERFactory;
import org.etsi.its.adapter.ports.AdapterControlPort; import org.etsi.its.adapter.ports.AdapterControlPort;
import org.etsi.its.adapter.ports.ConfigTesterPort;
import org.etsi.its.adapter.ports.IPort; import org.etsi.its.adapter.ports.IPort;
import org.etsi.its.adapter.ports.PortEvent; import org.etsi.its.adapter.ports.PortEvent;
import org.etsi.its.adapter.ports.ProtocolPortFactory; import org.etsi.its.adapter.ports.ProtocolPortFactory;
...@@ -93,8 +92,6 @@ public class TestAdapter implements TriCommunicationSA, Observer { ...@@ -93,8 +92,6 @@ public class TestAdapter implements TriCommunicationSA, Observer {
port = new AdapterControlPort(portName, ComponentId); port = new AdapterControlPort(portName, ComponentId);
} else if (tsiPortId.getPortName().equals("utPort")) { } else if (tsiPortId.getPortName().equals("utPort")) {
port = new UpperTesterPort(portName, ComponentId); port = new UpperTesterPort(portName, ComponentId);
} else if (tsiPortId.getPortName().equals("cfPort")) {
port = new ConfigTesterPort(portName, ComponentId);
} else { } else {
String componentName = compPortId.getComponent().getComponentName(); String componentName = compPortId.getComponent().getComponentName();
...@@ -296,8 +293,7 @@ public class TestAdapter implements TriCommunicationSA, Observer { ...@@ -296,8 +293,7 @@ public class TestAdapter implements TriCommunicationSA, Observer {
*/ */
@Override @Override
public TriStatus triSutActionInformal(String description) { public TriStatus triSutActionInformal(String description) {
javax.swing.JOptionPane.showMessageDialog(null, description); return required.getTriStatus(TriStatus.TRI_ERROR, "triSutActionInformal not implemented");
return required.getTriStatus(TriStatus.TRI_OK, "");
} }
/** /**
......
...@@ -46,11 +46,7 @@ public class LayerFactory { ...@@ -46,11 +46,7 @@ public class LayerFactory {
layers.put("GN", GnLayer.class); layers.put("GN", GnLayer.class);
layers.put("G5", G5Layer.class); layers.put("G5", G5Layer.class);
layers.put("ETH", EthernetLayer.class); layers.put("ETH", EthernetLayer.class);
layers.put("UdpIp", UdpIpLayer.class); // Used for CALM ports
layers.put("FNTP", FntpLayer.class);
layers.put("FSAP", FsapLayer.class);
layers.put("IICP", IicpLayer.class);
layers.put("ATSP", AtspLayer.class);
layers.put("Loopback", LoopbackLayer.class); layers.put("Loopback", LoopbackLayer.class);
layers.put("Debug", DebugLayer.class); layers.put("Debug", DebugLayer.class);
layers.put("CamSource", CamSourceLayer.class); layers.put("CamSource", CamSourceLayer.class);
......
...@@ -7,19 +7,12 @@ import java.net.InetAddress; ...@@ -7,19 +7,12 @@ import java.net.InetAddress;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Stack; import java.util.Stack;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.etsi.adapter.TERFactory;
import org.etsi.common.ByteHelper; import org.etsi.common.ByteHelper;
import org.etsi.its.adapter.IManagementLayers; import org.etsi.its.adapter.IManagementLayers;
import org.etsi.ttcn.tci.CharstringValue;
public class UdpIpLayer extends Layer { public class UdpIpLayer extends Layer {
private static final String SETTINGS_PATTERN = "(\\S+)\\:(\\d+)\\:(\\d+)"; // FIXME The second port shall be optional if the same port shall be used for server and client
private Pattern settingsPattern = Pattern.compile(SETTINGS_PATTERN);
public UdpIpLayer(IManagementLayers management, Stack<String> lowerStack) { public UdpIpLayer(IManagementLayers management, Stack<String> lowerStack) {
super(management, lowerStack); super(management, lowerStack);
...@@ -30,7 +23,7 @@ public class UdpIpLayer extends Layer { ...@@ -30,7 +23,7 @@ public class UdpIpLayer extends Layer {
*/ */
@Override @Override
public boolean send(byte[] message, Map<String, Object> params) { public boolean send(byte[] message, Map<String, Object> params) {
DatagramPacket packet = new DatagramPacket(message, message.length, iutAddress, iutClientPort); DatagramPacket packet = new DatagramPacket(message, message.length, iutAddress, iutPort);
try { try {
iutSocket.send(packet); iutSocket.send(packet);
} catch (IOException e) { } catch (IOException e) {
...@@ -47,22 +40,10 @@ public class UdpIpLayer extends Layer { ...@@ -47,22 +40,10 @@ public class UdpIpLayer extends Layer {
if(registeredUpperLayer == null) { if(registeredUpperLayer == null) {
super.register(upperLayer); super.register(upperLayer);
try { try {
// UDP connection parameters iutAddress = InetAddress.getByName("127.0.0.1");
String settings = ((CharstringValue)TERFactory.getInstance().getTaParameter("LowerTesterSettings")).getString(); //System.out.println("IUT Address: " + iutAddress.getHostAddress());
Matcher matcher = settingsPattern.matcher(settings); iutPort = 3750;
if (matcher.find()) { iutSocket = new DatagramSocket(3751);
iutAddress = InetAddress.getByName(matcher.group(1));
iutClientPort = Integer.parseInt(matcher.group(2));
if (matcher.group(3) != null) {
iutServerPort = Integer.parseInt(matcher.group(3));
} else {
iutServerPort = iutClientPort;
}
} else {
System.err.println("No pattern matching");
}
// UDP server socket for communication with UT
iutSocket = new DatagramSocket(iutServerPort);
iutThread = new UdpThread(iutSocket); iutThread = new UdpThread(iutSocket);
iutThread.start(); iutThread.start();
} catch (Exception e) { } catch (Exception e) {
...@@ -88,8 +69,7 @@ public class UdpIpLayer extends Layer { ...@@ -88,8 +69,7 @@ public class UdpIpLayer extends Layer {
private DatagramSocket iutSocket; private DatagramSocket iutSocket;
private InetAddress iutAddress; private InetAddress iutAddress;
private int iutClientPort; private int iutPort;
private int iutServerPort;
private Thread iutThread; private Thread iutThread;
private class UdpThread extends Thread { private class UdpThread extends Thread {
......
...@@ -20,7 +20,6 @@ public class AdapterControlPort extends AdapterPort implements IPort, IObservabl ...@@ -20,7 +20,6 @@ public class AdapterControlPort extends AdapterPort implements IPort, IObservabl
/* AdapterControl Primitives */ /* AdapterControl Primitives */
private static final byte AcGnPrimitive = 0; private static final byte AcGnPrimitive = 0;
private static final byte AcGn6Primitive = 1; private static final byte AcGn6Primitive = 1;
private static final byte AcFsapPrimitive = 2;
/* AdapterControl Response */ /* AdapterControl Response */
private static final byte AcGnResponse = 0; private static final byte AcGnResponse = 0;
...@@ -113,15 +112,6 @@ public class AdapterControlPort extends AdapterPort implements IPort, IObservabl ...@@ -113,15 +112,6 @@ public class AdapterControlPort extends AdapterPort implements IPort, IObservabl
} }
*/ */
break; break;
case AcFsapPrimitive:
ByteHelper.dump("AdapterControlPort.send", message);
byte[] data = ByteHelper.extract(message, 2, message.length - 2);
if ((data.length == 1) && (data[0] == 0x01)) {
Management.getInstance(getComponentName()).stopSamTransmission();
} else {
Management.getInstance(getComponentName()).startSamTransmission(data);
}
break;
} // End of 'switch' statement } // End of 'switch' statement
return result; return result;
......
...@@ -38,10 +38,6 @@ public class ProtocolPortFactory { ...@@ -38,10 +38,6 @@ public class ProtocolPortFactory {
ports.put("geoNetworkingPort", GnPort.class); ports.put("geoNetworkingPort", GnPort.class);
ports.put("ipv6OverGeoNetworkingPort", Gn6Port.class); ports.put("ipv6OverGeoNetworkingPort", Gn6Port.class);
ports.put("v2gPort", V2GPort.class); ports.put("v2gPort", V2GPort.class);
ports.put("fntpPort", FntpPort.class);
ports.put("fsapPort", FsapPort.class);
ports.put("iicpPort", IicpPort.class);
ports.put("atspPort", AtspPort.class);
} }
/** /**
......
...@@ -27,31 +27,7 @@ public interface ITciCDWrapper { ...@@ -27,31 +27,7 @@ public interface ITciCDWrapper {
* See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger * See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
* @return An instance of Type representing a TTCN-3 integer type * @return An instance of Type representing a TTCN-3 integer type
*/ */
public IntegerValue setInteger(final Integer value); public IntegerValue getInteger();
/**
* Constructs and returns a basic TTCN-3 big integer type
*
* @see ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
* @return An instance of Type representing a TTCN-3 integer type
*/
public IntegerValue setInteger(final BigInteger value);
/**
* Constructs and returns a basic integer type
*
* See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
* @return An instance of Type representing a TTCN-3 integer type
*/
public int getInteger(final IntegerValue iv);
/**
* Constructs and returns a basic big integer type
*
* @see ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
* @return An instance of Type representing a TTCN-3 integer type
*/
public long/*TODO BigInteger*/ getBigInteger(final IntegerValue iv);
/** /**
* Constructs and returns a basic TTCN-3 octet string type * Constructs and returns a basic TTCN-3 octet string type
...@@ -68,6 +44,14 @@ public interface ITciCDWrapper { ...@@ -68,6 +44,14 @@ public interface ITciCDWrapper {
* @return An instance of Type representing a TTCN-3 float type * @return An instance of Type representing a TTCN-3 float type
*/ */
public FloatValue getFloat(); public FloatValue getFloat();
/**
* Constructs and returns a basic TTCN-3 big integer type
*
* @see ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getInteger
* @return An instance of Type representing a TTCN-3 integer type
*/
IntegerValue getBigInteger(BigInteger bigInt);
/** /**
* Constructs and returns a basic TTCN-3 float type * Constructs and returns a basic TTCN-3 float type
......
...@@ -59,14 +59,9 @@ public class CodecFactory { ...@@ -59,14 +59,9 @@ public class CodecFactory {
// initialize additional codec plugins // initialize additional codec plugins
org.etsi.ttcn.codec.its.adapter.Plugin.init(); org.etsi.ttcn.codec.its.adapter.Plugin.init();
org.etsi.ttcn.codec.its.uppertester.Plugin.init(); org.etsi.ttcn.codec.its.uppertester.Plugin.init();
org.etsi.ttcn.codec.its.configtester.Plugin.init();
org.etsi.ttcn.codec.its.geonetworking.Plugin.init(); org.etsi.ttcn.codec.its.geonetworking.Plugin.init();
org.etsi.ttcn.codec.its.btp.Plugin.init(); org.etsi.ttcn.codec.its.btp.Plugin.init();
org.etsi.ttcn.codec.its.fntp.Plugin.init();
org.etsi.ttcn.codec.its.fsap.Plugin.init();
org.etsi.ttcn.codec.its.iicp.Plugin.init();
org.etsi.ttcn.codec.its.atsp.Plugin.init();
} }
} }
......
...@@ -8,15 +8,15 @@ package org.etsi.ttcn.codec; ...@@ -8,15 +8,15 @@ package org.etsi.ttcn.codec;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import org.etsi.codec.ITciCDWrapper; import org.etsi.ttcn.tri.TriMessage;
import org.etsi.ttcn.tci.TciCDProvided; import org.etsi.ttcn.tci.TciCDProvided;
import org.etsi.ttcn.tci.TciCDRequired;
import org.etsi.ttcn.tci.Type; import org.etsi.ttcn.tci.Type;
import org.etsi.ttcn.tci.Value; import org.etsi.ttcn.tci.Value;
import org.etsi.ttcn.tri.TriMessage;
public class MainCodec extends ICodec { public class MainCodec extends ICodec {
public MainCodec(ITciCDWrapper cdReq) { public MainCodec(TciCDRequired cdReq) {
super(null); super(null);
this.cdReq = cdReq; this.cdReq = cdReq;
} }
...@@ -97,11 +97,11 @@ public class MainCodec extends ICodec { ...@@ -97,11 +97,11 @@ public class MainCodec extends ICodec {
presenceHints.put(key, value); presenceHints.put(key, value);
} }
public ITciCDWrapper getTciCDRequired() { public TciCDRequired getTciCDRequired() {
return cdReq; return cdReq;
} }
protected Map<String, String> hints = new TreeMap<String, String>(); protected Map<String, String> hints = new TreeMap<String, String>();
protected Map<String, java.lang.Boolean> presenceHints = new TreeMap<String, java.lang.Boolean>(); protected Map<String, java.lang.Boolean> presenceHints = new TreeMap<String, java.lang.Boolean>();
protected ITciCDWrapper cdReq; protected TciCDRequired cdReq;
} }
/**
* @author ETSI / STF462 / Alexandre Berge
* @version $URL$
* $Id$
*/
package org.etsi.ttcn.codec.its.adapter;
import org.etsi.ttcn.codec.CodecBuffer;
import org.etsi.ttcn.codec.MainCodec;
import org.etsi.ttcn.codec.generic.Union;
import org.etsi.ttcn.common.ByteHelper;
import org.etsi.ttcn.tci.UnionValue;
public class AcFsapPrimitive extends Union {
public AcFsapPrimitive(MainCodec mainCodec) {
super(mainCodec);
}
@Override
protected void preEncode(CodecBuffer buf, UnionValue uv) {
String variant = uv.getPresentVariantName();
int primitiveId = -1;
// Append AcGnPrimitive message id
buf.appendBytes(ByteHelper.intToByteArray(2, 1)); // AdapterControl Primitive identifer for AcFsapPrimitive
// Append primitive command identifier
if(variant.equals("inSapPrimitivesUp")) {
primitiveId = 0;
}
else if(variant.equals("stopTransmission")) {
primitiveId = 1;
}
buf.appendBytes(ByteHelper.intToByteArray(primitiveId, 1));
}
}
package org.etsi.ttcn.codec.its.atsp;
import org.etsi.ttcn.codec.CodecBuffer;
import org.etsi.ttcn.codec.MainCodec;
import org.etsi.ttcn.codec.generic.Record;
import org.etsi.ttcn.tci.RecordValue;
import org.etsi.ttcn.tci.Type;
import org.etsi.ttcn.tci.Value;
public class AtspInd extends Record {
public AtspInd(MainCodec mainCodec) {
super(mainCodec);
}
@Override
protected void preDecodeField(String fieldName, CodecBuffer buf, Type decodingHypothesis, RecordValue rv) {
System.out.println("FntpInd.preDecodeField: " + fieldName + " - " + decodingHypothesis.getName());
if(fieldName.equals("receptionTime")) {
buf.overwriteWith(receptionTime);
}
}
@Override
protected void preDecode(CodecBuffer buf, Type decodingHypothesis) {
int msgLen = buf.getNbBits() - 6/*Time48IAT*/ * Byte.SIZE;
receptionTime = buf.getBuffer(msgLen, 6 * Byte.SIZE);
}
private CodecBuffer receptionTime = null;
} // End of class FntpInd
/**
* @author ETSI / STF462 / Alexandre Berge
* @version $URL$
* $Id$
*/
package org.etsi.ttcn.codec.its.atsp;
import org.etsi.ttcn.tci.TciTypeClass;
import org.etsi.ttcn.codec.CodecFactory;
public class Plugin {
public static void init() {
CodecFactory cf = CodecFactory.getInstance();
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "AtspInd", AtspInd.class);
}
}
\ No newline at end of file
/**
* @author ETSI / STF462 / Alexandre Berge
* @version $URL$
* $Id$
*/
package org.etsi.ttcn.codec.its.configtester;
import org.etsi.ttcn.codec.CodecBuffer;
import org.etsi.ttcn.codec.MainCodec;
import org.etsi.ttcn.codec.generic.Boolean;
import org.etsi.ttcn.tci.Type;
import org.etsi.ttcn.tci.Value;
public class CfBoolean extends Boolean {
public CfBoolean(MainCodec mainCodec) {
super(mainCodec);
}
@Override
public Value decode(CodecBuffer buf, Type decodingHypothesis) {
Byte id = CfPduId.value(decodingHypothesis.getName());
if(id != null) {
byte[] readId = buf.readBytes(1);
if(readId[0] != id) {
return null;