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

ccsds.sle.transfer.service.fsp.incoming.pdus.FspInvokeDirectiveInvocation 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.fsp.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.SlePeerAbort;
import ccsds.sle.transfer.service.bind.types.SleUnbindInvocation;
import ccsds.sle.transfer.service.common.pdus.SleScheduleStatusReportInvocation;
import ccsds.sle.transfer.service.common.pdus.SleStopInvocation;
import ccsds.sle.transfer.service.common.types.Credentials;
import ccsds.sle.transfer.service.common.types.Duration;
import ccsds.sle.transfer.service.common.types.IntPosLong;
import ccsds.sle.transfer.service.common.types.IntPosShort;
import ccsds.sle.transfer.service.common.types.IntUnsignedLong;
import ccsds.sle.transfer.service.common.types.InvokeId;
import ccsds.sle.transfer.service.common.types.SlduStatusNotification;
import ccsds.sle.transfer.service.fsp.structures.BlockingUsage;
import ccsds.sle.transfer.service.fsp.structures.FspData;
import ccsds.sle.transfer.service.fsp.structures.FspParameterName;
import ccsds.sle.transfer.service.fsp.structures.Map;
import ccsds.sle.transfer.service.fsp.structures.MapMuxControl;
import ccsds.sle.transfer.service.fsp.structures.PacketIdentification;
import ccsds.sle.transfer.service.fsp.structures.ProductionTime;
import ccsds.sle.transfer.service.fsp.structures.TransmissionMode;

public class FspInvokeDirectiveInvocation implements BerType, Serializable {

	private static final long serialVersionUID = 1L;

	public static class Directive implements BerType, Serializable {

		private static final long serialVersionUID = 1L;

		public byte[] code = null;
		private BerNull initiateADserviceWithoutCLCW = null;
		private BerNull initiateADserviceWithCLCW = null;
		private BerNull initiateADserviceWithUnlock = null;
		private BerInteger initiateADserviceWithSetVR = null;
		private BerNull terminateADservice = null;
		private BerNull resumeADservice = null;
		private BerInteger setVS = null;
		private BerInteger setFOPslidingWindowWidth = null;
		private IntPosLong setT1Initial = null;
		private IntPosShort setTransmissionLimit = null;
		private BerInteger setTimeoutType = null;
		private BerNull abortVC = null;
		private MapMuxControl modifyMapMuxControl = null;
		
		public Directive() {
		}

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

		public void setInitiateADserviceWithoutCLCW(BerNull initiateADserviceWithoutCLCW) {
			this.initiateADserviceWithoutCLCW = initiateADserviceWithoutCLCW;
		}

		public BerNull getInitiateADserviceWithoutCLCW() {
			return initiateADserviceWithoutCLCW;
		}

		public void setInitiateADserviceWithCLCW(BerNull initiateADserviceWithCLCW) {
			this.initiateADserviceWithCLCW = initiateADserviceWithCLCW;
		}

		public BerNull getInitiateADserviceWithCLCW() {
			return initiateADserviceWithCLCW;
		}

		public void setInitiateADserviceWithUnlock(BerNull initiateADserviceWithUnlock) {
			this.initiateADserviceWithUnlock = initiateADserviceWithUnlock;
		}

		public BerNull getInitiateADserviceWithUnlock() {
			return initiateADserviceWithUnlock;
		}

		public void setInitiateADserviceWithSetVR(BerInteger initiateADserviceWithSetVR) {
			this.initiateADserviceWithSetVR = initiateADserviceWithSetVR;
		}

		public BerInteger getInitiateADserviceWithSetVR() {
			return initiateADserviceWithSetVR;
		}

		public void setTerminateADservice(BerNull terminateADservice) {
			this.terminateADservice = terminateADservice;
		}

		public BerNull getTerminateADservice() {
			return terminateADservice;
		}

		public void setResumeADservice(BerNull resumeADservice) {
			this.resumeADservice = resumeADservice;
		}

		public BerNull getResumeADservice() {
			return resumeADservice;
		}

		public void setSetVS(BerInteger setVS) {
			this.setVS = setVS;
		}

		public BerInteger getSetVS() {
			return setVS;
		}

		public void setSetFOPslidingWindowWidth(BerInteger setFOPslidingWindowWidth) {
			this.setFOPslidingWindowWidth = setFOPslidingWindowWidth;
		}

		public BerInteger getSetFOPslidingWindowWidth() {
			return setFOPslidingWindowWidth;
		}

