Rev

Rev 1822 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | Download | SVN | Bug Tracker

/**
 * @author      ETSI / STF481 / Yann Garcia
 * @version     $URL: file:///D:/RepositoriesNew/ITS/trunk/javasrc/codec/org/etsi/ttcn/codec/its/security/EncryptionParametersContainer.java $
 *              $Id: EncryptionParametersContainer.java 2655 2017-01-26 10:46:08Z filatov $
 */

package org.etsi.ttcn.codec.its.security;

import org.etsi.ttcn.codec.CodecBuffer;
import org.etsi.ttcn.codec.MainCodec;
import org.etsi.ttcn.codec.generic.Union;
import org.etsi.ttcn.tci.OctetstringValue;
import org.etsi.ttcn.tci.UnionValue;

public class EncryptionParametersContainer extends Union {

    public EncryptionParametersContainer(MainCodec mainCodec) {
        super(mainCodec);
        setLengths();
    }

    private void setLengths() {
        mainCodec.setHint("Oct12Len", "12");
    }
   
    @Override
    protected void preEncode(CodecBuffer buf, UnionValue uv) {
//        TERFactory.getInstance().logDebug(">>> EncryptionParametersContainer.preEncode: " + uv.getType().getName() + ", " + uv.getPresentVariantName());
       
        if (uv.getPresentVariantName().equals("params")) {
            buf.appendBytes(new byte[] { (byte)((OctetstringValue)(uv.getVariant(uv.getPresentVariantName()))).getLength() } );
        }
    }
   
} // End of class EncryptionParametersContainer