Commit d11515b3 authored by berge's avatar berge
Browse files

Merged revision(s) 1474 from branches/Security/tct3_javasrc_patch.patch:

Merged revision(s) 1721-1722 from branches/Security/taconfig.xml:
parent 8211f688
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@
          </Values:charstring>
        </value>
      </parameter>
      <parameter id="camPort" value="Loopback"/>
      <parameter id="denmPort" value="Loopback"/>
      <parameter id="btpPort" value="Loopback"/>
      <parameter id="camPort" value="BTP/GN/ETH"/>
      <parameter id="denmPort" value="BTP/GN/ETH"/>
      <parameter id="btpPort" value="GN/ETH"/>
      <parameter id="geoNetworkingPort" value="ETH"/>
      <parameter id="ipv6OverGeoNetworkingPort" value="Debug"/>
      <parameter id="UpperTesterSettings" value="192.168.56.129:1501"/>
@@ -61,6 +61,9 @@
      <parameter id="LinkLayer_NodeF" value="BABEBABE0006"/>
      <parameter id="Gn6RemoteAdapterIp" value="192.168.56.11"/>
      <parameter id="Gn6RemoteAdapterPort" value="42000"/>
      <parameter id="TsSecuredMode" value="false"/>
      <parameter id="TsSecuredPath" value=""/>
      <parameter id="TsSecuredConfiId" value="cfg01"/>
    </parameter>
    <parameter id="default" value="true"/>
  </port>
+228 −82
Original line number Diff line number Diff line
Index: adapter/org/etsi/its/adapter/ports/ProtocolPortFactory.java
===================================================================
--- adapter/org/etsi/its/adapter/ports/ProtocolPortFactory.java	(revision 1471)
+++ adapter/org/etsi/its/adapter/ports/ProtocolPortFactory.java	(working copy)
@@ -37,7 +37,6 @@
 		ports.put("btpPort", BtpPort.class);
 		ports.put("geoNetworkingPort", GnPort.class);
 		ports.put("ipv6OverGeoNetworkingPort", Gn6Port.class);
-		ports.put("v2gPort", V2GPort.class);
 	}
 
 	/**
Index: adapter/org/etsi/its/adapter/ports/V2GPort.java
===================================================================
--- adapter/org/etsi/its/adapter/ports/V2GPort.java	(revision 653)
--- adapter/org/etsi/its/adapter/ports/V2GPort.java	(revision 1471)
+++ adapter/org/etsi/its/adapter/ports/V2GPort.java	(working copy)
@@ -75,7 +75,7 @@
 		role = ((CharstringValue)TERFactory.getInstance().getTaParameter("V2gTsRole")).getString();
@@ -13,7 +25,7 @@ Index: adapter/org/etsi/its/adapter/ports/V2GPort.java
 		} catch (UnknownHostException e1) {
Index: adapter/org/etsi/its/adapter/TestAdapter.java
===================================================================
--- adapter/org/etsi/its/adapter/TestAdapter.java	(revision 653)
--- adapter/org/etsi/its/adapter/TestAdapter.java	(revision 1471)
+++ adapter/org/etsi/its/adapter/TestAdapter.java	(working copy)
@@ -19,7 +19,6 @@
 import org.etsi.its.adapter.ports.ProtocolPortFactory;
@@ -23,30 +35,27 @@ Index: adapter/org/etsi/its/adapter/TestAdapter.java
 import org.etsi.ttcn.tri.TriAddress;
 import org.etsi.ttcn.tri.TriAddressList;
 import org.etsi.ttcn.tri.TriCommunicationSA;
@@ -71,14 +70,13 @@
@@ -70,10 +69,14 @@
 		return required.getTriStatus(TriStatus.TRI_OK);
 	} 
 
+	@Override
+	public TriStatus triExecuteTestCase(TriTestCaseId tcId, TriPortIdList portList) {
+		return triExecuteTestcase(tcId, portList);
+	}
+
 	/* (non-Javadoc)
-	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triExecuteTestcase(org.etsi.ttcn.tri.TriTestCaseId, org.etsi.ttcn.tri.TriPortIdList)
-	 */
 	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triExecuteTestcase(org.etsi.ttcn.tri.TriTestCaseId, org.etsi.ttcn.tri.TriPortIdList)
 	 */
