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

ccsds.sle.transfer.service.raf.incoming.pdus.RafUsertoProviderPdu 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.raf.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.common.types.ParameterName;
import ccsds.sle.transfer.service.raf.structures.RafParameterName;
import ccsds.sle.transfer.service.raf.structures.RequestedFrameQuality;

public class RafUsertoProviderPdu implements BerType, Serializable {

	private static final long serialVersionUID = 1L;

	public byte[] code = null;
	private SleBindInvocation rafBindInvocation = null;
	private SleBindReturn rafBindReturn = null;
	private SleUnbindInvocation rafUnbindInvocation = null;
	private SleUnbindReturn rafUnbindReturn = null;
	private RafStartInvocation rafStartInvocation = null;
	private SleStopInvocation rafStopInvocation = null;
	private SleScheduleStatusReportInvocation rafScheduleStatusReportInvocation = null;
	private RafGetParameterInvocation rafGetParameterInvocation = null;
	private SlePeerAbort rafPeerAbortInvocation = null;
	
	public RafUsertoProviderPdu() {
	}

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

	public void setRafBindInvocation(SleBindInvocation rafBindInvocation) {
		this.rafBindInvocation = rafBindInvocation;
	}

	public SleBindInvocation getRafBindInvocation() {
		return rafBindInvocation;
	}

	public void setRafBindReturn(SleBindReturn rafBindReturn) {
		this.rafBindReturn = rafBindReturn;
	}

	public SleBindReturn getRafBindReturn() {
		return rafBindReturn;
	}

	public void setRafUnbindInvocation(SleUnbindInvocation rafUnbindInvocation) {
		this.rafUnbindInvocation = rafUnbindInvocation;
	}

	public SleUnbindInvocation getRafUnbindInvocation() {
		return rafUnbindInvocation;
	}

	public void setRafUnbindReturn(SleUnbindReturn rafUnbindReturn) {
		this.rafUnbindReturn = rafUnbindReturn;
	}

	public SleUnbindReturn getRafUnbindReturn() {
		return rafUnbindReturn;
	}

	public void setRafStartInvocation(RafStartInvocation rafStartInvocation) {
		this.rafStartInvocation = rafStartInvocation;
	}

	public RafStartInvocation getRafStartInvocation() {
		return rafStartInvocation;
	}

	public void setRafStopInvocation(SleStopInvocation rafStopInvocation) {
		this.rafStopInvocation = rafStopInvocation;
	}

	public SleStopInvocation getRafStopInvocation() {
		return rafStopInvocation;
	}

	public void setRafScheduleStatusReportInvocation(SleScheduleStatusReportInvocation rafScheduleStatusReportInvocation) {
		this.rafScheduleStatusReportInvocation = rafScheduleStatusReportInvocation;
	}

	public SleScheduleStatusReportInvocation getRafScheduleStatusReportInvocation() {
		return rafScheduleStatusReportInvocation;
	}

	public void setRafGetParameterInvocation(RafGetParameterInvocation rafGetParameterInvocation) {
		this.rafGetParameterInvocation = rafGetParameterInvocation;
	}

	public RafGetParameterInvocation getRafGetParameterInvocation() {
		return rafGetParameterInvocation;
	}

	public void setRafPeerAbortInvocation(SlePeerAbort rafPeerAbortInvocation) {
		this.rafPeerAbortInvocation = rafPeerAbortInvocation;
	}

	public SlePeerAbort getRafPeerAbortInvocation() {
		return rafPeerAbortInvocation;
	}

	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 (rafPeerAbortInvocation != null) {
			codeLength += rafPeerAbortInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, PRIMITIVE, 104
			reverseOS.write(0x68);
			reverseOS.write(0x9F);
			codeLength += 2;
			return codeLength;
		}
		
		if (rafGetParameterInvocation != null) {
			codeLength += rafGetParameterInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 6
			reverseOS.write(0xA6);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafScheduleStatusReportInvocation != null) {
			codeLength += rafScheduleStatusReportInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 4
			reverseOS.write(0xA4);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafStopInvocation != null) {
			codeLength += rafStopInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 2
			reverseOS.write(0xA2);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafStartInvocation != null) {
			codeLength += rafStartInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 0
			reverseOS.write(0xA0);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafUnbindReturn != null) {
			codeLength += rafUnbindReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 103
			reverseOS.write(0x67);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rafUnbindInvocation != null) {
			codeLength += rafUnbindInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 102
			reverseOS.write(0x66);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rafBindReturn != null) {
			codeLength += rafBindReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 101
			reverseOS.write(0x65);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rafBindInvocation != null) {
			codeLength += rafBindInvocation.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)) {
			rafBindInvocation = new SleBindInvocation();
			codeLength += rafBindInvocation.decode(is, false);
			return codeLength;
		}

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

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

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

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

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

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

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

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 104)) {
			rafPeerAbortInvocation = new SlePeerAbort();
			codeLength += rafPeerAbortInvocation.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 (rafBindInvocation != null) {
			sb.append("rafBindInvocation: ");
			rafBindInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

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

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

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

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

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

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

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

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

		sb.append("");
	}

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy