/**
|
* This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org)
|
*/
|
|
package org.openmuc.openiec61850.internal.mms.asn1;
|
|
import java.io.IOException;
|
import java.io.InputStream;
|
import java.io.OutputStream;
|
import java.io.Serializable;
|
|
import org.openmuc.jasn1.ber.BerLength;
|
import org.openmuc.jasn1.ber.BerTag;
|
import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream;
|
|
public class InitiateResponsePDU implements Serializable {
|
|
private static final long serialVersionUID = 1L;
|
|
public static class InitResponseDetail implements Serializable {
|
|
private static final long serialVersionUID = 1L;
|
|
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
|
public byte[] code = null;
|
private Integer16 negotiatedVersionNumber = null;
|
private ParameterSupportOptions negotiatedParameterCBB = null;
|
private ServiceSupportOptions servicesSupportedCalled = null;
|
|
public InitResponseDetail() {
|
}
|
|
public InitResponseDetail(byte[] code) {
|
this.code = code;
|
}
|
|
public void setNegotiatedVersionNumber(Integer16 negotiatedVersionNumber) {
|
this.negotiatedVersionNumber = negotiatedVersionNumber;
|
}
|
|
public Integer16 getNegotiatedVersionNumber() {
|
return negotiatedVersionNumber;
|
}
|
|
public void setNegotiatedParameterCBB(ParameterSupportOptions negotiatedParameterCBB) {
|
this.negotiatedParameterCBB = negotiatedParameterCBB;
|
}
|
|
public ParameterSupportOptions getNegotiatedParameterCBB() {
|
return negotiatedParameterCBB;
|
}
|
|
public void setServicesSupportedCalled(ServiceSupportOptions servicesSupportedCalled) {
|
this.servicesSupportedCalled = servicesSupportedCalled;
|
}
|
|
public ServiceSupportOptions getServicesSupportedCalled() {
|
return servicesSupportedCalled;
|
}
|
|
public int encode(OutputStream os) throws IOException {
|
return encode(os, true);
|
}
|
|
public int encode(OutputStream os, boolean withTag) throws IOException {
|
|
if (code != null) {
|
for (int i = code.length - 1; i >= 0; i--) {
|
os.write(code[i]);
|
}
|
if (withTag) {
|
return tag.encode(os) + code.length;
|
}
|
return code.length;
|
}
|
|
int codeLength = 0;
|
codeLength += servicesSupportedCalled.encode(os, false);
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 2
|
os.write(0x82);
|
codeLength += 1;
|
|
codeLength += negotiatedParameterCBB.encode(os, false);
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
os.write(0x81);
|
codeLength += 1;
|
|
codeLength += negotiatedVersionNumber.encode(os, false);
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 0
|
os.write(0x80);
|
codeLength += 1;
|
|
codeLength += BerLength.encodeLength(os, codeLength);
|
|
if (withTag) {
|
codeLength += tag.encode(os);
|
}
|
|
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);
|
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
|
negotiatedVersionNumber = new Integer16();
|
subCodeLength += negotiatedVersionNumber.decode(is, false);
|
subCodeLength += berTag.decode(is);
|
}
|
else {
|
throw new IOException("Tag does not match the mandatory sequence element tag.");
|
}
|
|
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
|
negotiatedParameterCBB = new ParameterSupportOptions();
|
subCodeLength += negotiatedParameterCBB.decode(is, false);
|
subCodeLength += berTag.decode(is);
|
}
|
else {
|
throw new IOException("Tag does not match the mandatory sequence element tag.");
|
}
|
|
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
|
servicesSupportedCalled = new ServiceSupportOptions();
|
subCodeLength += servicesSupportedCalled.decode(is, false);
|
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 os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
encode(os, false);
|
code = os.getArray();
|
}
|
|
@Override
|
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 (negotiatedVersionNumber != null) {
|
sb.append("negotiatedVersionNumber: ").append(negotiatedVersionNumber);
|
}
|
else {
|
sb.append("negotiatedVersionNumber: <empty-required-field>");
|
}
|
|
sb.append(",\n");
|
for (int i = 0; i < indentLevel + 1; i++) {
|
sb.append("\t");
|
}
|
if (negotiatedParameterCBB != null) {
|
sb.append("negotiatedParameterCBB: ").append(negotiatedParameterCBB);
|
}
|
else {
|
sb.append("negotiatedParameterCBB: <empty-required-field>");
|
}
|
|
sb.append(",\n");
|
for (int i = 0; i < indentLevel + 1; i++) {
|
sb.append("\t");
|
}
|
if (servicesSupportedCalled != null) {
|
sb.append("servicesSupportedCalled: ").append(servicesSupportedCalled);
|
}
|
else {
|
sb.append("servicesSupportedCalled: <empty-required-field>");
|
}
|
|
sb.append("\n");
|
for (int i = 0; i < indentLevel; i++) {
|
sb.append("\t");
|
}
|
sb.append("}");
|
}
|
|
}
|
|
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
|
public byte[] code = null;
|
private Integer32 localDetailCalled = null;
|
private Integer16 negotiatedMaxServOutstandingCalling = null;
|
private Integer16 negotiatedMaxServOutstandingCalled = null;
|
private Integer8 negotiatedDataStructureNestingLevel = null;
|
private InitResponseDetail initResponseDetail = null;
|
|
public InitiateResponsePDU() {
|
}
|
|
public InitiateResponsePDU(byte[] code) {
|
this.code = code;
|
}
|
|
public void setLocalDetailCalled(Integer32 localDetailCalled) {
|
this.localDetailCalled = localDetailCalled;
|
}
|
|
public Integer32 getLocalDetailCalled() {
|
return localDetailCalled;
|
}
|
|
public void setNegotiatedMaxServOutstandingCalling(Integer16 negotiatedMaxServOutstandingCalling) {
|
this.negotiatedMaxServOutstandingCalling = negotiatedMaxServOutstandingCalling;
|
}
|
|
public Integer16 getNegotiatedMaxServOutstandingCalling() {
|
return negotiatedMaxServOutstandingCalling;
|
}
|
|
public void setNegotiatedMaxServOutstandingCalled(Integer16 negotiatedMaxServOutstandingCalled) {
|
this.negotiatedMaxServOutstandingCalled = negotiatedMaxServOutstandingCalled;
|
}
|
|
public Integer16 getNegotiatedMaxServOutstandingCalled() {
|
return negotiatedMaxServOutstandingCalled;
|
}
|
|
public void setNegotiatedDataStructureNestingLevel(Integer8 negotiatedDataStructureNestingLevel) {
|
this.negotiatedDataStructureNestingLevel = negotiatedDataStructureNestingLevel;
|
}
|
|
public Integer8 getNegotiatedDataStructureNestingLevel() {
|
return negotiatedDataStructureNestingLevel;
|
}
|
|
public void setInitResponseDetail(InitResponseDetail initResponseDetail) {
|
this.initResponseDetail = initResponseDetail;
|
}
|
|
public InitResponseDetail getInitResponseDetail() {
|
return initResponseDetail;
|
}
|
|
public int encode(OutputStream os) throws IOException {
|
return encode(os, true);
|
}
|
|
public int encode(OutputStream os, boolean withTag) throws IOException {
|
|
if (code != null) {
|
for (int i = code.length - 1; i >= 0; i--) {
|
os.write(code[i]);
|
}
|
if (withTag) {
|
return tag.encode(os) + code.length;
|
}
|
return code.length;
|
}
|
|
int codeLength = 0;
|
codeLength += initResponseDetail.encode(os, false);
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 4
|
os.write(0xA4);
|
codeLength += 1;
|
|
if (negotiatedDataStructureNestingLevel != null) {
|
codeLength += negotiatedDataStructureNestingLevel.encode(os, false);
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 3
|
os.write(0x83);
|
codeLength += 1;
|
}
|
|
codeLength += negotiatedMaxServOutstandingCalled.encode(os, false);
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 2
|
os.write(0x82);
|
codeLength += 1;
|
|
codeLength += negotiatedMaxServOutstandingCalling.encode(os, false);
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
os.write(0x81);
|
codeLength += 1;
|
|
if (localDetailCalled != null) {
|
codeLength += localDetailCalled.encode(os, false);
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 0
|
os.write(0x80);
|
codeLength += 1;
|
}
|
|
codeLength += BerLength.encodeLength(os, codeLength);
|
|
if (withTag) {
|
codeLength += tag.encode(os);
|
}
|
|
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);
|
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
|
localDetailCalled = new Integer32();
|
subCodeLength += localDetailCalled.decode(is, false);
|
subCodeLength += berTag.decode(is);
|
}
|
|
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
|
negotiatedMaxServOutstandingCalling = new Integer16();
|
subCodeLength += negotiatedMaxServOutstandingCalling.decode(is, false);
|
subCodeLength += berTag.decode(is);
|
}
|
else {
|
throw new IOException("Tag does not match the mandatory sequence element tag.");
|
}
|
|
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
|
negotiatedMaxServOutstandingCalled = new Integer16();
|
subCodeLength += negotiatedMaxServOutstandingCalled.decode(is, false);
|
subCodeLength += berTag.decode(is);
|
}
|
else {
|
throw new IOException("Tag does not match the mandatory sequence element tag.");
|
}
|
|
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
|
negotiatedDataStructureNestingLevel = new Integer8();
|
subCodeLength += negotiatedDataStructureNestingLevel.decode(is, false);
|
subCodeLength += berTag.decode(is);
|
}
|
|
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
|
initResponseDetail = new InitResponseDetail();
|
subCodeLength += initResponseDetail.decode(is, false);
|
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 os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
encode(os, false);
|
code = os.getArray();
|
}
|
|
@Override
|
public String toString() {
|
StringBuilder sb = new StringBuilder();
|
appendAsString(sb, 0);
|
return sb.toString();
|
}
|
|
public void appendAsString(StringBuilder sb, int indentLevel) {
|
|
sb.append("{");
|
boolean firstSelectedElement = true;
|
if (localDetailCalled != null) {
|
sb.append("\n");
|
for (int i = 0; i < indentLevel + 1; i++) {
|
sb.append("\t");
|
}
|
sb.append("localDetailCalled: ").append(localDetailCalled);
|
firstSelectedElement = false;
|
}
|
|
if (!firstSelectedElement) {
|
sb.append(",\n");
|
}
|
for (int i = 0; i < indentLevel + 1; i++) {
|
sb.append("\t");
|
}
|
if (negotiatedMaxServOutstandingCalling != null) {
|
sb.append("negotiatedMaxServOutstandingCalling: ").append(negotiatedMaxServOutstandingCalling);
|
}
|
else {
|
sb.append("negotiatedMaxServOutstandingCalling: <empty-required-field>");
|
}
|
|
sb.append(",\n");
|
for (int i = 0; i < indentLevel + 1; i++) {
|
sb.append("\t");
|
}
|
if (negotiatedMaxServOutstandingCalled != null) {
|
sb.append("negotiatedMaxServOutstandingCalled: ").append(negotiatedMaxServOutstandingCalled);
|
}
|
else {
|
sb.append("negotiatedMaxServOutstandingCalled: <empty-required-field>");
|
}
|
|
if (negotiatedDataStructureNestingLevel != null) {
|
sb.append(",\n");
|
for (int i = 0; i < indentLevel + 1; i++) {
|
sb.append("\t");
|
}
|
sb.append("negotiatedDataStructureNestingLevel: ").append(negotiatedDataStructureNestingLevel);
|
}
|
|
sb.append(",\n");
|
for (int i = 0; i < indentLevel + 1; i++) {
|
sb.append("\t");
|
}
|
if (initResponseDetail != null) {
|
sb.append("initResponseDetail: ");
|
initResponseDetail.appendAsString(sb, indentLevel + 1);
|
}
|
else {
|
sb.append("initResponseDetail: <empty-required-field>");
|
}
|
|
sb.append("\n");
|
for (int i = 0; i < indentLevel; i++) {
|
sb.append("\t");
|
}
|
sb.append("}");
|
}
|
|
}
|