-	@Override
+     * @see org.etsi.ttcn.tri.TriCommunicationSA#triExecuteTestcase(org.etsi.ttcn.tri.TriTestCaseId, org.etsi.ttcn.tri.TriPortIdList)
+     */
     public TriStatus triExecuteTestcase(final TriTestCaseId tcId, final TriPortIdList portList) {
-		return required.getTriStatus(TriStatus.TRI_OK);
-	} 
+        return required.getTriStatus(TriStatus.TRI_OK);
+    } 
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triMap(org.etsi.ttcn.tri.TriPortId, org.etsi.ttcn.tri.TriPortId)
 	 */
 	@Override
@@ -297,15 +295,6 @@
 		return required.getTriStatus(TriStatus.TRI_OK);
 	} 
@@ -296,14 +299,14 @@
 		return required.getTriStatus(TriStatus.TRI_ERROR, "triSutActionInformal not implemented");	
 	}
 
 	/**
-	/**
-	 * triSutActionTemplate not implemented
-	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triSutActionTemplate(org.etsi.ttcn.tri.TriActionTemplate)
-	 */
@@ -54,40 +63,124 @@ Index: adapter/org/etsi/its/adapter/TestAdapter.java
-	public TriStatus triSutActionTemplate(TriActionTemplate templateValue) {
-		return required.getTriStatus(TriStatus.TRI_ERROR, "triSutActionTemplate not implemented");
-	}
-
-	/**
+//	/**
+//	 * triSutActionTemplate not implemented
+//	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triSutActionTemplate(org.etsi.ttcn.tri.TriActionTemplate)
+//	 */
+//	@Override
+//	public TriStatus triSutActionTemplate(TriActionTemplate templateValue) {
+//		return required.getTriStatus(TriStatus.TRI_ERROR, "triSutActionTemplate not implemented");
+//	}
 
 	/**
      * triMapParam not implemented
 	 * @see org.etsi.ttcn.tri.TriCommunicationSA#triMapParam(org.etsi.ttcn.tri.TriPortId, org.etsi.ttcn.tri.TriPortId, org.etsi.ttcn.tri.TriParameterList)
 	 */
@@ -322,4 +311,14 @@
@@ -322,4 +325,21 @@
     public TriStatus triUnmapParam(TriPortId compPortId, TriPortId tsiPortId, TriParameterList paramList) {
 		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
 	}
+
+	@Override
+	public TriStatus triExecuteTestCase(TriTestCaseId tcId, TriPortIdList portList) {
+		return this.triExecuteTestcase(tcId, portList);
+	public TriStatus triGetStreamValue(TriComponentId arg0, TriPortId arg1,
+			TriAddress arg2, TriMessage arg3) {
+		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
+	}
+
+	@Override
+	public TriStatus triSetStreamValue(TriComponentId arg0, TriPortId arg1,
+			TriAddress arg2, TriMessage arg3) {
+		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
+	}
+
+	@Override
+	public TriStatus triStaticMap(TriPortId arg0, TriPortId arg1) {
+		return required.getTriStatus(TriStatus.TRI_ERROR, "triMapParam not implemented");
+		return required.getTriStatus(TriStatus.TRI_ERROR, "triUnmapParam not implemented");
+	}
 } 
Index: codec/org/etsi/codec/ITciCDWrapper.java
===================================================================
--- codec/org/etsi/codec/ITciCDWrapper.java	(revision 1471)
+++ codec/org/etsi/codec/ITciCDWrapper.java	(working copy)
@@ -27,9 +27,33 @@
 	 * 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 getInteger();