		public void setSetT1Initial(IntPosLong setT1Initial) {
			this.setT1Initial = setT1Initial;
		}

		public IntPosLong getSetT1Initial() {
			return setT1Initial;
		}

		public void setSetTransmissionLimit(IntPosShort setTransmissionLimit) {
			this.setTransmissionLimit = setTransmissionLimit;
		}

		public IntPosShort getSetTransmissionLimit() {
			return setTransmissionLimit;
		}

		public void setSetTimeoutType(BerInteger setTimeoutType) {
			this.setTimeoutType = setTimeoutType;
		}

		public BerInteger getSetTimeoutType() {
			return setTimeoutType;
		}

		public void setAbortVC(BerNull abortVC) {
			this.abortVC = abortVC;
		}

		public BerNull getAbortVC() {
			return abortVC;
		}

		public void setModifyMapMuxControl(MapMuxControl modifyMapMuxControl) {
			this.modifyMapMuxControl = modifyMapMuxControl;
		}

		public MapMuxControl getModifyMapMuxControl() {
			return modifyMapMuxControl;
		}

		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;
			int sublength;

			if (modifyMapMuxControl != null) {
				sublength = modifyMapMuxControl.encode(reverseOS);
				codeLength += sublength;
				codeLength += BerLength.encodeLength(reverseOS, sublength);
				// write tag: CONTEXT_CLASS, CONSTRUCTED, 12
				reverseOS.write(0xAC);
				codeLength += 1;
				return codeLength;
			}
			
			if (abortVC != null) {
				codeLength += abortVC.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 11
				reverseOS.write(0x8B);
				codeLength += 1;
				return codeLength;
			}
			
			if (setTimeoutType != null) {
				codeLength += setTimeoutType.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 10
				reverseOS.write(0x8A);
				codeLength += 1;
				return codeLength;
			}
			
			if (setTransmissionLimit != null) {
				codeLength += setTransmissionLimit.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 9
				reverseOS.write(0x89);
				codeLength += 1;
				return codeLength;
			}
			
			if (setT1Initial != null) {
				codeLength += setT1Initial.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 8
				reverseOS.write(0x88);
				codeLength += 1;
				return codeLength;
			}
			
			if (setFOPslidingWindowWidth != null) {
				codeLength += setFOPslidingWindowWidth.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 7
				reverseOS.write(0x87);
				codeLength += 1;
				return codeLength;
			}
			
			if (setVS != null) {
				codeLength += setVS.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 6
				reverseOS.write(0x86);
				codeLength += 1;
				return codeLength;
			}
			
			if (resumeADservice != null) {
				codeLength += resumeADservice.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 5
				reverseOS.write(0x85);
				codeLength += 1;
				return codeLength;
			}
			
			if (terminateADservice != null) {
				codeLength += terminateADservice.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 4
				reverseOS.write(0x84);
				codeLength += 1;
				return codeLength;
			}
			
			if (initiateADserviceWithSetVR != null) {
				codeLength += initiateADserviceWithSetVR.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 3
				reverseOS.write(0x83);
				codeLength += 1;
				return codeLength;
			}
			
			if (initiateADserviceWithUnlock != null) {
				codeLength += initiateADserviceWithUnlock.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 2
				reverseOS.write(0x82);
				codeLength += 1;
				return codeLength;
			}
			
			if (initiateADserviceWithCLCW != null) {
				codeLength += initiateADserviceWithCLCW.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 1
				reverseOS.write(0x81);
				codeLength += 1;
				return codeLength;
			}
			
			if (initiateADserviceWithoutCLCW != null) {
				codeLength += initiateADserviceWithoutCLCW.encode(reverseOS, false);
				// write tag: CONTEXT_CLASS, PRIMITIVE, 0
				reverseOS.write(0x80);
				codeLength += 1;
				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.PRIMITIVE, 0)) {
				initiateADserviceWithoutCLCW = new BerNull();
				codeLength += initiateADserviceWithoutCLCW.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
				initiateADserviceWithCLCW = new BerNull();
				codeLength += initiateADserviceWithCLCW.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
				initiateADserviceWithUnlock = new BerNull();
				codeLength += initiateADserviceWithUnlock.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
				initiateADserviceWithSetVR = new BerInteger();
				codeLength += initiateADserviceWithSetVR.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
				terminateADservice = new BerNull();
				codeLength += terminateADservice.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) {
				resumeADservice = new BerNull();
				codeLength += resumeADservice.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
				setVS = new BerInteger();
				codeLength += setVS.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) {
				setFOPslidingWindowWidth = new BerInteger();
				codeLength += setFOPslidingWindowWidth.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
				setT1Initial = new IntPosLong();
				codeLength += setT1Initial.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
				setTransmissionLimit = new IntPosShort();
				codeLength += setTransmissionLimit.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) {
				setTimeoutType = new BerInteger();
				codeLength += setTimeoutType.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) {
				abortVC = new BerNull();
				codeLength += abortVC.decode(is, false);
				return codeLength;
			}

