All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ccsds.sle.transfer.service.rocf.incoming.pdus.RocfUsertoProviderPdu Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
/**
 * This class file was automatically generated by jASN1 v1.11.2 (http://www.beanit.com)
 */

package ccsds.sle.transfer.service.rocf.incoming.pdus;

import java.io.IOException;
import java.io.EOFException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.io.Serializable;
import com.beanit.jasn1.ber.*;
import com.beanit.jasn1.ber.types.*;
import com.beanit.jasn1.ber.types.string.*;

import ccsds.sle.transfer.service.bind.types.SleBindInvocation;
import ccsds.sle.transfer.service.bind.types.SleBindReturn;
import ccsds.sle.transfer.service.bind.types.SlePeerAbort;
import ccsds.sle.transfer.service.bind.types.SleUnbindInvocation;
import ccsds.sle.transfer.service.bind.types.SleUnbindReturn;
import ccsds.sle.transfer.service.common.pdus.SleScheduleStatusReportInvocation;
import ccsds.sle.transfer.service.common.pdus.SleStopInvocation;
import ccsds.sle.transfer.service.common.types.ConditionalTime;
import ccsds.sle.transfer.service.common.types.Credentials;
import ccsds.sle.transfer.service.common.types.InvokeId;
import ccsds.sle.transfer.service.rocf.structures.ControlWordType;
import ccsds.sle.transfer.service.rocf.structures.GvcId;
import ccsds.sle.transfer.service.rocf.structures.RocfParameterName;
import ccsds.sle.transfer.service.rocf.structures.TcVcid;
import ccsds.sle.transfer.service.rocf.structures.UpdateMode;

public class RocfUsertoProviderPdu implements BerType, Serializable {

	private static final long serialVersionUID = 1L;

	public byte[] code = null;
	private SleBindInvocation rocfBindInvocation = null;
	private SleBindReturn rocfBindReturn = null;
	private SleUnbindInvocation rocfUnbindInvocation = null;
	private SleUnbindReturn rocfUnbindReturn = null;
	private RocfStartInvocation rocfStartInvocation = null;
	private SleStopInvocation rocfStopInvocation = null;
	private SleScheduleStatusReportInvocation rocfScheduleStatusReportInvocation = null;
	private RocfGetParameterInvocation rocfGetParameterInvocation = null;
	private SlePeerAbort rocfPeerAbortInvocation = null;
	
	public RocfUsertoProviderPdu() {
	}

	public RocfUsertoProviderPdu(byte[] code) {
		this.code = code;
	}

	public void setRocfBindInvocation(SleBindInvocation rocfBindInvocation) {
		this.rocfBindInvocation = rocfBindInvocation;
	}

	public SleBindInvocation getRocfBindInvocation() {
		return rocfBindInvocation;
	}

	public void setRocfBindReturn(SleBindReturn rocfBindReturn) {
		this.rocfBindReturn = rocfBindReturn;
	}

	public SleBindReturn getRocfBindReturn() {
		return rocfBindReturn;
	}

	public void setRocfUnbindInvocation(SleUnbindInvocation rocfUnbindInvocation) {
		this.rocfUnbindInvocation = rocfUnbindInvocation;
	}

	public SleUnbindInvocation getRocfUnbindInvocation() {
		return rocfUnbindInvocation;
	}

	public void setRocfUnbindReturn(SleUnbindReturn rocfUnbindReturn) {
		this.rocfUnbindReturn = rocfUnbindReturn;
	}

	public SleUnbindReturn getRocfUnbindReturn() {
		return rocfUnbindReturn;
	}

	public void setRocfStartInvocation(RocfStartInvocation rocfStartInvocation) {
		this.rocfStartInvocation = rocfStartInvocation;
	}

	public RocfStartInvocation getRocfStartInvocation() {
		return rocfStartInvocation;
	}

	public void setRocfStopInvocation(SleStopInvocation rocfStopInvocation) {
		this.rocfStopInvocation = rocfStopInvocation;
	}

	public SleStopInvocation getRocfStopInvocation() {
		return rocfStopInvocation;
	}

	public void setRocfScheduleStatusReportInvocation(SleScheduleStatusReportInvocation rocfScheduleStatusReportInvocation) {
		this.rocfScheduleStatusReportInvocation = rocfScheduleStatusReportInvocation;
	}

	public SleScheduleStatusReportInvocation getRocfScheduleStatusReportInvocation() {
		return rocfScheduleStatusReportInvocation;
	}

	public void setRocfGetParameterInvocation(RocfGetParameterInvocation rocfGetParameterInvocation) {
		this.rocfGetParameterInvocation = rocfGetParameterInvocation;
	}

	public RocfGetParameterInvocation getRocfGetParameterInvocation() {
		return rocfGetParameterInvocation;
	}

	public void setRocfPeerAbortInvocation(SlePeerAbort rocfPeerAbortInvocation) {
		this.rocfPeerAbortInvocation = rocfPeerAbortInvocation;
	}