+	public IntegerValue setInteger(final Integer value);
 
 	/** 
+	 * 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
 	 * 
 	 * See ETSI ES 201 873-6 V4.2.1 - 7.3.2.1.2 getOctetstring
@@ -44,14 +68,6 @@
 	 * @return An instance of Type representing a TTCN-3 float type
 	 */
 	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
Index: codec/org/etsi/ttcn/codec/CodecFactory.java
===================================================================
--- codec/org/etsi/ttcn/codec/CodecFactory.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/CodecFactory.java	(working copy)
@@ -61,7 +61,7 @@
             org.etsi.ttcn.codec.its.uppertester.Plugin.init();
             org.etsi.ttcn.codec.its.geonetworking.Plugin.init();
             org.etsi.ttcn.codec.its.btp.Plugin.init();
-                                 
+            org.etsi.ttcn.codec.its.security.Plugin.init();
         }        
     }
 
Index: codec/org/etsi/ttcn/codec/generic/Integer.java
===================================================================
--- codec/org/etsi/ttcn/codec/generic/Integer.java	(revision 653)
--- codec/org/etsi/ttcn/codec/generic/Integer.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/generic/Integer.java	(working copy)
@@ -48,15 +48,15 @@
@@ -46,17 +46,17 @@
         try {
             Matcher matcher = UNSIGNED_VARIANT.matcher(decodingHypothesis.getTypeEncodingVariant());
             if(matcher.find()) {
                 // Unsigned integer                
                 if(lengthInBits >= 32) {                 
-                // Unsigned integer                
-                if(lengthInBits >= 32) {                 
-                    iv.setBigInt(new BigInteger(1, value)); // /!\ ttwb specific
+                    iv.setInteger(java.lang.Integer.MAX_VALUE);  //!\ testcastT3 does not support big integer
+                // Unsigned integer
+                if(lengthInBits >= java.lang.Integer.SIZE) { 
+                    iv = mainCodec.getTciCDRequired().setInteger(new BigInteger(1, value)); 
                 }
                 else {
-                    iv.setInt(ByteHelper.byteArrayToInt(value));
+                    iv.setInteger(ByteHelper.byteArrayToInt(value));
+                    iv = mainCodec.getTciCDRequired().setInteger(ByteHelper.byteArrayToInt(value));
                 }
             }
             else {
@@ -97,31 +190,22 @@ Index: codec/org/etsi/ttcn/codec/generic/Integer.java
             }
         }
         catch(Exception e) {
@@ -85,7 +85,7 @@
         }
         lengthInBytes = lengthInBits / 8 + (((lengthInBits % 8) > 0)?1:0);
@@ -87,10 +87,10 @@
         
 //        System.out.println(String.format("Integer.encode: length: %d", lengthInBytes));
         if (lengthInBits > java.lang.Integer.SIZE) {
-            encoded = ByteHelper.longToByteArray(iv.getBigInt().longValue(), lengthInBytes);
+            encoded = ByteHelper.longToByteArray(mainCodec.getTciCDRequired().getBigInteger(iv), lengthInBytes);
             res.setBits(encoded, lengthInBits);
         } else {
-            encoded = ByteHelper.intToByteArray(iv.getInt(), lengthInBytes);
+        encoded = ByteHelper.intToByteArray(iv.getInteger(), lengthInBytes);
+            encoded = ByteHelper.intToByteArray(mainCodec.getTciCDRequired().getInteger(iv), lengthInBytes);
             res.setBits(encoded, lengthInBits);
 
         return res;
Index: codec/org/etsi/ttcn/codec/ICodec.java
===================================================================
--- codec/org/etsi/ttcn/codec/ICodec.java	(revision 653)
+++ codec/org/etsi/ttcn/codec/ICodec.java	(working copy)
@@ -35,6 +35,8 @@
         }
         catch(Exception e) {
             // Empty on purpose
+            System.err.println(e.getMessage());
+            return -1;
         }
         return 0;
         }
         res.setBits(encoded, lengthInBits);
Index: codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java
===================================================================
--- codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java	(revision 653)
--- codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java	(working copy)
@@ -27,7 +27,7 @@
     protected void postDecodeField(String fieldName, CodecBuffer buf, Type decodingHypothesis, RecordValue rv) {
@@ -134,7 +218,7 @@ Index: codec/org/etsi/ttcn/codec/ipv6/Ipv6ExtHdr.java
     }
Index: codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java
===================================================================
--- codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java	(revision 653)
--- codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java	(working copy)
@@ -39,7 +39,7 @@
         }