			if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 12)) {
				codeLength += BerLength.skip(is);
				modifyMapMuxControl = new MapMuxControl();
				codeLength += modifyMapMuxControl.decode(is, null);
				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 (initiateADserviceWithoutCLCW != null) {
				sb.append("initiateADserviceWithoutCLCW: ").append(initiateADserviceWithoutCLCW);
				return;
			}

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

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

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

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

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

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

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

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

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

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

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

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

			sb.append("");
		}

	}

	public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);

	public byte[] code = null;
	private Credentials invokerCredentials = null;
	private InvokeId invokeId = null;
	private IntUnsignedLong directiveIdentification = null;
	private Directive directive = null;
	
	public FspInvokeDirectiveInvocation() {
	}

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

	public void setInvokerCredentials(Credentials invokerCredentials) {
		this.invokerCredentials = invokerCredentials;
	}

	public Credentials getInvokerCredentials() {
		return invokerCredentials;
	}

	public void setInvokeId(InvokeId invokeId) {
		this.invokeId = invokeId;
	}

	public InvokeId getInvokeId() {
		return invokeId;
	}

	public void setDirectiveIdentification(IntUnsignedLong directiveIdentification) {
		this.directiveIdentification = directiveIdentification;
	}

	public IntUnsignedLong getDirectiveIdentification() {
		return directiveIdentification;
	}

	public void setDirective(Directive directive) {
		this.directive = directive;
	}

	public Directive getDirective() {
		return directive;
	}

	public int encode(OutputStream reverseOS) throws IOException {
		return encode(reverseOS, true);
	}

	public int encode(OutputStream reverseOS, boolean withTag) throws IOException {

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

		int codeLength = 0;
		codeLength += directive.encode(reverseOS);
		
		codeLength += directiveIdentification.encode(reverseOS, true);
		
		codeLength += invokeId.encode(reverseOS, true);
		
		codeLength += invokerCredentials.encode(reverseOS);
		
		codeLength += BerLength.encodeLength(reverseOS, codeLength);

		if (withTag) {
			codeLength += tag.encode(reverseOS);
		}

		return codeLength;

	}

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

	public int decode(InputStream is, boolean withTag) throws IOException {
		int codeLength = 0;
		int subCodeLength = 0;
		BerTag berTag = new BerTag();

		if (withTag) {
			codeLength += tag.decodeAndCheck(is);
		}

		BerLength length = new BerLength();
		codeLength += length.decode(is);

		int totalLength = length.val;
		codeLength += totalLength;

		subCodeLength += berTag.decode(is);
		invokerCredentials = new Credentials();
		subCodeLength += invokerCredentials.decode(is, berTag);
		subCodeLength += berTag.decode(is);
		
		if (berTag.equals(InvokeId.tag)) {
			invokeId = new InvokeId();
			subCodeLength += invokeId.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		if (berTag.equals(IntUnsignedLong.tag)) {
			directiveIdentification = new IntUnsignedLong();
			subCodeLength += directiveIdentification.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		directive = new Directive();
		subCodeLength += directive.decode(is, berTag);
		if (subCodeLength == totalLength) {
			return codeLength;
		}
		throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);

		
	}

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

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

	public void appendAsString(StringBuilder sb, int indentLevel) {

		sb.append("{");
		sb.append("\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (invokerCredentials != null) {
			sb.append("invokerCredentials: ");
			invokerCredentials.appendAsString(sb, indentLevel + 1);
		}
		else {
			sb.append("invokerCredentials: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (invokeId != null) {
			sb.append("invokeId: ").append(invokeId);
		}
		else {
			sb.append("invokeId: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (directiveIdentification != null) {
			sb.append("directiveIdentification: ").append(directiveIdentification);
		}
		else {
			sb.append("directiveIdentification: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (directive != null) {
			sb.append("directive: ");
			directive.appendAsString(sb, indentLevel + 1);
		}
		else {
			sb.append("directive: ");
		}
		
		sb.append("\n");
		for (int i = 0; i < indentLevel; i++) {
			sb.append("\t");
		}
		sb.append("}");
	}

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy