diff --git a/asn1/mms/mms.asn b/asn1/mms/mms.asn index 6838ae9..3440db3 100644 --- a/asn1/mms/mms.asn +++ b/asn1/mms/mms.asn @@ -29,7 +29,11 @@ ConfirmedServiceRequest ::= CHOICE { getVariableAccessAttributes [6] GetVariableAccessAttributes-Request, defineNamedVariableList [11] IMPLICIT DefineNamedVariableList-Request, getNamedVariableListAttributes [12] GetNamedVariableListAttributes-Request, - deleteNamedVariableList [13] IMPLICIT DeleteNamedVariableList-Request + deleteNamedVariableList [13] IMPLICIT DeleteNamedVariableList-Request, +-- fileOpen [72] IMPLICIT FileOpen-Request, +-- fileRead [73] IMPLICIT FileRead-Request, +-- fileClose [74] IMPLICIT FileClose-Request, + fileDirectory [77] IMPLICIT FileDirectory-Request } Unconfirmed-PDU ::= SEQUENCE { @@ -52,7 +56,11 @@ ConfirmedServiceResponse ::= CHOICE { getVariableAccessAttributes [6] IMPLICIT GetVariableAccessAttributes-Response, defineNamedVariableList [11] IMPLICIT DefineNamedVariableList-Response, getNamedVariableListAttributes [12] IMPLICIT GetNamedVariableListAttributes-Response, - deleteNamedVariableList [13] IMPLICIT DeleteNamedVariableList-Response + deleteNamedVariableList [13] IMPLICIT DeleteNamedVariableList-Response, +-- fileOpen [72] IMPLICIT FileOpen-Response, +-- fileRead [73] IMPLICIT FileRead-Response, +-- fileClose [74] IMPLICIT FileClose-Response, + fileDirectory [77] IMPLICIT FileDirectory-Response } @@ -581,6 +589,28 @@ DeleteNamedVariableList-Response ::= SEQUENCE { numberDeleted [1] IMPLICIT Unsigned32 } +FileDirectory-Request ::= SEQUENCE { + fileSpecification [0] IMPLICIT FileName OPTIONAL, + continueAfter [1] IMPLICIT FileName OPTIONAL +} + +FileDirectory-Response ::= SEQUENCE { + listOfDirectoryEntry [0] SEQUENCE OF DirectoryEntry, + moreFollows [1] IMPLICIT BOOLEAN DEFAULT FALSE +} + +DirectoryEntry ::= SEQUENCE { + fileName [0] IMPLICIT FileName, + fileAttributes [1] IMPLICIT FileAttributes +} + +FileAttributes ::= SEQUENCE { + sizeOfFile [0] IMPLICIT Unsigned32, -- in octets + lastModified [1] IMPLICIT GeneralizedTime OPTIONAL +} + +FileName ::= SEQUENCE OF GraphicString + TypeDescription ::= CHOICE { array [1] IMPLICIT SEQUENCE { packed [0] IMPLICIT BOOLEAN DEFAULT FALSE, diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AccessResult.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AccessResult.java index 36d74b6..0691dd2 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AccessResult.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AccessResult.java @@ -1,137 +1,144 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class AccessResult implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private DataAccessError failure = null; - private Data success = null; - - public AccessResult() { - } - - public AccessResult(byte[] code) { - this.code = code; - } - - public void setFailure(DataAccessError failure) { - this.failure = failure; - } - - public DataAccessError getFailure() { - return failure; - } - - public void setSuccess(Data success) { - this.success = success; - } - - public Data getSuccess() { - return success; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (success != null) { - codeLength += success.encode(os); - return codeLength; - } - - if (failure != null) { - codeLength += failure.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 0 - os.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)) { - failure = new DataAccessError(); - codeLength += failure.decode(is, false); - return codeLength; - } - - success = new Data(); - int choiceDecodeLength = success.decode(is, berTag); - if (choiceDecodeLength != 0) { - return codeLength + choiceDecodeLength; - } - else { - success = null; - } - - 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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (failure != null) { - sb.append("failure: ").append(failure); - return; - } - - if (success != null) { - sb.append("success: "); - success.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private DataAccessError failure = null; + private Data success = null; + + public AccessResult() { + } + + public AccessResult(byte[] code) { + this.code = code; + } + + public void setFailure(DataAccessError failure) { + this.failure = failure; + } + + public DataAccessError getFailure() { + return failure; + } + + public void setSuccess(Data success) { + this.success = success; + } + + public Data getSuccess() { + return success; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (success != null) { + codeLength += success.encode(os); + return codeLength; + } + + if (failure != null) { + codeLength += failure.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 0 + os.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)) { + failure = new DataAccessError(); + codeLength += failure.decode(is, false); + return codeLength; + } + + success = new Data(); + int choiceDecodeLength = success.decode(is, berTag); + if (choiceDecodeLength != 0) { + return codeLength + choiceDecodeLength; + } + else { + success = null; + } + + 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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (failure != null) { + sb.append("failure: ").append(failure); + return; + } + + if (success != null) { + sb.append("success: "); + success.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AlternateAccess.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AlternateAccess.java index 1e98d83..590b182 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AlternateAccess.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AlternateAccess.java @@ -1,241 +1,242 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class AlternateAccess implements Serializable { - private static final long serialVersionUID = 1L; - - public static class CHOICE implements Serializable { - - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private AlternateAccessSelection unnamed = null; - - public CHOICE() { - } - - public CHOICE(byte[] code) { - this.code = code; - } + private static final long serialVersionUID = 1L; - public void setUnnamed(AlternateAccessSelection unnamed) { - this.unnamed = unnamed; - } + public static class CHOICE implements Serializable { + + private static final long serialVersionUID = 1L; - public AlternateAccessSelection getUnnamed() { - return unnamed; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (unnamed != null) { - codeLength += unnamed.encode(os); - 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); - } - - unnamed = new AlternateAccessSelection(); - int choiceDecodeLength = unnamed.decode(is, berTag); - if (choiceDecodeLength != 0) { - return codeLength + choiceDecodeLength; - } - else { - unnamed = null; - } - - 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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (unnamed != null) { - sb.append("unnamed: "); - unnamed.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 List seqOf = null; - - public AlternateAccess() { - seqOf = new ArrayList<>(); - } - - public AlternateAccess(byte[] code) { - this.code = code; - } - - public List getCHOICE() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - CHOICE element = new CHOICE(); - subCodeLength += element.decode(is, null); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " - + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + public byte[] code = null; + private AlternateAccessSelection unnamed = null; + + public CHOICE() { + } + + public CHOICE(byte[] code) { + this.code = code; + } + + public void setUnnamed(AlternateAccessSelection unnamed) { + this.unnamed = unnamed; + } + + public AlternateAccessSelection getUnnamed() { + return unnamed; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (unnamed != null) { + codeLength += unnamed.encode(os); + 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); + } + + unnamed = new AlternateAccessSelection(); + int choiceDecodeLength = unnamed.decode(is, berTag); + if (choiceDecodeLength != 0) { + return codeLength + choiceDecodeLength; + } + else { + unnamed = null; + } + + 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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (unnamed != null) { + sb.append("unnamed: "); + unnamed.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 List seqOf = null; + + public AlternateAccess() { + seqOf = new ArrayList(); + } + + public AlternateAccess(byte[] code) { + this.code = code; + } + + public List getCHOICE() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + CHOICE element = new CHOICE(); + subCodeLength += element.decode(is, null); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AlternateAccessSelection.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AlternateAccessSelection.java index 3f6f19e..8d649fe 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AlternateAccessSelection.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/AlternateAccessSelection.java @@ -1,1165 +1,1159 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerNull; -import org.openmuc.jasn1.ber.types.string.BerVisibleString; public class AlternateAccessSelection implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public byte[] code = null; + public byte[] code = null; + public static class SelectAlternateAccess implements Serializable { - public static class SelectAlternateAccess implements Serializable { + private static final long serialVersionUID = 1L; - private static final long serialVersionUID = 1L; + public static class AccessSelection implements Serializable { - public static class AccessSelection implements Serializable { + private static final long serialVersionUID = 1L; - private static final long serialVersionUID = 1L; + public byte[] code = null; + public static class Component implements Serializable { - public byte[] code = null; + private static final long serialVersionUID = 1L; - public static class Component implements Serializable { + public byte[] code = null; + private BasicIdentifier basic = null; + + public Component() { + } - private static final long serialVersionUID = 1L; + public Component(byte[] code) { + this.code = code; + } - public byte[] code = null; - private BasicIdentifier basic = null; + public void setBasic(BasicIdentifier basic) { + this.basic = basic; + } - public Component() { - } + public BasicIdentifier getBasic() { + return basic; + } - public Component(byte[] code) { - this.code = code; - } + public int encode(OutputStream os) throws IOException { - public void setBasic(BasicIdentifier basic) { - this.basic = basic; - } + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } - public BasicIdentifier getBasic() { - return basic; - } + int codeLength = 0; + if (basic != null) { + codeLength += basic.encode(os, true); + return codeLength; + } + + throw new IOException("Error encoding CHOICE: No element of CHOICE was selected."); + } - public int encode(OutputStream os) throws IOException { + public int decode(InputStream is) throws IOException { + return decode(is, null); + } - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } + public int decode(InputStream is, BerTag berTag) throws IOException { - int codeLength = 0; - if (basic != null) { - codeLength += basic.encode(os, true); - return codeLength; - } + int codeLength = 0; + BerTag passedTag = berTag; - throw new IOException("Error encoding CHOICE: No element of CHOICE was selected."); - } + if (berTag == null) { + berTag = new BerTag(); + codeLength += berTag.decode(is); + } - public int decode(InputStream is) throws IOException { - return decode(is, null); - } + if (berTag.equals(BasicIdentifier.tag)) { + basic = new BasicIdentifier(); + codeLength += basic.decode(is, false); + return codeLength; + } - public int decode(InputStream is, BerTag berTag) throws IOException { + if (passedTag != null) { + return 0; + } - int codeLength = 0; - BerTag passedTag = berTag; + throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); + } - if (berTag == null) { - berTag = new BerTag(); - codeLength += berTag.decode(is); - } + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } - if (berTag.equals(BerVisibleString.tag)) { - basic = new BasicIdentifier(); - codeLength += basic.decode(is, false); - return codeLength; - } + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } - if (passedTag != null) { - return 0; - } + public void appendAsString(StringBuilder sb, int indentLevel) { - throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); - } + if (basic != null) { + sb.append("basic: ").append(basic); + return; + } - public void encodeAndSave(int encodingSizeGuess) throws IOException { - ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (basic != null) { - sb.append("basic: ").append(basic); - return; - } - - sb.append(""); - } - - } - - public static class IndexRange 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 Unsigned32 lowIndex = null; - private Unsigned32 numberOfElements = null; - - public IndexRange() { - } - - public IndexRange(byte[] code) { - this.code = code; - } - - public void setLowIndex(Unsigned32 lowIndex) { - this.lowIndex = lowIndex; - } - - public Unsigned32 getLowIndex() { - return lowIndex; - } - - public void setNumberOfElements(Unsigned32 numberOfElements) { - this.numberOfElements = numberOfElements; - } - - public Unsigned32 getNumberOfElements() { - return numberOfElements; - } - - 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 += numberOfElements.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - - codeLength += lowIndex.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)) { - lowIndex = new Unsigned32(); - subCodeLength += lowIndex.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)) { - numberOfElements = new Unsigned32(); - subCodeLength += numberOfElements.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 (lowIndex != null) { - sb.append("lowIndex: ").append(lowIndex); - } - else { - sb.append("lowIndex: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (numberOfElements != null) { - sb.append("numberOfElements: ").append(numberOfElements); - } - else { - sb.append("numberOfElements: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - private Component component = null; - private Unsigned32 index = null; - private IndexRange indexRange = null; - private BerNull allElements = null; - - public AccessSelection() { - } - - public AccessSelection(byte[] code) { - this.code = code; - } - - public void setComponent(Component component) { - this.component = component; - } - - public Component getComponent() { - return component; - } - - public void setIndex(Unsigned32 index) { - this.index = index; - } - - public Unsigned32 getIndex() { - return index; - } - - public void setIndexRange(IndexRange indexRange) { - this.indexRange = indexRange; - } - - public IndexRange getIndexRange() { - return indexRange; - } - - public void setAllElements(BerNull allElements) { - this.allElements = allElements; - } - - public BerNull getAllElements() { - return allElements; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - int sublength; - - if (allElements != null) { - codeLength += allElements.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 3 - os.write(0x83); - codeLength += 1; - return codeLength; - } - - if (indexRange != null) { - codeLength += indexRange.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 - os.write(0xA2); - codeLength += 1; - return codeLength; - } - - if (index != null) { - codeLength += index.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - return codeLength; - } - - if (component != null) { - sublength = component.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - codeLength += BerLength.skip(is); - component = new Component(); - codeLength += component.decode(is, null); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { - index = new Unsigned32(); - codeLength += index.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { - indexRange = new IndexRange(); - codeLength += indexRange.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { - allElements = new BerNull(); - codeLength += allElements.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (component != null) { - sb.append("component: "); - component.appendAsString(sb, indentLevel + 1); - return; - } - - if (index != null) { - sb.append("index: ").append(index); - return; - } - - if (indexRange != null) { - sb.append("indexRange: "); - indexRange.appendAsString(sb, indentLevel + 1); - return; - } - - if (allElements != null) { - sb.append("allElements: ").append(allElements); - return; - } - - sb.append(""); - } - - } - - public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); - - public byte[] code = null; - private AccessSelection accessSelection = null; - private AlternateAccess alternateAccess = null; - - public SelectAlternateAccess() { - } - - public SelectAlternateAccess(byte[] code) { - this.code = code; - } - - public void setAccessSelection(AccessSelection accessSelection) { - this.accessSelection = accessSelection; - } - - public AccessSelection getAccessSelection() { - return accessSelection; - } - - public void setAlternateAccess(AlternateAccess alternateAccess) { - this.alternateAccess = alternateAccess; - } - - public AlternateAccess getAlternateAccess() { - return alternateAccess; - } - - 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 += alternateAccess.encode(os, true); - - codeLength += accessSelection.encode(os); - - 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); - accessSelection = new AccessSelection(); - subCodeLength += accessSelection.decode(is, berTag); - subCodeLength += berTag.decode(is); - - if (berTag.equals(AlternateAccess.tag)) { - alternateAccess = new AlternateAccess(); - subCodeLength += alternateAccess.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 (accessSelection != null) { - sb.append("accessSelection: "); - accessSelection.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("accessSelection: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (alternateAccess != null) { - sb.append("alternateAccess: "); - alternateAccess.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("alternateAccess: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - public static class SelectAccess implements Serializable { - - private static final long serialVersionUID = 1L; - - public byte[] code = null; - - public static class Component implements Serializable { - - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private BasicIdentifier basic = null; - - public Component() { - } - - public Component(byte[] code) { - this.code = code; - } - - public void setBasic(BasicIdentifier basic) { - this.basic = basic; - } - - public BasicIdentifier getBasic() { - return basic; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (basic != null) { - codeLength += basic.encode(os, true); - 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(BerVisibleString.tag)) { - basic = new BasicIdentifier(); - codeLength += basic.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (basic != null) { - sb.append("basic: ").append(basic); - return; - } - - sb.append(""); - } - - } - - public static class IndexRange 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 Unsigned32 lowIndex = null; - private Unsigned32 numberOfElements = null; - - public IndexRange() { - } - - public IndexRange(byte[] code) { - this.code = code; - } - - public void setLowIndex(Unsigned32 lowIndex) { - this.lowIndex = lowIndex; - } - - public Unsigned32 getLowIndex() { - return lowIndex; - } - - public void setNumberOfElements(Unsigned32 numberOfElements) { - this.numberOfElements = numberOfElements; - } - - public Unsigned32 getNumberOfElements() { - return numberOfElements; - } - - 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 += numberOfElements.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - - codeLength += lowIndex.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)) { - lowIndex = new Unsigned32(); - subCodeLength += lowIndex.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)) { - numberOfElements = new Unsigned32(); - subCodeLength += numberOfElements.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 (lowIndex != null) { - sb.append("lowIndex: ").append(lowIndex); - } - else { - sb.append("lowIndex: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (numberOfElements != null) { - sb.append("numberOfElements: ").append(numberOfElements); - } - else { - sb.append("numberOfElements: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - private Component component = null; - private Unsigned32 index = null; - private IndexRange indexRange = null; - private BerNull allElements = null; - - public SelectAccess() { - } - - public SelectAccess(byte[] code) { - this.code = code; - } - - public void setComponent(Component component) { - this.component = component; - } - - public Component getComponent() { - return component; - } - - public void setIndex(Unsigned32 index) { - this.index = index; - } - - public Unsigned32 getIndex() { - return index; - } - - public void setIndexRange(IndexRange indexRange) { - this.indexRange = indexRange; - } - - public IndexRange getIndexRange() { - return indexRange; - } - - public void setAllElements(BerNull allElements) { - this.allElements = allElements; - } - - public BerNull getAllElements() { - return allElements; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - int sublength; - - if (allElements != null) { - codeLength += allElements.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 4 - os.write(0x84); - codeLength += 1; - return codeLength; - } - - if (indexRange != null) { - codeLength += indexRange.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 3 - os.write(0xA3); - codeLength += 1; - return codeLength; - } - - if (index != null) { - codeLength += index.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - return codeLength; - } - - if (component != null) { - sublength = component.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - 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.CONSTRUCTED, 1)) { - codeLength += BerLength.skip(is); - component = new Component(); - codeLength += component.decode(is, null); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { - index = new Unsigned32(); - codeLength += index.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) { - indexRange = new IndexRange(); - codeLength += indexRange.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { - allElements = new BerNull(); - codeLength += allElements.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (component != null) { - sb.append("component: "); - component.appendAsString(sb, indentLevel + 1); - return; - } - - if (index != null) { - sb.append("index: ").append(index); - return; - } - - if (indexRange != null) { - sb.append("indexRange: "); - indexRange.appendAsString(sb, indentLevel + 1); - return; - } - - if (allElements != null) { - sb.append("allElements: ").append(allElements); - return; - } - - sb.append(""); - } - - } - - private SelectAlternateAccess selectAlternateAccess = null; - private SelectAccess selectAccess = null; - - public AlternateAccessSelection() { - } - - public AlternateAccessSelection(byte[] code) { - this.code = code; - } - - public void setSelectAlternateAccess(SelectAlternateAccess selectAlternateAccess) { - this.selectAlternateAccess = selectAlternateAccess; - } - - public SelectAlternateAccess getSelectAlternateAccess() { - return selectAlternateAccess; - } - - public void setSelectAccess(SelectAccess selectAccess) { - this.selectAccess = selectAccess; - } - - public SelectAccess getSelectAccess() { - return selectAccess; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (selectAccess != null) { - codeLength += selectAccess.encode(os); - return codeLength; - } - - if (selectAlternateAccess != null) { - codeLength += selectAlternateAccess.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - selectAlternateAccess = new SelectAlternateAccess(); - codeLength += selectAlternateAccess.decode(is, false); - return codeLength; - } - - selectAccess = new SelectAccess(); - int choiceDecodeLength = selectAccess.decode(is, berTag); - if (choiceDecodeLength != 0) { - return codeLength + choiceDecodeLength; - } - else { - selectAccess = null; - } - - 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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (selectAlternateAccess != null) { - sb.append("selectAlternateAccess: "); - selectAlternateAccess.appendAsString(sb, indentLevel + 1); - return; - } - - if (selectAccess != null) { - sb.append("selectAccess: "); - selectAccess.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + sb.append(""); + } + + } + + public static class IndexRange 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 Unsigned32 lowIndex = null; + private Unsigned32 numberOfElements = null; + + public IndexRange() { + } + + public IndexRange(byte[] code) { + this.code = code; + } + + public void setLowIndex(Unsigned32 lowIndex) { + this.lowIndex = lowIndex; + } + + public Unsigned32 getLowIndex() { + return lowIndex; + } + + public void setNumberOfElements(Unsigned32 numberOfElements) { + this.numberOfElements = numberOfElements; + } + + public Unsigned32 getNumberOfElements() { + return numberOfElements; + } + + 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 += numberOfElements.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + + codeLength += lowIndex.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)) { + lowIndex = new Unsigned32(); + subCodeLength += lowIndex.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)) { + numberOfElements = new Unsigned32(); + subCodeLength += numberOfElements.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(); + } + + 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 (lowIndex != null) { + sb.append("lowIndex: ").append(lowIndex); + } + else { + sb.append("lowIndex: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (numberOfElements != null) { + sb.append("numberOfElements: ").append(numberOfElements); + } + else { + sb.append("numberOfElements: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + private Component component = null; + private Unsigned32 index = null; + private IndexRange indexRange = null; + private BerNull allElements = null; + + public AccessSelection() { + } + + public AccessSelection(byte[] code) { + this.code = code; + } + + public void setComponent(Component component) { + this.component = component; + } + + public Component getComponent() { + return component; + } + + public void setIndex(Unsigned32 index) { + this.index = index; + } + + public Unsigned32 getIndex() { + return index; + } + + public void setIndexRange(IndexRange indexRange) { + this.indexRange = indexRange; + } + + public IndexRange getIndexRange() { + return indexRange; + } + + public void setAllElements(BerNull allElements) { + this.allElements = allElements; + } + + public BerNull getAllElements() { + return allElements; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + int sublength; + + if (allElements != null) { + codeLength += allElements.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 3 + os.write(0x83); + codeLength += 1; + return codeLength; + } + + if (indexRange != null) { + codeLength += indexRange.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 + os.write(0xA2); + codeLength += 1; + return codeLength; + } + + if (index != null) { + codeLength += index.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + return codeLength; + } + + if (component != null) { + sublength = component.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + codeLength += BerLength.skip(is); + component = new Component(); + codeLength += component.decode(is, null); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { + index = new Unsigned32(); + codeLength += index.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { + indexRange = new IndexRange(); + codeLength += indexRange.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { + allElements = new BerNull(); + codeLength += allElements.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (component != null) { + sb.append("component: "); + component.appendAsString(sb, indentLevel + 1); + return; + } + + if (index != null) { + sb.append("index: ").append(index); + return; + } + + if (indexRange != null) { + sb.append("indexRange: "); + indexRange.appendAsString(sb, indentLevel + 1); + return; + } + + if (allElements != null) { + sb.append("allElements: ").append(allElements); + return; + } + + sb.append(""); + } + + } + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private AccessSelection accessSelection = null; + private AlternateAccess alternateAccess = null; + + public SelectAlternateAccess() { + } + + public SelectAlternateAccess(byte[] code) { + this.code = code; + } + + public void setAccessSelection(AccessSelection accessSelection) { + this.accessSelection = accessSelection; + } + + public AccessSelection getAccessSelection() { + return accessSelection; + } + + public void setAlternateAccess(AlternateAccess alternateAccess) { + this.alternateAccess = alternateAccess; + } + + public AlternateAccess getAlternateAccess() { + return alternateAccess; + } + + 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 += alternateAccess.encode(os, true); + + codeLength += accessSelection.encode(os); + + 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); + accessSelection = new AccessSelection(); + subCodeLength += accessSelection.decode(is, berTag); + subCodeLength += berTag.decode(is); + + if (berTag.equals(AlternateAccess.tag)) { + alternateAccess = new AlternateAccess(); + subCodeLength += alternateAccess.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(); + } + + 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 (accessSelection != null) { + sb.append("accessSelection: "); + accessSelection.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("accessSelection: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (alternateAccess != null) { + sb.append("alternateAccess: "); + alternateAccess.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("alternateAccess: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + public static class SelectAccess implements Serializable { + + private static final long serialVersionUID = 1L; + + public byte[] code = null; + public static class Component implements Serializable { + + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private BasicIdentifier basic = null; + + public Component() { + } + + public Component(byte[] code) { + this.code = code; + } + + public void setBasic(BasicIdentifier basic) { + this.basic = basic; + } + + public BasicIdentifier getBasic() { + return basic; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (basic != null) { + codeLength += basic.encode(os, true); + 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(BasicIdentifier.tag)) { + basic = new BasicIdentifier(); + codeLength += basic.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (basic != null) { + sb.append("basic: ").append(basic); + return; + } + + sb.append(""); + } + + } + + public static class IndexRange 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 Unsigned32 lowIndex = null; + private Unsigned32 numberOfElements = null; + + public IndexRange() { + } + + public IndexRange(byte[] code) { + this.code = code; + } + + public void setLowIndex(Unsigned32 lowIndex) { + this.lowIndex = lowIndex; + } + + public Unsigned32 getLowIndex() { + return lowIndex; + } + + public void setNumberOfElements(Unsigned32 numberOfElements) { + this.numberOfElements = numberOfElements; + } + + public Unsigned32 getNumberOfElements() { + return numberOfElements; + } + + 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 += numberOfElements.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + + codeLength += lowIndex.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)) { + lowIndex = new Unsigned32(); + subCodeLength += lowIndex.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)) { + numberOfElements = new Unsigned32(); + subCodeLength += numberOfElements.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(); + } + + 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 (lowIndex != null) { + sb.append("lowIndex: ").append(lowIndex); + } + else { + sb.append("lowIndex: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (numberOfElements != null) { + sb.append("numberOfElements: ").append(numberOfElements); + } + else { + sb.append("numberOfElements: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + private Component component = null; + private Unsigned32 index = null; + private IndexRange indexRange = null; + private BerNull allElements = null; + + public SelectAccess() { + } + + public SelectAccess(byte[] code) { + this.code = code; + } + + public void setComponent(Component component) { + this.component = component; + } + + public Component getComponent() { + return component; + } + + public void setIndex(Unsigned32 index) { + this.index = index; + } + + public Unsigned32 getIndex() { + return index; + } + + public void setIndexRange(IndexRange indexRange) { + this.indexRange = indexRange; + } + + public IndexRange getIndexRange() { + return indexRange; + } + + public void setAllElements(BerNull allElements) { + this.allElements = allElements; + } + + public BerNull getAllElements() { + return allElements; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + int sublength; + + if (allElements != null) { + codeLength += allElements.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 4 + os.write(0x84); + codeLength += 1; + return codeLength; + } + + if (indexRange != null) { + codeLength += indexRange.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 3 + os.write(0xA3); + codeLength += 1; + return codeLength; + } + + if (index != null) { + codeLength += index.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + return codeLength; + } + + if (component != null) { + sublength = component.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + 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.CONSTRUCTED, 1)) { + codeLength += BerLength.skip(is); + component = new Component(); + codeLength += component.decode(is, null); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { + index = new Unsigned32(); + codeLength += index.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) { + indexRange = new IndexRange(); + codeLength += indexRange.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { + allElements = new BerNull(); + codeLength += allElements.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (component != null) { + sb.append("component: "); + component.appendAsString(sb, indentLevel + 1); + return; + } + + if (index != null) { + sb.append("index: ").append(index); + return; + } + + if (indexRange != null) { + sb.append("indexRange: "); + indexRange.appendAsString(sb, indentLevel + 1); + return; + } + + if (allElements != null) { + sb.append("allElements: ").append(allElements); + return; + } + + sb.append(""); + } + + } + + private SelectAlternateAccess selectAlternateAccess = null; + private SelectAccess selectAccess = null; + + public AlternateAccessSelection() { + } + + public AlternateAccessSelection(byte[] code) { + this.code = code; + } + + public void setSelectAlternateAccess(SelectAlternateAccess selectAlternateAccess) { + this.selectAlternateAccess = selectAlternateAccess; + } + + public SelectAlternateAccess getSelectAlternateAccess() { + return selectAlternateAccess; + } + + public void setSelectAccess(SelectAccess selectAccess) { + this.selectAccess = selectAccess; + } + + public SelectAccess getSelectAccess() { + return selectAccess; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (selectAccess != null) { + codeLength += selectAccess.encode(os); + return codeLength; + } + + if (selectAlternateAccess != null) { + codeLength += selectAlternateAccess.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + selectAlternateAccess = new SelectAlternateAccess(); + codeLength += selectAlternateAccess.decode(is, false); + return codeLength; + } + + selectAccess = new SelectAccess(); + int choiceDecodeLength = selectAccess.decode(is, berTag); + if (choiceDecodeLength != 0) { + return codeLength + choiceDecodeLength; + } + else { + selectAccess = null; + } + + 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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (selectAlternateAccess != null) { + sb.append("selectAlternateAccess: "); + selectAlternateAccess.appendAsString(sb, indentLevel + 1); + return; + } + + if (selectAccess != null) { + sb.append("selectAccess: "); + selectAccess.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/BasicIdentifier.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/BasicIdentifier.java index e405cb0..79f2efa 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/BasicIdentifier.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/BasicIdentifier.java @@ -1,20 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.string.BerVisibleString; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class BasicIdentifier extends BerVisibleString { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public BasicIdentifier() { - } + public BasicIdentifier() { + } - public BasicIdentifier(byte[] value) { - super(value); - } + public BasicIdentifier(byte[] value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConcludeRequestPDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConcludeRequestPDU.java index f3456a4..542be46 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConcludeRequestPDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConcludeRequestPDU.java @@ -1,20 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.BerNull; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class ConcludeRequestPDU extends BerNull { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public ConcludeRequestPDU() { - } + public ConcludeRequestPDU() { + } - public ConcludeRequestPDU(byte[] code) { - super(code); - } + public ConcludeRequestPDU(byte[] code) { + super(code); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedErrorPDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedErrorPDU.java index 87cb0c0..d2005b5 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedErrorPDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedErrorPDU.java @@ -1,203 +1,209 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class ConfirmedErrorPDU 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 Unsigned32 invokeID = null; - private Unsigned32 modifierPosition = null; - private ServiceError serviceError = null; - - public ConfirmedErrorPDU() { - } - - public ConfirmedErrorPDU(byte[] code) { - this.code = code; - } - - public void setInvokeID(Unsigned32 invokeID) { - this.invokeID = invokeID; - } - - public Unsigned32 getInvokeID() { - return invokeID; - } - - public void setModifierPosition(Unsigned32 modifierPosition) { - this.modifierPosition = modifierPosition; - } - - public Unsigned32 getModifierPosition() { - return modifierPosition; - } - - public void setServiceError(ServiceError serviceError) { - this.serviceError = serviceError; - } - - public ServiceError getServiceError() { - return serviceError; - } - - 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 += serviceError.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 - os.write(0xA2); - codeLength += 1; - - if (modifierPosition != null) { - codeLength += modifierPosition.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - } - - codeLength += invokeID.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)) { - invokeID = new Unsigned32(); - 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(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { - modifierPosition = new Unsigned32(); - subCodeLength += modifierPosition.decode(is, false); - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { - serviceError = new ServiceError(); - subCodeLength += serviceError.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 (invokeID != null) { - sb.append("invokeID: ").append(invokeID); - } - else { - sb.append("invokeID: "); - } - - if (modifierPosition != null) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("modifierPosition: ").append(modifierPosition); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (serviceError != null) { - sb.append("serviceError: "); - serviceError.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("serviceError: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private Unsigned32 invokeID = null; + private Unsigned32 modifierPosition = null; + private ServiceError serviceError = null; + + public ConfirmedErrorPDU() { + } + + public ConfirmedErrorPDU(byte[] code) { + this.code = code; + } + + public void setInvokeID(Unsigned32 invokeID) { + this.invokeID = invokeID; + } + + public Unsigned32 getInvokeID() { + return invokeID; + } + + public void setModifierPosition(Unsigned32 modifierPosition) { + this.modifierPosition = modifierPosition; + } + + public Unsigned32 getModifierPosition() { + return modifierPosition; + } + + public void setServiceError(ServiceError serviceError) { + this.serviceError = serviceError; + } + + public ServiceError getServiceError() { + return serviceError; + } + + 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 += serviceError.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 + os.write(0xA2); + codeLength += 1; + + if (modifierPosition != null) { + codeLength += modifierPosition.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + } + + codeLength += invokeID.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)) { + invokeID = new Unsigned32(); + 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(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { + modifierPosition = new Unsigned32(); + subCodeLength += modifierPosition.decode(is, false); + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { + serviceError = new ServiceError(); + subCodeLength += serviceError.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(); + } + + 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 (invokeID != null) { + sb.append("invokeID: ").append(invokeID); + } + else { + sb.append("invokeID: "); + } + + if (modifierPosition != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("modifierPosition: ").append(modifierPosition); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (serviceError != null) { + sb.append("serviceError: "); + serviceError.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("serviceError: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedRequestPDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedRequestPDU.java index c0f483d..0f56e27 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedRequestPDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedRequestPDU.java @@ -1,166 +1,171 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerInteger; public class ConfirmedRequestPDU 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 Unsigned32 invokeID = null; - private ConfirmedServiceRequest service = null; - - public ConfirmedRequestPDU() { - } - - public ConfirmedRequestPDU(byte[] code) { - this.code = code; - } - - public void setInvokeID(Unsigned32 invokeID) { - this.invokeID = invokeID; - } - - public Unsigned32 getInvokeID() { - return invokeID; - } - - public void setService(ConfirmedServiceRequest service) { - this.service = service; - } - - public ConfirmedServiceRequest getService() { - return service; - } - - 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 += service.encode(os); - - codeLength += invokeID.encode(os, true); - - 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(BerInteger.tag)) { - invokeID = new Unsigned32(); - subCodeLength += invokeID.decode(is, false); - subCodeLength += berTag.decode(is); - } - else { - throw new IOException("Tag does not match the mandatory sequence element tag."); - } - - service = new ConfirmedServiceRequest(); - subCodeLength += service.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 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 (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 (service != null) { - sb.append("service: "); - service.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("service: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private Unsigned32 invokeID = null; + private ConfirmedServiceRequest service = null; + + public ConfirmedRequestPDU() { + } + + public ConfirmedRequestPDU(byte[] code) { + this.code = code; + } + + public void setInvokeID(Unsigned32 invokeID) { + this.invokeID = invokeID; + } + + public Unsigned32 getInvokeID() { + return invokeID; + } + + public void setService(ConfirmedServiceRequest service) { + this.service = service; + } + + public ConfirmedServiceRequest getService() { + return service; + } + + 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 += service.encode(os); + + codeLength += invokeID.encode(os, true); + + 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(Unsigned32.tag)) { + invokeID = new Unsigned32(); + subCodeLength += invokeID.decode(is, false); + subCodeLength += berTag.decode(is); + } + else { + throw new IOException("Tag does not match the mandatory sequence element tag."); + } + + service = new ConfirmedServiceRequest(); + subCodeLength += service.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.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 (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 (service != null) { + sb.append("service: "); + service.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("service: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedResponsePDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedResponsePDU.java index bc1240d..08fc62c 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedResponsePDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedResponsePDU.java @@ -1,166 +1,171 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerInteger; public class ConfirmedResponsePDU 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 Unsigned32 invokeID = null; - private ConfirmedServiceResponse service = null; - - public ConfirmedResponsePDU() { - } - - public ConfirmedResponsePDU(byte[] code) { - this.code = code; - } - - public void setInvokeID(Unsigned32 invokeID) { - this.invokeID = invokeID; - } - - public Unsigned32 getInvokeID() { - return invokeID; - } - - public void setService(ConfirmedServiceResponse service) { - this.service = service; - } - - public ConfirmedServiceResponse getService() { - return service; - } - - 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 += service.encode(os); - - codeLength += invokeID.encode(os, true); - - 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(BerInteger.tag)) { - invokeID = new Unsigned32(); - subCodeLength += invokeID.decode(is, false); - subCodeLength += berTag.decode(is); - } - else { - throw new IOException("Tag does not match the mandatory sequence element tag."); - } - - service = new ConfirmedServiceResponse(); - subCodeLength += service.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 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 (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 (service != null) { - sb.append("service: "); - service.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("service: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private Unsigned32 invokeID = null; + private ConfirmedServiceResponse service = null; + + public ConfirmedResponsePDU() { + } + + public ConfirmedResponsePDU(byte[] code) { + this.code = code; + } + + public void setInvokeID(Unsigned32 invokeID) { + this.invokeID = invokeID; + } + + public Unsigned32 getInvokeID() { + return invokeID; + } + + public void setService(ConfirmedServiceResponse service) { + this.service = service; + } + + public ConfirmedServiceResponse getService() { + return service; + } + + 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 += service.encode(os); + + codeLength += invokeID.encode(os, true); + + 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(Unsigned32.tag)) { + invokeID = new Unsigned32(); + subCodeLength += invokeID.decode(is, false); + subCodeLength += berTag.decode(is); + } + else { + throw new IOException("Tag does not match the mandatory sequence element tag."); + } + + service = new ConfirmedServiceResponse(); + subCodeLength += service.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.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 (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 (service != null) { + sb.append("service: "); + service.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("service: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedServiceRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedServiceRequest.java index ae6ca3f..afd3617 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedServiceRequest.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedServiceRequest.java @@ -1,293 +1,328 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class ConfirmedServiceRequest implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private GetNameListRequest getNameList = null; - private ReadRequest read = null; - private WriteRequest write = null; - private GetVariableAccessAttributesRequest getVariableAccessAttributes = null; - private DefineNamedVariableListRequest defineNamedVariableList = null; - private GetNamedVariableListAttributesRequest getNamedVariableListAttributes = null; - private DeleteNamedVariableListRequest deleteNamedVariableList = null; - - public ConfirmedServiceRequest() { - } - - public ConfirmedServiceRequest(byte[] code) { - this.code = code; - } - - public void setGetNameList(GetNameListRequest getNameList) { - this.getNameList = getNameList; - } - - public GetNameListRequest getGetNameList() { - return getNameList; - } - - public void setRead(ReadRequest read) { - this.read = read; - } - - public ReadRequest getRead() { - return read; - } - - public void setWrite(WriteRequest write) { - this.write = write; - } - - public WriteRequest getWrite() { - return write; - } - - public void setGetVariableAccessAttributes(GetVariableAccessAttributesRequest getVariableAccessAttributes) { - this.getVariableAccessAttributes = getVariableAccessAttributes; - } - - public GetVariableAccessAttributesRequest getGetVariableAccessAttributes() { - return getVariableAccessAttributes; - } - - public void setDefineNamedVariableList(DefineNamedVariableListRequest defineNamedVariableList) { - this.defineNamedVariableList = defineNamedVariableList; - } - - public DefineNamedVariableListRequest getDefineNamedVariableList() { - return defineNamedVariableList; - } - - public void setGetNamedVariableListAttributes( - GetNamedVariableListAttributesRequest getNamedVariableListAttributes) { - this.getNamedVariableListAttributes = getNamedVariableListAttributes; - } - - public GetNamedVariableListAttributesRequest getGetNamedVariableListAttributes() { - return getNamedVariableListAttributes; - } - - public void setDeleteNamedVariableList(DeleteNamedVariableListRequest deleteNamedVariableList) { - this.deleteNamedVariableList = deleteNamedVariableList; - } - - public DeleteNamedVariableListRequest getDeleteNamedVariableList() { - return deleteNamedVariableList; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - int sublength; - - if (deleteNamedVariableList != null) { - codeLength += deleteNamedVariableList.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 13 - os.write(0xAD); - codeLength += 1; - return codeLength; - } - - if (getNamedVariableListAttributes != null) { - sublength = getNamedVariableListAttributes.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 12 - os.write(0xAC); - codeLength += 1; - return codeLength; - } - - if (defineNamedVariableList != null) { - codeLength += defineNamedVariableList.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 11 - os.write(0xAB); - codeLength += 1; - return codeLength; - } - - if (getVariableAccessAttributes != null) { - sublength = getVariableAccessAttributes.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 6 - os.write(0xA6); - codeLength += 1; - return codeLength; - } - - if (write != null) { - codeLength += write.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 5 - os.write(0xA5); - codeLength += 1; - return codeLength; - } - - if (read != null) { - codeLength += read.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 - os.write(0xA4); - codeLength += 1; - return codeLength; - } - - if (getNameList != null) { - codeLength += getNameList.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - 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.CONSTRUCTED, 1)) { - getNameList = new GetNameListRequest(); - codeLength += getNameList.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { - read = new ReadRequest(); - codeLength += read.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) { - write = new WriteRequest(); - codeLength += write.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) { - codeLength += BerLength.skip(is); - getVariableAccessAttributes = new GetVariableAccessAttributesRequest(); - codeLength += getVariableAccessAttributes.decode(is, null); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 11)) { - defineNamedVariableList = new DefineNamedVariableListRequest(); - codeLength += defineNamedVariableList.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 12)) { - codeLength += BerLength.skip(is); - getNamedVariableListAttributes = new GetNamedVariableListAttributesRequest(); - codeLength += getNamedVariableListAttributes.decode(is, null); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 13)) { - deleteNamedVariableList = new DeleteNamedVariableListRequest(); - codeLength += deleteNamedVariableList.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (getNameList != null) { - sb.append("getNameList: "); - getNameList.appendAsString(sb, indentLevel + 1); - return; - } - - if (read != null) { - sb.append("read: "); - read.appendAsString(sb, indentLevel + 1); - return; - } - - if (write != null) { - sb.append("write: "); - write.appendAsString(sb, indentLevel + 1); - return; - } - - if (getVariableAccessAttributes != null) { - sb.append("getVariableAccessAttributes: "); - getVariableAccessAttributes.appendAsString(sb, indentLevel + 1); - return; - } - - if (defineNamedVariableList != null) { - sb.append("defineNamedVariableList: "); - defineNamedVariableList.appendAsString(sb, indentLevel + 1); - return; - } - - if (getNamedVariableListAttributes != null) { - sb.append("getNamedVariableListAttributes: "); - getNamedVariableListAttributes.appendAsString(sb, indentLevel + 1); - return; - } - - if (deleteNamedVariableList != null) { - sb.append("deleteNamedVariableList: "); - deleteNamedVariableList.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private GetNameListRequest getNameList = null; + private ReadRequest read = null; + private WriteRequest write = null; + private GetVariableAccessAttributesRequest getVariableAccessAttributes = null; + private DefineNamedVariableListRequest defineNamedVariableList = null; + private GetNamedVariableListAttributesRequest getNamedVariableListAttributes = null; + private DeleteNamedVariableListRequest deleteNamedVariableList = null; + private FileDirectoryRequest fileDirectory = null; + + public ConfirmedServiceRequest() { + } + + public ConfirmedServiceRequest(byte[] code) { + this.code = code; + } + + public void setGetNameList(GetNameListRequest getNameList) { + this.getNameList = getNameList; + } + + public GetNameListRequest getGetNameList() { + return getNameList; + } + + public void setRead(ReadRequest read) { + this.read = read; + } + + public ReadRequest getRead() { + return read; + } + + public void setWrite(WriteRequest write) { + this.write = write; + } + + public WriteRequest getWrite() { + return write; + } + + public void setGetVariableAccessAttributes(GetVariableAccessAttributesRequest getVariableAccessAttributes) { + this.getVariableAccessAttributes = getVariableAccessAttributes; + } + + public GetVariableAccessAttributesRequest getGetVariableAccessAttributes() { + return getVariableAccessAttributes; + } + + public void setDefineNamedVariableList(DefineNamedVariableListRequest defineNamedVariableList) { + this.defineNamedVariableList = defineNamedVariableList; + } + + public DefineNamedVariableListRequest getDefineNamedVariableList() { + return defineNamedVariableList; + } + + public void setGetNamedVariableListAttributes(GetNamedVariableListAttributesRequest getNamedVariableListAttributes) { + this.getNamedVariableListAttributes = getNamedVariableListAttributes; + } + + public GetNamedVariableListAttributesRequest getGetNamedVariableListAttributes() { + return getNamedVariableListAttributes; + } + + public void setDeleteNamedVariableList(DeleteNamedVariableListRequest deleteNamedVariableList) { + this.deleteNamedVariableList = deleteNamedVariableList; + } + + public DeleteNamedVariableListRequest getDeleteNamedVariableList() { + return deleteNamedVariableList; + } + + public void setFileDirectory(FileDirectoryRequest fileDirectory) { + this.fileDirectory = fileDirectory; + } + + public FileDirectoryRequest getFileDirectory() { + return fileDirectory; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + int sublength; + + if (fileDirectory != null) { + codeLength += fileDirectory.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 77 + os.write(0x4D); + os.write(0xBF); + codeLength += 2; + return codeLength; + } + + if (deleteNamedVariableList != null) { + codeLength += deleteNamedVariableList.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 13 + os.write(0xAD); + codeLength += 1; + return codeLength; + } + + if (getNamedVariableListAttributes != null) { + sublength = getNamedVariableListAttributes.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 12 + os.write(0xAC); + codeLength += 1; + return codeLength; + } + + if (defineNamedVariableList != null) { + codeLength += defineNamedVariableList.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 11 + os.write(0xAB); + codeLength += 1; + return codeLength; + } + + if (getVariableAccessAttributes != null) { + sublength = getVariableAccessAttributes.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 6 + os.write(0xA6); + codeLength += 1; + return codeLength; + } + + if (write != null) { + codeLength += write.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 5 + os.write(0xA5); + codeLength += 1; + return codeLength; + } + + if (read != null) { + codeLength += read.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 + os.write(0xA4); + codeLength += 1; + return codeLength; + } + + if (getNameList != null) { + codeLength += getNameList.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + 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.CONSTRUCTED, 1)) { + getNameList = new GetNameListRequest(); + codeLength += getNameList.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { + read = new ReadRequest(); + codeLength += read.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) { + write = new WriteRequest(); + codeLength += write.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) { + codeLength += BerLength.skip(is); + getVariableAccessAttributes = new GetVariableAccessAttributesRequest(); + codeLength += getVariableAccessAttributes.decode(is, null); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 11)) { + defineNamedVariableList = new DefineNamedVariableListRequest(); + codeLength += defineNamedVariableList.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 12)) { + codeLength += BerLength.skip(is); + getNamedVariableListAttributes = new GetNamedVariableListAttributesRequest(); + codeLength += getNamedVariableListAttributes.decode(is, null); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 13)) { + deleteNamedVariableList = new DeleteNamedVariableListRequest(); + codeLength += deleteNamedVariableList.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 77)) { + fileDirectory = new FileDirectoryRequest(); + codeLength += fileDirectory.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (getNameList != null) { + sb.append("getNameList: "); + getNameList.appendAsString(sb, indentLevel + 1); + return; + } + + if (read != null) { + sb.append("read: "); + read.appendAsString(sb, indentLevel + 1); + return; + } + + if (write != null) { + sb.append("write: "); + write.appendAsString(sb, indentLevel + 1); + return; + } + + if (getVariableAccessAttributes != null) { + sb.append("getVariableAccessAttributes: "); + getVariableAccessAttributes.appendAsString(sb, indentLevel + 1); + return; + } + + if (defineNamedVariableList != null) { + sb.append("defineNamedVariableList: "); + defineNamedVariableList.appendAsString(sb, indentLevel + 1); + return; + } + + if (getNamedVariableListAttributes != null) { + sb.append("getNamedVariableListAttributes: "); + getNamedVariableListAttributes.appendAsString(sb, indentLevel + 1); + return; + } + + if (deleteNamedVariableList != null) { + sb.append("deleteNamedVariableList: "); + deleteNamedVariableList.appendAsString(sb, indentLevel + 1); + return; + } + + if (fileDirectory != null) { + sb.append("fileDirectory: "); + fileDirectory.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedServiceResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedServiceResponse.java index 4d63b21..4293ae4 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedServiceResponse.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ConfirmedServiceResponse.java @@ -1,283 +1,319 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class ConfirmedServiceResponse implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private GetNameListResponse getNameList = null; - private ReadResponse read = null; - private WriteResponse write = null; - private GetVariableAccessAttributesResponse getVariableAccessAttributes = null; - private DefineNamedVariableListResponse defineNamedVariableList = null; - private GetNamedVariableListAttributesResponse getNamedVariableListAttributes = null; - private DeleteNamedVariableListResponse deleteNamedVariableList = null; - - public ConfirmedServiceResponse() { - } - - public ConfirmedServiceResponse(byte[] code) { - this.code = code; - } - - public void setGetNameList(GetNameListResponse getNameList) { - this.getNameList = getNameList; - } - - public GetNameListResponse getGetNameList() { - return getNameList; - } - - public void setRead(ReadResponse read) { - this.read = read; - } - - public ReadResponse getRead() { - return read; - } - - public void setWrite(WriteResponse write) { - this.write = write; - } - - public WriteResponse getWrite() { - return write; - } - - public void setGetVariableAccessAttributes(GetVariableAccessAttributesResponse getVariableAccessAttributes) { - this.getVariableAccessAttributes = getVariableAccessAttributes; - } - - public GetVariableAccessAttributesResponse getGetVariableAccessAttributes() { - return getVariableAccessAttributes; - } - - public void setDefineNamedVariableList(DefineNamedVariableListResponse defineNamedVariableList) { - this.defineNamedVariableList = defineNamedVariableList; - } - - public DefineNamedVariableListResponse getDefineNamedVariableList() { - return defineNamedVariableList; - } - - public void setGetNamedVariableListAttributes( - GetNamedVariableListAttributesResponse getNamedVariableListAttributes) { - this.getNamedVariableListAttributes = getNamedVariableListAttributes; - } - - public GetNamedVariableListAttributesResponse getGetNamedVariableListAttributes() { - return getNamedVariableListAttributes; - } - - public void setDeleteNamedVariableList(DeleteNamedVariableListResponse deleteNamedVariableList) { - this.deleteNamedVariableList = deleteNamedVariableList; - } - - public DeleteNamedVariableListResponse getDeleteNamedVariableList() { - return deleteNamedVariableList; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (deleteNamedVariableList != null) { - codeLength += deleteNamedVariableList.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 13 - os.write(0xAD); - codeLength += 1; - return codeLength; - } - - if (getNamedVariableListAttributes != null) { - codeLength += getNamedVariableListAttributes.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 12 - os.write(0xAC); - codeLength += 1; - return codeLength; - } - - if (defineNamedVariableList != null) { - codeLength += defineNamedVariableList.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 11 - os.write(0x8B); - codeLength += 1; - return codeLength; - } - - if (getVariableAccessAttributes != null) { - codeLength += getVariableAccessAttributes.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 6 - os.write(0xA6); - codeLength += 1; - return codeLength; - } - - if (write != null) { - codeLength += write.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 5 - os.write(0xA5); - codeLength += 1; - return codeLength; - } - - if (read != null) { - codeLength += read.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 - os.write(0xA4); - codeLength += 1; - return codeLength; - } - - if (getNameList != null) { - codeLength += getNameList.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - 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.CONSTRUCTED, 1)) { - getNameList = new GetNameListResponse(); - codeLength += getNameList.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { - read = new ReadResponse(); - codeLength += read.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) { - write = new WriteResponse(); - codeLength += write.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) { - getVariableAccessAttributes = new GetVariableAccessAttributesResponse(); - codeLength += getVariableAccessAttributes.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) { - defineNamedVariableList = new DefineNamedVariableListResponse(); - codeLength += defineNamedVariableList.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 12)) { - getNamedVariableListAttributes = new GetNamedVariableListAttributesResponse(); - codeLength += getNamedVariableListAttributes.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 13)) { - deleteNamedVariableList = new DeleteNamedVariableListResponse(); - codeLength += deleteNamedVariableList.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (getNameList != null) { - sb.append("getNameList: "); - getNameList.appendAsString(sb, indentLevel + 1); - return; - } - - if (read != null) { - sb.append("read: "); - read.appendAsString(sb, indentLevel + 1); - return; - } - - if (write != null) { - sb.append("write: "); - write.appendAsString(sb, indentLevel + 1); - return; - } - - if (getVariableAccessAttributes != null) { - sb.append("getVariableAccessAttributes: "); - getVariableAccessAttributes.appendAsString(sb, indentLevel + 1); - return; - } - - if (defineNamedVariableList != null) { - sb.append("defineNamedVariableList: ").append(defineNamedVariableList); - return; - } - - if (getNamedVariableListAttributes != null) { - sb.append("getNamedVariableListAttributes: "); - getNamedVariableListAttributes.appendAsString(sb, indentLevel + 1); - return; - } - - if (deleteNamedVariableList != null) { - sb.append("deleteNamedVariableList: "); - deleteNamedVariableList.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private GetNameListResponse getNameList = null; + private ReadResponse read = null; + private WriteResponse write = null; + private GetVariableAccessAttributesResponse getVariableAccessAttributes = null; + private DefineNamedVariableListResponse defineNamedVariableList = null; + private GetNamedVariableListAttributesResponse getNamedVariableListAttributes = null; + private DeleteNamedVariableListResponse deleteNamedVariableList = null; + private FileDirectoryResponse fileDirectory = null; + + public ConfirmedServiceResponse() { + } + + public ConfirmedServiceResponse(byte[] code) { + this.code = code; + } + + public void setGetNameList(GetNameListResponse getNameList) { + this.getNameList = getNameList; + } + + public GetNameListResponse getGetNameList() { + return getNameList; + } + + public void setRead(ReadResponse read) { + this.read = read; + } + + public ReadResponse getRead() { + return read; + } + + public void setWrite(WriteResponse write) { + this.write = write; + } + + public WriteResponse getWrite() { + return write; + } + + public void setGetVariableAccessAttributes(GetVariableAccessAttributesResponse getVariableAccessAttributes) { + this.getVariableAccessAttributes = getVariableAccessAttributes; + } + + public GetVariableAccessAttributesResponse getGetVariableAccessAttributes() { + return getVariableAccessAttributes; + } + + public void setDefineNamedVariableList(DefineNamedVariableListResponse defineNamedVariableList) { + this.defineNamedVariableList = defineNamedVariableList; + } + + public DefineNamedVariableListResponse getDefineNamedVariableList() { + return defineNamedVariableList; + } + + public void setGetNamedVariableListAttributes(GetNamedVariableListAttributesResponse getNamedVariableListAttributes) { + this.getNamedVariableListAttributes = getNamedVariableListAttributes; + } + + public GetNamedVariableListAttributesResponse getGetNamedVariableListAttributes() { + return getNamedVariableListAttributes; + } + + public void setDeleteNamedVariableList(DeleteNamedVariableListResponse deleteNamedVariableList) { + this.deleteNamedVariableList = deleteNamedVariableList; + } + + public DeleteNamedVariableListResponse getDeleteNamedVariableList() { + return deleteNamedVariableList; + } + + public void setFileDirectory(FileDirectoryResponse fileDirectory) { + this.fileDirectory = fileDirectory; + } + + public FileDirectoryResponse getFileDirectory() { + return fileDirectory; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (fileDirectory != null) { + codeLength += fileDirectory.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 77 + os.write(0x4D); + os.write(0xBF); + codeLength += 2; + return codeLength; + } + + if (deleteNamedVariableList != null) { + codeLength += deleteNamedVariableList.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 13 + os.write(0xAD); + codeLength += 1; + return codeLength; + } + + if (getNamedVariableListAttributes != null) { + codeLength += getNamedVariableListAttributes.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 12 + os.write(0xAC); + codeLength += 1; + return codeLength; + } + + if (defineNamedVariableList != null) { + codeLength += defineNamedVariableList.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 11 + os.write(0x8B); + codeLength += 1; + return codeLength; + } + + if (getVariableAccessAttributes != null) { + codeLength += getVariableAccessAttributes.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 6 + os.write(0xA6); + codeLength += 1; + return codeLength; + } + + if (write != null) { + codeLength += write.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 5 + os.write(0xA5); + codeLength += 1; + return codeLength; + } + + if (read != null) { + codeLength += read.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 + os.write(0xA4); + codeLength += 1; + return codeLength; + } + + if (getNameList != null) { + codeLength += getNameList.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + 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.CONSTRUCTED, 1)) { + getNameList = new GetNameListResponse(); + codeLength += getNameList.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { + read = new ReadResponse(); + codeLength += read.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) { + write = new WriteResponse(); + codeLength += write.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) { + getVariableAccessAttributes = new GetVariableAccessAttributesResponse(); + codeLength += getVariableAccessAttributes.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) { + defineNamedVariableList = new DefineNamedVariableListResponse(); + codeLength += defineNamedVariableList.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 12)) { + getNamedVariableListAttributes = new GetNamedVariableListAttributesResponse(); + codeLength += getNamedVariableListAttributes.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 13)) { + deleteNamedVariableList = new DeleteNamedVariableListResponse(); + codeLength += deleteNamedVariableList.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 77)) { + fileDirectory = new FileDirectoryResponse(); + codeLength += fileDirectory.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (getNameList != null) { + sb.append("getNameList: "); + getNameList.appendAsString(sb, indentLevel + 1); + return; + } + + if (read != null) { + sb.append("read: "); + read.appendAsString(sb, indentLevel + 1); + return; + } + + if (write != null) { + sb.append("write: "); + write.appendAsString(sb, indentLevel + 1); + return; + } + + if (getVariableAccessAttributes != null) { + sb.append("getVariableAccessAttributes: "); + getVariableAccessAttributes.appendAsString(sb, indentLevel + 1); + return; + } + + if (defineNamedVariableList != null) { + sb.append("defineNamedVariableList: ").append(defineNamedVariableList); + return; + } + + if (getNamedVariableListAttributes != null) { + sb.append("getNamedVariableListAttributes: "); + getNamedVariableListAttributes.appendAsString(sb, indentLevel + 1); + return; + } + + if (deleteNamedVariableList != null) { + sb.append("deleteNamedVariableList: "); + deleteNamedVariableList.appendAsString(sb, indentLevel + 1); + return; + } + + if (fileDirectory != null) { + sb.append("fileDirectory: "); + fileDirectory.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Data.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Data.java index dfb7271..b2b3d1b 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Data.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Data.java @@ -1,684 +1,677 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerBitString; -import org.openmuc.jasn1.ber.types.BerBoolean; -import org.openmuc.jasn1.ber.types.BerInteger; -import org.openmuc.jasn1.ber.types.BerOctetString; -import org.openmuc.jasn1.ber.types.string.BerVisibleString; public class Data implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - - public static class Array 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 List seqOf = null; - - public Array() { - seqOf = new ArrayList<>(); - } - - public Array(byte[] code) { - this.code = code; - } - - public List getData() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - Data element = new Data(); - subCodeLength += element.decode(is, null); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength - + " but has " + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - public static class Structure 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 List seqOf = null; - - public Structure() { - seqOf = new ArrayList<>(); - } - - public Structure(byte[] code) { - this.code = code; - } - - public List getData() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - Data element = new Data(); - subCodeLength += element.decode(is, null); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength - + " but has " + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - private Array array = null; - private Structure structure = null; - private BerBoolean bool = null; - private BerBitString bitString = null; - private BerInteger integer = null; - private BerInteger unsigned = null; - private FloatingPoint floatingPoint = null; - private BerOctetString octetString = null; - private BerVisibleString visibleString = null; - private TimeOfDay binaryTime = null; - private MMSString mMSString = null; - private UtcTime utcTime = null; - - public Data() { - } - - public Data(byte[] code) { - this.code = code; - } - - public void setArray(Array array) { - this.array = array; - } - - public Array getArray() { - return array; - } - - public void setStructure(Structure structure) { - this.structure = structure; - } - - public Structure getStructure() { - return structure; - } - - public void setBool(BerBoolean bool) { - this.bool = bool; - } - - public BerBoolean getBool() { - return bool; - } - - public void setBitString(BerBitString bitString) { - this.bitString = bitString; - } - - public BerBitString getBitString() { - return bitString; - } - - public void setInteger(BerInteger integer) { - this.integer = integer; - } - - public BerInteger getInteger() { - return integer; - } - - public void setUnsigned(BerInteger unsigned) { - this.unsigned = unsigned; - } - - public BerInteger getUnsigned() { - return unsigned; - } - - public void setFloatingPoint(FloatingPoint floatingPoint) { - this.floatingPoint = floatingPoint; - } - - public FloatingPoint getFloatingPoint() { - return floatingPoint; - } - - public void setOctetString(BerOctetString octetString) { - this.octetString = octetString; - } - - public BerOctetString getOctetString() { - return octetString; - } - - public void setVisibleString(BerVisibleString visibleString) { - this.visibleString = visibleString; - } - - public BerVisibleString getVisibleString() { - return visibleString; - } - - public void setBinaryTime(TimeOfDay binaryTime) { - this.binaryTime = binaryTime; - } - - public TimeOfDay getBinaryTime() { - return binaryTime; - } - - public void setMMSString(MMSString mMSString) { - this.mMSString = mMSString; - } - - public MMSString getMMSString() { - return mMSString; - } - - public void setUtcTime(UtcTime utcTime) { - this.utcTime = utcTime; - } - - public UtcTime getUtcTime() { - return utcTime; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (utcTime != null) { - codeLength += utcTime.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 17 - os.write(0x91); - codeLength += 1; - return codeLength; - } - - if (mMSString != null) { - codeLength += mMSString.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 16 - os.write(0x90); - codeLength += 1; - return codeLength; - } - - if (binaryTime != null) { - codeLength += binaryTime.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 12 - os.write(0x8C); - codeLength += 1; - return codeLength; - } - - if (visibleString != null) { - codeLength += visibleString.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 10 - os.write(0x8A); - codeLength += 1; - return codeLength; - } - - if (octetString != null) { - codeLength += octetString.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 9 - os.write(0x89); - codeLength += 1; - return codeLength; - } - - if (floatingPoint != null) { - codeLength += floatingPoint.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 7 - os.write(0x87); - codeLength += 1; - return codeLength; - } - - if (unsigned != null) { - codeLength += unsigned.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 6 - os.write(0x86); - codeLength += 1; - return codeLength; - } - - if (integer != null) { - codeLength += integer.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 5 - os.write(0x85); - codeLength += 1; - return codeLength; - } - - if (bitString != null) { - codeLength += bitString.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 4 - os.write(0x84); - codeLength += 1; - return codeLength; - } - - if (bool != null) { - codeLength += bool.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 3 - os.write(0x83); - codeLength += 1; - return codeLength; - } - - if (structure != null) { - codeLength += structure.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 - os.write(0xA2); - codeLength += 1; - return codeLength; - } - - if (array != null) { - codeLength += array.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - 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.CONSTRUCTED, 1)) { - array = new Array(); - codeLength += array.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { - structure = new Structure(); - codeLength += structure.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { - bool = new BerBoolean(); - codeLength += bool.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { - bitString = new BerBitString(); - codeLength += bitString.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { - integer = new BerInteger(); - codeLength += integer.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { - unsigned = new BerInteger(); - codeLength += unsigned.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) { - floatingPoint = new FloatingPoint(); - codeLength += floatingPoint.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { - octetString = new BerOctetString(); - codeLength += octetString.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { - visibleString = new BerVisibleString(); - codeLength += visibleString.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) { - binaryTime = new TimeOfDay(); - codeLength += binaryTime.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 16)) { - mMSString = new MMSString(); - codeLength += mMSString.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 17)) { - utcTime = new UtcTime(); - codeLength += utcTime.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (array != null) { - sb.append("array: "); - array.appendAsString(sb, indentLevel + 1); - return; - } - - if (structure != null) { - sb.append("structure: "); - structure.appendAsString(sb, indentLevel + 1); - return; - } - - if (bool != null) { - sb.append("bool: ").append(bool); - return; - } - - if (bitString != null) { - sb.append("bitString: ").append(bitString); - return; - } - - if (integer != null) { - sb.append("integer: ").append(integer); - return; - } - - if (unsigned != null) { - sb.append("unsigned: ").append(unsigned); - return; - } - - if (floatingPoint != null) { - sb.append("floatingPoint: ").append(floatingPoint); - return; - } - - if (octetString != null) { - sb.append("octetString: ").append(octetString); - return; - } - - if (visibleString != null) { - sb.append("visibleString: ").append(visibleString); - return; - } - - if (binaryTime != null) { - sb.append("binaryTime: ").append(binaryTime); - return; - } - - if (mMSString != null) { - sb.append("mMSString: ").append(mMSString); - return; - } - - if (utcTime != null) { - sb.append("utcTime: ").append(utcTime); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + public static class Array 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 List seqOf = null; + + public Array() { + seqOf = new ArrayList(); + } + + public Array(byte[] code) { + this.code = code; + } + + public List getData() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + Data element = new Data(); + subCodeLength += element.decode(is, null); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + public static class Structure 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 List seqOf = null; + + public Structure() { + seqOf = new ArrayList(); + } + + public Structure(byte[] code) { + this.code = code; + } + + public List getData() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + Data element = new Data(); + subCodeLength += element.decode(is, null); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + private Array array = null; + private Structure structure = null; + private BerBoolean bool = null; + private BerBitString bitString = null; + private BerInteger integer = null; + private BerInteger unsigned = null; + private FloatingPoint floatingPoint = null; + private BerOctetString octetString = null; + private BerVisibleString visibleString = null; + private TimeOfDay binaryTime = null; + private MMSString mMSString = null; + private UtcTime utcTime = null; + + public Data() { + } + + public Data(byte[] code) { + this.code = code; + } + + public void setArray(Array array) { + this.array = array; + } + + public Array getArray() { + return array; + } + + public void setStructure(Structure structure) { + this.structure = structure; + } + + public Structure getStructure() { + return structure; + } + + public void setBool(BerBoolean bool) { + this.bool = bool; + } + + public BerBoolean getBool() { + return bool; + } + + public void setBitString(BerBitString bitString) { + this.bitString = bitString; + } + + public BerBitString getBitString() { + return bitString; + } + + public void setInteger(BerInteger integer) { + this.integer = integer; + } + + public BerInteger getInteger() { + return integer; + } + + public void setUnsigned(BerInteger unsigned) { + this.unsigned = unsigned; + } + + public BerInteger getUnsigned() { + return unsigned; + } + + public void setFloatingPoint(FloatingPoint floatingPoint) { + this.floatingPoint = floatingPoint; + } + + public FloatingPoint getFloatingPoint() { + return floatingPoint; + } + + public void setOctetString(BerOctetString octetString) { + this.octetString = octetString; + } + + public BerOctetString getOctetString() { + return octetString; + } + + public void setVisibleString(BerVisibleString visibleString) { + this.visibleString = visibleString; + } + + public BerVisibleString getVisibleString() { + return visibleString; + } + + public void setBinaryTime(TimeOfDay binaryTime) { + this.binaryTime = binaryTime; + } + + public TimeOfDay getBinaryTime() { + return binaryTime; + } + + public void setMMSString(MMSString mMSString) { + this.mMSString = mMSString; + } + + public MMSString getMMSString() { + return mMSString; + } + + public void setUtcTime(UtcTime utcTime) { + this.utcTime = utcTime; + } + + public UtcTime getUtcTime() { + return utcTime; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (utcTime != null) { + codeLength += utcTime.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 17 + os.write(0x91); + codeLength += 1; + return codeLength; + } + + if (mMSString != null) { + codeLength += mMSString.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 16 + os.write(0x90); + codeLength += 1; + return codeLength; + } + + if (binaryTime != null) { + codeLength += binaryTime.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 12 + os.write(0x8C); + codeLength += 1; + return codeLength; + } + + if (visibleString != null) { + codeLength += visibleString.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 10 + os.write(0x8A); + codeLength += 1; + return codeLength; + } + + if (octetString != null) { + codeLength += octetString.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 9 + os.write(0x89); + codeLength += 1; + return codeLength; + } + + if (floatingPoint != null) { + codeLength += floatingPoint.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 7 + os.write(0x87); + codeLength += 1; + return codeLength; + } + + if (unsigned != null) { + codeLength += unsigned.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 6 + os.write(0x86); + codeLength += 1; + return codeLength; + } + + if (integer != null) { + codeLength += integer.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 5 + os.write(0x85); + codeLength += 1; + return codeLength; + } + + if (bitString != null) { + codeLength += bitString.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 4 + os.write(0x84); + codeLength += 1; + return codeLength; + } + + if (bool != null) { + codeLength += bool.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 3 + os.write(0x83); + codeLength += 1; + return codeLength; + } + + if (structure != null) { + codeLength += structure.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 + os.write(0xA2); + codeLength += 1; + return codeLength; + } + + if (array != null) { + codeLength += array.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + 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.CONSTRUCTED, 1)) { + array = new Array(); + codeLength += array.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { + structure = new Structure(); + codeLength += structure.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { + bool = new BerBoolean(); + codeLength += bool.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { + bitString = new BerBitString(); + codeLength += bitString.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { + integer = new BerInteger(); + codeLength += integer.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { + unsigned = new BerInteger(); + codeLength += unsigned.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) { + floatingPoint = new FloatingPoint(); + codeLength += floatingPoint.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { + octetString = new BerOctetString(); + codeLength += octetString.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { + visibleString = new BerVisibleString(); + codeLength += visibleString.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) { + binaryTime = new TimeOfDay(); + codeLength += binaryTime.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 16)) { + mMSString = new MMSString(); + codeLength += mMSString.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 17)) { + utcTime = new UtcTime(); + codeLength += utcTime.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (array != null) { + sb.append("array: "); + array.appendAsString(sb, indentLevel + 1); + return; + } + + if (structure != null) { + sb.append("structure: "); + structure.appendAsString(sb, indentLevel + 1); + return; + } + + if (bool != null) { + sb.append("bool: ").append(bool); + return; + } + + if (bitString != null) { + sb.append("bitString: ").append(bitString); + return; + } + + if (integer != null) { + sb.append("integer: ").append(integer); + return; + } + + if (unsigned != null) { + sb.append("unsigned: ").append(unsigned); + return; + } + + if (floatingPoint != null) { + sb.append("floatingPoint: ").append(floatingPoint); + return; + } + + if (octetString != null) { + sb.append("octetString: ").append(octetString); + return; + } + + if (visibleString != null) { + sb.append("visibleString: ").append(visibleString); + return; + } + + if (binaryTime != null) { + sb.append("binaryTime: ").append(binaryTime); + return; + } + + if (mMSString != null) { + sb.append("mMSString: ").append(mMSString); + return; + } + + if (utcTime != null) { + sb.append("utcTime: ").append(utcTime); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DataAccessError.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DataAccessError.java index ebb552b..c0904bc 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DataAccessError.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DataAccessError.java @@ -1,30 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.types.BerInteger; public class DataAccessError extends BerInteger { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public DataAccessError() { - } + public DataAccessError() { + } - public DataAccessError(byte[] code) { - super(code); - } + public DataAccessError(byte[] code) { + super(code); + } - public DataAccessError(BigInteger value) { - super(value); - } + public DataAccessError(BigInteger value) { + super(value); + } - public DataAccessError(long value) { - super(value); - } + public DataAccessError(long value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListRequest.java index bf3e0a2..641f575 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListRequest.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListRequest.java @@ -1,166 +1,172 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class DefineNamedVariableListRequest 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 ObjectName variableListName = null; - private VariableDefs listOfVariable = null; - - public DefineNamedVariableListRequest() { - } - - public DefineNamedVariableListRequest(byte[] code) { - this.code = code; - } - - public void setVariableListName(ObjectName variableListName) { - this.variableListName = variableListName; - } - - public ObjectName getVariableListName() { - return variableListName; - } - - public void setListOfVariable(VariableDefs listOfVariable) { - this.listOfVariable = listOfVariable; - } - - public VariableDefs getListOfVariable() { - return listOfVariable; - } - - 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 += listOfVariable.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - codeLength += 1; - - codeLength += variableListName.encode(os); - - 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); - variableListName = new ObjectName(); - subCodeLength += variableListName.decode(is, berTag); - subCodeLength += berTag.decode(is); - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { - listOfVariable = new VariableDefs(); - subCodeLength += listOfVariable.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 (variableListName != null) { - sb.append("variableListName: "); - variableListName.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("variableListName: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (listOfVariable != null) { - sb.append("listOfVariable: "); - listOfVariable.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("listOfVariable: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private ObjectName variableListName = null; + private VariableDefs listOfVariable = null; + + public DefineNamedVariableListRequest() { + } + + public DefineNamedVariableListRequest(byte[] code) { + this.code = code; + } + + public void setVariableListName(ObjectName variableListName) { + this.variableListName = variableListName; + } + + public ObjectName getVariableListName() { + return variableListName; + } + + public void setListOfVariable(VariableDefs listOfVariable) { + this.listOfVariable = listOfVariable; + } + + public VariableDefs getListOfVariable() { + return listOfVariable; + } + + 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 += listOfVariable.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + codeLength += 1; + + codeLength += variableListName.encode(os); + + 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); + variableListName = new ObjectName(); + subCodeLength += variableListName.decode(is, berTag); + subCodeLength += berTag.decode(is); + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { + listOfVariable = new VariableDefs(); + subCodeLength += listOfVariable.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(); + } + + 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 (variableListName != null) { + sb.append("variableListName: "); + variableListName.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("variableListName: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (listOfVariable != null) { + sb.append("listOfVariable: "); + listOfVariable.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("listOfVariable: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListResponse.java index f2fdb08..a3b53a1 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListResponse.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DefineNamedVariableListResponse.java @@ -1,20 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.BerNull; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class DefineNamedVariableListResponse extends BerNull { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public DefineNamedVariableListResponse() { - } + public DefineNamedVariableListResponse() { + } - public DefineNamedVariableListResponse(byte[] code) { - super(code); - } + public DefineNamedVariableListResponse(byte[] code) { + super(code); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DeleteNamedVariableListRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DeleteNamedVariableListRequest.java index d191bab..8b0c75a 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DeleteNamedVariableListRequest.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DeleteNamedVariableListRequest.java @@ -1,446 +1,444 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerInteger; -import org.openmuc.jasn1.ber.types.string.BerVisibleString; public class DeleteNamedVariableListRequest implements Serializable { - private static final long serialVersionUID = 1L; - - public static class ListOfVariableListName 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 List seqOf = null; - - public ListOfVariableListName() { - seqOf = new ArrayList<>(); - } - - public ListOfVariableListName(byte[] code) { - this.code = code; - } - - public List getObjectName() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - ObjectName element = new ObjectName(); - subCodeLength += element.decode(is, null); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength - + " but has " + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - public static class DomainName implements Serializable { - - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private BasicIdentifier basic = null; - - public DomainName() { - } - - public DomainName(byte[] code) { - this.code = code; - } - - public void setBasic(BasicIdentifier basic) { - this.basic = basic; - } - - public BasicIdentifier getBasic() { - return basic; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (basic != null) { - codeLength += basic.encode(os, true); - 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(BerVisibleString.tag)) { - basic = new BasicIdentifier(); - codeLength += basic.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (basic != null) { - sb.append("basic: ").append(basic); - return; - } - - sb.append(""); - } - - } - - public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); - - public byte[] code = null; - private BerInteger scopeOfDelete = null; - private ListOfVariableListName listOfVariableListName = null; - private DomainName domainName = null; - - public DeleteNamedVariableListRequest() { - } - - public DeleteNamedVariableListRequest(byte[] code) { - this.code = code; - } - - public void setScopeOfDelete(BerInteger scopeOfDelete) { - this.scopeOfDelete = scopeOfDelete; - } - - public BerInteger getScopeOfDelete() { - return scopeOfDelete; - } - - public void setListOfVariableListName(ListOfVariableListName listOfVariableListName) { - this.listOfVariableListName = listOfVariableListName; - } - - public ListOfVariableListName getListOfVariableListName() { - return listOfVariableListName; - } - - public void setDomainName(DomainName domainName) { - this.domainName = domainName; - } - - public DomainName getDomainName() { - return domainName; - } - - 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; - int sublength; - - if (domainName != null) { - sublength = domainName.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 - os.write(0xA2); - codeLength += 1; - } - - if (listOfVariableListName != null) { - codeLength += listOfVariableListName.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - } - - if (scopeOfDelete != null) { - codeLength += scopeOfDelete.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; - - if (totalLength == 0) { - return codeLength; - } - subCodeLength += berTag.decode(is); - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) { - scopeOfDelete = new BerInteger(); - subCodeLength += scopeOfDelete.decode(is, false); - if (subCodeLength == totalLength) { - return codeLength; - } - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - listOfVariableListName = new ListOfVariableListName(); - subCodeLength += listOfVariableListName.decode(is, false); - if (subCodeLength == totalLength) { - return codeLength; - } - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { - subCodeLength += length.decode(is); - domainName = new DomainName(); - subCodeLength += domainName.decode(is, null); - 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 (scopeOfDelete != null) { - sb.append("\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("scopeOfDelete: ").append(scopeOfDelete); - firstSelectedElement = false; - } - - if (listOfVariableListName != null) { - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("listOfVariableListName: "); - listOfVariableListName.appendAsString(sb, indentLevel + 1); - firstSelectedElement = false; - } - - if (domainName != null) { - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("domainName: "); - domainName.appendAsString(sb, indentLevel + 1); - firstSelectedElement = false; - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class ListOfVariableListName 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 List seqOf = null; + + public ListOfVariableListName() { + seqOf = new ArrayList(); + } + + public ListOfVariableListName(byte[] code) { + this.code = code; + } + + public List getObjectName() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + ObjectName element = new ObjectName(); + subCodeLength += element.decode(is, null); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + public static class DomainName implements Serializable { + + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private BasicIdentifier basic = null; + + public DomainName() { + } + + public DomainName(byte[] code) { + this.code = code; + } + + public void setBasic(BasicIdentifier basic) { + this.basic = basic; + } + + public BasicIdentifier getBasic() { + return basic; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (basic != null) { + codeLength += basic.encode(os, true); + 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(BasicIdentifier.tag)) { + basic = new BasicIdentifier(); + codeLength += basic.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (basic != null) { + sb.append("basic: ").append(basic); + return; + } + + sb.append(""); + } + + } + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private BerInteger scopeOfDelete = null; + private ListOfVariableListName listOfVariableListName = null; + private DomainName domainName = null; + + public DeleteNamedVariableListRequest() { + } + + public DeleteNamedVariableListRequest(byte[] code) { + this.code = code; + } + + public void setScopeOfDelete(BerInteger scopeOfDelete) { + this.scopeOfDelete = scopeOfDelete; + } + + public BerInteger getScopeOfDelete() { + return scopeOfDelete; + } + + public void setListOfVariableListName(ListOfVariableListName listOfVariableListName) { + this.listOfVariableListName = listOfVariableListName; + } + + public ListOfVariableListName getListOfVariableListName() { + return listOfVariableListName; + } + + public void setDomainName(DomainName domainName) { + this.domainName = domainName; + } + + public DomainName getDomainName() { + return domainName; + } + + 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; + int sublength; + + if (domainName != null) { + sublength = domainName.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 + os.write(0xA2); + codeLength += 1; + } + + if (listOfVariableListName != null) { + codeLength += listOfVariableListName.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + } + + if (scopeOfDelete != null) { + codeLength += scopeOfDelete.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; + + if (totalLength == 0) { + return codeLength; + } + subCodeLength += berTag.decode(is); + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) { + scopeOfDelete = new BerInteger(); + subCodeLength += scopeOfDelete.decode(is, false); + if (subCodeLength == totalLength) { + return codeLength; + } + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + listOfVariableListName = new ListOfVariableListName(); + subCodeLength += listOfVariableListName.decode(is, false); + if (subCodeLength == totalLength) { + return codeLength; + } + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { + subCodeLength += length.decode(is); + domainName = new DomainName(); + subCodeLength += domainName.decode(is, null); + 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(); + } + + 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 (scopeOfDelete != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("scopeOfDelete: ").append(scopeOfDelete); + firstSelectedElement = false; + } + + if (listOfVariableListName != null) { + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("listOfVariableListName: "); + listOfVariableListName.appendAsString(sb, indentLevel + 1); + firstSelectedElement = false; + } + + if (domainName != null) { + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("domainName: "); + domainName.appendAsString(sb, indentLevel + 1); + firstSelectedElement = false; + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DeleteNamedVariableListResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DeleteNamedVariableListResponse.java index 6ff4adc..60e2453 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DeleteNamedVariableListResponse.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DeleteNamedVariableListResponse.java @@ -1,172 +1,178 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class DeleteNamedVariableListResponse 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 Unsigned32 numberMatched = null; - private Unsigned32 numberDeleted = null; - - public DeleteNamedVariableListResponse() { - } - - public DeleteNamedVariableListResponse(byte[] code) { - this.code = code; - } - - public void setNumberMatched(Unsigned32 numberMatched) { - this.numberMatched = numberMatched; - } - - public Unsigned32 getNumberMatched() { - return numberMatched; - } - - public void setNumberDeleted(Unsigned32 numberDeleted) { - this.numberDeleted = numberDeleted; - } - - public Unsigned32 getNumberDeleted() { - return numberDeleted; - } - - 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 += numberDeleted.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - - codeLength += numberMatched.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)) { - numberMatched = new Unsigned32(); - subCodeLength += numberMatched.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)) { - numberDeleted = new Unsigned32(); - subCodeLength += numberDeleted.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 (numberMatched != null) { - sb.append("numberMatched: ").append(numberMatched); - } - else { - sb.append("numberMatched: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (numberDeleted != null) { - sb.append("numberDeleted: ").append(numberDeleted); - } - else { - sb.append("numberDeleted: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private Unsigned32 numberMatched = null; + private Unsigned32 numberDeleted = null; + + public DeleteNamedVariableListResponse() { + } + + public DeleteNamedVariableListResponse(byte[] code) { + this.code = code; + } + + public void setNumberMatched(Unsigned32 numberMatched) { + this.numberMatched = numberMatched; + } + + public Unsigned32 getNumberMatched() { + return numberMatched; + } + + public void setNumberDeleted(Unsigned32 numberDeleted) { + this.numberDeleted = numberDeleted; + } + + public Unsigned32 getNumberDeleted() { + return numberDeleted; + } + + 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 += numberDeleted.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + + codeLength += numberMatched.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)) { + numberMatched = new Unsigned32(); + subCodeLength += numberMatched.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)) { + numberDeleted = new Unsigned32(); + subCodeLength += numberDeleted.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(); + } + + 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 (numberMatched != null) { + sb.append("numberMatched: ").append(numberMatched); + } + else { + sb.append("numberMatched: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (numberDeleted != null) { + sb.append("numberDeleted: ").append(numberDeleted); + } + else { + sb.append("numberDeleted: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DirectoryEntry.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DirectoryEntry.java new file mode 100644 index 0000000..6a3006b --- /dev/null +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/DirectoryEntry.java @@ -0,0 +1,180 @@ +/** + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) + */ + +package org.openmuc.openiec61850.internal.mms.asn1; + +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + + +public class DirectoryEntry 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 FileName fileName = null; + private FileAttributes fileAttributes = null; + + public DirectoryEntry() { + } + + public DirectoryEntry(byte[] code) { + this.code = code; + } + + public void setFileName(FileName fileName) { + this.fileName = fileName; + } + + public FileName getFileName() { + return fileName; + } + + public void setFileAttributes(FileAttributes fileAttributes) { + this.fileAttributes = fileAttributes; + } + + public FileAttributes getFileAttributes() { + return fileAttributes; + } + + 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 += fileAttributes.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + + codeLength += fileName.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + fileName = new FileName(); + subCodeLength += fileName.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.CONSTRUCTED, 1)) { + fileAttributes = new FileAttributes(); + subCodeLength += fileAttributes.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(); + } + + 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 (fileName != null) { + sb.append("fileName: "); + fileName.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("fileName: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (fileAttributes != null) { + sb.append("fileAttributes: "); + fileAttributes.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("fileAttributes: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + +} + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileAttributes.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileAttributes.java new file mode 100644 index 0000000..7c67174 --- /dev/null +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileAttributes.java @@ -0,0 +1,180 @@ +/** + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) + */ + +package org.openmuc.openiec61850.internal.mms.asn1; + +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + + +public class FileAttributes 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 Unsigned32 sizeOfFile = null; + private BerGeneralizedTime lastModified = null; + + public FileAttributes() { + } + + public FileAttributes(byte[] code) { + this.code = code; + } + + public void setSizeOfFile(Unsigned32 sizeOfFile) { + this.sizeOfFile = sizeOfFile; + } + + public Unsigned32 getSizeOfFile() { + return sizeOfFile; + } + + public void setLastModified(BerGeneralizedTime lastModified) { + this.lastModified = lastModified; + } + + public BerGeneralizedTime getLastModified() { + return lastModified; + } + + 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; + if (lastModified != null) { + codeLength += lastModified.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + } + + codeLength += sizeOfFile.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)) { + sizeOfFile = new Unsigned32(); + subCodeLength += sizeOfFile.decode(is, false); + if (subCodeLength == totalLength) { + return codeLength; + } + 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)) { + lastModified = new BerGeneralizedTime(); + subCodeLength += lastModified.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(); + } + + 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 (sizeOfFile != null) { + sb.append("sizeOfFile: ").append(sizeOfFile); + } + else { + sb.append("sizeOfFile: "); + } + + if (lastModified != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("lastModified: ").append(lastModified); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + +} + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileDirectoryRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileDirectoryRequest.java new file mode 100644 index 0000000..377684f --- /dev/null +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileDirectoryRequest.java @@ -0,0 +1,186 @@ +/** + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) + */ + +package org.openmuc.openiec61850.internal.mms.asn1; + +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + + +public class FileDirectoryRequest 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 FileName fileSpecification = null; + private FileName continueAfter = null; + + public FileDirectoryRequest() { + } + + public FileDirectoryRequest(byte[] code) { + this.code = code; + } + + public void setFileSpecification(FileName fileSpecification) { + this.fileSpecification = fileSpecification; + } + + public FileName getFileSpecification() { + return fileSpecification; + } + + public void setContinueAfter(FileName continueAfter) { + this.continueAfter = continueAfter; + } + + public FileName getContinueAfter() { + return continueAfter; + } + + 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; + if (continueAfter != null) { + codeLength += continueAfter.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + } + + if (fileSpecification != null) { + codeLength += fileSpecification.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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; + + if (totalLength == 0) { + return codeLength; + } + subCodeLength += berTag.decode(is); + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { + fileSpecification = new FileName(); + subCodeLength += fileSpecification.decode(is, false); + if (subCodeLength == totalLength) { + return codeLength; + } + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + continueAfter = new FileName(); + subCodeLength += continueAfter.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(); + } + + 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 (fileSpecification != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("fileSpecification: "); + fileSpecification.appendAsString(sb, indentLevel + 1); + firstSelectedElement = false; + } + + if (continueAfter != null) { + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("continueAfter: "); + continueAfter.appendAsString(sb, indentLevel + 1); + firstSelectedElement = false; + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + +} + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileDirectoryResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileDirectoryResponse.java new file mode 100644 index 0000000..3ae9008 --- /dev/null +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileDirectoryResponse.java @@ -0,0 +1,312 @@ +/** + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) + */ + +package org.openmuc.openiec61850.internal.mms.asn1; + +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + + +public class FileDirectoryResponse implements Serializable { + + private static final long serialVersionUID = 1L; + + public static class ListOfDirectoryEntry 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 List seqOf = null; + + public ListOfDirectoryEntry() { + seqOf = new ArrayList(); + } + + public ListOfDirectoryEntry(byte[] code) { + this.code = code; + } + + public List getDirectoryEntry() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os, true); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + DirectoryEntry element = new DirectoryEntry(); + subCodeLength += element.decode(is, true); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + 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 ListOfDirectoryEntry listOfDirectoryEntry = null; + private BerBoolean moreFollows = null; + + public FileDirectoryResponse() { + } + + public FileDirectoryResponse(byte[] code) { + this.code = code; + } + + public void setListOfDirectoryEntry(ListOfDirectoryEntry listOfDirectoryEntry) { + this.listOfDirectoryEntry = listOfDirectoryEntry; + } + + public ListOfDirectoryEntry getListOfDirectoryEntry() { + return listOfDirectoryEntry; + } + + public void setMoreFollows(BerBoolean moreFollows) { + this.moreFollows = moreFollows; + } + + public BerBoolean getMoreFollows() { + return moreFollows; + } + + 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; + int sublength; + + if (moreFollows != null) { + codeLength += moreFollows.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + } + + sublength = listOfDirectoryEntry.encode(os, true); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + subCodeLength += length.decode(is); + listOfDirectoryEntry = new ListOfDirectoryEntry(); + subCodeLength += listOfDirectoryEntry.decode(is, true); + if (subCodeLength == totalLength) { + return codeLength; + } + 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)) { + moreFollows = new BerBoolean(); + subCodeLength += moreFollows.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(); + } + + 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 (listOfDirectoryEntry != null) { + sb.append("listOfDirectoryEntry: "); + listOfDirectoryEntry.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("listOfDirectoryEntry: "); + } + + if (moreFollows != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("moreFollows: ").append(moreFollows); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + +} + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileName.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileName.java new file mode 100644 index 0000000..c175c5a --- /dev/null +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FileName.java @@ -0,0 +1,147 @@ +/** + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) + */ + +package org.openmuc.openiec61850.internal.mms.asn1; + +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + + +public class FileName 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 List seqOf = null; + + public FileName() { + seqOf = new ArrayList(); + } + + public FileName(byte[] code) { + this.code = code; + } + + public List getBerGraphicString() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os, true); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + BerGraphicString element = new BerGraphicString(); + subCodeLength += element.decode(is, true); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + sb.append(it.next()); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append(it.next()); + } + } + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + +} + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FloatingPoint.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FloatingPoint.java index d186ccb..c1d5188 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FloatingPoint.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/FloatingPoint.java @@ -1,20 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.BerOctetString; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class FloatingPoint extends BerOctetString { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public FloatingPoint() { - } + public FloatingPoint() { + } - public FloatingPoint(byte[] value) { - super(value); - } + public FloatingPoint(byte[] value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNameListRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNameListRequest.java index 7d27d57..545984e 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNameListRequest.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNameListRequest.java @@ -1,370 +1,374 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerNull; public class GetNameListRequest implements Serializable { - private static final long serialVersionUID = 1L; - - public static class ObjectScope implements Serializable { - - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private BerNull vmdSpecific = null; - private Identifier domainSpecific = null; - private BerNull aaSpecific = null; - - public ObjectScope() { - } - - public ObjectScope(byte[] code) { - this.code = code; - } - - public void setVmdSpecific(BerNull vmdSpecific) { - this.vmdSpecific = vmdSpecific; - } - - public BerNull getVmdSpecific() { - return vmdSpecific; - } - - public void setDomainSpecific(Identifier domainSpecific) { - this.domainSpecific = domainSpecific; - } - - public Identifier getDomainSpecific() { - return domainSpecific; - } - - public void setAaSpecific(BerNull aaSpecific) { - this.aaSpecific = aaSpecific; - } - - public BerNull getAaSpecific() { - return aaSpecific; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (aaSpecific != null) { - codeLength += aaSpecific.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - return codeLength; - } - - if (domainSpecific != null) { - codeLength += domainSpecific.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - return codeLength; - } - - if (vmdSpecific != null) { - codeLength += vmdSpecific.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 0 - os.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)) { - vmdSpecific = new BerNull(); - codeLength += vmdSpecific.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { - domainSpecific = new Identifier(); - codeLength += domainSpecific.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { - aaSpecific = new BerNull(); - codeLength += aaSpecific.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (vmdSpecific != null) { - sb.append("vmdSpecific: ").append(vmdSpecific); - return; - } - - if (domainSpecific != null) { - sb.append("domainSpecific: ").append(domainSpecific); - return; - } - - if (aaSpecific != null) { - sb.append("aaSpecific: ").append(aaSpecific); - return; - } - - sb.append(""); - } - - } - - public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); - - public byte[] code = null; - private ObjectClass objectClass = null; - private ObjectScope objectScope = null; - private Identifier continueAfter = null; - - public GetNameListRequest() { - } - - public GetNameListRequest(byte[] code) { - this.code = code; - } - - public void setObjectClass(ObjectClass objectClass) { - this.objectClass = objectClass; - } - - public ObjectClass getObjectClass() { - return objectClass; - } - - public void setObjectScope(ObjectScope objectScope) { - this.objectScope = objectScope; - } - - public ObjectScope getObjectScope() { - return objectScope; - } - - public void setContinueAfter(Identifier continueAfter) { - this.continueAfter = continueAfter; - } - - public Identifier getContinueAfter() { - return continueAfter; - } - - 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; - int sublength; - - if (continueAfter != null) { - codeLength += continueAfter.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - } - - sublength = objectScope.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - - sublength = objectClass.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - subCodeLength += length.decode(is); - objectClass = new ObjectClass(); - subCodeLength += objectClass.decode(is, null); - subCodeLength += berTag.decode(is); - } - else { - throw new IOException("Tag does not match the mandatory sequence element tag."); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - subCodeLength += length.decode(is); - objectScope = new ObjectScope(); - subCodeLength += objectScope.decode(is, null); - if (subCodeLength == totalLength) { - return codeLength; - } - 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)) { - continueAfter = new Identifier(); - subCodeLength += continueAfter.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 (objectClass != null) { - sb.append("objectClass: "); - objectClass.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("objectClass: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (objectScope != null) { - sb.append("objectScope: "); - objectScope.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("objectScope: "); - } - - if (continueAfter != null) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("continueAfter: ").append(continueAfter); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class ObjectScope implements Serializable { + + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private BerNull vmdSpecific = null; + private Identifier domainSpecific = null; + private BerNull aaSpecific = null; + + public ObjectScope() { + } + + public ObjectScope(byte[] code) { + this.code = code; + } + + public void setVmdSpecific(BerNull vmdSpecific) { + this.vmdSpecific = vmdSpecific; + } + + public BerNull getVmdSpecific() { + return vmdSpecific; + } + + public void setDomainSpecific(Identifier domainSpecific) { + this.domainSpecific = domainSpecific; + } + + public Identifier getDomainSpecific() { + return domainSpecific; + } + + public void setAaSpecific(BerNull aaSpecific) { + this.aaSpecific = aaSpecific; + } + + public BerNull getAaSpecific() { + return aaSpecific; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (aaSpecific != null) { + codeLength += aaSpecific.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + return codeLength; + } + + if (domainSpecific != null) { + codeLength += domainSpecific.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + return codeLength; + } + + if (vmdSpecific != null) { + codeLength += vmdSpecific.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 0 + os.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)) { + vmdSpecific = new BerNull(); + codeLength += vmdSpecific.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { + domainSpecific = new Identifier(); + codeLength += domainSpecific.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { + aaSpecific = new BerNull(); + codeLength += aaSpecific.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (vmdSpecific != null) { + sb.append("vmdSpecific: ").append(vmdSpecific); + return; + } + + if (domainSpecific != null) { + sb.append("domainSpecific: ").append(domainSpecific); + return; + } + + if (aaSpecific != null) { + sb.append("aaSpecific: ").append(aaSpecific); + return; + } + + sb.append(""); + } + + } + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private ObjectClass objectClass = null; + private ObjectScope objectScope = null; + private Identifier continueAfter = null; + + public GetNameListRequest() { + } + + public GetNameListRequest(byte[] code) { + this.code = code; + } + + public void setObjectClass(ObjectClass objectClass) { + this.objectClass = objectClass; + } + + public ObjectClass getObjectClass() { + return objectClass; + } + + public void setObjectScope(ObjectScope objectScope) { + this.objectScope = objectScope; + } + + public ObjectScope getObjectScope() { + return objectScope; + } + + public void setContinueAfter(Identifier continueAfter) { + this.continueAfter = continueAfter; + } + + public Identifier getContinueAfter() { + return continueAfter; + } + + 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; + int sublength; + + if (continueAfter != null) { + codeLength += continueAfter.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + } + + sublength = objectScope.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + + sublength = objectClass.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + subCodeLength += length.decode(is); + objectClass = new ObjectClass(); + subCodeLength += objectClass.decode(is, null); + subCodeLength += berTag.decode(is); + } + else { + throw new IOException("Tag does not match the mandatory sequence element tag."); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + subCodeLength += length.decode(is); + objectScope = new ObjectScope(); + subCodeLength += objectScope.decode(is, null); + if (subCodeLength == totalLength) { + return codeLength; + } + 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)) { + continueAfter = new Identifier(); + subCodeLength += continueAfter.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(); + } + + 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 (objectClass != null) { + sb.append("objectClass: "); + objectClass.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("objectClass: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (objectScope != null) { + sb.append("objectScope: "); + objectScope.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("objectScope: "); + } + + if (continueAfter != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("continueAfter: ").append(continueAfter); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNameListResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNameListResponse.java index a882f6e..9d0accd 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNameListResponse.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNameListResponse.java @@ -1,307 +1,307 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerBoolean; public class GetNameListResponse implements Serializable { - private static final long serialVersionUID = 1L; - - public static class ListOfIdentifier 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 List seqOf = null; - - public ListOfIdentifier() { - seqOf = new ArrayList<>(); - } - - public ListOfIdentifier(byte[] code) { - this.code = code; - } - - public List getIdentifier() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os, true); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - Identifier element = new Identifier(); - subCodeLength += element.decode(is, true); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength - + " but has " + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - sb.append(it.next()); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append(it.next()); - } - } - } - - 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 ListOfIdentifier listOfIdentifier = null; - private BerBoolean moreFollows = null; - - public GetNameListResponse() { - } - - public GetNameListResponse(byte[] code) { - this.code = code; - } - - public void setListOfIdentifier(ListOfIdentifier listOfIdentifier) { - this.listOfIdentifier = listOfIdentifier; - } - - public ListOfIdentifier getListOfIdentifier() { - return listOfIdentifier; - } - - public void setMoreFollows(BerBoolean moreFollows) { - this.moreFollows = moreFollows; - } - - public BerBoolean getMoreFollows() { - return moreFollows; - } - - 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; - if (moreFollows != null) { - codeLength += moreFollows.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - } - - codeLength += listOfIdentifier.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - listOfIdentifier = new ListOfIdentifier(); - subCodeLength += listOfIdentifier.decode(is, false); - if (subCodeLength == totalLength) { - return codeLength; - } - 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)) { - moreFollows = new BerBoolean(); - subCodeLength += moreFollows.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 (listOfIdentifier != null) { - sb.append("listOfIdentifier: "); - listOfIdentifier.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("listOfIdentifier: "); - } - - if (moreFollows != null) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("moreFollows: ").append(moreFollows); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class ListOfIdentifier 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 List seqOf = null; + + public ListOfIdentifier() { + seqOf = new ArrayList(); + } + + public ListOfIdentifier(byte[] code) { + this.code = code; + } + + public List getIdentifier() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os, true); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + Identifier element = new Identifier(); + subCodeLength += element.decode(is, true); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + sb.append(it.next()); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append(it.next()); + } + } + } + + 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 ListOfIdentifier listOfIdentifier = null; + private BerBoolean moreFollows = null; + + public GetNameListResponse() { + } + + public GetNameListResponse(byte[] code) { + this.code = code; + } + + public void setListOfIdentifier(ListOfIdentifier listOfIdentifier) { + this.listOfIdentifier = listOfIdentifier; + } + + public ListOfIdentifier getListOfIdentifier() { + return listOfIdentifier; + } + + public void setMoreFollows(BerBoolean moreFollows) { + this.moreFollows = moreFollows; + } + + public BerBoolean getMoreFollows() { + return moreFollows; + } + + 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; + if (moreFollows != null) { + codeLength += moreFollows.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + } + + codeLength += listOfIdentifier.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + listOfIdentifier = new ListOfIdentifier(); + subCodeLength += listOfIdentifier.decode(is, false); + if (subCodeLength == totalLength) { + return codeLength; + } + 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)) { + moreFollows = new BerBoolean(); + subCodeLength += moreFollows.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(); + } + + 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 (listOfIdentifier != null) { + sb.append("listOfIdentifier: "); + listOfIdentifier.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("listOfIdentifier: "); + } + + if (moreFollows != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("moreFollows: ").append(moreFollows); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesRequest.java index 6869fb0..1f07165 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesRequest.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesRequest.java @@ -1,18 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + + public class GetNamedVariableListAttributesRequest extends ObjectName { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public GetNamedVariableListAttributesRequest() { - } + public GetNamedVariableListAttributesRequest() { + } - public GetNamedVariableListAttributesRequest(byte[] code) { - super(code); - } + public GetNamedVariableListAttributesRequest(byte[] code) { + super(code); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesResponse.java index 730f86b..3674e4f 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesResponse.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetNamedVariableListAttributesResponse.java @@ -1,174 +1,179 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerBoolean; public class GetNamedVariableListAttributesResponse 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 BerBoolean mmsDeletable = null; - private VariableDefs listOfVariable = null; - - public GetNamedVariableListAttributesResponse() { - } - - public GetNamedVariableListAttributesResponse(byte[] code) { - this.code = code; - } - - public void setMmsDeletable(BerBoolean mmsDeletable) { - this.mmsDeletable = mmsDeletable; - } - - public BerBoolean getMmsDeletable() { - return mmsDeletable; - } - - public void setListOfVariable(VariableDefs listOfVariable) { - this.listOfVariable = listOfVariable; - } - - public VariableDefs getListOfVariable() { - return listOfVariable; - } - - 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 += listOfVariable.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - - codeLength += mmsDeletable.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)) { - mmsDeletable = new BerBoolean(); - subCodeLength += mmsDeletable.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.CONSTRUCTED, 1)) { - listOfVariable = new VariableDefs(); - subCodeLength += listOfVariable.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 (mmsDeletable != null) { - sb.append("mmsDeletable: ").append(mmsDeletable); - } - else { - sb.append("mmsDeletable: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (listOfVariable != null) { - sb.append("listOfVariable: "); - listOfVariable.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("listOfVariable: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private BerBoolean mmsDeletable = null; + private VariableDefs listOfVariable = null; + + public GetNamedVariableListAttributesResponse() { + } + + public GetNamedVariableListAttributesResponse(byte[] code) { + this.code = code; + } + + public void setMmsDeletable(BerBoolean mmsDeletable) { + this.mmsDeletable = mmsDeletable; + } + + public BerBoolean getMmsDeletable() { + return mmsDeletable; + } + + public void setListOfVariable(VariableDefs listOfVariable) { + this.listOfVariable = listOfVariable; + } + + public VariableDefs getListOfVariable() { + return listOfVariable; + } + + 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 += listOfVariable.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + + codeLength += mmsDeletable.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)) { + mmsDeletable = new BerBoolean(); + subCodeLength += mmsDeletable.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.CONSTRUCTED, 1)) { + listOfVariable = new VariableDefs(); + subCodeLength += listOfVariable.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(); + } + + 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 (mmsDeletable != null) { + sb.append("mmsDeletable: ").append(mmsDeletable); + } + else { + sb.append("mmsDeletable: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (listOfVariable != null) { + sb.append("listOfVariable: "); + listOfVariable.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("listOfVariable: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetVariableAccessAttributesRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetVariableAccessAttributesRequest.java index 4bab170..445aa9d 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetVariableAccessAttributesRequest.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetVariableAccessAttributesRequest.java @@ -1,115 +1,121 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class GetVariableAccessAttributesRequest implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private ObjectName name = null; - - public GetVariableAccessAttributesRequest() { - } - - public GetVariableAccessAttributesRequest(byte[] code) { - this.code = code; - } - - public void setName(ObjectName name) { - this.name = name; - } - - public ObjectName getName() { - return name; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - int sublength; - - if (name != null) { - sublength = name.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - codeLength += BerLength.skip(is); - name = new ObjectName(); - codeLength += name.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (name != null) { - sb.append("name: "); - name.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private ObjectName name = null; + + public GetVariableAccessAttributesRequest() { + } + + public GetVariableAccessAttributesRequest(byte[] code) { + this.code = code; + } + + public void setName(ObjectName name) { + this.name = name; + } + + public ObjectName getName() { + return name; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + int sublength; + + if (name != null) { + sublength = name.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + codeLength += BerLength.skip(is); + name = new ObjectName(); + codeLength += name.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (name != null) { + sb.append("name: "); + name.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetVariableAccessAttributesResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetVariableAccessAttributesResponse.java index 6142dd3..7c21cf7 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetVariableAccessAttributesResponse.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/GetVariableAccessAttributesResponse.java @@ -1,179 +1,184 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerBoolean; public class GetVariableAccessAttributesResponse 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 BerBoolean mmsDeletable = null; - private TypeDescription typeDescription = null; - - public GetVariableAccessAttributesResponse() { - } - - public GetVariableAccessAttributesResponse(byte[] code) { - this.code = code; - } - - public void setMmsDeletable(BerBoolean mmsDeletable) { - this.mmsDeletable = mmsDeletable; - } - - public BerBoolean getMmsDeletable() { - return mmsDeletable; - } - - public void setTypeDescription(TypeDescription typeDescription) { - this.typeDescription = typeDescription; - } - - public TypeDescription getTypeDescription() { - return typeDescription; - } - - 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; - int sublength; - - sublength = typeDescription.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 - os.write(0xA2); - codeLength += 1; - - codeLength += mmsDeletable.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)) { - mmsDeletable = new BerBoolean(); - subCodeLength += mmsDeletable.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.CONSTRUCTED, 2)) { - subCodeLength += length.decode(is); - typeDescription = new TypeDescription(); - subCodeLength += typeDescription.decode(is, null); - 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 (mmsDeletable != null) { - sb.append("mmsDeletable: ").append(mmsDeletable); - } - else { - sb.append("mmsDeletable: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (typeDescription != null) { - sb.append("typeDescription: "); - typeDescription.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("typeDescription: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private BerBoolean mmsDeletable = null; + private TypeDescription typeDescription = null; + + public GetVariableAccessAttributesResponse() { + } + + public GetVariableAccessAttributesResponse(byte[] code) { + this.code = code; + } + + public void setMmsDeletable(BerBoolean mmsDeletable) { + this.mmsDeletable = mmsDeletable; + } + + public BerBoolean getMmsDeletable() { + return mmsDeletable; + } + + public void setTypeDescription(TypeDescription typeDescription) { + this.typeDescription = typeDescription; + } + + public TypeDescription getTypeDescription() { + return typeDescription; + } + + 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; + int sublength; + + sublength = typeDescription.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 + os.write(0xA2); + codeLength += 1; + + codeLength += mmsDeletable.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)) { + mmsDeletable = new BerBoolean(); + subCodeLength += mmsDeletable.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.CONSTRUCTED, 2)) { + subCodeLength += length.decode(is); + typeDescription = new TypeDescription(); + subCodeLength += typeDescription.decode(is, null); + 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(); + } + + 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 (mmsDeletable != null) { + sb.append("mmsDeletable: ").append(mmsDeletable); + } + else { + sb.append("mmsDeletable: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (typeDescription != null) { + sb.append("typeDescription: "); + typeDescription.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("typeDescription: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Identifier.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Identifier.java index 55632f1..1cbe5de 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Identifier.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Identifier.java @@ -1,20 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.string.BerVisibleString; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class Identifier extends BerVisibleString { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public Identifier() { - } + public Identifier() { + } - public Identifier(byte[] value) { - super(value); - } + public Identifier(byte[] value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InformationReport.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InformationReport.java index 71bf957..39cc924 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InformationReport.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InformationReport.java @@ -1,297 +1,298 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class InformationReport implements Serializable { - private static final long serialVersionUID = 1L; - - public static class ListOfAccessResult 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 List seqOf = null; - - public ListOfAccessResult() { - seqOf = new ArrayList<>(); - } - - public ListOfAccessResult(byte[] code) { - this.code = code; - } - - public List getAccessResult() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - AccessResult element = new AccessResult(); - subCodeLength += element.decode(is, null); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength - + " but has " + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - 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 VariableAccessSpecification variableAccessSpecification = null; - private ListOfAccessResult listOfAccessResult = null; - - public InformationReport() { - } - - public InformationReport(byte[] code) { - this.code = code; - } - - public void setVariableAccessSpecification(VariableAccessSpecification variableAccessSpecification) { - this.variableAccessSpecification = variableAccessSpecification; - } - - public VariableAccessSpecification getVariableAccessSpecification() { - return variableAccessSpecification; - } - - public void setListOfAccessResult(ListOfAccessResult listOfAccessResult) { - this.listOfAccessResult = listOfAccessResult; - } - - public ListOfAccessResult getListOfAccessResult() { - return listOfAccessResult; - } - - 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 += listOfAccessResult.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - codeLength += 1; - - codeLength += variableAccessSpecification.encode(os); - - 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); - variableAccessSpecification = new VariableAccessSpecification(); - subCodeLength += variableAccessSpecification.decode(is, berTag); - subCodeLength += berTag.decode(is); - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { - listOfAccessResult = new ListOfAccessResult(); - subCodeLength += listOfAccessResult.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 (variableAccessSpecification != null) { - sb.append("variableAccessSpecification: "); - variableAccessSpecification.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("variableAccessSpecification: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (listOfAccessResult != null) { - sb.append("listOfAccessResult: "); - listOfAccessResult.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("listOfAccessResult: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class ListOfAccessResult 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 List seqOf = null; + + public ListOfAccessResult() { + seqOf = new ArrayList(); + } + + public ListOfAccessResult(byte[] code) { + this.code = code; + } + + public List getAccessResult() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + AccessResult element = new AccessResult(); + subCodeLength += element.decode(is, null); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + 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 VariableAccessSpecification variableAccessSpecification = null; + private ListOfAccessResult listOfAccessResult = null; + + public InformationReport() { + } + + public InformationReport(byte[] code) { + this.code = code; + } + + public void setVariableAccessSpecification(VariableAccessSpecification variableAccessSpecification) { + this.variableAccessSpecification = variableAccessSpecification; + } + + public VariableAccessSpecification getVariableAccessSpecification() { + return variableAccessSpecification; + } + + public void setListOfAccessResult(ListOfAccessResult listOfAccessResult) { + this.listOfAccessResult = listOfAccessResult; + } + + public ListOfAccessResult getListOfAccessResult() { + return listOfAccessResult; + } + + 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 += listOfAccessResult.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + codeLength += 1; + + codeLength += variableAccessSpecification.encode(os); + + 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); + variableAccessSpecification = new VariableAccessSpecification(); + subCodeLength += variableAccessSpecification.decode(is, berTag); + subCodeLength += berTag.decode(is); + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { + listOfAccessResult = new ListOfAccessResult(); + subCodeLength += listOfAccessResult.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(); + } + + 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 (variableAccessSpecification != null) { + sb.append("variableAccessSpecification: "); + variableAccessSpecification.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("variableAccessSpecification: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (listOfAccessResult != null) { + sb.append("listOfAccessResult: "); + listOfAccessResult.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("listOfAccessResult: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateErrorPDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateErrorPDU.java index 6b2ddb0..b1f7e95 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateErrorPDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateErrorPDU.java @@ -1,18 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + + public class InitiateErrorPDU extends ServiceError { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public InitiateErrorPDU() { - } + public InitiateErrorPDU() { + } - public InitiateErrorPDU(byte[] code) { - super(code); - } + public InitiateErrorPDU(byte[] code) { + super(code); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateRequestPDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateRequestPDU.java index 88a58e9..8778854 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateRequestPDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateRequestPDU.java @@ -1,463 +1,468 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class InitiateRequestPDU implements Serializable { - private static final long serialVersionUID = 1L; - - public static class InitRequestDetail 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 proposedVersionNumber = null; - private ParameterSupportOptions proposedParameterCBB = null; - private ServiceSupportOptions servicesSupportedCalling = null; - - public InitRequestDetail() { - } - - public InitRequestDetail(byte[] code) { - this.code = code; - } - - public void setProposedVersionNumber(Integer16 proposedVersionNumber) { - this.proposedVersionNumber = proposedVersionNumber; - } - - public Integer16 getProposedVersionNumber() { - return proposedVersionNumber; - } - - public void setProposedParameterCBB(ParameterSupportOptions proposedParameterCBB) { - this.proposedParameterCBB = proposedParameterCBB; - } - - public ParameterSupportOptions getProposedParameterCBB() { - return proposedParameterCBB; - } - - public void setServicesSupportedCalling(ServiceSupportOptions servicesSupportedCalling) { - this.servicesSupportedCalling = servicesSupportedCalling; - } - - public ServiceSupportOptions getServicesSupportedCalling() { - return servicesSupportedCalling; - } - - 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 += servicesSupportedCalling.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - - codeLength += proposedParameterCBB.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - - codeLength += proposedVersionNumber.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)) { - proposedVersionNumber = new Integer16(); - subCodeLength += proposedVersionNumber.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)) { - proposedParameterCBB = new ParameterSupportOptions(); - subCodeLength += proposedParameterCBB.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)) { - servicesSupportedCalling = new ServiceSupportOptions(); - subCodeLength += servicesSupportedCalling.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 (proposedVersionNumber != null) { - sb.append("proposedVersionNumber: ").append(proposedVersionNumber); - } - else { - sb.append("proposedVersionNumber: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (proposedParameterCBB != null) { - sb.append("proposedParameterCBB: ").append(proposedParameterCBB); - } - else { - sb.append("proposedParameterCBB: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (servicesSupportedCalling != null) { - sb.append("servicesSupportedCalling: ").append(servicesSupportedCalling); - } - else { - sb.append("servicesSupportedCalling: "); - } - - 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 localDetailCalling = null; - private Integer16 proposedMaxServOutstandingCalling = null; - private Integer16 proposedMaxServOutstandingCalled = null; - private Integer8 proposedDataStructureNestingLevel = null; - private InitRequestDetail initRequestDetail = null; - - public InitiateRequestPDU() { - } - - public InitiateRequestPDU(byte[] code) { - this.code = code; - } - - public void setLocalDetailCalling(Integer32 localDetailCalling) { - this.localDetailCalling = localDetailCalling; - } - - public Integer32 getLocalDetailCalling() { - return localDetailCalling; - } - - public void setProposedMaxServOutstandingCalling(Integer16 proposedMaxServOutstandingCalling) { - this.proposedMaxServOutstandingCalling = proposedMaxServOutstandingCalling; - } - - public Integer16 getProposedMaxServOutstandingCalling() { - return proposedMaxServOutstandingCalling; - } - - public void setProposedMaxServOutstandingCalled(Integer16 proposedMaxServOutstandingCalled) { - this.proposedMaxServOutstandingCalled = proposedMaxServOutstandingCalled; - } - - public Integer16 getProposedMaxServOutstandingCalled() { - return proposedMaxServOutstandingCalled; - } - - public void setProposedDataStructureNestingLevel(Integer8 proposedDataStructureNestingLevel) { - this.proposedDataStructureNestingLevel = proposedDataStructureNestingLevel; - } - - public Integer8 getProposedDataStructureNestingLevel() { - return proposedDataStructureNestingLevel; - } - - public void setInitRequestDetail(InitRequestDetail initRequestDetail) { - this.initRequestDetail = initRequestDetail; - } - - public InitRequestDetail getInitRequestDetail() { - return initRequestDetail; - } - - 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 += initRequestDetail.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 - os.write(0xA4); - codeLength += 1; - - if (proposedDataStructureNestingLevel != null) { - codeLength += proposedDataStructureNestingLevel.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 3 - os.write(0x83); - codeLength += 1; - } - - codeLength += proposedMaxServOutstandingCalled.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - - codeLength += proposedMaxServOutstandingCalling.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - - if (localDetailCalling != null) { - codeLength += localDetailCalling.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)) { - localDetailCalling = new Integer32(); - subCodeLength += localDetailCalling.decode(is, false); - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { - proposedMaxServOutstandingCalling = new Integer16(); - subCodeLength += proposedMaxServOutstandingCalling.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)) { - proposedMaxServOutstandingCalled = new Integer16(); - subCodeLength += proposedMaxServOutstandingCalled.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)) { - proposedDataStructureNestingLevel = new Integer8(); - subCodeLength += proposedDataStructureNestingLevel.decode(is, false); - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { - initRequestDetail = new InitRequestDetail(); - subCodeLength += initRequestDetail.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 (localDetailCalling != null) { - sb.append("\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("localDetailCalling: ").append(localDetailCalling); - firstSelectedElement = false; - } - - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (proposedMaxServOutstandingCalling != null) { - sb.append("proposedMaxServOutstandingCalling: ").append(proposedMaxServOutstandingCalling); - } - else { - sb.append("proposedMaxServOutstandingCalling: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (proposedMaxServOutstandingCalled != null) { - sb.append("proposedMaxServOutstandingCalled: ").append(proposedMaxServOutstandingCalled); - } - else { - sb.append("proposedMaxServOutstandingCalled: "); - } - - if (proposedDataStructureNestingLevel != null) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("proposedDataStructureNestingLevel: ").append(proposedDataStructureNestingLevel); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (initRequestDetail != null) { - sb.append("initRequestDetail: "); - initRequestDetail.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("initRequestDetail: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class InitRequestDetail 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 proposedVersionNumber = null; + private ParameterSupportOptions proposedParameterCBB = null; + private ServiceSupportOptions servicesSupportedCalling = null; + + public InitRequestDetail() { + } + + public InitRequestDetail(byte[] code) { + this.code = code; + } + + public void setProposedVersionNumber(Integer16 proposedVersionNumber) { + this.proposedVersionNumber = proposedVersionNumber; + } + + public Integer16 getProposedVersionNumber() { + return proposedVersionNumber; + } + + public void setProposedParameterCBB(ParameterSupportOptions proposedParameterCBB) { + this.proposedParameterCBB = proposedParameterCBB; + } + + public ParameterSupportOptions getProposedParameterCBB() { + return proposedParameterCBB; + } + + public void setServicesSupportedCalling(ServiceSupportOptions servicesSupportedCalling) { + this.servicesSupportedCalling = servicesSupportedCalling; + } + + public ServiceSupportOptions getServicesSupportedCalling() { + return servicesSupportedCalling; + } + + 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 += servicesSupportedCalling.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + + codeLength += proposedParameterCBB.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + + codeLength += proposedVersionNumber.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)) { + proposedVersionNumber = new Integer16(); + subCodeLength += proposedVersionNumber.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)) { + proposedParameterCBB = new ParameterSupportOptions(); + subCodeLength += proposedParameterCBB.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)) { + servicesSupportedCalling = new ServiceSupportOptions(); + subCodeLength += servicesSupportedCalling.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(); + } + + 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 (proposedVersionNumber != null) { + sb.append("proposedVersionNumber: ").append(proposedVersionNumber); + } + else { + sb.append("proposedVersionNumber: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (proposedParameterCBB != null) { + sb.append("proposedParameterCBB: ").append(proposedParameterCBB); + } + else { + sb.append("proposedParameterCBB: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (servicesSupportedCalling != null) { + sb.append("servicesSupportedCalling: ").append(servicesSupportedCalling); + } + else { + sb.append("servicesSupportedCalling: "); + } + + 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 localDetailCalling = null; + private Integer16 proposedMaxServOutstandingCalling = null; + private Integer16 proposedMaxServOutstandingCalled = null; + private Integer8 proposedDataStructureNestingLevel = null; + private InitRequestDetail initRequestDetail = null; + + public InitiateRequestPDU() { + } + + public InitiateRequestPDU(byte[] code) { + this.code = code; + } + + public void setLocalDetailCalling(Integer32 localDetailCalling) { + this.localDetailCalling = localDetailCalling; + } + + public Integer32 getLocalDetailCalling() { + return localDetailCalling; + } + + public void setProposedMaxServOutstandingCalling(Integer16 proposedMaxServOutstandingCalling) { + this.proposedMaxServOutstandingCalling = proposedMaxServOutstandingCalling; + } + + public Integer16 getProposedMaxServOutstandingCalling() { + return proposedMaxServOutstandingCalling; + } + + public void setProposedMaxServOutstandingCalled(Integer16 proposedMaxServOutstandingCalled) { + this.proposedMaxServOutstandingCalled = proposedMaxServOutstandingCalled; + } + + public Integer16 getProposedMaxServOutstandingCalled() { + return proposedMaxServOutstandingCalled; + } + + public void setProposedDataStructureNestingLevel(Integer8 proposedDataStructureNestingLevel) { + this.proposedDataStructureNestingLevel = proposedDataStructureNestingLevel; + } + + public Integer8 getProposedDataStructureNestingLevel() { + return proposedDataStructureNestingLevel; + } + + public void setInitRequestDetail(InitRequestDetail initRequestDetail) { + this.initRequestDetail = initRequestDetail; + } + + public InitRequestDetail getInitRequestDetail() { + return initRequestDetail; + } + + 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 += initRequestDetail.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 + os.write(0xA4); + codeLength += 1; + + if (proposedDataStructureNestingLevel != null) { + codeLength += proposedDataStructureNestingLevel.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 3 + os.write(0x83); + codeLength += 1; + } + + codeLength += proposedMaxServOutstandingCalled.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + + codeLength += proposedMaxServOutstandingCalling.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + + if (localDetailCalling != null) { + codeLength += localDetailCalling.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)) { + localDetailCalling = new Integer32(); + subCodeLength += localDetailCalling.decode(is, false); + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { + proposedMaxServOutstandingCalling = new Integer16(); + subCodeLength += proposedMaxServOutstandingCalling.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)) { + proposedMaxServOutstandingCalled = new Integer16(); + subCodeLength += proposedMaxServOutstandingCalled.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)) { + proposedDataStructureNestingLevel = new Integer8(); + subCodeLength += proposedDataStructureNestingLevel.decode(is, false); + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { + initRequestDetail = new InitRequestDetail(); + subCodeLength += initRequestDetail.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(); + } + + 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 (localDetailCalling != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("localDetailCalling: ").append(localDetailCalling); + firstSelectedElement = false; + } + + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (proposedMaxServOutstandingCalling != null) { + sb.append("proposedMaxServOutstandingCalling: ").append(proposedMaxServOutstandingCalling); + } + else { + sb.append("proposedMaxServOutstandingCalling: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (proposedMaxServOutstandingCalled != null) { + sb.append("proposedMaxServOutstandingCalled: ").append(proposedMaxServOutstandingCalled); + } + else { + sb.append("proposedMaxServOutstandingCalled: "); + } + + if (proposedDataStructureNestingLevel != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("proposedDataStructureNestingLevel: ").append(proposedDataStructureNestingLevel); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (initRequestDetail != null) { + sb.append("initRequestDetail: "); + initRequestDetail.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("initRequestDetail: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateResponsePDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateResponsePDU.java index 78f46da..967e140 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateResponsePDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/InitiateResponsePDU.java @@ -1,463 +1,468 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -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: "); - } - - 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: "); - } - - 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: "); - } - - 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: "); - } - - 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: "); - } - - 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: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + 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(); + } + + 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: "); + } + + 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: "); + } + + 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: "); + } + + 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(); + } + + 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: "); + } + + 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: "); + } + + 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: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer16.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer16.java index 01194c8..dad6f4c 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer16.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer16.java @@ -1,30 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.types.BerInteger; public class Integer16 extends BerInteger { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public Integer16() { - } + public Integer16() { + } - public Integer16(byte[] code) { - super(code); - } + public Integer16(byte[] code) { + super(code); + } - public Integer16(BigInteger value) { - super(value); - } + public Integer16(BigInteger value) { + super(value); + } - public Integer16(long value) { - super(value); - } + public Integer16(long value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer32.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer32.java index c117d16..2c091a8 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer32.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer32.java @@ -1,30 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.types.BerInteger; public class Integer32 extends BerInteger { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public Integer32() { - } + public Integer32() { + } - public Integer32(byte[] code) { - super(code); - } + public Integer32(byte[] code) { + super(code); + } - public Integer32(BigInteger value) { - super(value); - } + public Integer32(BigInteger value) { + super(value); + } - public Integer32(long value) { - super(value); - } + public Integer32(long value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer8.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer8.java index 3db3b76..13f5b4b 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer8.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Integer8.java @@ -1,30 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.types.BerInteger; public class Integer8 extends BerInteger { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public Integer8() { - } + public Integer8() { + } - public Integer8(byte[] code) { - super(code); - } + public Integer8(byte[] code) { + super(code); + } - public Integer8(BigInteger value) { - super(value); - } + public Integer8(BigInteger value) { + super(value); + } - public Integer8(long value) { - super(value); - } + public Integer8(long value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSString.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSString.java index 3e8b835..16e4838 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSString.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSString.java @@ -1,20 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.string.BerVisibleString; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class MMSString extends BerVisibleString { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public MMSString() { - } + public MMSString() { + } - public MMSString(byte[] value) { - super(value); - } + public MMSString(byte[] value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSpdu.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSpdu.java index 2d41990..b127ab5 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSpdu.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/MMSpdu.java @@ -1,340 +1,347 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class MMSpdu implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private ConfirmedRequestPDU confirmedRequestPDU = null; - private ConfirmedResponsePDU confirmedResponsePDU = null; - private ConfirmedErrorPDU confirmedErrorPDU = null; - private UnconfirmedPDU unconfirmedPDU = null; - private RejectPDU rejectPDU = null; - private InitiateRequestPDU initiateRequestPDU = null; - private InitiateResponsePDU initiateResponsePDU = null; - private InitiateErrorPDU initiateErrorPDU = null; - private ConcludeRequestPDU concludeRequestPDU = null; - - public MMSpdu() { - } - - public MMSpdu(byte[] code) { - this.code = code; - } - - public void setConfirmedRequestPDU(ConfirmedRequestPDU confirmedRequestPDU) { - this.confirmedRequestPDU = confirmedRequestPDU; - } - - public ConfirmedRequestPDU getConfirmedRequestPDU() { - return confirmedRequestPDU; - } - - public void setConfirmedResponsePDU(ConfirmedResponsePDU confirmedResponsePDU) { - this.confirmedResponsePDU = confirmedResponsePDU; - } - - public ConfirmedResponsePDU getConfirmedResponsePDU() { - return confirmedResponsePDU; - } - - public void setConfirmedErrorPDU(ConfirmedErrorPDU confirmedErrorPDU) { - this.confirmedErrorPDU = confirmedErrorPDU; - } - - public ConfirmedErrorPDU getConfirmedErrorPDU() { - return confirmedErrorPDU; - } - - public void setUnconfirmedPDU(UnconfirmedPDU unconfirmedPDU) { - this.unconfirmedPDU = unconfirmedPDU; - } - - public UnconfirmedPDU getUnconfirmedPDU() { - return unconfirmedPDU; - } - - public void setRejectPDU(RejectPDU rejectPDU) { - this.rejectPDU = rejectPDU; - } - - public RejectPDU getRejectPDU() { - return rejectPDU; - } - - public void setInitiateRequestPDU(InitiateRequestPDU initiateRequestPDU) { - this.initiateRequestPDU = initiateRequestPDU; - } - - public InitiateRequestPDU getInitiateRequestPDU() { - return initiateRequestPDU; - } - - public void setInitiateResponsePDU(InitiateResponsePDU initiateResponsePDU) { - this.initiateResponsePDU = initiateResponsePDU; - } - - public InitiateResponsePDU getInitiateResponsePDU() { - return initiateResponsePDU; - } - - public void setInitiateErrorPDU(InitiateErrorPDU initiateErrorPDU) { - this.initiateErrorPDU = initiateErrorPDU; - } - - public InitiateErrorPDU getInitiateErrorPDU() { - return initiateErrorPDU; - } - - public void setConcludeRequestPDU(ConcludeRequestPDU concludeRequestPDU) { - this.concludeRequestPDU = concludeRequestPDU; - } - - public ConcludeRequestPDU getConcludeRequestPDU() { - return concludeRequestPDU; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (concludeRequestPDU != null) { - codeLength += concludeRequestPDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 11 - os.write(0x8B); - codeLength += 1; - return codeLength; - } - - if (initiateErrorPDU != null) { - codeLength += initiateErrorPDU.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 10 - os.write(0xAA); - codeLength += 1; - return codeLength; - } - - if (initiateResponsePDU != null) { - codeLength += initiateResponsePDU.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 9 - os.write(0xA9); - codeLength += 1; - return codeLength; - } - - if (initiateRequestPDU != null) { - codeLength += initiateRequestPDU.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 8 - os.write(0xA8); - codeLength += 1; - return codeLength; - } - - if (rejectPDU != null) { - codeLength += rejectPDU.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 - os.write(0xA4); - codeLength += 1; - return codeLength; - } - - if (unconfirmedPDU != null) { - codeLength += unconfirmedPDU.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 3 - os.write(0xA3); - codeLength += 1; - return codeLength; - } - - if (confirmedErrorPDU != null) { - codeLength += confirmedErrorPDU.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 - os.write(0xA2); - codeLength += 1; - return codeLength; - } - - if (confirmedResponsePDU != null) { - codeLength += confirmedResponsePDU.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - return codeLength; - } - - if (confirmedRequestPDU != null) { - codeLength += confirmedRequestPDU.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - confirmedRequestPDU = new ConfirmedRequestPDU(); - codeLength += confirmedRequestPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - confirmedResponsePDU = new ConfirmedResponsePDU(); - codeLength += confirmedResponsePDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { - confirmedErrorPDU = new ConfirmedErrorPDU(); - codeLength += confirmedErrorPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) { - unconfirmedPDU = new UnconfirmedPDU(); - codeLength += unconfirmedPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { - rejectPDU = new RejectPDU(); - codeLength += rejectPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) { - initiateRequestPDU = new InitiateRequestPDU(); - codeLength += initiateRequestPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) { - initiateResponsePDU = new InitiateResponsePDU(); - codeLength += initiateResponsePDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 10)) { - initiateErrorPDU = new InitiateErrorPDU(); - codeLength += initiateErrorPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) { - concludeRequestPDU = new ConcludeRequestPDU(); - codeLength += concludeRequestPDU.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (confirmedRequestPDU != null) { - sb.append("confirmedRequestPDU: "); - confirmedRequestPDU.appendAsString(sb, indentLevel + 1); - return; - } - - if (confirmedResponsePDU != null) { - sb.append("confirmedResponsePDU: "); - confirmedResponsePDU.appendAsString(sb, indentLevel + 1); - return; - } - - if (confirmedErrorPDU != null) { - sb.append("confirmedErrorPDU: "); - confirmedErrorPDU.appendAsString(sb, indentLevel + 1); - return; - } - - if (unconfirmedPDU != null) { - sb.append("unconfirmedPDU: "); - unconfirmedPDU.appendAsString(sb, indentLevel + 1); - return; - } - - if (rejectPDU != null) { - sb.append("rejectPDU: "); - rejectPDU.appendAsString(sb, indentLevel + 1); - return; - } - - if (initiateRequestPDU != null) { - sb.append("initiateRequestPDU: "); - initiateRequestPDU.appendAsString(sb, indentLevel + 1); - return; - } - - if (initiateResponsePDU != null) { - sb.append("initiateResponsePDU: "); - initiateResponsePDU.appendAsString(sb, indentLevel + 1); - return; - } - - if (initiateErrorPDU != null) { - sb.append("initiateErrorPDU: "); - initiateErrorPDU.appendAsString(sb, indentLevel + 1); - return; - } - - if (concludeRequestPDU != null) { - sb.append("concludeRequestPDU: ").append(concludeRequestPDU); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private ConfirmedRequestPDU confirmedRequestPDU = null; + private ConfirmedResponsePDU confirmedResponsePDU = null; + private ConfirmedErrorPDU confirmedErrorPDU = null; + private UnconfirmedPDU unconfirmedPDU = null; + private RejectPDU rejectPDU = null; + private InitiateRequestPDU initiateRequestPDU = null; + private InitiateResponsePDU initiateResponsePDU = null; + private InitiateErrorPDU initiateErrorPDU = null; + private ConcludeRequestPDU concludeRequestPDU = null; + + public MMSpdu() { + } + + public MMSpdu(byte[] code) { + this.code = code; + } + + public void setConfirmedRequestPDU(ConfirmedRequestPDU confirmedRequestPDU) { + this.confirmedRequestPDU = confirmedRequestPDU; + } + + public ConfirmedRequestPDU getConfirmedRequestPDU() { + return confirmedRequestPDU; + } + + public void setConfirmedResponsePDU(ConfirmedResponsePDU confirmedResponsePDU) { + this.confirmedResponsePDU = confirmedResponsePDU; + } + + public ConfirmedResponsePDU getConfirmedResponsePDU() { + return confirmedResponsePDU; + } + + public void setConfirmedErrorPDU(ConfirmedErrorPDU confirmedErrorPDU) { + this.confirmedErrorPDU = confirmedErrorPDU; + } + + public ConfirmedErrorPDU getConfirmedErrorPDU() { + return confirmedErrorPDU; + } + + public void setUnconfirmedPDU(UnconfirmedPDU unconfirmedPDU) { + this.unconfirmedPDU = unconfirmedPDU; + } + + public UnconfirmedPDU getUnconfirmedPDU() { + return unconfirmedPDU; + } + + public void setRejectPDU(RejectPDU rejectPDU) { + this.rejectPDU = rejectPDU; + } + + public RejectPDU getRejectPDU() { + return rejectPDU; + } + + public void setInitiateRequestPDU(InitiateRequestPDU initiateRequestPDU) { + this.initiateRequestPDU = initiateRequestPDU; + } + + public InitiateRequestPDU getInitiateRequestPDU() { + return initiateRequestPDU; + } + + public void setInitiateResponsePDU(InitiateResponsePDU initiateResponsePDU) { + this.initiateResponsePDU = initiateResponsePDU; + } + + public InitiateResponsePDU getInitiateResponsePDU() { + return initiateResponsePDU; + } + + public void setInitiateErrorPDU(InitiateErrorPDU initiateErrorPDU) { + this.initiateErrorPDU = initiateErrorPDU; + } + + public InitiateErrorPDU getInitiateErrorPDU() { + return initiateErrorPDU; + } + + public void setConcludeRequestPDU(ConcludeRequestPDU concludeRequestPDU) { + this.concludeRequestPDU = concludeRequestPDU; + } + + public ConcludeRequestPDU getConcludeRequestPDU() { + return concludeRequestPDU; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (concludeRequestPDU != null) { + codeLength += concludeRequestPDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 11 + os.write(0x8B); + codeLength += 1; + return codeLength; + } + + if (initiateErrorPDU != null) { + codeLength += initiateErrorPDU.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 10 + os.write(0xAA); + codeLength += 1; + return codeLength; + } + + if (initiateResponsePDU != null) { + codeLength += initiateResponsePDU.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 9 + os.write(0xA9); + codeLength += 1; + return codeLength; + } + + if (initiateRequestPDU != null) { + codeLength += initiateRequestPDU.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 8 + os.write(0xA8); + codeLength += 1; + return codeLength; + } + + if (rejectPDU != null) { + codeLength += rejectPDU.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 + os.write(0xA4); + codeLength += 1; + return codeLength; + } + + if (unconfirmedPDU != null) { + codeLength += unconfirmedPDU.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 3 + os.write(0xA3); + codeLength += 1; + return codeLength; + } + + if (confirmedErrorPDU != null) { + codeLength += confirmedErrorPDU.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 + os.write(0xA2); + codeLength += 1; + return codeLength; + } + + if (confirmedResponsePDU != null) { + codeLength += confirmedResponsePDU.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + return codeLength; + } + + if (confirmedRequestPDU != null) { + codeLength += confirmedRequestPDU.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + confirmedRequestPDU = new ConfirmedRequestPDU(); + codeLength += confirmedRequestPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + confirmedResponsePDU = new ConfirmedResponsePDU(); + codeLength += confirmedResponsePDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { + confirmedErrorPDU = new ConfirmedErrorPDU(); + codeLength += confirmedErrorPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) { + unconfirmedPDU = new UnconfirmedPDU(); + codeLength += unconfirmedPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { + rejectPDU = new RejectPDU(); + codeLength += rejectPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) { + initiateRequestPDU = new InitiateRequestPDU(); + codeLength += initiateRequestPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) { + initiateResponsePDU = new InitiateResponsePDU(); + codeLength += initiateResponsePDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 10)) { + initiateErrorPDU = new InitiateErrorPDU(); + codeLength += initiateErrorPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) { + concludeRequestPDU = new ConcludeRequestPDU(); + codeLength += concludeRequestPDU.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (confirmedRequestPDU != null) { + sb.append("confirmedRequestPDU: "); + confirmedRequestPDU.appendAsString(sb, indentLevel + 1); + return; + } + + if (confirmedResponsePDU != null) { + sb.append("confirmedResponsePDU: "); + confirmedResponsePDU.appendAsString(sb, indentLevel + 1); + return; + } + + if (confirmedErrorPDU != null) { + sb.append("confirmedErrorPDU: "); + confirmedErrorPDU.appendAsString(sb, indentLevel + 1); + return; + } + + if (unconfirmedPDU != null) { + sb.append("unconfirmedPDU: "); + unconfirmedPDU.appendAsString(sb, indentLevel + 1); + return; + } + + if (rejectPDU != null) { + sb.append("rejectPDU: "); + rejectPDU.appendAsString(sb, indentLevel + 1); + return; + } + + if (initiateRequestPDU != null) { + sb.append("initiateRequestPDU: "); + initiateRequestPDU.appendAsString(sb, indentLevel + 1); + return; + } + + if (initiateResponsePDU != null) { + sb.append("initiateResponsePDU: "); + initiateResponsePDU.appendAsString(sb, indentLevel + 1); + return; + } + + if (initiateErrorPDU != null) { + sb.append("initiateErrorPDU: "); + initiateErrorPDU.appendAsString(sb, indentLevel + 1); + return; + } + + if (concludeRequestPDU != null) { + sb.append("concludeRequestPDU: ").append(concludeRequestPDU); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ObjectClass.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ObjectClass.java index 829c127..73c4f3f 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ObjectClass.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ObjectClass.java @@ -1,109 +1,115 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerInteger; public class ObjectClass implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private BerInteger basicObjectClass = null; - - public ObjectClass() { - } - - public ObjectClass(byte[] code) { - this.code = code; - } - - public void setBasicObjectClass(BerInteger basicObjectClass) { - this.basicObjectClass = basicObjectClass; - } - - public BerInteger getBasicObjectClass() { - return basicObjectClass; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (basicObjectClass != null) { - codeLength += basicObjectClass.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 0 - os.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)) { - basicObjectClass = new BerInteger(); - codeLength += basicObjectClass.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (basicObjectClass != null) { - sb.append("basicObjectClass: ").append(basicObjectClass); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private BerInteger basicObjectClass = null; + + public ObjectClass() { + } + + public ObjectClass(byte[] code) { + this.code = code; + } + + public void setBasicObjectClass(BerInteger basicObjectClass) { + this.basicObjectClass = basicObjectClass; + } + + public BerInteger getBasicObjectClass() { + return basicObjectClass; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (basicObjectClass != null) { + codeLength += basicObjectClass.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 0 + os.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)) { + basicObjectClass = new BerInteger(); + codeLength += basicObjectClass.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (basicObjectClass != null) { + sb.append("basicObjectClass: ").append(basicObjectClass); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ObjectName.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ObjectName.java index 5cdb733..cf56931 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ObjectName.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ObjectName.java @@ -1,320 +1,323 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.string.BerVisibleString; public class ObjectName implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - - public static class DomainSpecific 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 Identifier domainID = null; - private Identifier itemID = null; - - public DomainSpecific() { - } - - public DomainSpecific(byte[] code) { - this.code = code; - } - - public void setDomainID(Identifier domainID) { - this.domainID = domainID; - } - - public Identifier getDomainID() { - return domainID; - } - - public void setItemID(Identifier itemID) { - this.itemID = itemID; - } - - public Identifier getItemID() { - return itemID; - } - - 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 += itemID.encode(os, true); - - codeLength += domainID.encode(os, true); - - 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(BerVisibleString.tag)) { - domainID = new Identifier(); - subCodeLength += domainID.decode(is, false); - subCodeLength += berTag.decode(is); - } - else { - throw new IOException("Tag does not match the mandatory sequence element tag."); - } - - if (berTag.equals(BerVisibleString.tag)) { - itemID = new Identifier(); - subCodeLength += itemID.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 (domainID != null) { - sb.append("domainID: ").append(domainID); - } - else { - sb.append("domainID: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (itemID != null) { - sb.append("itemID: ").append(itemID); - } - else { - sb.append("itemID: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - private Identifier vmdSpecific = null; - private DomainSpecific domainSpecific = null; - private Identifier aaSpecific = null; - - public ObjectName() { - } - - public ObjectName(byte[] code) { - this.code = code; - } - - public void setVmdSpecific(Identifier vmdSpecific) { - this.vmdSpecific = vmdSpecific; - } - - public Identifier getVmdSpecific() { - return vmdSpecific; - } - - public void setDomainSpecific(DomainSpecific domainSpecific) { - this.domainSpecific = domainSpecific; - } - - public DomainSpecific getDomainSpecific() { - return domainSpecific; - } - - public void setAaSpecific(Identifier aaSpecific) { - this.aaSpecific = aaSpecific; - } - - public Identifier getAaSpecific() { - return aaSpecific; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (aaSpecific != null) { - codeLength += aaSpecific.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - return codeLength; - } - - if (domainSpecific != null) { - codeLength += domainSpecific.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - return codeLength; - } - - if (vmdSpecific != null) { - codeLength += vmdSpecific.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 0 - os.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)) { - vmdSpecific = new Identifier(); - codeLength += vmdSpecific.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - domainSpecific = new DomainSpecific(); - codeLength += domainSpecific.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { - aaSpecific = new Identifier(); - codeLength += aaSpecific.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (vmdSpecific != null) { - sb.append("vmdSpecific: ").append(vmdSpecific); - return; - } - - if (domainSpecific != null) { - sb.append("domainSpecific: "); - domainSpecific.appendAsString(sb, indentLevel + 1); - return; - } - - if (aaSpecific != null) { - sb.append("aaSpecific: ").append(aaSpecific); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + public static class DomainSpecific 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 Identifier domainID = null; + private Identifier itemID = null; + + public DomainSpecific() { + } + + public DomainSpecific(byte[] code) { + this.code = code; + } + + public void setDomainID(Identifier domainID) { + this.domainID = domainID; + } + + public Identifier getDomainID() { + return domainID; + } + + public void setItemID(Identifier itemID) { + this.itemID = itemID; + } + + public Identifier getItemID() { + return itemID; + } + + 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 += itemID.encode(os, true); + + codeLength += domainID.encode(os, true); + + 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(Identifier.tag)) { + domainID = new Identifier(); + subCodeLength += domainID.decode(is, false); + subCodeLength += berTag.decode(is); + } + else { + throw new IOException("Tag does not match the mandatory sequence element tag."); + } + + if (berTag.equals(Identifier.tag)) { + itemID = new Identifier(); + subCodeLength += itemID.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(); + } + + 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 (domainID != null) { + sb.append("domainID: ").append(domainID); + } + else { + sb.append("domainID: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (itemID != null) { + sb.append("itemID: ").append(itemID); + } + else { + sb.append("itemID: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + private Identifier vmdSpecific = null; + private DomainSpecific domainSpecific = null; + private Identifier aaSpecific = null; + + public ObjectName() { + } + + public ObjectName(byte[] code) { + this.code = code; + } + + public void setVmdSpecific(Identifier vmdSpecific) { + this.vmdSpecific = vmdSpecific; + } + + public Identifier getVmdSpecific() { + return vmdSpecific; + } + + public void setDomainSpecific(DomainSpecific domainSpecific) { + this.domainSpecific = domainSpecific; + } + + public DomainSpecific getDomainSpecific() { + return domainSpecific; + } + + public void setAaSpecific(Identifier aaSpecific) { + this.aaSpecific = aaSpecific; + } + + public Identifier getAaSpecific() { + return aaSpecific; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (aaSpecific != null) { + codeLength += aaSpecific.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + return codeLength; + } + + if (domainSpecific != null) { + codeLength += domainSpecific.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + return codeLength; + } + + if (vmdSpecific != null) { + codeLength += vmdSpecific.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 0 + os.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)) { + vmdSpecific = new Identifier(); + codeLength += vmdSpecific.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + domainSpecific = new DomainSpecific(); + codeLength += domainSpecific.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { + aaSpecific = new Identifier(); + codeLength += aaSpecific.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (vmdSpecific != null) { + sb.append("vmdSpecific: ").append(vmdSpecific); + return; + } + + if (domainSpecific != null) { + sb.append("domainSpecific: "); + domainSpecific.appendAsString(sb, indentLevel + 1); + return; + } + + if (aaSpecific != null) { + sb.append("aaSpecific: ").append(aaSpecific); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ParameterSupportOptions.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ParameterSupportOptions.java index 2cfdebe..ef6ef93 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ParameterSupportOptions.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ParameterSupportOptions.java @@ -1,28 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.BerBitString; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class ParameterSupportOptions extends BerBitString { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public ParameterSupportOptions() { - } + public ParameterSupportOptions() { + } - public ParameterSupportOptions(byte[] code) { - super(code); - } + public ParameterSupportOptions(byte[] code) { + super(code); + } - public ParameterSupportOptions(byte[] value, int numBits) { - super(value, numBits); - } + public ParameterSupportOptions(byte[] value, int numBits) { + super(value, numBits); + } - public ParameterSupportOptions(boolean[] value) { - super(value); - } + public ParameterSupportOptions(boolean[] value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ReadRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ReadRequest.java index f90d4b1..b036cea 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ReadRequest.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ReadRequest.java @@ -1,179 +1,184 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerBoolean; public class ReadRequest 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 BerBoolean specificationWithResult = null; - private VariableAccessSpecification variableAccessSpecification = null; - - public ReadRequest() { - } - - public ReadRequest(byte[] code) { - this.code = code; - } - - public void setSpecificationWithResult(BerBoolean specificationWithResult) { - this.specificationWithResult = specificationWithResult; - } - - public BerBoolean getSpecificationWithResult() { - return specificationWithResult; - } - - public void setVariableAccessSpecification(VariableAccessSpecification variableAccessSpecification) { - this.variableAccessSpecification = variableAccessSpecification; - } - - public VariableAccessSpecification getVariableAccessSpecification() { - return variableAccessSpecification; - } - - 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; - int sublength; - - sublength = variableAccessSpecification.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - - if (specificationWithResult != null) { - codeLength += specificationWithResult.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)) { - specificationWithResult = new BerBoolean(); - subCodeLength += specificationWithResult.decode(is, false); - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - subCodeLength += length.decode(is); - variableAccessSpecification = new VariableAccessSpecification(); - subCodeLength += variableAccessSpecification.decode(is, null); - 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 (specificationWithResult != null) { - sb.append("\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("specificationWithResult: ").append(specificationWithResult); - firstSelectedElement = false; - } - - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (variableAccessSpecification != null) { - sb.append("variableAccessSpecification: "); - variableAccessSpecification.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("variableAccessSpecification: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private BerBoolean specificationWithResult = null; + private VariableAccessSpecification variableAccessSpecification = null; + + public ReadRequest() { + } + + public ReadRequest(byte[] code) { + this.code = code; + } + + public void setSpecificationWithResult(BerBoolean specificationWithResult) { + this.specificationWithResult = specificationWithResult; + } + + public BerBoolean getSpecificationWithResult() { + return specificationWithResult; + } + + public void setVariableAccessSpecification(VariableAccessSpecification variableAccessSpecification) { + this.variableAccessSpecification = variableAccessSpecification; + } + + public VariableAccessSpecification getVariableAccessSpecification() { + return variableAccessSpecification; + } + + 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; + int sublength; + + sublength = variableAccessSpecification.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + + if (specificationWithResult != null) { + codeLength += specificationWithResult.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)) { + specificationWithResult = new BerBoolean(); + subCodeLength += specificationWithResult.decode(is, false); + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + subCodeLength += length.decode(is); + variableAccessSpecification = new VariableAccessSpecification(); + subCodeLength += variableAccessSpecification.decode(is, null); + 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(); + } + + 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 (specificationWithResult != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("specificationWithResult: ").append(specificationWithResult); + firstSelectedElement = false; + } + + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (variableAccessSpecification != null) { + sb.append("variableAccessSpecification: "); + variableAccessSpecification.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("variableAccessSpecification: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ReadResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ReadResponse.java index 6b4fdfd..2fa2b02 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ReadResponse.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ReadResponse.java @@ -1,310 +1,311 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class ReadResponse implements Serializable { - private static final long serialVersionUID = 1L; - - public static class ListOfAccessResult 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 List seqOf = null; - - public ListOfAccessResult() { - seqOf = new ArrayList<>(); - } - - public ListOfAccessResult(byte[] code) { - this.code = code; - } - - public List getAccessResult() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - AccessResult element = new AccessResult(); - subCodeLength += element.decode(is, null); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength - + " but has " + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - 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 VariableAccessSpecification variableAccessSpecification = null; - private ListOfAccessResult listOfAccessResult = null; - - public ReadResponse() { - } - - public ReadResponse(byte[] code) { - this.code = code; - } - - public void setVariableAccessSpecification(VariableAccessSpecification variableAccessSpecification) { - this.variableAccessSpecification = variableAccessSpecification; - } - - public VariableAccessSpecification getVariableAccessSpecification() { - return variableAccessSpecification; - } - - public void setListOfAccessResult(ListOfAccessResult listOfAccessResult) { - this.listOfAccessResult = listOfAccessResult; - } - - public ListOfAccessResult getListOfAccessResult() { - return listOfAccessResult; - } - - 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; - int sublength; - - codeLength += listOfAccessResult.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - - if (variableAccessSpecification != null) { - sublength = variableAccessSpecification.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - subCodeLength += length.decode(is); - variableAccessSpecification = new VariableAccessSpecification(); - subCodeLength += variableAccessSpecification.decode(is, null); - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - listOfAccessResult = new ListOfAccessResult(); - subCodeLength += listOfAccessResult.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 (variableAccessSpecification != null) { - sb.append("\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("variableAccessSpecification: "); - variableAccessSpecification.appendAsString(sb, indentLevel + 1); - firstSelectedElement = false; - } - - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (listOfAccessResult != null) { - sb.append("listOfAccessResult: "); - listOfAccessResult.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("listOfAccessResult: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class ListOfAccessResult 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 List seqOf = null; + + public ListOfAccessResult() { + seqOf = new ArrayList(); + } + + public ListOfAccessResult(byte[] code) { + this.code = code; + } + + public List getAccessResult() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + AccessResult element = new AccessResult(); + subCodeLength += element.decode(is, null); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + 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 VariableAccessSpecification variableAccessSpecification = null; + private ListOfAccessResult listOfAccessResult = null; + + public ReadResponse() { + } + + public ReadResponse(byte[] code) { + this.code = code; + } + + public void setVariableAccessSpecification(VariableAccessSpecification variableAccessSpecification) { + this.variableAccessSpecification = variableAccessSpecification; + } + + public VariableAccessSpecification getVariableAccessSpecification() { + return variableAccessSpecification; + } + + public void setListOfAccessResult(ListOfAccessResult listOfAccessResult) { + this.listOfAccessResult = listOfAccessResult; + } + + public ListOfAccessResult getListOfAccessResult() { + return listOfAccessResult; + } + + 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; + int sublength; + + codeLength += listOfAccessResult.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + + if (variableAccessSpecification != null) { + sublength = variableAccessSpecification.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + subCodeLength += length.decode(is); + variableAccessSpecification = new VariableAccessSpecification(); + subCodeLength += variableAccessSpecification.decode(is, null); + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + listOfAccessResult = new ListOfAccessResult(); + subCodeLength += listOfAccessResult.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(); + } + + 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 (variableAccessSpecification != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("variableAccessSpecification: "); + variableAccessSpecification.appendAsString(sb, indentLevel + 1); + firstSelectedElement = false; + } + + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (listOfAccessResult != null) { + sb.append("listOfAccessResult: "); + listOfAccessResult.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("listOfAccessResult: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/RejectPDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/RejectPDU.java index 97434ca..a0ce911 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/RejectPDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/RejectPDU.java @@ -1,544 +1,548 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerInteger; public class RejectPDU implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public static class RejectReason implements Serializable { + public static class RejectReason implements Serializable { + + private static final long serialVersionUID = 1L; - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private BerInteger confirmedRequestPDU = null; - private BerInteger confirmedResponsePDU = null; - private BerInteger confirmedErrorPDU = null; - private BerInteger unconfirmedPDU = null; - private BerInteger pduError = null; - private BerInteger cancelRequestPDU = null; - private BerInteger cancelResponsePDU = null; - private BerInteger cancelErrorPDU = null; - private BerInteger concludeRequestPDU = null; - private BerInteger concludeResponsePDU = null; - private BerInteger concludeErrorPDU = null; - - public RejectReason() { - } - - public RejectReason(byte[] code) { - this.code = code; - } - - public void setConfirmedRequestPDU(BerInteger confirmedRequestPDU) { - this.confirmedRequestPDU = confirmedRequestPDU; - } - - public BerInteger getConfirmedRequestPDU() { - return confirmedRequestPDU; - } - - public void setConfirmedResponsePDU(BerInteger confirmedResponsePDU) { - this.confirmedResponsePDU = confirmedResponsePDU; - } - - public BerInteger getConfirmedResponsePDU() { - return confirmedResponsePDU; - } - - public void setConfirmedErrorPDU(BerInteger confirmedErrorPDU) { - this.confirmedErrorPDU = confirmedErrorPDU; - } - - public BerInteger getConfirmedErrorPDU() { - return confirmedErrorPDU; - } - - public void setUnconfirmedPDU(BerInteger unconfirmedPDU) { - this.unconfirmedPDU = unconfirmedPDU; - } - - public BerInteger getUnconfirmedPDU() { - return unconfirmedPDU; - } - - public void setPduError(BerInteger pduError) { - this.pduError = pduError; - } - - public BerInteger getPduError() { - return pduError; - } - - public void setCancelRequestPDU(BerInteger cancelRequestPDU) { - this.cancelRequestPDU = cancelRequestPDU; - } - - public BerInteger getCancelRequestPDU() { - return cancelRequestPDU; - } - - public void setCancelResponsePDU(BerInteger cancelResponsePDU) { - this.cancelResponsePDU = cancelResponsePDU; - } - - public BerInteger getCancelResponsePDU() { - return cancelResponsePDU; - } - - public void setCancelErrorPDU(BerInteger cancelErrorPDU) { - this.cancelErrorPDU = cancelErrorPDU; - } - - public BerInteger getCancelErrorPDU() { - return cancelErrorPDU; - } - - public void setConcludeRequestPDU(BerInteger concludeRequestPDU) { - this.concludeRequestPDU = concludeRequestPDU; - } - - public BerInteger getConcludeRequestPDU() { - return concludeRequestPDU; - } - - public void setConcludeResponsePDU(BerInteger concludeResponsePDU) { - this.concludeResponsePDU = concludeResponsePDU; - } - - public BerInteger getConcludeResponsePDU() { - return concludeResponsePDU; - } - - public void setConcludeErrorPDU(BerInteger concludeErrorPDU) { - this.concludeErrorPDU = concludeErrorPDU; - } - - public BerInteger getConcludeErrorPDU() { - return concludeErrorPDU; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (concludeErrorPDU != null) { - codeLength += concludeErrorPDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 11 - os.write(0x8B); - codeLength += 1; - return codeLength; - } - - if (concludeResponsePDU != null) { - codeLength += concludeResponsePDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 10 - os.write(0x8A); - codeLength += 1; - return codeLength; - } - - if (concludeRequestPDU != null) { - codeLength += concludeRequestPDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 9 - os.write(0x89); - codeLength += 1; - return codeLength; - } - - if (cancelErrorPDU != null) { - codeLength += cancelErrorPDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 8 - os.write(0x88); - codeLength += 1; - return codeLength; - } - - if (cancelResponsePDU != null) { - codeLength += cancelResponsePDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 7 - os.write(0x87); - codeLength += 1; - return codeLength; - } - - if (cancelRequestPDU != null) { - codeLength += cancelRequestPDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 6 - os.write(0x86); - codeLength += 1; - return codeLength; - } - - if (pduError != null) { - codeLength += pduError.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 5 - os.write(0x85); - codeLength += 1; - return codeLength; - } - - if (unconfirmedPDU != null) { - codeLength += unconfirmedPDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 4 - os.write(0x84); - codeLength += 1; - return codeLength; - } - - if (confirmedErrorPDU != null) { - codeLength += confirmedErrorPDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 3 - os.write(0x83); - codeLength += 1; - return codeLength; - } - - if (confirmedResponsePDU != null) { - codeLength += confirmedResponsePDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - return codeLength; - } - - if (confirmedRequestPDU != null) { - codeLength += confirmedRequestPDU.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - 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, 1)) { - confirmedRequestPDU = new BerInteger(); - codeLength += confirmedRequestPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { - confirmedResponsePDU = new BerInteger(); - codeLength += confirmedResponsePDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { - confirmedErrorPDU = new BerInteger(); - codeLength += confirmedErrorPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { - unconfirmedPDU = new BerInteger(); - codeLength += unconfirmedPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { - pduError = new BerInteger(); - codeLength += pduError.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { - cancelRequestPDU = new BerInteger(); - codeLength += cancelRequestPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) { - cancelResponsePDU = new BerInteger(); - codeLength += cancelResponsePDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) { - cancelErrorPDU = new BerInteger(); - codeLength += cancelErrorPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { - concludeRequestPDU = new BerInteger(); - codeLength += concludeRequestPDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { - concludeResponsePDU = new BerInteger(); - codeLength += concludeResponsePDU.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) { - concludeErrorPDU = new BerInteger(); - codeLength += concludeErrorPDU.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (confirmedRequestPDU != null) { - sb.append("confirmedRequestPDU: ").append(confirmedRequestPDU); - return; - } - - if (confirmedResponsePDU != null) { - sb.append("confirmedResponsePDU: ").append(confirmedResponsePDU); - return; - } - - if (confirmedErrorPDU != null) { - sb.append("confirmedErrorPDU: ").append(confirmedErrorPDU); - return; - } - - if (unconfirmedPDU != null) { - sb.append("unconfirmedPDU: ").append(unconfirmedPDU); - return; - } - - if (pduError != null) { - sb.append("pduError: ").append(pduError); - return; - } - - if (cancelRequestPDU != null) { - sb.append("cancelRequestPDU: ").append(cancelRequestPDU); - return; - } - - if (cancelResponsePDU != null) { - sb.append("cancelResponsePDU: ").append(cancelResponsePDU); - return; - } - - if (cancelErrorPDU != null) { - sb.append("cancelErrorPDU: ").append(cancelErrorPDU); - return; - } - - if (concludeRequestPDU != null) { - sb.append("concludeRequestPDU: ").append(concludeRequestPDU); - return; - } - - if (concludeResponsePDU != null) { - sb.append("concludeResponsePDU: ").append(concludeResponsePDU); - return; - } - - if (concludeErrorPDU != null) { - sb.append("concludeErrorPDU: ").append(concludeErrorPDU); - return; - } - - sb.append(""); - } - - } - - public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); - - public byte[] code = null; - private Unsigned32 originalInvokeID = null; - private RejectReason rejectReason = null; - - public RejectPDU() { - } - - public RejectPDU(byte[] code) { - this.code = code; - } - - public void setOriginalInvokeID(Unsigned32 originalInvokeID) { - this.originalInvokeID = originalInvokeID; - } - - public Unsigned32 getOriginalInvokeID() { - return originalInvokeID; - } - - public void setRejectReason(RejectReason rejectReason) { - this.rejectReason = rejectReason; - } - - public RejectReason getRejectReason() { - return rejectReason; - } - - 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 += rejectReason.encode(os); - - if (originalInvokeID != null) { - codeLength += originalInvokeID.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)) { - originalInvokeID = new Unsigned32(); - subCodeLength += originalInvokeID.decode(is, false); - subCodeLength += berTag.decode(is); - } - - rejectReason = new RejectReason(); - subCodeLength += rejectReason.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 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 (originalInvokeID != null) { - sb.append("\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("originalInvokeID: ").append(originalInvokeID); - firstSelectedElement = false; - } - - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (rejectReason != null) { - sb.append("rejectReason: "); - rejectReason.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("rejectReason: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + public byte[] code = null; + private BerInteger confirmedRequestPDU = null; + private BerInteger confirmedResponsePDU = null; + private BerInteger confirmedErrorPDU = null; + private BerInteger unconfirmedPDU = null; + private BerInteger pduError = null; + private BerInteger cancelRequestPDU = null; + private BerInteger cancelResponsePDU = null; + private BerInteger cancelErrorPDU = null; + private BerInteger concludeRequestPDU = null; + private BerInteger concludeResponsePDU = null; + private BerInteger concludeErrorPDU = null; + + public RejectReason() { + } + + public RejectReason(byte[] code) { + this.code = code; + } + + public void setConfirmedRequestPDU(BerInteger confirmedRequestPDU) { + this.confirmedRequestPDU = confirmedRequestPDU; + } + + public BerInteger getConfirmedRequestPDU() { + return confirmedRequestPDU; + } + + public void setConfirmedResponsePDU(BerInteger confirmedResponsePDU) { + this.confirmedResponsePDU = confirmedResponsePDU; + } + + public BerInteger getConfirmedResponsePDU() { + return confirmedResponsePDU; + } + + public void setConfirmedErrorPDU(BerInteger confirmedErrorPDU) { + this.confirmedErrorPDU = confirmedErrorPDU; + } + + public BerInteger getConfirmedErrorPDU() { + return confirmedErrorPDU; + } + + public void setUnconfirmedPDU(BerInteger unconfirmedPDU) { + this.unconfirmedPDU = unconfirmedPDU; + } + + public BerInteger getUnconfirmedPDU() { + return unconfirmedPDU; + } + + public void setPduError(BerInteger pduError) { + this.pduError = pduError; + } + + public BerInteger getPduError() { + return pduError; + } + + public void setCancelRequestPDU(BerInteger cancelRequestPDU) { + this.cancelRequestPDU = cancelRequestPDU; + } + + public BerInteger getCancelRequestPDU() { + return cancelRequestPDU; + } + + public void setCancelResponsePDU(BerInteger cancelResponsePDU) { + this.cancelResponsePDU = cancelResponsePDU; + } + + public BerInteger getCancelResponsePDU() { + return cancelResponsePDU; + } + + public void setCancelErrorPDU(BerInteger cancelErrorPDU) { + this.cancelErrorPDU = cancelErrorPDU; + } + + public BerInteger getCancelErrorPDU() { + return cancelErrorPDU; + } + + public void setConcludeRequestPDU(BerInteger concludeRequestPDU) { + this.concludeRequestPDU = concludeRequestPDU; + } + + public BerInteger getConcludeRequestPDU() { + return concludeRequestPDU; + } + + public void setConcludeResponsePDU(BerInteger concludeResponsePDU) { + this.concludeResponsePDU = concludeResponsePDU; + } + + public BerInteger getConcludeResponsePDU() { + return concludeResponsePDU; + } + + public void setConcludeErrorPDU(BerInteger concludeErrorPDU) { + this.concludeErrorPDU = concludeErrorPDU; + } + + public BerInteger getConcludeErrorPDU() { + return concludeErrorPDU; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (concludeErrorPDU != null) { + codeLength += concludeErrorPDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 11 + os.write(0x8B); + codeLength += 1; + return codeLength; + } + + if (concludeResponsePDU != null) { + codeLength += concludeResponsePDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 10 + os.write(0x8A); + codeLength += 1; + return codeLength; + } + + if (concludeRequestPDU != null) { + codeLength += concludeRequestPDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 9 + os.write(0x89); + codeLength += 1; + return codeLength; + } + + if (cancelErrorPDU != null) { + codeLength += cancelErrorPDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 8 + os.write(0x88); + codeLength += 1; + return codeLength; + } + + if (cancelResponsePDU != null) { + codeLength += cancelResponsePDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 7 + os.write(0x87); + codeLength += 1; + return codeLength; + } + + if (cancelRequestPDU != null) { + codeLength += cancelRequestPDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 6 + os.write(0x86); + codeLength += 1; + return codeLength; + } + + if (pduError != null) { + codeLength += pduError.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 5 + os.write(0x85); + codeLength += 1; + return codeLength; + } + + if (unconfirmedPDU != null) { + codeLength += unconfirmedPDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 4 + os.write(0x84); + codeLength += 1; + return codeLength; + } + + if (confirmedErrorPDU != null) { + codeLength += confirmedErrorPDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 3 + os.write(0x83); + codeLength += 1; + return codeLength; + } + + if (confirmedResponsePDU != null) { + codeLength += confirmedResponsePDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + return codeLength; + } + + if (confirmedRequestPDU != null) { + codeLength += confirmedRequestPDU.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + 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, 1)) { + confirmedRequestPDU = new BerInteger(); + codeLength += confirmedRequestPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { + confirmedResponsePDU = new BerInteger(); + codeLength += confirmedResponsePDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { + confirmedErrorPDU = new BerInteger(); + codeLength += confirmedErrorPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { + unconfirmedPDU = new BerInteger(); + codeLength += unconfirmedPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { + pduError = new BerInteger(); + codeLength += pduError.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { + cancelRequestPDU = new BerInteger(); + codeLength += cancelRequestPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) { + cancelResponsePDU = new BerInteger(); + codeLength += cancelResponsePDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) { + cancelErrorPDU = new BerInteger(); + codeLength += cancelErrorPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { + concludeRequestPDU = new BerInteger(); + codeLength += concludeRequestPDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { + concludeResponsePDU = new BerInteger(); + codeLength += concludeResponsePDU.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) { + concludeErrorPDU = new BerInteger(); + codeLength += concludeErrorPDU.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (confirmedRequestPDU != null) { + sb.append("confirmedRequestPDU: ").append(confirmedRequestPDU); + return; + } + + if (confirmedResponsePDU != null) { + sb.append("confirmedResponsePDU: ").append(confirmedResponsePDU); + return; + } + + if (confirmedErrorPDU != null) { + sb.append("confirmedErrorPDU: ").append(confirmedErrorPDU); + return; + } + + if (unconfirmedPDU != null) { + sb.append("unconfirmedPDU: ").append(unconfirmedPDU); + return; + } + + if (pduError != null) { + sb.append("pduError: ").append(pduError); + return; + } + + if (cancelRequestPDU != null) { + sb.append("cancelRequestPDU: ").append(cancelRequestPDU); + return; + } + + if (cancelResponsePDU != null) { + sb.append("cancelResponsePDU: ").append(cancelResponsePDU); + return; + } + + if (cancelErrorPDU != null) { + sb.append("cancelErrorPDU: ").append(cancelErrorPDU); + return; + } + + if (concludeRequestPDU != null) { + sb.append("concludeRequestPDU: ").append(concludeRequestPDU); + return; + } + + if (concludeResponsePDU != null) { + sb.append("concludeResponsePDU: ").append(concludeResponsePDU); + return; + } + + if (concludeErrorPDU != null) { + sb.append("concludeErrorPDU: ").append(concludeErrorPDU); + return; + } + + sb.append(""); + } + + } + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private Unsigned32 originalInvokeID = null; + private RejectReason rejectReason = null; + + public RejectPDU() { + } + + public RejectPDU(byte[] code) { + this.code = code; + } + + public void setOriginalInvokeID(Unsigned32 originalInvokeID) { + this.originalInvokeID = originalInvokeID; + } + + public Unsigned32 getOriginalInvokeID() { + return originalInvokeID; + } + + public void setRejectReason(RejectReason rejectReason) { + this.rejectReason = rejectReason; + } + + public RejectReason getRejectReason() { + return rejectReason; + } + + 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 += rejectReason.encode(os); + + if (originalInvokeID != null) { + codeLength += originalInvokeID.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)) { + originalInvokeID = new Unsigned32(); + subCodeLength += originalInvokeID.decode(is, false); + subCodeLength += berTag.decode(is); + } + + rejectReason = new RejectReason(); + subCodeLength += rejectReason.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + 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 (originalInvokeID != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("originalInvokeID: ").append(originalInvokeID); + firstSelectedElement = false; + } + + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (rejectReason != null) { + sb.append("rejectReason: "); + rejectReason.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("rejectReason: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceError.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceError.java index 8dfbfa9..1a269b9 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceError.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceError.java @@ -1,646 +1,649 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerInteger; -import org.openmuc.jasn1.ber.types.string.BerVisibleString; public class ServiceError implements Serializable { - private static final long serialVersionUID = 1L; - - public static class ErrorClass implements Serializable { - - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private BerInteger vmdState = null; - private BerInteger applicationReference = null; - private BerInteger definition = null; - private BerInteger resource = null; - private BerInteger service = null; - private BerInteger servicePreempt = null; - private BerInteger timeResolution = null; - private BerInteger access = null; - private BerInteger initiate = null; - private BerInteger conclude = null; - private BerInteger cancel = null; - private BerInteger file = null; - private BerInteger others = null; - - public ErrorClass() { - } - - public ErrorClass(byte[] code) { - this.code = code; - } - - public void setVmdState(BerInteger vmdState) { - this.vmdState = vmdState; - } - - public BerInteger getVmdState() { - return vmdState; - } - - public void setApplicationReference(BerInteger applicationReference) { - this.applicationReference = applicationReference; - } - - public BerInteger getApplicationReference() { - return applicationReference; - } - - public void setDefinition(BerInteger definition) { - this.definition = definition; - } - - public BerInteger getDefinition() { - return definition; - } - - public void setResource(BerInteger resource) { - this.resource = resource; - } - - public BerInteger getResource() { - return resource; - } - - public void setService(BerInteger service) { - this.service = service; - } - - public BerInteger getService() { - return service; - } - - public void setServicePreempt(BerInteger servicePreempt) { - this.servicePreempt = servicePreempt; - } - - public BerInteger getServicePreempt() { - return servicePreempt; - } - - public void setTimeResolution(BerInteger timeResolution) { - this.timeResolution = timeResolution; - } - - public BerInteger getTimeResolution() { - return timeResolution; - } - - public void setAccess(BerInteger access) { - this.access = access; - } - - public BerInteger getAccess() { - return access; - } - - public void setInitiate(BerInteger initiate) { - this.initiate = initiate; - } - - public BerInteger getInitiate() { - return initiate; - } - - public void setConclude(BerInteger conclude) { - this.conclude = conclude; - } - - public BerInteger getConclude() { - return conclude; - } - - public void setCancel(BerInteger cancel) { - this.cancel = cancel; - } - - public BerInteger getCancel() { - return cancel; - } - - public void setFile(BerInteger file) { - this.file = file; - } - - public BerInteger getFile() { - return file; - } - - public void setOthers(BerInteger others) { - this.others = others; - } - - public BerInteger getOthers() { - return others; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (others != null) { - codeLength += others.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 12 - os.write(0x8C); - codeLength += 1; - return codeLength; - } - - if (file != null) { - codeLength += file.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 11 - os.write(0x8B); - codeLength += 1; - return codeLength; - } - - if (cancel != null) { - codeLength += cancel.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 10 - os.write(0x8A); - codeLength += 1; - return codeLength; - } - - if (conclude != null) { - codeLength += conclude.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 9 - os.write(0x89); - codeLength += 1; - return codeLength; - } - - if (initiate != null) { - codeLength += initiate.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 8 - os.write(0x88); - codeLength += 1; - return codeLength; - } - - if (access != null) { - codeLength += access.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 7 - os.write(0x87); - codeLength += 1; - return codeLength; - } - - if (timeResolution != null) { - codeLength += timeResolution.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 6 - os.write(0x86); - codeLength += 1; - return codeLength; - } - - if (servicePreempt != null) { - codeLength += servicePreempt.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 5 - os.write(0x85); - codeLength += 1; - return codeLength; - } - - if (service != null) { - codeLength += service.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 4 - os.write(0x84); - codeLength += 1; - return codeLength; - } - - if (resource != null) { - codeLength += resource.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 3 - os.write(0x83); - codeLength += 1; - return codeLength; - } - - if (definition != null) { - codeLength += definition.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - return codeLength; - } - - if (applicationReference != null) { - codeLength += applicationReference.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - return codeLength; - } - - if (vmdState != null) { - codeLength += vmdState.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 0 - os.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)) { - vmdState = new BerInteger(); - codeLength += vmdState.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { - applicationReference = new BerInteger(); - codeLength += applicationReference.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { - definition = new BerInteger(); - codeLength += definition.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { - resource = new BerInteger(); - codeLength += resource.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { - service = new BerInteger(); - codeLength += service.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { - servicePreempt = new BerInteger(); - codeLength += servicePreempt.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { - timeResolution = new BerInteger(); - codeLength += timeResolution.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) { - access = new BerInteger(); - codeLength += access.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) { - initiate = new BerInteger(); - codeLength += initiate.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { - conclude = new BerInteger(); - codeLength += conclude.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { - cancel = new BerInteger(); - codeLength += cancel.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) { - file = new BerInteger(); - codeLength += file.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) { - others = new BerInteger(); - codeLength += others.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (vmdState != null) { - sb.append("vmdState: ").append(vmdState); - return; - } - - if (applicationReference != null) { - sb.append("applicationReference: ").append(applicationReference); - return; - } - - if (definition != null) { - sb.append("definition: ").append(definition); - return; - } - - if (resource != null) { - sb.append("resource: ").append(resource); - return; - } - - if (service != null) { - sb.append("service: ").append(service); - return; - } - - if (servicePreempt != null) { - sb.append("servicePreempt: ").append(servicePreempt); - return; - } - - if (timeResolution != null) { - sb.append("timeResolution: ").append(timeResolution); - return; - } - - if (access != null) { - sb.append("access: ").append(access); - return; - } - - if (initiate != null) { - sb.append("initiate: ").append(initiate); - return; - } - - if (conclude != null) { - sb.append("conclude: ").append(conclude); - return; - } - - if (cancel != null) { - sb.append("cancel: ").append(cancel); - return; - } - - if (file != null) { - sb.append("file: ").append(file); - return; - } - - if (others != null) { - sb.append("others: ").append(others); - return; - } - - sb.append(""); - } - - } - - public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); - - public byte[] code = null; - private ErrorClass errorClass = null; - private BerInteger additionalCode = null; - private BerVisibleString additionalDescription = null; - - public ServiceError() { - } - - public ServiceError(byte[] code) { - this.code = code; - } - - public void setErrorClass(ErrorClass errorClass) { - this.errorClass = errorClass; - } - - public ErrorClass getErrorClass() { - return errorClass; - } - - public void setAdditionalCode(BerInteger additionalCode) { - this.additionalCode = additionalCode; - } - - public BerInteger getAdditionalCode() { - return additionalCode; - } - - public void setAdditionalDescription(BerVisibleString additionalDescription) { - this.additionalDescription = additionalDescription; - } - - public BerVisibleString getAdditionalDescription() { - return additionalDescription; - } - - 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; - int sublength; - - if (additionalDescription != null) { - codeLength += additionalDescription.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 2 - os.write(0x82); - codeLength += 1; - } - - if (additionalCode != null) { - codeLength += additionalCode.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - } - - sublength = errorClass.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - subCodeLength += length.decode(is); - errorClass = new ErrorClass(); - subCodeLength += errorClass.decode(is, null); - if (subCodeLength == totalLength) { - return codeLength; - } - 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)) { - additionalCode = new BerInteger(); - subCodeLength += additionalCode.decode(is, false); - if (subCodeLength == totalLength) { - return codeLength; - } - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { - additionalDescription = new BerVisibleString(); - subCodeLength += additionalDescription.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 (errorClass != null) { - sb.append("errorClass: "); - errorClass.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("errorClass: "); - } - - if (additionalCode != null) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("additionalCode: ").append(additionalCode); - } - - if (additionalDescription != null) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("additionalDescription: ").append(additionalDescription); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class ErrorClass implements Serializable { + + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private BerInteger vmdState = null; + private BerInteger applicationReference = null; + private BerInteger definition = null; + private BerInteger resource = null; + private BerInteger service = null; + private BerInteger servicePreempt = null; + private BerInteger timeResolution = null; + private BerInteger access = null; + private BerInteger initiate = null; + private BerInteger conclude = null; + private BerInteger cancel = null; + private BerInteger file = null; + private BerInteger others = null; + + public ErrorClass() { + } + + public ErrorClass(byte[] code) { + this.code = code; + } + + public void setVmdState(BerInteger vmdState) { + this.vmdState = vmdState; + } + + public BerInteger getVmdState() { + return vmdState; + } + + public void setApplicationReference(BerInteger applicationReference) { + this.applicationReference = applicationReference; + } + + public BerInteger getApplicationReference() { + return applicationReference; + } + + public void setDefinition(BerInteger definition) { + this.definition = definition; + } + + public BerInteger getDefinition() { + return definition; + } + + public void setResource(BerInteger resource) { + this.resource = resource; + } + + public BerInteger getResource() { + return resource; + } + + public void setService(BerInteger service) { + this.service = service; + } + + public BerInteger getService() { + return service; + } + + public void setServicePreempt(BerInteger servicePreempt) { + this.servicePreempt = servicePreempt; + } + + public BerInteger getServicePreempt() { + return servicePreempt; + } + + public void setTimeResolution(BerInteger timeResolution) { + this.timeResolution = timeResolution; + } + + public BerInteger getTimeResolution() { + return timeResolution; + } + + public void setAccess(BerInteger access) { + this.access = access; + } + + public BerInteger getAccess() { + return access; + } + + public void setInitiate(BerInteger initiate) { + this.initiate = initiate; + } + + public BerInteger getInitiate() { + return initiate; + } + + public void setConclude(BerInteger conclude) { + this.conclude = conclude; + } + + public BerInteger getConclude() { + return conclude; + } + + public void setCancel(BerInteger cancel) { + this.cancel = cancel; + } + + public BerInteger getCancel() { + return cancel; + } + + public void setFile(BerInteger file) { + this.file = file; + } + + public BerInteger getFile() { + return file; + } + + public void setOthers(BerInteger others) { + this.others = others; + } + + public BerInteger getOthers() { + return others; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (others != null) { + codeLength += others.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 12 + os.write(0x8C); + codeLength += 1; + return codeLength; + } + + if (file != null) { + codeLength += file.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 11 + os.write(0x8B); + codeLength += 1; + return codeLength; + } + + if (cancel != null) { + codeLength += cancel.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 10 + os.write(0x8A); + codeLength += 1; + return codeLength; + } + + if (conclude != null) { + codeLength += conclude.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 9 + os.write(0x89); + codeLength += 1; + return codeLength; + } + + if (initiate != null) { + codeLength += initiate.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 8 + os.write(0x88); + codeLength += 1; + return codeLength; + } + + if (access != null) { + codeLength += access.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 7 + os.write(0x87); + codeLength += 1; + return codeLength; + } + + if (timeResolution != null) { + codeLength += timeResolution.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 6 + os.write(0x86); + codeLength += 1; + return codeLength; + } + + if (servicePreempt != null) { + codeLength += servicePreempt.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 5 + os.write(0x85); + codeLength += 1; + return codeLength; + } + + if (service != null) { + codeLength += service.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 4 + os.write(0x84); + codeLength += 1; + return codeLength; + } + + if (resource != null) { + codeLength += resource.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 3 + os.write(0x83); + codeLength += 1; + return codeLength; + } + + if (definition != null) { + codeLength += definition.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + return codeLength; + } + + if (applicationReference != null) { + codeLength += applicationReference.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + return codeLength; + } + + if (vmdState != null) { + codeLength += vmdState.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 0 + os.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)) { + vmdState = new BerInteger(); + codeLength += vmdState.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { + applicationReference = new BerInteger(); + codeLength += applicationReference.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { + definition = new BerInteger(); + codeLength += definition.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { + resource = new BerInteger(); + codeLength += resource.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { + service = new BerInteger(); + codeLength += service.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { + servicePreempt = new BerInteger(); + codeLength += servicePreempt.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { + timeResolution = new BerInteger(); + codeLength += timeResolution.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) { + access = new BerInteger(); + codeLength += access.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) { + initiate = new BerInteger(); + codeLength += initiate.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { + conclude = new BerInteger(); + codeLength += conclude.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { + cancel = new BerInteger(); + codeLength += cancel.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) { + file = new BerInteger(); + codeLength += file.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) { + others = new BerInteger(); + codeLength += others.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (vmdState != null) { + sb.append("vmdState: ").append(vmdState); + return; + } + + if (applicationReference != null) { + sb.append("applicationReference: ").append(applicationReference); + return; + } + + if (definition != null) { + sb.append("definition: ").append(definition); + return; + } + + if (resource != null) { + sb.append("resource: ").append(resource); + return; + } + + if (service != null) { + sb.append("service: ").append(service); + return; + } + + if (servicePreempt != null) { + sb.append("servicePreempt: ").append(servicePreempt); + return; + } + + if (timeResolution != null) { + sb.append("timeResolution: ").append(timeResolution); + return; + } + + if (access != null) { + sb.append("access: ").append(access); + return; + } + + if (initiate != null) { + sb.append("initiate: ").append(initiate); + return; + } + + if (conclude != null) { + sb.append("conclude: ").append(conclude); + return; + } + + if (cancel != null) { + sb.append("cancel: ").append(cancel); + return; + } + + if (file != null) { + sb.append("file: ").append(file); + return; + } + + if (others != null) { + sb.append("others: ").append(others); + return; + } + + sb.append(""); + } + + } + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private ErrorClass errorClass = null; + private BerInteger additionalCode = null; + private BerVisibleString additionalDescription = null; + + public ServiceError() { + } + + public ServiceError(byte[] code) { + this.code = code; + } + + public void setErrorClass(ErrorClass errorClass) { + this.errorClass = errorClass; + } + + public ErrorClass getErrorClass() { + return errorClass; + } + + public void setAdditionalCode(BerInteger additionalCode) { + this.additionalCode = additionalCode; + } + + public BerInteger getAdditionalCode() { + return additionalCode; + } + + public void setAdditionalDescription(BerVisibleString additionalDescription) { + this.additionalDescription = additionalDescription; + } + + public BerVisibleString getAdditionalDescription() { + return additionalDescription; + } + + 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; + int sublength; + + if (additionalDescription != null) { + codeLength += additionalDescription.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 2 + os.write(0x82); + codeLength += 1; + } + + if (additionalCode != null) { + codeLength += additionalCode.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + } + + sublength = errorClass.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + subCodeLength += length.decode(is); + errorClass = new ErrorClass(); + subCodeLength += errorClass.decode(is, null); + if (subCodeLength == totalLength) { + return codeLength; + } + 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)) { + additionalCode = new BerInteger(); + subCodeLength += additionalCode.decode(is, false); + if (subCodeLength == totalLength) { + return codeLength; + } + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) { + additionalDescription = new BerVisibleString(); + subCodeLength += additionalDescription.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(); + } + + 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 (errorClass != null) { + sb.append("errorClass: "); + errorClass.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("errorClass: "); + } + + if (additionalCode != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("additionalCode: ").append(additionalCode); + } + + if (additionalDescription != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("additionalDescription: ").append(additionalDescription); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceSupportOptions.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceSupportOptions.java index b445c08..701149f 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceSupportOptions.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/ServiceSupportOptions.java @@ -1,28 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.BerBitString; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class ServiceSupportOptions extends BerBitString { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public ServiceSupportOptions() { - } + public ServiceSupportOptions() { + } - public ServiceSupportOptions(byte[] code) { - super(code); - } + public ServiceSupportOptions(byte[] code) { + super(code); + } - public ServiceSupportOptions(byte[] value, int numBits) { - super(value, numBits); - } + public ServiceSupportOptions(byte[] value, int numBits) { + super(value, numBits); + } - public ServiceSupportOptions(boolean[] value) { - super(value); - } + public ServiceSupportOptions(boolean[] value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TimeOfDay.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TimeOfDay.java index e4f3eef..8792636 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TimeOfDay.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TimeOfDay.java @@ -1,20 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.BerOctetString; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class TimeOfDay extends BerOctetString { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public TimeOfDay() { - } + public TimeOfDay() { + } - public TimeOfDay(byte[] value) { - super(value); - } + public TimeOfDay(byte[] value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TypeDescription.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TypeDescription.java index 6569a96..247bd1d 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TypeDescription.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TypeDescription.java @@ -1,1228 +1,1221 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerBoolean; -import org.openmuc.jasn1.ber.types.BerInteger; -import org.openmuc.jasn1.ber.types.BerNull; public class TypeDescription implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - - public static class Array 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 BerBoolean packed = null; - private Unsigned32 numberOfElements = null; - private TypeSpecification elementType = null; - - public Array() { - } - - public Array(byte[] code) { - this.code = code; - } - - public void setPacked(BerBoolean packed) { - this.packed = packed; - } - - public BerBoolean getPacked() { - return packed; - } - - public void setNumberOfElements(Unsigned32 numberOfElements) { - this.numberOfElements = numberOfElements; - } - - public Unsigned32 getNumberOfElements() { - return numberOfElements; - } - - public void setElementType(TypeSpecification elementType) { - this.elementType = elementType; - } - - public TypeSpecification getElementType() { - return elementType; - } - - 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; - int sublength; - - sublength = elementType.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 - os.write(0xA2); - codeLength += 1; - - codeLength += numberOfElements.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - - if (packed != null) { - codeLength += packed.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)) { - packed = new BerBoolean(); - subCodeLength += packed.decode(is, false); - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { - numberOfElements = new Unsigned32(); - subCodeLength += numberOfElements.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.CONSTRUCTED, 2)) { - subCodeLength += length.decode(is); - elementType = new TypeSpecification(); - subCodeLength += elementType.decode(is, null); - 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 (packed != null) { - sb.append("\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("packed: ").append(packed); - firstSelectedElement = false; - } - - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (numberOfElements != null) { - sb.append("numberOfElements: ").append(numberOfElements); - } - else { - sb.append("numberOfElements: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (elementType != null) { - sb.append("elementType: "); - elementType.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("elementType: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - public static class Structure implements Serializable { - - private static final long serialVersionUID = 1L; - - public static class Components implements Serializable { - - private static final long serialVersionUID = 1L; - - public static class SEQUENCE 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 Identifier componentName = null; - private TypeSpecification componentType = null; - - public SEQUENCE() { - } - - public SEQUENCE(byte[] code) { - this.code = code; - } - - public void setComponentName(Identifier componentName) { - this.componentName = componentName; - } - - public Identifier getComponentName() { - return componentName; - } - - public void setComponentType(TypeSpecification componentType) { - this.componentType = componentType; - } - - public TypeSpecification getComponentType() { - return componentType; - } - - 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; - int sublength; - - sublength = componentType.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - - if (componentName != null) { - codeLength += componentName.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)) { - componentName = new Identifier(); - subCodeLength += componentName.decode(is, false); - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - subCodeLength += length.decode(is); - componentType = new TypeSpecification(); - subCodeLength += componentType.decode(is, null); - 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 (componentName != null) { - sb.append("\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("componentName: ").append(componentName); - firstSelectedElement = false; - } - - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (componentType != null) { - sb.append("componentType: "); - componentType.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("componentType: "); - } - - 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 List seqOf = null; - - public Components() { - seqOf = new ArrayList<>(); - } - - public Components(byte[] code) { - this.code = code; - } - - public List getSEQUENCE() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os, true); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - SEQUENCE element = new SEQUENCE(); - subCodeLength += element.decode(is, true); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength - + " but has " + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - 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 BerBoolean packed = null; - private Components components = null; - - public Structure() { - } - - public Structure(byte[] code) { - this.code = code; - } - - public void setPacked(BerBoolean packed) { - this.packed = packed; - } - - public BerBoolean getPacked() { - return packed; - } - - public void setComponents(Components components) { - this.components = components; - } - - public Components getComponents() { - return components; - } - - 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 += components.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - - if (packed != null) { - codeLength += packed.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)) { - packed = new BerBoolean(); - subCodeLength += packed.decode(is, false); - subCodeLength += berTag.decode(is); - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - components = new Components(); - subCodeLength += components.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 (packed != null) { - sb.append("\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("packed: ").append(packed); - firstSelectedElement = false; - } - - if (!firstSelectedElement) { - sb.append(",\n"); - } - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (components != null) { - sb.append("components: "); - components.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("components: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - public static class FloatingPoint 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 Unsigned8 formatWidth = null; - private Unsigned8 exponentWidth = null; - - public FloatingPoint() { - } - - public FloatingPoint(byte[] code) { - this.code = code; - } - - public void setFormatWidth(Unsigned8 formatWidth) { - this.formatWidth = formatWidth; - } - - public Unsigned8 getFormatWidth() { - return formatWidth; - } - - public void setExponentWidth(Unsigned8 exponentWidth) { - this.exponentWidth = exponentWidth; - } - - public Unsigned8 getExponentWidth() { - return exponentWidth; - } - - 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 += exponentWidth.encode(os, true); - - codeLength += formatWidth.encode(os, true); - - 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(BerInteger.tag)) { - formatWidth = new Unsigned8(); - subCodeLength += formatWidth.decode(is, false); - subCodeLength += berTag.decode(is); - } - else { - throw new IOException("Tag does not match the mandatory sequence element tag."); - } - - if (berTag.equals(BerInteger.tag)) { - exponentWidth = new Unsigned8(); - subCodeLength += exponentWidth.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 (formatWidth != null) { - sb.append("formatWidth: ").append(formatWidth); - } - else { - sb.append("formatWidth: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (exponentWidth != null) { - sb.append("exponentWidth: ").append(exponentWidth); - } - else { - sb.append("exponentWidth: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } - - } - - private Array array = null; - private Structure structure = null; - private BerNull bool = null; - private Integer32 bitString = null; - private Unsigned8 integer = null; - private Unsigned8 unsigned = null; - private FloatingPoint floatingPoint = null; - private Integer32 octetString = null; - private Integer32 visibleString = null; - private BerBoolean binaryTime = null; - private Integer32 mMSString = null; - private BerNull utcTime = null; - - public TypeDescription() { - } - - public TypeDescription(byte[] code) { - this.code = code; - } - - public void setArray(Array array) { - this.array = array; - } - - public Array getArray() { - return array; - } - - public void setStructure(Structure structure) { - this.structure = structure; - } - - public Structure getStructure() { - return structure; - } - - public void setBool(BerNull bool) { - this.bool = bool; - } - - public BerNull getBool() { - return bool; - } - - public void setBitString(Integer32 bitString) { - this.bitString = bitString; - } - - public Integer32 getBitString() { - return bitString; - } - - public void setInteger(Unsigned8 integer) { - this.integer = integer; - } - - public Unsigned8 getInteger() { - return integer; - } - - public void setUnsigned(Unsigned8 unsigned) { - this.unsigned = unsigned; - } - - public Unsigned8 getUnsigned() { - return unsigned; - } - - public void setFloatingPoint(FloatingPoint floatingPoint) { - this.floatingPoint = floatingPoint; - } - - public FloatingPoint getFloatingPoint() { - return floatingPoint; - } - - public void setOctetString(Integer32 octetString) { - this.octetString = octetString; - } - - public Integer32 getOctetString() { - return octetString; - } - - public void setVisibleString(Integer32 visibleString) { - this.visibleString = visibleString; - } - - public Integer32 getVisibleString() { - return visibleString; - } - - public void setBinaryTime(BerBoolean binaryTime) { - this.binaryTime = binaryTime; - } - - public BerBoolean getBinaryTime() { - return binaryTime; - } - - public void setMMSString(Integer32 mMSString) { - this.mMSString = mMSString; - } - - public Integer32 getMMSString() { - return mMSString; - } - - public void setUtcTime(BerNull utcTime) { - this.utcTime = utcTime; - } - - public BerNull getUtcTime() { - return utcTime; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (utcTime != null) { - codeLength += utcTime.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 17 - os.write(0x91); - codeLength += 1; - return codeLength; - } - - if (mMSString != null) { - codeLength += mMSString.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 16 - os.write(0x90); - codeLength += 1; - return codeLength; - } - - if (binaryTime != null) { - codeLength += binaryTime.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 12 - os.write(0x8C); - codeLength += 1; - return codeLength; - } - - if (visibleString != null) { - codeLength += visibleString.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 10 - os.write(0x8A); - codeLength += 1; - return codeLength; - } - - if (octetString != null) { - codeLength += octetString.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 9 - os.write(0x89); - codeLength += 1; - return codeLength; - } - - if (floatingPoint != null) { - codeLength += floatingPoint.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 7 - os.write(0xA7); - codeLength += 1; - return codeLength; - } - - if (unsigned != null) { - codeLength += unsigned.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 6 - os.write(0x86); - codeLength += 1; - return codeLength; - } - - if (integer != null) { - codeLength += integer.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 5 - os.write(0x85); - codeLength += 1; - return codeLength; - } - - if (bitString != null) { - codeLength += bitString.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 4 - os.write(0x84); - codeLength += 1; - return codeLength; - } - - if (bool != null) { - codeLength += bool.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 3 - os.write(0x83); - codeLength += 1; - return codeLength; - } - - if (structure != null) { - codeLength += structure.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 - os.write(0xA2); - codeLength += 1; - return codeLength; - } - - if (array != null) { - codeLength += array.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - 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.CONSTRUCTED, 1)) { - array = new Array(); - codeLength += array.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { - structure = new Structure(); - codeLength += structure.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { - bool = new BerNull(); - codeLength += bool.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { - bitString = new Integer32(); - codeLength += bitString.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { - integer = new Unsigned8(); - codeLength += integer.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { - unsigned = new Unsigned8(); - codeLength += unsigned.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 7)) { - floatingPoint = new FloatingPoint(); - codeLength += floatingPoint.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { - octetString = new Integer32(); - codeLength += octetString.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { - visibleString = new Integer32(); - codeLength += visibleString.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) { - binaryTime = new BerBoolean(); - codeLength += binaryTime.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 16)) { - mMSString = new Integer32(); - codeLength += mMSString.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 17)) { - utcTime = new BerNull(); - codeLength += utcTime.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (array != null) { - sb.append("array: "); - array.appendAsString(sb, indentLevel + 1); - return; - } - - if (structure != null) { - sb.append("structure: "); - structure.appendAsString(sb, indentLevel + 1); - return; - } - - if (bool != null) { - sb.append("bool: ").append(bool); - return; - } - - if (bitString != null) { - sb.append("bitString: ").append(bitString); - return; - } - - if (integer != null) { - sb.append("integer: ").append(integer); - return; - } - - if (unsigned != null) { - sb.append("unsigned: ").append(unsigned); - return; - } - - if (floatingPoint != null) { - sb.append("floatingPoint: "); - floatingPoint.appendAsString(sb, indentLevel + 1); - return; - } - - if (octetString != null) { - sb.append("octetString: ").append(octetString); - return; - } - - if (visibleString != null) { - sb.append("visibleString: ").append(visibleString); - return; - } - - if (binaryTime != null) { - sb.append("binaryTime: ").append(binaryTime); - return; - } - - if (mMSString != null) { - sb.append("mMSString: ").append(mMSString); - return; - } - - if (utcTime != null) { - sb.append("utcTime: ").append(utcTime); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + public static class Array 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 BerBoolean packed = null; + private Unsigned32 numberOfElements = null; + private TypeSpecification elementType = null; + + public Array() { + } + + public Array(byte[] code) { + this.code = code; + } + + public void setPacked(BerBoolean packed) { + this.packed = packed; + } + + public BerBoolean getPacked() { + return packed; + } + + public void setNumberOfElements(Unsigned32 numberOfElements) { + this.numberOfElements = numberOfElements; + } + + public Unsigned32 getNumberOfElements() { + return numberOfElements; + } + + public void setElementType(TypeSpecification elementType) { + this.elementType = elementType; + } + + public TypeSpecification getElementType() { + return elementType; + } + + 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; + int sublength; + + sublength = elementType.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 + os.write(0xA2); + codeLength += 1; + + codeLength += numberOfElements.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + + if (packed != null) { + codeLength += packed.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)) { + packed = new BerBoolean(); + subCodeLength += packed.decode(is, false); + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { + numberOfElements = new Unsigned32(); + subCodeLength += numberOfElements.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.CONSTRUCTED, 2)) { + subCodeLength += length.decode(is); + elementType = new TypeSpecification(); + subCodeLength += elementType.decode(is, null); + 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(); + } + + 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 (packed != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("packed: ").append(packed); + firstSelectedElement = false; + } + + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (numberOfElements != null) { + sb.append("numberOfElements: ").append(numberOfElements); + } + else { + sb.append("numberOfElements: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (elementType != null) { + sb.append("elementType: "); + elementType.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("elementType: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + public static class Structure implements Serializable { + + private static final long serialVersionUID = 1L; + + public static class Components implements Serializable { + + private static final long serialVersionUID = 1L; + + public static class SEQUENCE 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 Identifier componentName = null; + private TypeSpecification componentType = null; + + public SEQUENCE() { + } + + public SEQUENCE(byte[] code) { + this.code = code; + } + + public void setComponentName(Identifier componentName) { + this.componentName = componentName; + } + + public Identifier getComponentName() { + return componentName; + } + + public void setComponentType(TypeSpecification componentType) { + this.componentType = componentType; + } + + public TypeSpecification getComponentType() { + return componentType; + } + + 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; + int sublength; + + sublength = componentType.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + + if (componentName != null) { + codeLength += componentName.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)) { + componentName = new Identifier(); + subCodeLength += componentName.decode(is, false); + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + subCodeLength += length.decode(is); + componentType = new TypeSpecification(); + subCodeLength += componentType.decode(is, null); + 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(); + } + + 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 (componentName != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("componentName: ").append(componentName); + firstSelectedElement = false; + } + + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (componentType != null) { + sb.append("componentType: "); + componentType.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("componentType: "); + } + + 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 List seqOf = null; + + public Components() { + seqOf = new ArrayList(); + } + + public Components(byte[] code) { + this.code = code; + } + + public List getSEQUENCE() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os, true); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + SEQUENCE element = new SEQUENCE(); + subCodeLength += element.decode(is, true); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + 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 BerBoolean packed = null; + private Components components = null; + + public Structure() { + } + + public Structure(byte[] code) { + this.code = code; + } + + public void setPacked(BerBoolean packed) { + this.packed = packed; + } + + public BerBoolean getPacked() { + return packed; + } + + public void setComponents(Components components) { + this.components = components; + } + + public Components getComponents() { + return components; + } + + 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 += components.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + + if (packed != null) { + codeLength += packed.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)) { + packed = new BerBoolean(); + subCodeLength += packed.decode(is, false); + subCodeLength += berTag.decode(is); + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + components = new Components(); + subCodeLength += components.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(); + } + + 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 (packed != null) { + sb.append("\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("packed: ").append(packed); + firstSelectedElement = false; + } + + if (!firstSelectedElement) { + sb.append(",\n"); + } + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (components != null) { + sb.append("components: "); + components.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("components: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + public static class FloatingPoint 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 Unsigned8 formatWidth = null; + private Unsigned8 exponentWidth = null; + + public FloatingPoint() { + } + + public FloatingPoint(byte[] code) { + this.code = code; + } + + public void setFormatWidth(Unsigned8 formatWidth) { + this.formatWidth = formatWidth; + } + + public Unsigned8 getFormatWidth() { + return formatWidth; + } + + public void setExponentWidth(Unsigned8 exponentWidth) { + this.exponentWidth = exponentWidth; + } + + public Unsigned8 getExponentWidth() { + return exponentWidth; + } + + 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 += exponentWidth.encode(os, true); + + codeLength += formatWidth.encode(os, true); + + 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(Unsigned8.tag)) { + formatWidth = new Unsigned8(); + subCodeLength += formatWidth.decode(is, false); + subCodeLength += berTag.decode(is); + } + else { + throw new IOException("Tag does not match the mandatory sequence element tag."); + } + + if (berTag.equals(Unsigned8.tag)) { + exponentWidth = new Unsigned8(); + subCodeLength += exponentWidth.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(); + } + + 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 (formatWidth != null) { + sb.append("formatWidth: ").append(formatWidth); + } + else { + sb.append("formatWidth: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (exponentWidth != null) { + sb.append("exponentWidth: ").append(exponentWidth); + } + else { + sb.append("exponentWidth: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } + + } + + private Array array = null; + private Structure structure = null; + private BerNull bool = null; + private Integer32 bitString = null; + private Unsigned8 integer = null; + private Unsigned8 unsigned = null; + private FloatingPoint floatingPoint = null; + private Integer32 octetString = null; + private Integer32 visibleString = null; + private BerBoolean binaryTime = null; + private Integer32 mMSString = null; + private BerNull utcTime = null; + + public TypeDescription() { + } + + public TypeDescription(byte[] code) { + this.code = code; + } + + public void setArray(Array array) { + this.array = array; + } + + public Array getArray() { + return array; + } + + public void setStructure(Structure structure) { + this.structure = structure; + } + + public Structure getStructure() { + return structure; + } + + public void setBool(BerNull bool) { + this.bool = bool; + } + + public BerNull getBool() { + return bool; + } + + public void setBitString(Integer32 bitString) { + this.bitString = bitString; + } + + public Integer32 getBitString() { + return bitString; + } + + public void setInteger(Unsigned8 integer) { + this.integer = integer; + } + + public Unsigned8 getInteger() { + return integer; + } + + public void setUnsigned(Unsigned8 unsigned) { + this.unsigned = unsigned; + } + + public Unsigned8 getUnsigned() { + return unsigned; + } + + public void setFloatingPoint(FloatingPoint floatingPoint) { + this.floatingPoint = floatingPoint; + } + + public FloatingPoint getFloatingPoint() { + return floatingPoint; + } + + public void setOctetString(Integer32 octetString) { + this.octetString = octetString; + } + + public Integer32 getOctetString() { + return octetString; + } + + public void setVisibleString(Integer32 visibleString) { + this.visibleString = visibleString; + } + + public Integer32 getVisibleString() { + return visibleString; + } + + public void setBinaryTime(BerBoolean binaryTime) { + this.binaryTime = binaryTime; + } + + public BerBoolean getBinaryTime() { + return binaryTime; + } + + public void setMMSString(Integer32 mMSString) { + this.mMSString = mMSString; + } + + public Integer32 getMMSString() { + return mMSString; + } + + public void setUtcTime(BerNull utcTime) { + this.utcTime = utcTime; + } + + public BerNull getUtcTime() { + return utcTime; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (utcTime != null) { + codeLength += utcTime.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 17 + os.write(0x91); + codeLength += 1; + return codeLength; + } + + if (mMSString != null) { + codeLength += mMSString.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 16 + os.write(0x90); + codeLength += 1; + return codeLength; + } + + if (binaryTime != null) { + codeLength += binaryTime.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 12 + os.write(0x8C); + codeLength += 1; + return codeLength; + } + + if (visibleString != null) { + codeLength += visibleString.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 10 + os.write(0x8A); + codeLength += 1; + return codeLength; + } + + if (octetString != null) { + codeLength += octetString.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 9 + os.write(0x89); + codeLength += 1; + return codeLength; + } + + if (floatingPoint != null) { + codeLength += floatingPoint.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 7 + os.write(0xA7); + codeLength += 1; + return codeLength; + } + + if (unsigned != null) { + codeLength += unsigned.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 6 + os.write(0x86); + codeLength += 1; + return codeLength; + } + + if (integer != null) { + codeLength += integer.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 5 + os.write(0x85); + codeLength += 1; + return codeLength; + } + + if (bitString != null) { + codeLength += bitString.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 4 + os.write(0x84); + codeLength += 1; + return codeLength; + } + + if (bool != null) { + codeLength += bool.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 3 + os.write(0x83); + codeLength += 1; + return codeLength; + } + + if (structure != null) { + codeLength += structure.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 + os.write(0xA2); + codeLength += 1; + return codeLength; + } + + if (array != null) { + codeLength += array.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + 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.CONSTRUCTED, 1)) { + array = new Array(); + codeLength += array.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { + structure = new Structure(); + codeLength += structure.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) { + bool = new BerNull(); + codeLength += bool.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) { + bitString = new Integer32(); + codeLength += bitString.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) { + integer = new Unsigned8(); + codeLength += integer.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) { + unsigned = new Unsigned8(); + codeLength += unsigned.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 7)) { + floatingPoint = new FloatingPoint(); + codeLength += floatingPoint.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) { + octetString = new Integer32(); + codeLength += octetString.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) { + visibleString = new Integer32(); + codeLength += visibleString.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) { + binaryTime = new BerBoolean(); + codeLength += binaryTime.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 16)) { + mMSString = new Integer32(); + codeLength += mMSString.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 17)) { + utcTime = new BerNull(); + codeLength += utcTime.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (array != null) { + sb.append("array: "); + array.appendAsString(sb, indentLevel + 1); + return; + } + + if (structure != null) { + sb.append("structure: "); + structure.appendAsString(sb, indentLevel + 1); + return; + } + + if (bool != null) { + sb.append("bool: ").append(bool); + return; + } + + if (bitString != null) { + sb.append("bitString: ").append(bitString); + return; + } + + if (integer != null) { + sb.append("integer: ").append(integer); + return; + } + + if (unsigned != null) { + sb.append("unsigned: ").append(unsigned); + return; + } + + if (floatingPoint != null) { + sb.append("floatingPoint: "); + floatingPoint.appendAsString(sb, indentLevel + 1); + return; + } + + if (octetString != null) { + sb.append("octetString: ").append(octetString); + return; + } + + if (visibleString != null) { + sb.append("visibleString: ").append(visibleString); + return; + } + + if (binaryTime != null) { + sb.append("binaryTime: ").append(binaryTime); + return; + } + + if (mMSString != null) { + sb.append("mMSString: ").append(mMSString); + return; + } + + if (utcTime != null) { + sb.append("utcTime: ").append(utcTime); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TypeSpecification.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TypeSpecification.java index a1ca156..a75ca68 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TypeSpecification.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/TypeSpecification.java @@ -1,109 +1,116 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class TypeSpecification implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private TypeDescription typeDescription = null; - - public TypeSpecification() { - } - - public TypeSpecification(byte[] code) { - this.code = code; - } - - public void setTypeDescription(TypeDescription typeDescription) { - this.typeDescription = typeDescription; - } - - public TypeDescription getTypeDescription() { - return typeDescription; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (typeDescription != null) { - codeLength += typeDescription.encode(os); - 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); - } - - typeDescription = new TypeDescription(); - int choiceDecodeLength = typeDescription.decode(is, berTag); - if (choiceDecodeLength != 0) { - return codeLength + choiceDecodeLength; - } - else { - typeDescription = null; - } - - 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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (typeDescription != null) { - sb.append("typeDescription: "); - typeDescription.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private TypeDescription typeDescription = null; + + public TypeSpecification() { + } + + public TypeSpecification(byte[] code) { + this.code = code; + } + + public void setTypeDescription(TypeDescription typeDescription) { + this.typeDescription = typeDescription; + } + + public TypeDescription getTypeDescription() { + return typeDescription; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (typeDescription != null) { + codeLength += typeDescription.encode(os); + 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); + } + + typeDescription = new TypeDescription(); + int choiceDecodeLength = typeDescription.decode(is, berTag); + if (choiceDecodeLength != 0) { + return codeLength + choiceDecodeLength; + } + else { + typeDescription = null; + } + + 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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (typeDescription != null) { + sb.append("typeDescription: "); + typeDescription.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UnconfirmedPDU.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UnconfirmedPDU.java index e473399..2f81343 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UnconfirmedPDU.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UnconfirmedPDU.java @@ -1,134 +1,140 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class UnconfirmedPDU 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 UnconfirmedService service = null; - - public UnconfirmedPDU() { - } - - public UnconfirmedPDU(byte[] code) { - this.code = code; - } - - public void setService(UnconfirmedService service) { - this.service = service; - } - - public UnconfirmedService getService() { - return service; - } - - 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 += service.encode(os); - - 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); - service = new UnconfirmedService(); - subCodeLength += service.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 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 (service != null) { - sb.append("service: "); - service.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("service: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + + public byte[] code = null; + private UnconfirmedService service = null; + + public UnconfirmedPDU() { + } + + public UnconfirmedPDU(byte[] code) { + this.code = code; + } + + public void setService(UnconfirmedService service) { + this.service = service; + } + + public UnconfirmedService getService() { + return service; + } + + 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 += service.encode(os); + + 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); + service = new UnconfirmedService(); + subCodeLength += service.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.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 (service != null) { + sb.append("service: "); + service.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("service: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UnconfirmedService.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UnconfirmedService.java index d2215ce..0b3fc6d 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UnconfirmedService.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UnconfirmedService.java @@ -1,109 +1,116 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class UnconfirmedService implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private InformationReport informationReport = null; - - public UnconfirmedService() { - } - - public UnconfirmedService(byte[] code) { - this.code = code; - } - - public void setInformationReport(InformationReport informationReport) { - this.informationReport = informationReport; - } - - public InformationReport getInformationReport() { - return informationReport; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (informationReport != null) { - codeLength += informationReport.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - informationReport = new InformationReport(); - codeLength += informationReport.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (informationReport != null) { - sb.append("informationReport: "); - informationReport.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private InformationReport informationReport = null; + + public UnconfirmedService() { + } + + public UnconfirmedService(byte[] code) { + this.code = code; + } + + public void setInformationReport(InformationReport informationReport) { + this.informationReport = informationReport; + } + + public InformationReport getInformationReport() { + return informationReport; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (informationReport != null) { + codeLength += informationReport.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + informationReport = new InformationReport(); + codeLength += informationReport.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (informationReport != null) { + sb.append("informationReport: "); + informationReport.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned16.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned16.java index 490a2b2..b3c7db8 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned16.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned16.java @@ -1,30 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.types.BerInteger; public class Unsigned16 extends BerInteger { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public Unsigned16() { - } + public Unsigned16() { + } - public Unsigned16(byte[] code) { - super(code); - } + public Unsigned16(byte[] code) { + super(code); + } - public Unsigned16(BigInteger value) { - super(value); - } + public Unsigned16(BigInteger value) { + super(value); + } - public Unsigned16(long value) { - super(value); - } + public Unsigned16(long value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned32.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned32.java index 5b2aa24..596e1eb 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned32.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned32.java @@ -1,30 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.types.BerInteger; public class Unsigned32 extends BerInteger { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public Unsigned32() { - } + public Unsigned32() { + } - public Unsigned32(byte[] code) { - super(code); - } + public Unsigned32(byte[] code) { + super(code); + } - public Unsigned32(BigInteger value) { - super(value); - } + public Unsigned32(BigInteger value) { + super(value); + } - public Unsigned32(long value) { - super(value); - } + public Unsigned32(long value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned8.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned8.java index 9a4b9cc..d2c7e46 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned8.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/Unsigned8.java @@ -1,30 +1,41 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.types.BerInteger; public class Unsigned8 extends BerInteger { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public Unsigned8() { - } + public Unsigned8() { + } - public Unsigned8(byte[] code) { - super(code); - } + public Unsigned8(byte[] code) { + super(code); + } - public Unsigned8(BigInteger value) { - super(value); - } + public Unsigned8(BigInteger value) { + super(value); + } - public Unsigned8(long value) { - super(value); - } + public Unsigned8(long value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UtcTime.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UtcTime.java index 0c5be45..4462cc5 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UtcTime.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/UtcTime.java @@ -1,20 +1,33 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; -import org.openmuc.jasn1.ber.types.BerOctetString; +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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; + public class UtcTime extends BerOctetString { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public UtcTime() { - } + public UtcTime() { + } - public UtcTime(byte[] value) { - super(value); - } + public UtcTime(byte[] value) { + super(value); + } } diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableAccessSpecification.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableAccessSpecification.java index 1e792d4..9b92e40 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableAccessSpecification.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableAccessSpecification.java @@ -1,144 +1,150 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class VariableAccessSpecification implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private VariableDefs listOfVariable = null; - private ObjectName variableListName = null; - - public VariableAccessSpecification() { - } - - public VariableAccessSpecification(byte[] code) { - this.code = code; - } - - public void setListOfVariable(VariableDefs listOfVariable) { - this.listOfVariable = listOfVariable; - } - - public VariableDefs getListOfVariable() { - return listOfVariable; - } - - public void setVariableListName(ObjectName variableListName) { - this.variableListName = variableListName; - } - - public ObjectName getVariableListName() { - return variableListName; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - int sublength; - - if (variableListName != null) { - sublength = variableListName.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 - os.write(0xA1); - codeLength += 1; - return codeLength; - } - - if (listOfVariable != null) { - codeLength += listOfVariable.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - listOfVariable = new VariableDefs(); - codeLength += listOfVariable.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { - codeLength += BerLength.skip(is); - variableListName = new ObjectName(); - codeLength += variableListName.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (listOfVariable != null) { - sb.append("listOfVariable: "); - listOfVariable.appendAsString(sb, indentLevel + 1); - return; - } - - if (variableListName != null) { - sb.append("variableListName: "); - variableListName.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private VariableDefs listOfVariable = null; + private ObjectName variableListName = null; + + public VariableAccessSpecification() { + } + + public VariableAccessSpecification(byte[] code) { + this.code = code; + } + + public void setListOfVariable(VariableDefs listOfVariable) { + this.listOfVariable = listOfVariable; + } + + public VariableDefs getListOfVariable() { + return listOfVariable; + } + + public void setVariableListName(ObjectName variableListName) { + this.variableListName = variableListName; + } + + public ObjectName getVariableListName() { + return variableListName; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + int sublength; + + if (variableListName != null) { + sublength = variableListName.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 + os.write(0xA1); + codeLength += 1; + return codeLength; + } + + if (listOfVariable != null) { + codeLength += listOfVariable.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + listOfVariable = new VariableDefs(); + codeLength += listOfVariable.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { + codeLength += BerLength.skip(is); + variableListName = new ObjectName(); + codeLength += variableListName.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (listOfVariable != null) { + sb.append("listOfVariable: "); + listOfVariable.appendAsString(sb, indentLevel + 1); + return; + } + + if (variableListName != null) { + sb.append("variableListName: "); + variableListName.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableDefs.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableDefs.java index eadf9d9..6e01756 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableDefs.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableDefs.java @@ -1,299 +1,300 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class VariableDefs implements Serializable { - private static final long serialVersionUID = 1L; - - public static class SEQUENCE 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 VariableSpecification variableSpecification = null; - private AlternateAccess alternateAccess = null; - - public SEQUENCE() { - } - - public SEQUENCE(byte[] code) { - this.code = code; - } - - public void setVariableSpecification(VariableSpecification variableSpecification) { - this.variableSpecification = variableSpecification; - } - - public VariableSpecification getVariableSpecification() { - return variableSpecification; - } - - public void setAlternateAccess(AlternateAccess alternateAccess) { - this.alternateAccess = alternateAccess; - } - - public AlternateAccess getAlternateAccess() { - return alternateAccess; - } - - 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; - if (alternateAccess != null) { - codeLength += alternateAccess.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 5 - os.write(0xA5); - codeLength += 1; - } - - codeLength += variableSpecification.encode(os); - - 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); - variableSpecification = new VariableSpecification(); - subCodeLength += variableSpecification.decode(is, berTag); - if (subCodeLength == totalLength) { - return codeLength; - } - subCodeLength += berTag.decode(is); - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) { - alternateAccess = new AlternateAccess(); - subCodeLength += alternateAccess.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 (variableSpecification != null) { - sb.append("variableSpecification: "); - variableSpecification.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("variableSpecification: "); - } - - if (alternateAccess != null) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - sb.append("alternateAccess: "); - alternateAccess.appendAsString(sb, indentLevel + 1); - } - - 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 List seqOf = null; - - public VariableDefs() { - seqOf = new ArrayList<>(); - } - - public VariableDefs(byte[] code) { - this.code = code; - } - - public List getSEQUENCE() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os, true); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - SEQUENCE element = new SEQUENCE(); - subCodeLength += element.decode(is, true); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " - + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class SEQUENCE 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 VariableSpecification variableSpecification = null; + private AlternateAccess alternateAccess = null; + + public SEQUENCE() { + } + + public SEQUENCE(byte[] code) { + this.code = code; + } + + public void setVariableSpecification(VariableSpecification variableSpecification) { + this.variableSpecification = variableSpecification; + } + + public VariableSpecification getVariableSpecification() { + return variableSpecification; + } + + public void setAlternateAccess(AlternateAccess alternateAccess) { + this.alternateAccess = alternateAccess; + } + + public AlternateAccess getAlternateAccess() { + return alternateAccess; + } + + 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; + if (alternateAccess != null) { + codeLength += alternateAccess.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 5 + os.write(0xA5); + codeLength += 1; + } + + codeLength += variableSpecification.encode(os); + + 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); + variableSpecification = new VariableSpecification(); + subCodeLength += variableSpecification.decode(is, berTag); + if (subCodeLength == totalLength) { + return codeLength; + } + subCodeLength += berTag.decode(is); + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) { + alternateAccess = new AlternateAccess(); + subCodeLength += alternateAccess.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(); + } + + 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 (variableSpecification != null) { + sb.append("variableSpecification: "); + variableSpecification.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("variableSpecification: "); + } + + if (alternateAccess != null) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + sb.append("alternateAccess: "); + alternateAccess.appendAsString(sb, indentLevel + 1); + } + + 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 List seqOf = null; + + public VariableDefs() { + seqOf = new ArrayList(); + } + + public VariableDefs(byte[] code) { + this.code = code; + } + + public List getSEQUENCE() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os, true); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + SEQUENCE element = new SEQUENCE(); + subCodeLength += element.decode(is, true); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableSpecification.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableSpecification.java index 5049fc8..efa7c9e 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableSpecification.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/VariableSpecification.java @@ -1,115 +1,121 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; 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 org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class VariableSpecification implements Serializable { - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private ObjectName name = null; - - public VariableSpecification() { - } - - public VariableSpecification(byte[] code) { - this.code = code; - } - - public void setName(ObjectName name) { - this.name = name; - } - - public ObjectName getName() { - return name; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - int sublength; - - if (name != null) { - sublength = name.encode(os); - codeLength += sublength; - codeLength += BerLength.encodeLength(os, sublength); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - 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.CONSTRUCTED, 0)) { - codeLength += BerLength.skip(is); - name = new ObjectName(); - codeLength += name.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (name != null) { - sb.append("name: "); - name.appendAsString(sb, indentLevel + 1); - return; - } - - sb.append(""); - } + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private ObjectName name = null; + + public VariableSpecification() { + } + + public VariableSpecification(byte[] code) { + this.code = code; + } + + public void setName(ObjectName name) { + this.name = name; + } + + public ObjectName getName() { + return name; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + int sublength; + + if (name != null) { + sublength = name.encode(os); + codeLength += sublength; + codeLength += BerLength.encodeLength(os, sublength); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + 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.CONSTRUCTED, 0)) { + codeLength += BerLength.skip(is); + name = new ObjectName(); + codeLength += name.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (name != null) { + sb.append("name: "); + name.appendAsString(sb, indentLevel + 1); + return; + } + + sb.append(""); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/WriteRequest.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/WriteRequest.java index 2dd0545..e75ff7a 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/WriteRequest.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/WriteRequest.java @@ -1,297 +1,298 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; public class WriteRequest implements Serializable { - private static final long serialVersionUID = 1L; - - public static class ListOfData 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 List seqOf = null; - - public ListOfData() { - seqOf = new ArrayList<>(); - } - - public ListOfData(byte[] code) { - this.code = code; - } - - public List getData() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - Data element = new Data(); - subCodeLength += element.decode(is, null); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength - + " but has " + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - 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 VariableAccessSpecification variableAccessSpecification = null; - private ListOfData listOfData = null; - - public WriteRequest() { - } - - public WriteRequest(byte[] code) { - this.code = code; - } - - public void setVariableAccessSpecification(VariableAccessSpecification variableAccessSpecification) { - this.variableAccessSpecification = variableAccessSpecification; - } - - public VariableAccessSpecification getVariableAccessSpecification() { - return variableAccessSpecification; - } - - public void setListOfData(ListOfData listOfData) { - this.listOfData = listOfData; - } - - public ListOfData getListOfData() { - return listOfData; - } - - 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 += listOfData.encode(os, false); - // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 - os.write(0xA0); - codeLength += 1; - - codeLength += variableAccessSpecification.encode(os); - - 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); - variableAccessSpecification = new VariableAccessSpecification(); - subCodeLength += variableAccessSpecification.decode(is, berTag); - subCodeLength += berTag.decode(is); - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { - listOfData = new ListOfData(); - subCodeLength += listOfData.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 (variableAccessSpecification != null) { - sb.append("variableAccessSpecification: "); - variableAccessSpecification.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("variableAccessSpecification: "); - } - - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (listOfData != null) { - sb.append("listOfData: "); - listOfData.appendAsString(sb, indentLevel + 1); - } - else { - sb.append("listOfData: "); - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class ListOfData 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 List seqOf = null; + + public ListOfData() { + seqOf = new ArrayList(); + } + + public ListOfData(byte[] code) { + this.code = code; + } + + public List getData() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + Data element = new Data(); + subCodeLength += element.decode(is, null); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + 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 VariableAccessSpecification variableAccessSpecification = null; + private ListOfData listOfData = null; + + public WriteRequest() { + } + + public WriteRequest(byte[] code) { + this.code = code; + } + + public void setVariableAccessSpecification(VariableAccessSpecification variableAccessSpecification) { + this.variableAccessSpecification = variableAccessSpecification; + } + + public VariableAccessSpecification getVariableAccessSpecification() { + return variableAccessSpecification; + } + + public void setListOfData(ListOfData listOfData) { + this.listOfData = listOfData; + } + + public ListOfData getListOfData() { + return listOfData; + } + + 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 += listOfData.encode(os, false); + // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 + os.write(0xA0); + codeLength += 1; + + codeLength += variableAccessSpecification.encode(os); + + 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); + variableAccessSpecification = new VariableAccessSpecification(); + subCodeLength += variableAccessSpecification.decode(is, berTag); + subCodeLength += berTag.decode(is); + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { + listOfData = new ListOfData(); + subCodeLength += listOfData.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(); + } + + 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 (variableAccessSpecification != null) { + sb.append("variableAccessSpecification: "); + variableAccessSpecification.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("variableAccessSpecification: "); + } + + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (listOfData != null) { + sb.append("listOfData: "); + listOfData.appendAsString(sb, indentLevel + 1); + } + else { + sb.append("listOfData: "); + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/WriteResponse.java b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/WriteResponse.java index 35ad50b..88c1550 100644 --- a/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/WriteResponse.java +++ b/src/main/java-gen/org/openmuc/openiec61850/internal/mms/asn1/WriteResponse.java @@ -1,269 +1,269 @@ /** - * This class file was automatically generated by jASN1 v1.9.0 (http://www.openmuc.org) + * This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */ package org.openmuc.openiec61850.internal.mms.asn1; import java.io.IOException; +import java.io.EOFException; import java.io.InputStream; import java.io.OutputStream; -import java.io.Serializable; +import java.util.List; import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; +import java.io.Serializable; +import org.openmuc.jasn1.ber.*; +import org.openmuc.jasn1.ber.types.*; +import org.openmuc.jasn1.ber.types.string.*; -import org.openmuc.jasn1.ber.BerLength; -import org.openmuc.jasn1.ber.BerTag; -import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; -import org.openmuc.jasn1.ber.types.BerNull; public class WriteResponse implements Serializable { - private static final long serialVersionUID = 1L; - - public static class CHOICE implements Serializable { - - private static final long serialVersionUID = 1L; - - public byte[] code = null; - private DataAccessError failure = null; - private BerNull success = null; - - public CHOICE() { - } - - public CHOICE(byte[] code) { - this.code = code; - } - - public void setFailure(DataAccessError failure) { - this.failure = failure; - } - - public DataAccessError getFailure() { - return failure; - } - - public void setSuccess(BerNull success) { - this.success = success; - } - - public BerNull getSuccess() { - return success; - } - - public int encode(OutputStream os) throws IOException { - - if (code != null) { - for (int i = code.length - 1; i >= 0; i--) { - os.write(code[i]); - } - return code.length; - } - - int codeLength = 0; - if (success != null) { - codeLength += success.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 1 - os.write(0x81); - codeLength += 1; - return codeLength; - } - - if (failure != null) { - codeLength += failure.encode(os, false); - // write tag: CONTEXT_CLASS, PRIMITIVE, 0 - os.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)) { - failure = new DataAccessError(); - codeLength += failure.decode(is, false); - return codeLength; - } - - if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { - success = new BerNull(); - codeLength += success.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); - encode(os); - code = os.getArray(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - appendAsString(sb, 0); - return sb.toString(); - } - - public void appendAsString(StringBuilder sb, int indentLevel) { - - if (failure != null) { - sb.append("failure: ").append(failure); - return; - } - - if (success != null) { - sb.append("success: ").append(success); - return; - } - - sb.append(""); - } - - } - - public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); - public byte[] code = null; - private List seqOf = null; - - public WriteResponse() { - seqOf = new ArrayList<>(); - } - - public WriteResponse(byte[] code) { - this.code = code; - } - - public List getCHOICE() { - if (seqOf == null) { - seqOf = new ArrayList<>(); - } - return seqOf; - } - - 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; - for (int i = (seqOf.size() - 1); i >= 0; i--) { - codeLength += seqOf.get(i).encode(os); - } - - 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; - if (withTag) { - codeLength += tag.decodeAndCheck(is); - } - - BerLength length = new BerLength(); - codeLength += length.decode(is); - int totalLength = length.val; - - while (subCodeLength < totalLength) { - CHOICE element = new CHOICE(); - subCodeLength += element.decode(is, null); - seqOf.add(element); - } - if (subCodeLength != totalLength) { - throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " - + subCodeLength); - - } - codeLength += subCodeLength; - - return codeLength; - } - - 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("{\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - if (seqOf == null) { - sb.append("null"); - } - else { - Iterator it = seqOf.iterator(); - if (it.hasNext()) { - it.next().appendAsString(sb, indentLevel + 1); - while (it.hasNext()) { - sb.append(",\n"); - for (int i = 0; i < indentLevel + 1; i++) { - sb.append("\t"); - } - it.next().appendAsString(sb, indentLevel + 1); - } - } - } - - sb.append("\n"); - for (int i = 0; i < indentLevel; i++) { - sb.append("\t"); - } - sb.append("}"); - } + private static final long serialVersionUID = 1L; + + public static class CHOICE implements Serializable { + + private static final long serialVersionUID = 1L; + + public byte[] code = null; + private DataAccessError failure = null; + private BerNull success = null; + + public CHOICE() { + } + + public CHOICE(byte[] code) { + this.code = code; + } + + public void setFailure(DataAccessError failure) { + this.failure = failure; + } + + public DataAccessError getFailure() { + return failure; + } + + public void setSuccess(BerNull success) { + this.success = success; + } + + public BerNull getSuccess() { + return success; + } + + public int encode(OutputStream os) throws IOException { + + if (code != null) { + for (int i = code.length - 1; i >= 0; i--) { + os.write(code[i]); + } + return code.length; + } + + int codeLength = 0; + if (success != null) { + codeLength += success.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 1 + os.write(0x81); + codeLength += 1; + return codeLength; + } + + if (failure != null) { + codeLength += failure.encode(os, false); + // write tag: CONTEXT_CLASS, PRIMITIVE, 0 + os.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)) { + failure = new DataAccessError(); + codeLength += failure.decode(is, false); + return codeLength; + } + + if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) { + success = new BerNull(); + codeLength += success.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 os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + if (failure != null) { + sb.append("failure: ").append(failure); + return; + } + + if (success != null) { + sb.append("success: ").append(success); + return; + } + + sb.append(""); + } + + } + + public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); + public byte[] code = null; + private List seqOf = null; + + public WriteResponse() { + seqOf = new ArrayList(); + } + + public WriteResponse(byte[] code) { + this.code = code; + } + + public List getCHOICE() { + if (seqOf == null) { + seqOf = new ArrayList(); + } + return seqOf; + } + + 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; + for (int i = (seqOf.size() - 1); i >= 0; i--) { + codeLength += seqOf.get(i).encode(os); + } + + 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; + if (withTag) { + codeLength += tag.decodeAndCheck(is); + } + + BerLength length = new BerLength(); + codeLength += length.decode(is); + int totalLength = length.val; + + while (subCodeLength < totalLength) { + CHOICE element = new CHOICE(); + subCodeLength += element.decode(is, null); + seqOf.add(element); + } + if (subCodeLength != totalLength) { + throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); + + } + codeLength += subCodeLength; + + return codeLength; + } + + public void encodeAndSave(int encodingSizeGuess) throws IOException { + ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess); + encode(os, false); + code = os.getArray(); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + appendAsString(sb, 0); + return sb.toString(); + } + + public void appendAsString(StringBuilder sb, int indentLevel) { + + sb.append("{\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + if (seqOf == null) { + sb.append("null"); + } + else { + Iterator it = seqOf.iterator(); + if (it.hasNext()) { + it.next().appendAsString(sb, indentLevel + 1); + while (it.hasNext()) { + sb.append(",\n"); + for (int i = 0; i < indentLevel + 1; i++) { + sb.append("\t"); + } + it.next().appendAsString(sb, indentLevel + 1); + } + } + } + + sb.append("\n"); + for (int i = 0; i < indentLevel; i++) { + sb.append("\t"); + } + sb.append("}"); + } } + diff --git a/src/main/java/org/openmuc/openiec61850/ClientAssociation.java b/src/main/java/org/openmuc/openiec61850/ClientAssociation.java index 426291e..ee6f16c 100644 --- a/src/main/java/org/openmuc/openiec61850/ClientAssociation.java +++ b/src/main/java/org/openmuc/openiec61850/ClientAssociation.java @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.InetAddress; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -35,6 +36,7 @@ import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream; import org.openmuc.jasn1.ber.types.BerBoolean; import org.openmuc.jasn1.ber.types.BerInteger; import org.openmuc.jasn1.ber.types.BerNull; +import org.openmuc.jasn1.ber.types.string.BerGraphicString; import org.openmuc.jasn1.ber.types.string.BerVisibleString; import org.openmuc.josistack.AcseAssociation; import org.openmuc.josistack.ByteBufferInputStream; @@ -50,6 +52,8 @@ import org.openmuc.openiec61850.internal.mms.asn1.DefineNamedVariableListRequest import org.openmuc.openiec61850.internal.mms.asn1.DeleteNamedVariableListRequest; import org.openmuc.openiec61850.internal.mms.asn1.DeleteNamedVariableListRequest.ListOfVariableListName; import org.openmuc.openiec61850.internal.mms.asn1.DeleteNamedVariableListResponse; +import org.openmuc.openiec61850.internal.mms.asn1.FileDirectoryRequest; +import org.openmuc.openiec61850.internal.mms.asn1.FileName; import org.openmuc.openiec61850.internal.mms.asn1.GetNameListRequest; import org.openmuc.openiec61850.internal.mms.asn1.GetNameListRequest.ObjectScope; import org.openmuc.openiec61850.internal.mms.asn1.GetNameListResponse; @@ -901,6 +905,28 @@ public final class ClientAssociation { decodeGetDataValuesResponse(confirmedServiceResponse, modelNode); } + public void getFileDirectory(String directoryName) throws ServiceError, IOException { + + System.out.println("getFileDirectory"); + + FileDirectoryRequest fileDirectoryRequest = new FileDirectoryRequest(); + + BerGraphicString berGraphicString = new BerGraphicString(directoryName.getBytes()); + + FileName fileSpecifcation = new FileName(); + fileSpecifcation.getBerGraphicString().add(berGraphicString); + + fileDirectoryRequest.setFileSpecification(fileSpecifcation); + + ConfirmedServiceRequest confirmedServiceRequest = new ConfirmedServiceRequest(); + confirmedServiceRequest.setFileDirectory(fileDirectoryRequest); + + System.out.println("Create file directory request"); + + ConfirmedServiceResponse confirmedServiceResponse = encodeWriteReadDecode(confirmedServiceRequest); + } + + /** * Will update all data inside the model except for control variables (those that have FC=CO). Control variables are * not meant to be read. Update is done by calling getDataValues on the FCDOs below the Logical Nodes.