@@ -145,9 +229,23 @@ Index: codec/org/etsi/ttcn/codec/its/geonetworking/CommonHeader.java
             mainCodec.setHint("payloadLength", Integer.toString(pl));
         }
     }
Index: codec/org/etsi/ttcn/codec/its/security/Plugin.java
===================================================================
--- codec/org/etsi/ttcn/codec/its/security/Plugin.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/its/security/Plugin.java	(working copy)
@@ -13,7 +13,6 @@
     public static void init() {
 
         CodecFactory cf = CodecFactory.getInstance();
-//        cf.setCodec(TciTypeClass.UNION, "LibItsSecurity", "LibItsSecurity", BtpHeader.class);
-//        cf.setCodec(TciTypeClass.RECORD, "LibItsSecurity", "LibItsSecurity", Payload.class);
+        cf.setCodec(TciTypeClass.RECORD, "LibItsSecurity", "Payload", Payload.class);
     }
 }
\ No newline at end of file
Index: codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java
===================================================================
--- codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java	(revision 653)
--- codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java	(working copy)
@@ -126,7 +126,7 @@
         }
@@ -158,30 +256,71 @@ Index: codec/org/etsi/ttcn/codec/lowpan/IphcHeader.java
             mainCodec.setHint("Ipv6NextHeader", Integer.toString(nh));
             if(nh == 0 || nh == 60 || nh == 43 || nh == 44) { 
                 mainCodec.setHint("ExtensionHeaderListMore", "true");
Index: codec/org/etsi/ttcn/codec/MainCodec.java
===================================================================
--- codec/org/etsi/ttcn/codec/MainCodec.java	(revision 1471)
+++ codec/org/etsi/ttcn/codec/MainCodec.java	(working copy)
@@ -8,6 +8,7 @@
 import java.util.Map;
 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.TciCDRequired;
@@ -16,9 +17,9 @@
 
 public class MainCodec extends ICodec {
 
-    public MainCodec(TciCDRequired cdReq) {
+    public MainCodec(ITciCDWrapper _cdReq) {
         super(null);
-        this.cdReq = cdReq;
+        this.cdReq = _cdReq;
     }
 
     public Value triDecode(TriMessage message, Type decodingHypothesis) {
@@ -97,11 +98,11 @@
         presenceHints.put(key, value);
     }
 
-    public TciCDRequired getTciCDRequired() {
+    public ITciCDWrapper getTciCDRequired() {
         return cdReq;
     }
 
     protected Map<String, String> hints = new TreeMap<String, String>();
     protected Map<String, java.lang.Boolean> presenceHints = new TreeMap<String, java.lang.Boolean>();
-    protected TciCDRequired cdReq;
+    protected ITciCDWrapper cdReq;
 }
Index: extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java
===================================================================
--- extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java	(revision 653)
--- extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java	(revision 1471)
+++ extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java	(working copy)
@@ -7,7 +7,6 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.text.DateFormat;
@@ -81,15 +80,15 @@
@@ -79,24 +79,19 @@
         
         String datestr="01/01/2004 00:00:00";
         DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
         IntegerValue now = _tcicdWrapper.getInteger();
-        IntegerValue now = _tcicdWrapper.getInteger();
+        IntegerValue now = null;
         try {
-            now.setInt(
+            now.setInteger(
                 (int)
                     (System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime())
-//            System.out.println(String.format("fx_getCurrentTime: now:%d, 2004:%d", System.currentTimeMillis(), ((java.util.Date)formatter.parse(datestr)).getTime()));
-//            System.out.println("Diff: " + (int)(System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime()));
-            now.setBigInt(
+            now = _tcicdWrapper.setInteger(
                 new BigInteger(
                     1, 
-                    ByteHelper.longToByteArray(
-                        System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime(),
-                        Long.SIZE / Byte.SIZE
-                    )
+                    ByteHelper.longToByteArray(System.currentTimeMillis() - ((java.util.Date)formatter.parse(datestr)).getTime(), Long.SIZE / Byte.SIZE)
                 )
             );
         } catch (ParseException e) {
-            now.setInt(0);
+            now.setInteger(0);
+        	now = _tcicdWrapper.setInteger(0);
         }
         
-        _logger.exiting("ItsExternalFunctionsProvider", "fx_getCurrentTime", String.format("%10d", now.getInt())); 
@@ -189,7 +328,7 @@ Index: extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java
         return now;
     } // End of method fx_getCurrentTime
 
@@ -115,17 +114,17 @@
@@ -122,17 +117,17 @@
             final IntegerValue p_latitudeA, final IntegerValue p_longitudeA,
             final IntegerValue p_latitudeB, final IntegerValue p_longitudeB) {
         _logger.entering("ItsExternalFunctionsProvider", "fx_computeDistance",
@@ -214,7 +353,7 @@ Index: extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java
 
         long d = Math.round(Math.sqrt(Math.pow(dlat * rbis, 2)
                 + Math.pow(dlong * rbis * Math.cos(dlat), 2)));
@@ -165,17 +164,17 @@
@@ -172,17 +167,17 @@
         _logger.entering(
                 "ItsExternalFunctionsProvider",
                 "fx_computePositionUsingDistance",
@@ -238,7 +377,7 @@ Index: extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java
                 * Math.PI / 180;
 
         double lat2 = Math.asin(Math.sin(lat1) * Math.cos(angularD)
@@ -193,8 +192,8 @@
@@ -200,8 +195,8 @@
         long rlat2 = Math.round(lat2 * 10000000 / Math.PI * 180);
         long rlong2 = Math.round(long2 * 10000000 / Math.PI * 180);
 
@@ -249,19 +388,26 @@ Index: extfunc/org/etsi/its/extfunc/ItsExternalFunctionsProvider.java
 
     } // End of method fx_computePositionUsingDistance
 
@@ -221,9 +220,8 @@
@@ -226,11 +221,14 @@
      */
     @Override
     public IntegerValue fx_computeGnTimestamp() {
 
         IntegerValue timestamp = _tcicdWrapper.getInteger();
-
-        IntegerValue timestamp = _tcicdWrapper.getInteger();
         
-        // /!\ ttwb specific
-        timestamp.setBigInt(new BigInteger(1, ByteHelper.longToByteArray(((System.currentTimeMillis() - ITS_REF_TIME) % (long)Math.pow(2,32)), 5)));
+        timestamp.setInteger((int)((System.currentTimeMillis() - ITS_REF_TIME) % (long)Math.pow(2,32)));
+        IntegerValue timestamp = _tcicdWrapper.setInteger(
+                new BigInteger(
+                    1,
+                    ByteHelper.longToByteArray((System.currentTimeMillis() - ITS_REF_TIME) % (long)Math.pow(2,32), Long.SIZE / Byte.SIZE) 
+                )
+            );
+        
         return timestamp;
     }
 
@@ -298,11 +296,11 @@
@@ -305,11 +303,11 @@
         try {
             // Upper-Layer Packet Length (32bits)
             pseudoheader.write(ByteHelper.intToByteArray(