	public SlePeerAbort getRocfPeerAbortInvocation() {
		return rocfPeerAbortInvocation;
	}

	public int encode(OutputStream reverseOS) throws IOException {

		if (code != null) {
			for (int i = code.length - 1; i >= 0; i--) {
				reverseOS.write(code[i]);
			}
			return code.length;
		}

		int codeLength = 0;
		if (rocfPeerAbortInvocation != null) {
			codeLength += rocfPeerAbortInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, PRIMITIVE, 104
			reverseOS.write(0x68);
			reverseOS.write(0x9F);
			codeLength += 2;
			return codeLength;
		}
		
		if (rocfGetParameterInvocation != null) {
			codeLength += rocfGetParameterInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 6
			reverseOS.write(0xA6);
			codeLength += 1;
			return codeLength;
		}
		
		if (rocfScheduleStatusReportInvocation != null) {
			codeLength += rocfScheduleStatusReportInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 4
			reverseOS.write(0xA4);
			codeLength += 1;
			return codeLength;
		}
		
		if (rocfStopInvocation != null) {
			codeLength += rocfStopInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 2
			reverseOS.write(0xA2);
			codeLength += 1;
			return codeLength;
		}
		
		if (rocfStartInvocation != null) {
			codeLength += rocfStartInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 0
			reverseOS.write(0xA0);
			codeLength += 1;
			return codeLength;
		}
		
		if (rocfUnbindReturn != null) {
			codeLength += rocfUnbindReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 103
			reverseOS.write(0x67);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rocfUnbindInvocation != null) {
			codeLength += rocfUnbindInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 102
			reverseOS.write(0x66);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rocfBindReturn != null) {
			codeLength += rocfBindReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 101
			reverseOS.write(0x65);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rocfBindInvocation != null) {
			codeLength += rocfBindInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 100
			reverseOS.write(0x64);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
	}

	public int decode(InputStream is) throws IOException {
		return decode(is, null);
	}

	public int decode(InputStream is, BerTag berTag) throws IOException {

		int codeLength = 0;
		BerTag passedTag = berTag;

		if (berTag == null) {
			berTag = new BerTag();
			codeLength += berTag.decode(is);
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 100)) {
			rocfBindInvocation = new SleBindInvocation();
			codeLength += rocfBindInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 101)) {
			rocfBindReturn = new SleBindReturn();
			codeLength += rocfBindReturn.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 102)) {
			rocfUnbindInvocation = new SleUnbindInvocation();
			codeLength += rocfUnbindInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 103)) {
			rocfUnbindReturn = new SleUnbindReturn();
			codeLength += rocfUnbindReturn.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
			rocfStartInvocation = new RocfStartInvocation();
			codeLength += rocfStartInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
			rocfStopInvocation = new SleStopInvocation();
			codeLength += rocfStopInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
			rocfScheduleStatusReportInvocation = new SleScheduleStatusReportInvocation();
			codeLength += rocfScheduleStatusReportInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
			rocfGetParameterInvocation = new RocfGetParameterInvocation();
			codeLength += rocfGetParameterInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 104)) {
			rocfPeerAbortInvocation = new SlePeerAbort();
			codeLength += rocfPeerAbortInvocation.decode(is, false);
			return codeLength;
		}

		if (passedTag != null) {
			return 0;
		}

		throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item.");
	}

	public void encodeAndSave(int encodingSizeGuess) throws IOException {
		ReverseByteArrayOutputStream reverseOS = new ReverseByteArrayOutputStream(encodingSizeGuess);
		encode(reverseOS);
		code = reverseOS.getArray();
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		appendAsString(sb, 0);
		return sb.toString();
	}

	public void appendAsString(StringBuilder sb, int indentLevel) {

		if (rocfBindInvocation != null) {
			sb.append("rocfBindInvocation: ");
			rocfBindInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rocfBindReturn != null) {
			sb.append("rocfBindReturn: ");
			rocfBindReturn.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rocfUnbindInvocation != null) {
			sb.append("rocfUnbindInvocation: ");
			rocfUnbindInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rocfUnbindReturn != null) {
			sb.append("rocfUnbindReturn: ");
			rocfUnbindReturn.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rocfStartInvocation != null) {
			sb.append("rocfStartInvocation: ");
			rocfStartInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rocfStopInvocation != null) {
			sb.append("rocfStopInvocation: ");
			rocfStopInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rocfScheduleStatusReportInvocation != null) {
			sb.append("rocfScheduleStatusReportInvocation: ");
			rocfScheduleStatusReportInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rocfGetParameterInvocation != null) {
			sb.append("rocfGetParameterInvocation: ");
			rocfGetParameterInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rocfPeerAbortInvocation != null) {
			sb.append("rocfPeerAbortInvocation: ").append(rocfPeerAbortInvocation);
			return;
		}

		sb.append("");
	}

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy