Commit ae988481 authored by tepelmann's avatar tepelmann
Browse files

Generated codec for ARP.

Implemented support for ARP in the TA.
parent 6a5886ef
Loading
Loading
Loading
Loading
+262 −0
Original line number Diff line number Diff line
/*
 *   NOTE: this is a machine generated file - editing not recommended
 * ----------------------------------------------------------------------------
 *  (C) Copyright Testing Technologies, 2000-2007.  All Rights Reserved.
 *
 *  All copies of this program, whether in whole or in part, and whether
 *  modified or not, must display this and all other embedded copyright
 *  and ownership notices in full.
 *
 *  See the file COPYRIGHT and LICENSE for details of redistribution
 *  and use.
 *
 *  You should have received a copy of the COPYRIGHT and LICENSE file
 *  along with this file; if not, write to the Testing Technologies,
 *  Rosenthaler Str. 13, 10119 Berlin, Germany.
 *
 * ----------------------------------------------------------------------------
 *
 *   Source File: D:\\dte\\workspaces\\workspace_ipv6\\IPv6_ETSI_STF276_P2_new\\ttcn3\\EtsiLibrary\\LibIpv6\\LibTransitioning\\LibIpv6_Rfc826Arp_TypesAndValues.ttcn
 *   File       : TabularArpEthPacket.java
 *
 *   This is a Java class providing a com.testingtech.ttcn.tci based decoding
 *   using tabular encoding information within a TTCN-3 file.
 *
 *   This file was generated by TabularCodecGenerator(version v1.0)
  *  at 24.05.2007 16:09:03
 *
 *   REVISION INFO:
 *        $Revision: 1.4 $ $Date: 2007/02/26 10:03:23 $
 * -----------------------------------------------------------------------------
 */
package com.testingtech.generated.codec.LibIpv6_Rfc826Arp_TypesAndValues;

import com.testingtech.ttcn.tci.codec.tabular.*;

import org.etsi.ttcn.tci.RecordValue;
import org.etsi.ttcn.tci.Value;


public class TabularArpEthPacket extends TabularRecord {
    public RecordValue rv;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16 hwAddrSpace;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16 protAddrSpace;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8 hwAddrLength;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8 protAddrLength;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16 opcode;
    public TabularOctetstring senderHwAddr;
    public TabularOctetstring senderProtAddr;
    public TabularOctetstring targetHwAddr;
    public TabularOctetstring targetProtAddr;

    public TabularArpEthPacket(Value theValue) {
        super(theValue);
        present = false;
        rv = (RecordValue) tciValue;

        /*
                                        isPDU;
                                        */
    }

    public TabularObject decode(final TabularDecoder dec)
        throws TabularException {
        present = isNext(dec);

        if (!present) {
            return null;
        }

        // -- hwAddrSpace
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16.isNext(
                    dec)) {
            hwAddrSpace = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                        "hwAddrSpace"));
            hwAddrSpace.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'hwAddrSpace' of 'ArpEthPacket' missing");
        }

        // -- protAddrSpace
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16.isNext(
                    dec)) {
            protAddrSpace = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                        "protAddrSpace"));
            protAddrSpace.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'protAddrSpace' of 'ArpEthPacket' missing");
        }

        // -- hwAddrLength
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8.isNext(
                    dec)) {
            hwAddrLength = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8(rv.getField(
                        "hwAddrLength"));
            hwAddrLength.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'hwAddrLength' of 'ArpEthPacket' missing");
        }

        if (hwAddrLength != null) {
            dec.intTag("hwAddrLength", valueOf(hwAddrLength));
        }

        // -- protAddrLength
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8.isNext(
                    dec)) {
            protAddrLength = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8(rv.getField(
                        "protAddrLength"));
            protAddrLength.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'protAddrLength' of 'ArpEthPacket' missing");
        }

        if (protAddrLength != null) {
            dec.intTag("protAddrLength", valueOf(protAddrLength));
        }

        // -- opcode
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16.isNext(
                    dec)) {
            opcode = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                        "opcode"));
            opcode.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'opcode' of 'ArpEthPacket' missing");
        }

        // -- senderHwAddr
        if (TabularOctetstring.isNext(dec)) {
            senderHwAddr = (TabularOctetstring) new TabularOctetstring(rv.getField(
                        "senderHwAddr")) {
                        public int getLength() throws TabularException {
                            return dec.getIntTag("hwAddrLength");
                        }
                    }.decode(dec);
        }

        // -- senderProtAddr
        if (TabularOctetstring.isNext(dec)) {
            senderProtAddr = (TabularOctetstring) new TabularOctetstring(rv.getField(
                        "senderProtAddr")) {
                        public int getLength() throws TabularException {
                            return dec.getIntTag("protAddrLength");
                        }
                    }.decode(dec);
        }

        // -- targetHwAddr
        if (TabularOctetstring.isNext(dec)) {
            targetHwAddr = (TabularOctetstring) new TabularOctetstring(rv.getField(
                        "targetHwAddr")) {
                        public int getLength() throws TabularException {
                            return dec.getIntTag("hwAddrLength");
                        }
                    }.decode(dec);
        }

        // -- targetProtAddr
        if (TabularOctetstring.isNext(dec)) {
            targetProtAddr = (TabularOctetstring) new TabularOctetstring(rv.getField(
                        "targetProtAddr")) {
                        public int getLength() throws TabularException {
                            return dec.getIntTag("protAddrLength");
                        }
                    }.decode(dec);
        }

        return this;
    }

    public TabularObject decode(TabularDecoder dec, int proceedingByteNumber)
        throws TabularException {
        throw new TabularException(
            "method decode(TabularDecoder dec, int proceedingByteNumber) not implemented by default");
    }

    public void encode(final TabularEncoder enc) throws TabularException {
        // -- hwAddrSpace
        hwAddrSpace = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                    "hwAddrSpace"));
        hwAddrSpace.encode(enc);

        // -- protAddrSpace
        protAddrSpace = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                    "protAddrSpace"));
        protAddrSpace.encode(enc);

        // -- hwAddrLength
        hwAddrLength = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8(rv.getField(
                    "hwAddrLength"));
        hwAddrLength.encode(enc);

        // -- protAddrLength
        protAddrLength = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8(rv.getField(
                    "protAddrLength"));
        protAddrLength.encode(enc);

        // -- opcode
        opcode = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                    "opcode"));
        opcode.encode(enc);

        // -- senderHwAddr
        senderHwAddr = new TabularOctetstring(rv.getField("senderHwAddr")) {
                    // 	Complex
                    // there is no code generation for complex length restrictions.
                };
        senderHwAddr.encode(enc);

        // -- senderProtAddr
        senderProtAddr = new TabularOctetstring(rv.getField("senderProtAddr")) {
                    // 	Complex
                    // there is no code generation for complex length restrictions.
                };
        senderProtAddr.encode(enc);

        // -- targetHwAddr
        targetHwAddr = new TabularOctetstring(rv.getField("targetHwAddr")) {
                    // 	Complex
                    // there is no code generation for complex length restrictions.
                };
        targetHwAddr.encode(enc);

        // -- targetProtAddr
        targetProtAddr = new TabularOctetstring(rv.getField("targetProtAddr")) {
                    // 	Complex
                    // there is no code generation for complex length restrictions.
                };
        targetProtAddr.encode(enc);

        return;
    }

    public void encode(TabularEncoder enc, int proceedingByteNumber)
        throws TabularException {
        throw new TabularException(
            "method encode(TabularEncoder enc, int proceedingByteNumber) not implemented by default");
    }

    public static boolean isNext(TabularDecoder dec) throws TabularException {
        return !dec.bits(4, 4) && !dec.bits(4, 6);
    }

    public Value toValue() {
        safeFieldSet(rv, "hwAddrSpace", hwAddrSpace);
        safeFieldSet(rv, "protAddrSpace", protAddrSpace);
        safeFieldSet(rv, "hwAddrLength", hwAddrLength);
        safeFieldSet(rv, "protAddrLength", protAddrLength);
        safeFieldSet(rv, "opcode", opcode);
        safeFieldSet(rv, "senderHwAddr", senderHwAddr);
        safeFieldSet(rv, "senderProtAddr", senderProtAddr);
        safeFieldSet(rv, "targetHwAddr", targetHwAddr);
        safeFieldSet(rv, "targetProtAddr", targetProtAddr);

        return rv;
    }
}
+262 −0
Original line number Diff line number Diff line
/*
 *   NOTE: this is a machine generated file - editing not recommended
 * ----------------------------------------------------------------------------
 *  (C) Copyright Testing Technologies, 2000-2007.  All Rights Reserved.
 *
 *  All copies of this program, whether in whole or in part, and whether
 *  modified or not, must display this and all other embedded copyright
 *  and ownership notices in full.
 *
 *  See the file COPYRIGHT and LICENSE for details of redistribution
 *  and use.
 *
 *  You should have received a copy of the COPYRIGHT and LICENSE file
 *  along with this file; if not, write to the Testing Technologies,
 *  Rosenthaler Str. 13, 10119 Berlin, Germany.
 *
 * ----------------------------------------------------------------------------
 *
 *   Source File: D:\\dte\\workspaces\\workspace_ipv6\\IPv6_ETSI_STF276_P2_new\\ttcn3\\EtsiLibrary\\LibIpv6\\LibTransitioning\\LibIpv6_Rfc826Arp_TypesAndValues.ttcn
 *   File       : TabularArpEthReply.java
 *
 *   This is a Java class providing a com.testingtech.ttcn.tci based decoding
 *   using tabular encoding information within a TTCN-3 file.
 *
 *   This file was generated by TabularCodecGenerator(version v1.0)
  *  at 24.05.2007 16:09:03
 *
 *   REVISION INFO:
 *        $Revision: 1.4 $ $Date: 2007/02/26 10:03:23 $
 * -----------------------------------------------------------------------------
 */
package com.testingtech.generated.codec.LibIpv6_Rfc826Arp_TypesAndValues;

import com.testingtech.ttcn.tci.codec.tabular.*;

import org.etsi.ttcn.tci.RecordValue;
import org.etsi.ttcn.tci.Value;


public class TabularArpEthReply extends TabularRecord {
    public RecordValue rv;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16 hwAddrSpace;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16 protAddrSpace;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8 hwAddrLength;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8 protAddrLength;
    public com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16 opcode;
    public TabularOctetstring senderHwAddr;
    public TabularOctetstring senderProtAddr;
    public TabularOctetstring targetHwAddr;
    public TabularOctetstring targetProtAddr;

    public TabularArpEthReply(Value theValue) {
        super(theValue);
        present = false;
        rv = (RecordValue) tciValue;

        /*
                                        isPDU;
                                        */
    }

    public TabularObject decode(final TabularDecoder dec)
        throws TabularException {
        present = isNext(dec);

        if (!present) {
            return null;
        }

        // -- hwAddrSpace
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16.isNext(
                    dec)) {
            hwAddrSpace = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                        "hwAddrSpace"));
            hwAddrSpace.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'hwAddrSpace' of 'ArpEthReply' missing");
        }

        // -- protAddrSpace
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16.isNext(
                    dec)) {
            protAddrSpace = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                        "protAddrSpace"));
            protAddrSpace.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'protAddrSpace' of 'ArpEthReply' missing");
        }

        // -- hwAddrLength
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8.isNext(
                    dec)) {
            hwAddrLength = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8(rv.getField(
                        "hwAddrLength"));
            hwAddrLength.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'hwAddrLength' of 'ArpEthReply' missing");
        }

        if (hwAddrLength != null) {
            dec.intTag("hwAddrLength", valueOf(hwAddrLength));
        }

        // -- protAddrLength
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8.isNext(
                    dec)) {
            protAddrLength = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8(rv.getField(
                        "protAddrLength"));
            protAddrLength.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'protAddrLength' of 'ArpEthReply' missing");
        }

        if (protAddrLength != null) {
            dec.intTag("protAddrLength", valueOf(protAddrLength));
        }

        // -- opcode
        if (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16.isNext(
                    dec)) {
            opcode = (com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16) new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                        "opcode"));
            opcode.decode(dec);
        } else {
            throw new TabularException(
                "Mandatory field 'opcode' of 'ArpEthReply' missing");
        }

        // -- senderHwAddr
        if (TabularOctetstring.isNext(dec)) {
            senderHwAddr = (TabularOctetstring) new TabularOctetstring(rv.getField(
                        "senderHwAddr")) {
                        public int getLength() throws TabularException {
                            return dec.getIntTag("hwAddrLength");
                        }
                    }.decode(dec);
        }

        // -- senderProtAddr
        if (TabularOctetstring.isNext(dec)) {
            senderProtAddr = (TabularOctetstring) new TabularOctetstring(rv.getField(
                        "senderProtAddr")) {
                        public int getLength() throws TabularException {
                            return dec.getIntTag("protAddrLength");
                        }
                    }.decode(dec);
        }

        // -- targetHwAddr
        if (TabularOctetstring.isNext(dec)) {
            targetHwAddr = (TabularOctetstring) new TabularOctetstring(rv.getField(
                        "targetHwAddr")) {
                        public int getLength() throws TabularException {
                            return dec.getIntTag("hwAddrLength");
                        }
                    }.decode(dec);
        }

        // -- targetProtAddr
        if (TabularOctetstring.isNext(dec)) {
            targetProtAddr = (TabularOctetstring) new TabularOctetstring(rv.getField(
                        "targetProtAddr")) {
                        public int getLength() throws TabularException {
                            return dec.getIntTag("protAddrLength");
                        }
                    }.decode(dec);
        }

        return this;
    }

    public TabularObject decode(TabularDecoder dec, int proceedingByteNumber)
        throws TabularException {
        throw new TabularException(
            "method decode(TabularDecoder dec, int proceedingByteNumber) not implemented by default");
    }

    public void encode(final TabularEncoder enc) throws TabularException {
        // -- hwAddrSpace
        hwAddrSpace = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                    "hwAddrSpace"));
        hwAddrSpace.encode(enc);

        // -- protAddrSpace
        protAddrSpace = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                    "protAddrSpace"));
        protAddrSpace.encode(enc);

        // -- hwAddrLength
        hwAddrLength = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8(rv.getField(
                    "hwAddrLength"));
        hwAddrLength.encode(enc);

        // -- protAddrLength
        protAddrLength = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt8(rv.getField(
                    "protAddrLength"));
        protAddrLength.encode(enc);

        // -- opcode
        opcode = new com.testingtech.generated.codec.LibCommon_BasicTypesAndValues.TabularUInt16(rv.getField(
                    "opcode"));
        opcode.encode(enc);

        // -- senderHwAddr
        senderHwAddr = new TabularOctetstring(rv.getField("senderHwAddr")) {
                    // 	Complex
                    // there is no code generation for complex length restrictions.
                };
        senderHwAddr.encode(enc);

        // -- senderProtAddr
        senderProtAddr = new TabularOctetstring(rv.getField("senderProtAddr")) {
                    // 	Complex
                    // there is no code generation for complex length restrictions.
                };
        senderProtAddr.encode(enc);

        // -- targetHwAddr
        targetHwAddr = new TabularOctetstring(rv.getField("targetHwAddr")) {
                    // 	Complex
                    // there is no code generation for complex length restrictions.
                };
        targetHwAddr.encode(enc);

        // -- targetProtAddr
        targetProtAddr = new TabularOctetstring(rv.getField("targetProtAddr")) {
                    // 	Complex
                    // there is no code generation for complex length restrictions.
                };
        targetProtAddr.encode(enc);

        return;
    }

    public void encode(TabularEncoder enc, int proceedingByteNumber)
        throws TabularException {
        throw new TabularException(
            "method encode(TabularEncoder enc, int proceedingByteNumber) not implemented by default");
    }

    public static boolean isNext(TabularDecoder dec) throws TabularException {
        return !dec.bits(4, 4) && !dec.bits(4, 6) && dec.bytes(6, 2, 0x0001);
    }

    public Value toValue() {
        safeFieldSet(rv, "hwAddrSpace", hwAddrSpace);
        safeFieldSet(rv, "protAddrSpace", protAddrSpace);
        safeFieldSet(rv, "hwAddrLength", hwAddrLength);
        safeFieldSet(rv, "protAddrLength", protAddrLength);
        safeFieldSet(rv, "opcode", opcode);
        safeFieldSet(rv, "senderHwAddr", senderHwAddr);
        safeFieldSet(rv, "senderProtAddr", senderProtAddr);
        safeFieldSet(rv, "targetHwAddr", targetHwAddr);
        safeFieldSet(rv, "targetProtAddr", targetProtAddr);

        return rv;
    }
}
+262 −0

File added.

Preview size limit exceeded, changes collapsed.

+227 −0

File added.

Preview size limit exceeded, changes collapsed.

+81 −52

File changed.

Preview size limit exceeded, changes collapsed.

Loading