switched to newest snapshot of jasn1 which was renamed to asn1bean

pull/19/head
Stefan Feuerhahn 5 years ago
parent e37e072144
commit d7d87c6004

@ -4,4 +4,4 @@ cd `dirname $0`
rm ../../src/main/java-gen/com/beanit/josistack/internal/acse/asn1/*
jasn1-compiler -o "../../src/main/java-gen/" -p "com.beanit.josistack.internal.acse" -f iso-acse-layer.asn -dv
asn1bean-compiler -o "../../src/main/java-gen/" -p "com.beanit.josistack.internal.acse" -f iso-acse-layer.asn -dv

@ -3,4 +3,4 @@
cd `dirname $0`
rm ../../src/main/java-gen/com/beanit/josistack/internal/presentation/asn1/*.java
jasn1-compiler -o ../../src/main/java-gen/ -p com.beanit.josistack.internal.presentation -f iso-presentation-layer.asn -dv
asn1bean-compiler -o ../../src/main/java-gen/ -p com.beanit.josistack.internal.presentation -f iso-presentation-layer.asn -dv

@ -4,4 +4,4 @@ cd `dirname $0`
rm -r ../../src/main/java-gen/com/beanit/openiec61850/internal/mms/asn1/*
jasn1-compiler -o "../../src/main/java-gen" -p "com.beanit.openiec61850.internal.mms" -f mms.asn -dv
asn1bean-compiler -o "../../src/main/java-gen" -p "com.beanit.openiec61850.internal.mms" -f mms.asn -dv

@ -2,4 +2,4 @@
cd `dirname $0`
find ../../ -iname "*.java" | xargs sed -i 's/import com\.beanit\.jasn1\.ber\.types\.BerBoolean/import com\.beanit\.openiec61850\.internal\.BerBoolean/g'
find ../../ -iname "*.java" | xargs sed -i 's/import com\.beanit\.asn1bean\.ber\.types\.BerBoolean/import com\.beanit\.openiec61850\.internal\.BerBoolean/g'

@ -31,7 +31,7 @@ val javaProjects: Set<Project> = allprojects
val distributionProjects = javaProjects
val docProjects = javaProjects
val repositoryProjects = javaProjects
val cfgModuleName = "com.beanit.jasn1"
val cfgModuleName = "com.beanit.openiec61850"
tasks.register<Tar>("tar") {
into(project.name) {
@ -65,7 +65,7 @@ tasks.register<Tar>("tar") {
//-----java root project configurations
dependencies {
implementation("com.beanit:jasn1:1.11.0")
implementation("com.beanit:asn1bean:1.11.4-SNAPSHOT")
implementation("com.toedter:jcalendar:1.4")
implementation("org.slf4j:slf4j-api:1.7.25")
runtimeOnly("ch.qos.logback:logback-classic:1.2.3")
@ -78,7 +78,7 @@ tasks["jar"].withConvention(aQute.bnd.gradle.BundleTaskConvention::class) {
Bundle-Name: OpenIEC61850
Bundle-SymbolicName: ${project.extra["cfgModuleName"]}
-exportcontents: !*.internal.*,*
Import-Package: com.beanit.jasn1.*,javax.net,*;resolution:=optional
Import-Package: com.beanit.asn1bean.*,javax.net,*;resolution:=optional
""")
}
@ -138,6 +138,7 @@ configure(javaProjects) {
repositories {
mavenCentral()
mavenLocal()
}
java {

@ -15,7 +15,7 @@ After extracting the distribution tar file, the OpenIEC61850 library can be foun
Besides the OpenIEC61850 library the folder *build/libs-all/* contains the following external libraries:
* *jasn1* - the ASN.1 BER encoding/decoding library by beanit, license: Apache 2.0, https://www.beanit.com
* *asn1bean* - the ASN.1 BER encoding/decoding library by beanit, license: Apache 2.0, https://www.beanit.com
* *slf4j-api* - a popular logging API. It is only needed if openiec61850 is used to implement a server. The client part does not log anything. License: MIT, http://www.slf4j.org

@ -1,12 +1,12 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -16,7 +16,7 @@ public class AAREApdu implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.APPLICATION_CLASS, BerTag.CONSTRUCTED, 1);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerBitString protocolVersion = null;
private BerObjectIdentifier applicationContextName = null;
private AssociateResult result = null;
@ -152,6 +152,7 @@ public class AAREApdu implements BerType, Serializable {
this.userInformation = userInformation;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -159,9 +160,7 @@ public class AAREApdu implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -288,160 +287,174 @@ public class AAREApdu implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
int totalLength = length.val;
codeLength += totalLength;
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
protocolVersion = new BerBitString();
subCodeLength += protocolVersion.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += protocolVersion.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
applicationContextName = new BerObjectIdentifier();
subCodeLength += applicationContextName.decode(is, true);
subCodeLength += berTag.decode(is);
vByteCount += applicationContextName.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
result = new AssociateResult();
subCodeLength += result.decode(is, true);
subCodeLength += berTag.decode(is);
vByteCount += result.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
resultSourceDiagnostic = new AssociateSourceDiagnostic();
subCodeLength += resultSourceDiagnostic.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += resultSourceDiagnostic.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
respondingAPTitle = new APTitle();
subCodeLength += respondingAPTitle.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += respondingAPTitle.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
respondingAEQualifier = new AEQualifier();
subCodeLength += respondingAEQualifier.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += respondingAEQualifier.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
respondingAPInvocationIdentifier = new APInvocationIdentifier();
subCodeLength += respondingAPInvocationIdentifier.decode(is, true);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += respondingAPInvocationIdentifier.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 7)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
respondingAEInvocationIdentifier = new AEInvocationIdentifier();
subCodeLength += respondingAEInvocationIdentifier.decode(is, true);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += respondingAEInvocationIdentifier.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
responderAcseRequirements = new ACSERequirements();
subCodeLength += responderAcseRequirements.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += responderAcseRequirements.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
mechanismName = new MechanismName();
subCodeLength += mechanismName.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += mechanismName.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 10)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
respondingAuthenticationValue = new AuthenticationValue();
subCodeLength += respondingAuthenticationValue.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += respondingAuthenticationValue.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 11)) {
applicationContextNameList = new ApplicationContextNameList();
subCodeLength += applicationContextNameList.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += applicationContextNameList.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 29)) {
implementationInformation = new ImplementationData();
subCodeLength += implementationInformation.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += implementationInformation.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 30)) {
userInformation = new AssociationInformation();
subCodeLength += userInformation.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += userInformation.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -450,6 +463,7 @@ public class AAREApdu implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,12 +1,12 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -16,7 +16,7 @@ public class AARQApdu implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.APPLICATION_CLASS, BerTag.CONSTRUCTED, 0);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerBitString protocolVersion = null;
private BerObjectIdentifier applicationContextName = null;
private APTitle calledAPTitle = null;
@ -170,6 +170,7 @@ public class AARQApdu implements BerType, Serializable {
this.userInformation = userInformation;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -177,9 +178,7 @@ public class AARQApdu implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -328,182 +327,198 @@ public class AARQApdu implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
int totalLength = length.val;
codeLength += totalLength;
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
protocolVersion = new BerBitString();
subCodeLength += protocolVersion.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += protocolVersion.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
applicationContextName = new BerObjectIdentifier();
subCodeLength += applicationContextName.decode(is, true);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += applicationContextName.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
calledAPTitle = new APTitle();
subCodeLength += calledAPTitle.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += calledAPTitle.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
calledAEQualifier = new AEQualifier();
subCodeLength += calledAEQualifier.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += calledAEQualifier.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
calledAPInvocationIdentifier = new APInvocationIdentifier();
subCodeLength += calledAPInvocationIdentifier.decode(is, true);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += calledAPInvocationIdentifier.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
calledAEInvocationIdentifier = new AEInvocationIdentifier();
subCodeLength += calledAEInvocationIdentifier.decode(is, true);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += calledAEInvocationIdentifier.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
callingAPTitle = new APTitle();
subCodeLength += callingAPTitle.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += callingAPTitle.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 7)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
callingAEQualifier = new AEQualifier();
subCodeLength += callingAEQualifier.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += callingAEQualifier.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
callingAPInvocationIdentifier = new APInvocationIdentifier();
subCodeLength += callingAPInvocationIdentifier.decode(is, true);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += callingAPInvocationIdentifier.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
callingAEInvocationIdentifier = new AEInvocationIdentifier();
subCodeLength += callingAEInvocationIdentifier.decode(is, true);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += callingAEInvocationIdentifier.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) {
senderAcseRequirements = new ACSERequirements();
subCodeLength += senderAcseRequirements.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += senderAcseRequirements.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) {
mechanismName = new MechanismName();
subCodeLength += mechanismName.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += mechanismName.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 12)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
callingAuthenticationValue = new AuthenticationValue();
subCodeLength += callingAuthenticationValue.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += callingAuthenticationValue.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 13)) {
applicationContextNameList = new ApplicationContextNameList();
subCodeLength += applicationContextNameList.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += applicationContextNameList.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 29)) {
implementationInformation = new ImplementationData();
subCodeLength += implementationInformation.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += implementationInformation.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 30)) {
userInformation = new AssociationInformation();
subCodeLength += userInformation.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += userInformation.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -512,6 +527,7 @@ public class AARQApdu implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,9 +1,9 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -13,7 +13,7 @@ public class ACSEApdu implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private AARQApdu aarq = null;
private AAREApdu aare = null;
private RLRQApdu rlrq = null;
@ -57,12 +57,11 @@ public class ACSEApdu implements BerType, Serializable {
this.rlre = rlre;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -90,45 +89,46 @@ public class ACSEApdu implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(AARQApdu.tag)) {
aarq = new AARQApdu();
codeLength += aarq.decode(is, false);
return codeLength;
tlvByteCount += aarq.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(AAREApdu.tag)) {
aare = new AAREApdu();
codeLength += aare.decode(is, false);
return codeLength;
tlvByteCount += aare.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(RLRQApdu.tag)) {
rlrq = new RLRQApdu();
codeLength += rlrq.decode(is, false);
return codeLength;
tlvByteCount += rlrq.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(RLREApdu.tag)) {
rlre = new RLREApdu();
codeLength += rlre.decode(is, false);
return codeLength;
tlvByteCount += rlre.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -141,6 +141,7 @@ public class ACSEApdu implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerBitString;
public class ACSERequirements extends BerBitString {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class AEInvocationIdentifier extends BerInteger {

@ -1,9 +1,9 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -13,7 +13,7 @@ public class AEQualifier implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private AEQualifierForm2 aeQualifierForm2 = null;
public AEQualifier() {}
@ -30,12 +30,11 @@ public class AEQualifier implements BerType, Serializable {
this.aeQualifierForm2 = aeQualifierForm2;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -48,27 +47,28 @@ public class AEQualifier implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(AEQualifierForm2.tag)) {
aeQualifierForm2 = new AEQualifierForm2();
codeLength += aeQualifierForm2.decode(is, false);
return codeLength;
tlvByteCount += aeQualifierForm2.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -81,6 +81,7 @@ public class AEQualifier implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class AEQualifierForm2 extends BerInteger {

@ -1,9 +1,9 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -13,7 +13,7 @@ public class AETitle implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private AETitleForm2 aeTitleForm2 = null;
public AETitle() {}
@ -30,12 +30,11 @@ public class AETitle implements BerType, Serializable {
this.aeTitleForm2 = aeTitleForm2;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -48,27 +47,28 @@ public class AETitle implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(AETitleForm2.tag)) {
aeTitleForm2 = new AETitleForm2();
codeLength += aeTitleForm2.decode(is, false);
return codeLength;
tlvByteCount += aeTitleForm2.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -81,6 +81,7 @@ public class AETitle implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
public class AETitleForm2 extends BerObjectIdentifier {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class APInvocationIdentifier extends BerInteger {

@ -1,9 +1,9 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -13,7 +13,7 @@ public class APTitle implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private APTitleForm2 apTitleForm2 = null;
public APTitle() {}
@ -30,12 +30,11 @@ public class APTitle implements BerType, Serializable {
this.apTitleForm2 = apTitleForm2;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -48,27 +47,28 @@ public class APTitle implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(APTitleForm2.tag)) {
apTitleForm2 = new APTitleForm2();
codeLength += apTitleForm2.decode(is, false);
return codeLength;
tlvByteCount += apTitleForm2.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -81,6 +81,7 @@ public class APTitle implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
public class APTitleForm2 extends BerObjectIdentifier {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
public class ApplicationContextName extends BerObjectIdentifier {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -17,7 +17,7 @@ public class ApplicationContextNameList implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<ApplicationContextName> seqOf = null;
public ApplicationContextNameList() {
@ -35,6 +35,7 @@ public class ApplicationContextNameList implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -42,9 +43,7 @@ public class ApplicationContextNameList implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -65,36 +64,46 @@ public class ApplicationContextNameList implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
if (!berTag.equals(ApplicationContextName.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
ApplicationContextName element = new ApplicationContextName();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -103,6 +112,7 @@ public class ApplicationContextNameList implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class AssociateResult extends BerInteger {

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,7 +15,7 @@ public class AssociateSourceDiagnostic implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerInteger acseServiceUser = null;
private BerInteger acseServiceProvider = null;
@ -41,12 +41,11 @@ public class AssociateSourceDiagnostic implements BerType, Serializable {
this.acseServiceProvider = acseServiceProvider;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -76,35 +75,40 @@ public class AssociateSourceDiagnostic implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
acseServiceUser = new BerInteger();
codeLength += acseServiceUser.decode(is, true);
return codeLength;
tlvByteCount += acseServiceUser.decode(is, true);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
acseServiceProvider = new BerInteger();
codeLength += acseServiceProvider.decode(is, true);
return codeLength;
tlvByteCount += acseServiceProvider.decode(is, true);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -117,6 +121,7 @@ public class AssociateSourceDiagnostic implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -17,7 +17,7 @@ public class AssociationInformation implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<Myexternal> seqOf = null;
public AssociationInformation() {
@ -35,6 +35,7 @@ public class AssociationInformation implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -42,9 +43,7 @@ public class AssociationInformation implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -65,36 +64,46 @@ public class AssociationInformation implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
if (!berTag.equals(Myexternal.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
Myexternal element = new Myexternal();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -103,6 +112,7 @@ public class AssociationInformation implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.jasn1.ber.types.string.BerGraphicString;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerType;
import com.beanit.asn1bean.ber.types.string.BerGraphicString;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,7 +15,7 @@ public class AuthenticationValue implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerGraphicString charstring = null;
private BerBitString bitstring = null;
private Myexternal2 external = null;
@ -50,12 +50,11 @@ public class AuthenticationValue implements BerType, Serializable {
this.external = external;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -87,39 +86,40 @@ public class AuthenticationValue implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
charstring = new BerGraphicString();
codeLength += charstring.decode(is, false);
return codeLength;
tlvByteCount += charstring.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
bitstring = new BerBitString();
codeLength += bitstring.decode(is, false);
return codeLength;
tlvByteCount += bitstring.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
external = new Myexternal2();
codeLength += external.decode(is, false);
return codeLength;
tlvByteCount += external.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -132,6 +132,7 @@ public class AuthenticationValue implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.string.BerGraphicString;
import com.beanit.asn1bean.ber.types.string.BerGraphicString;
public class ImplementationData extends BerGraphicString {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
public class MechanismName extends BerObjectIdentifier {

@ -1,15 +1,15 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerAny;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.jasn1.ber.types.BerOctetString;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerAny;
import com.beanit.asn1bean.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerOctetString;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -19,11 +19,10 @@ public class Myexternal implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 8);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerObjectIdentifier directReference = null;
private BerInteger indirectReference = null;
private Encoding encoding = null;
public Myexternal() {}
public Myexternal(byte[] code) {
@ -54,6 +53,7 @@ public class Myexternal implements BerType, Serializable {
this.encoding = encoding;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -61,9 +61,7 @@ public class Myexternal implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -90,48 +88,59 @@ public class Myexternal implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
subCodeLength += berTag.decode(is);
if (berTag.equals(BerObjectIdentifier.tag)) {
directReference = new BerObjectIdentifier();
subCodeLength += directReference.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += directReference.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerInteger.tag)) {
indirectReference = new BerInteger();
subCodeLength += indirectReference.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += indirectReference.decode(is, false);
vByteCount += berTag.decode(is);
}
encoding = new Encoding();
subCodeLength += encoding.decode(is, berTag);
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = encoding.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -140,6 +149,7 @@ public class Myexternal implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -194,7 +204,7 @@ public class Myexternal implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerAny singleASN1Type = null;
private BerOctetString octetAligned = null;
private BerBitString arbitrary = null;
@ -229,12 +239,11 @@ public class Myexternal implements BerType, Serializable {
this.arbitrary = arbitrary;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -270,40 +279,43 @@ public class Myexternal implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
singleASN1Type = new BerAny();
codeLength += singleASN1Type.decode(is, null);
return codeLength;
tlvByteCount += singleASN1Type.decode(is, null);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
octetAligned = new BerOctetString();
codeLength += octetAligned.decode(is, false);
return codeLength;
tlvByteCount += octetAligned.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
arbitrary = new BerBitString();
codeLength += arbitrary.decode(is, false);
return codeLength;
tlvByteCount += arbitrary.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -316,6 +328,7 @@ public class Myexternal implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,15 +1,15 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerAny;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.jasn1.ber.types.BerOctetString;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerAny;
import com.beanit.asn1bean.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerOctetString;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -19,11 +19,10 @@ public class Myexternal2 implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 8);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerObjectIdentifier directReference = null;
private BerInteger indirectReference = null;
private Encoding encoding = null;
public Myexternal2() {}
public Myexternal2(byte[] code) {
@ -54,6 +53,7 @@ public class Myexternal2 implements BerType, Serializable {
this.encoding = encoding;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -61,9 +61,7 @@ public class Myexternal2 implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -90,48 +88,59 @@ public class Myexternal2 implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
subCodeLength += berTag.decode(is);
if (berTag.equals(BerObjectIdentifier.tag)) {
directReference = new BerObjectIdentifier();
subCodeLength += directReference.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += directReference.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerInteger.tag)) {
indirectReference = new BerInteger();
subCodeLength += indirectReference.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += indirectReference.decode(is, false);
vByteCount += berTag.decode(is);
}
encoding = new Encoding();
subCodeLength += encoding.decode(is, berTag);
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = encoding.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -140,6 +149,7 @@ public class Myexternal2 implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -194,7 +204,7 @@ public class Myexternal2 implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerAny singleASN1Type = null;
private BerOctetString octetAligned = null;
private BerBitString arbitrary = null;
@ -229,12 +239,11 @@ public class Myexternal2 implements BerType, Serializable {
this.arbitrary = arbitrary;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -270,40 +279,43 @@ public class Myexternal2 implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
singleASN1Type = new BerAny();
codeLength += singleASN1Type.decode(is, null);
return codeLength;
tlvByteCount += singleASN1Type.decode(is, null);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
octetAligned = new BerOctetString();
codeLength += octetAligned.decode(is, false);
return codeLength;
tlvByteCount += octetAligned.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
arbitrary = new BerBitString();
codeLength += arbitrary.decode(is, false);
return codeLength;
tlvByteCount += arbitrary.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -316,6 +328,7 @@ public class Myexternal2 implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
public final class OidValues {
public static final BerObjectIdentifier aCSEId =

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class RLREApdu implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.APPLICATION_CLASS, BerTag.CONSTRUCTED, 3);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ReleaseResponseReason reason = null;
private AssociationInformation userInformation = null;
@ -40,6 +40,7 @@ public class RLREApdu implements BerType, Serializable {
this.userInformation = userInformation;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class RLREApdu implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -80,50 +79,56 @@ public class RLREApdu implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
if (totalLength == 0) {
return codeLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
if (lengthVal == 0) {
return tlByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
reason = new ReleaseResponseReason();
subCodeLength += reason.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += reason.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 30)) {
userInformation = new AssociationInformation();
subCodeLength += userInformation.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += userInformation.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -132,6 +137,7 @@ public class RLREApdu implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class RLRQApdu implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.APPLICATION_CLASS, BerTag.CONSTRUCTED, 2);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ReleaseRequestReason reason = null;
private AssociationInformation userInformation = null;
@ -40,6 +40,7 @@ public class RLRQApdu implements BerType, Serializable {
this.userInformation = userInformation;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class RLRQApdu implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -80,50 +79,56 @@ public class RLRQApdu implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
if (totalLength == 0) {
return codeLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
if (lengthVal == 0) {
return tlByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
reason = new ReleaseRequestReason();
subCodeLength += reason.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += reason.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 30)) {
userInformation = new AssociationInformation();
subCodeLength += userInformation.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += userInformation.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -132,6 +137,7 @@ public class RLRQApdu implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class ReleaseRequestReason extends BerInteger {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.acse.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class ReleaseResponseReason extends BerInteger {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
public class AbstractSyntaxName extends BerObjectIdentifier {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,10 +14,9 @@ public class CPAPPDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 17);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ModeSelector modeSelector = null;
private NormalModeParameters normalModeParameters = null;
public CPAPPDU() {}
public CPAPPDU(byte[] code) {
@ -40,6 +39,7 @@ public class CPAPPDU implements BerType, Serializable {
this.normalModeParameters = normalModeParameters;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +47,7 @@ public class CPAPPDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -78,43 +76,47 @@ public class CPAPPDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
int totalLength = length.val;
while (subCodeLength < totalLength) {
subCodeLength += berTag.decode(is);
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
modeSelector = new ModeSelector();
subCodeLength += modeSelector.decode(is, false);
vByteCount += modeSelector.decode(is, false);
} else if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
normalModeParameters = new NormalModeParameters();
subCodeLength += normalModeParameters.decode(is, false);
vByteCount += normalModeParameters.decode(is, false);
} else if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
} else {
throw new IOException("Tag does not match any set component: " + berTag);
}
}
if (subCodeLength != totalLength) {
if (vByteCount != lengthVal) {
throw new IOException(
"Length of set does not match length tag, length tag: "
+ totalLength
+ lengthVal
+ ", actual set length: "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -123,6 +125,7 @@ public class CPAPPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -163,7 +166,7 @@ public class CPAPPDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ProtocolVersion protocolVersion = null;
private RespondingPresentationSelector respondingPresentationSelector = null;
private PresentationContextDefinitionResultList presentationContextDefinitionResultList = null;
@ -227,6 +230,7 @@ public class CPAPPDU implements BerType, Serializable {
this.userData = userData;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -234,9 +238,7 @@ public class CPAPPDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -292,85 +294,98 @@ public class CPAPPDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
if (totalLength == 0) {
return codeLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
if (lengthVal == 0) {
return tlByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
protocolVersion = new ProtocolVersion();
subCodeLength += protocolVersion.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += protocolVersion.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
respondingPresentationSelector = new RespondingPresentationSelector();
subCodeLength += respondingPresentationSelector.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += respondingPresentationSelector.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
presentationContextDefinitionResultList = new PresentationContextDefinitionResultList();
subCodeLength += presentationContextDefinitionResultList.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += presentationContextDefinitionResultList.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
presentationRequirements = new PresentationRequirements();
subCodeLength += presentationRequirements.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += presentationRequirements.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
userSessionRequirements = new UserSessionRequirements();
subCodeLength += userSessionRequirements.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += userSessionRequirements.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
userData = new UserData();
int choiceDecodeLength = userData.decode(is, berTag);
subCodeLength += choiceDecodeLength;
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = userData.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
userData = null;
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -379,6 +394,7 @@ public class CPAPPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,10 +14,9 @@ public class CPType implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 17);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ModeSelector modeSelector = null;
private NormalModeParameters normalModeParameters = null;
public CPType() {}
public CPType(byte[] code) {
@ -40,6 +39,7 @@ public class CPType implements BerType, Serializable {
this.normalModeParameters = normalModeParameters;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +47,7 @@ public class CPType implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -78,43 +76,47 @@ public class CPType implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
int totalLength = length.val;
while (subCodeLength < totalLength) {
subCodeLength += berTag.decode(is);
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
modeSelector = new ModeSelector();
subCodeLength += modeSelector.decode(is, false);
vByteCount += modeSelector.decode(is, false);
} else if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
normalModeParameters = new NormalModeParameters();
subCodeLength += normalModeParameters.decode(is, false);
vByteCount += normalModeParameters.decode(is, false);
} else if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
} else {
throw new IOException("Tag does not match any set component: " + berTag);
}
}
if (subCodeLength != totalLength) {
if (vByteCount != lengthVal) {
throw new IOException(
"Length of set does not match length tag, length tag: "
+ totalLength
+ lengthVal
+ ", actual set length: "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -123,6 +125,7 @@ public class CPType implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -163,7 +166,7 @@ public class CPType implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ProtocolVersion protocolVersion = null;
private CallingPresentationSelector callingPresentationSelector = null;
private CalledPresentationSelector calledPresentationSelector = null;
@ -246,6 +249,7 @@ public class CPType implements BerType, Serializable {
this.userData = userData;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -253,9 +257,7 @@ public class CPType implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -325,103 +327,116 @@ public class CPType implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
if (totalLength == 0) {
return codeLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
if (lengthVal == 0) {
return tlByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
protocolVersion = new ProtocolVersion();
subCodeLength += protocolVersion.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += protocolVersion.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
callingPresentationSelector = new CallingPresentationSelector();
subCodeLength += callingPresentationSelector.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += callingPresentationSelector.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
calledPresentationSelector = new CalledPresentationSelector();
subCodeLength += calledPresentationSelector.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += calledPresentationSelector.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
presentationContextDefinitionList = new PresentationContextDefinitionList();
subCodeLength += presentationContextDefinitionList.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += presentationContextDefinitionList.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
defaultContextName = new DefaultContextName();
subCodeLength += defaultContextName.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += defaultContextName.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
presentationRequirements = new PresentationRequirements();
subCodeLength += presentationRequirements.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += presentationRequirements.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
userSessionRequirements = new UserSessionRequirements();
subCodeLength += userSessionRequirements.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += userSessionRequirements.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
userData = new UserData();
int choiceDecodeLength = userData.decode(is, berTag);
subCodeLength += choiceDecodeLength;
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = userData.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
userData = null;
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -430,6 +445,7 @@ public class CPType implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
public class CalledPresentationSelector extends PresentationSelector {

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
public class CallingPresentationSelector extends PresentationSelector {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -17,9 +17,8 @@ public class ContextList implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<SEQUENCE> seqOf = null;
public ContextList() {
seqOf = new ArrayList<SEQUENCE>();
}
@ -35,6 +34,7 @@ public class ContextList implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -42,9 +42,7 @@ public class ContextList implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -65,36 +63,46 @@ public class ContextList implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
while (subCodeLength < totalLength) {
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
if (!berTag.equals(SEQUENCE.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
SEQUENCE element = new SEQUENCE();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -103,6 +111,7 @@ public class ContextList implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -142,11 +151,10 @@ public class ContextList implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private PresentationContextIdentifier presentationContextIdentifier = null;
private AbstractSyntaxName abstractSyntaxName = null;
private TransferSyntaxNameList transferSyntaxNameList = null;
public SEQUENCE() {}
public SEQUENCE(byte[] code) {
@ -178,6 +186,7 @@ public class ContextList implements BerType, Serializable {
this.transferSyntaxNameList = transferSyntaxNameList;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -185,9 +194,7 @@ public class ContextList implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -210,54 +217,65 @@ public class ContextList implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
subCodeLength += berTag.decode(is);
if (berTag.equals(PresentationContextIdentifier.tag)) {
presentationContextIdentifier = new PresentationContextIdentifier();
subCodeLength += presentationContextIdentifier.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += presentationContextIdentifier.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(AbstractSyntaxName.tag)) {
abstractSyntaxName = new AbstractSyntaxName();
subCodeLength += abstractSyntaxName.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += abstractSyntaxName.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(TransferSyntaxNameList.tag)) {
transferSyntaxNameList = new TransferSyntaxNameList();
subCodeLength += transferSyntaxNameList.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += transferSyntaxNameList.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -266,6 +284,7 @@ public class ContextList implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -317,7 +336,7 @@ public class ContextList implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<TransferSyntaxName> seqOf = null;
public TransferSyntaxNameList() {
@ -335,6 +354,7 @@ public class ContextList implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -342,9 +362,7 @@ public class ContextList implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -365,36 +383,46 @@ public class ContextList implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (subCodeLength < totalLength) {
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
if (!berTag.equals(TransferSyntaxName.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
TransferSyntaxName element = new TransferSyntaxName();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -404,6 +432,7 @@ public class ContextList implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class DefaultContextName implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private AbstractSyntaxName abstractSyntaxName = null;
private TransferSyntaxName transferSyntaxName = null;
@ -40,6 +40,7 @@ public class DefaultContextName implements BerType, Serializable {
this.transferSyntaxName = transferSyntaxName;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class DefaultContextName implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -76,46 +75,54 @@ public class DefaultContextName implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
int totalLength = length.val;
codeLength += totalLength;
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
abstractSyntaxName = new AbstractSyntaxName();
subCodeLength += abstractSyntaxName.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += abstractSyntaxName.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
transferSyntaxName = new TransferSyntaxName();
subCodeLength += transferSyntaxName.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += transferSyntaxName.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -124,6 +131,7 @@ public class DefaultContextName implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -17,7 +17,7 @@ public class FullyEncodedData implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<PDVList> seqOf = null;
public FullyEncodedData() {
@ -35,6 +35,7 @@ public class FullyEncodedData implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -42,9 +43,7 @@ public class FullyEncodedData implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -65,36 +64,46 @@ public class FullyEncodedData implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
if (!berTag.equals(PDVList.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
PDVList element = new PDVList();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -103,6 +112,7 @@ public class FullyEncodedData implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,7 +15,7 @@ public class ModeSelector implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 17);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerInteger modeValue = null;
public ModeSelector() {}
@ -32,6 +32,7 @@ public class ModeSelector implements BerType, Serializable {
this.modeValue = modeValue;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -39,9 +40,7 @@ public class ModeSelector implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -63,40 +62,44 @@ public class ModeSelector implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
int totalLength = length.val;
while (subCodeLength < totalLength) {
subCodeLength += berTag.decode(is);
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
modeValue = new BerInteger();
subCodeLength += modeValue.decode(is, false);
vByteCount += modeValue.decode(is, false);
} else if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
} else {
throw new IOException("Tag does not match any set component: " + berTag);
}
}
if (subCodeLength != totalLength) {
if (vByteCount != lengthVal) {
throw new IOException(
"Length of set does not match length tag, length tag: "
+ totalLength
+ lengthVal
+ ", actual set length: "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -105,6 +108,7 @@ public class ModeSelector implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,13 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerAny;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.jasn1.ber.types.BerOctetString;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerAny;
import com.beanit.asn1bean.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerOctetString;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -17,11 +17,10 @@ public class PDVList implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private TransferSyntaxName transferSyntaxName = null;
private PresentationContextIdentifier presentationContextIdentifier = null;
private PresentationDataValues presentationDataValues = null;
public PDVList() {}
public PDVList(byte[] code) {
@ -53,6 +52,7 @@ public class PDVList implements BerType, Serializable {
this.presentationDataValues = presentationDataValues;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -60,9 +60,7 @@ public class PDVList implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -87,50 +85,61 @@ public class PDVList implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
subCodeLength += berTag.decode(is);
if (berTag.equals(TransferSyntaxName.tag)) {
transferSyntaxName = new TransferSyntaxName();
subCodeLength += transferSyntaxName.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += transferSyntaxName.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(PresentationContextIdentifier.tag)) {
presentationContextIdentifier = new PresentationContextIdentifier();
subCodeLength += presentationContextIdentifier.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += presentationContextIdentifier.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
presentationDataValues = new PresentationDataValues();
subCodeLength += presentationDataValues.decode(is, berTag);
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = presentationDataValues.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -139,6 +148,7 @@ public class PDVList implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -192,7 +202,7 @@ public class PDVList implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerAny singleASN1Type = null;
private BerOctetString octetAligned = null;
private BerBitString arbitrary = null;
@ -227,12 +237,11 @@ public class PDVList implements BerType, Serializable {
this.arbitrary = arbitrary;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -268,40 +277,43 @@ public class PDVList implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
singleASN1Type = new BerAny();
codeLength += singleASN1Type.decode(is, null);
return codeLength;
tlvByteCount += singleASN1Type.decode(is, null);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
octetAligned = new BerOctetString();
codeLength += octetAligned.decode(is, false);
return codeLength;
tlvByteCount += octetAligned.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
arbitrary = new BerBitString();
codeLength += arbitrary.decode(is, false);
return codeLength;
tlvByteCount += arbitrary.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -314,6 +326,7 @@ public class PDVList implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
public class PresentationContextDefinitionList extends ContextList {

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
public class PresentationContextDefinitionResultList extends ResultList {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class PresentationContextIdentifier extends BerInteger {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerBitString;
public class PresentationRequirements extends BerBitString {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerOctetString;
import com.beanit.asn1bean.ber.types.BerOctetString;
public class PresentationSelector extends BerOctetString {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerBitString;
public class ProtocolVersion extends BerBitString {

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
public class RespondingPresentationSelector extends PresentationSelector {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class Result extends BerInteger {

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -18,9 +18,8 @@ public class ResultList implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<SEQUENCE> seqOf = null;
public ResultList() {
seqOf = new ArrayList<SEQUENCE>();
}
@ -36,6 +35,7 @@ public class ResultList implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -43,9 +43,7 @@ public class ResultList implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -66,36 +64,46 @@ public class ResultList implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
while (subCodeLength < totalLength) {
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
if (!berTag.equals(SEQUENCE.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
SEQUENCE element = new SEQUENCE();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -104,6 +112,7 @@ public class ResultList implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -143,7 +152,7 @@ public class ResultList implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Result result = null;
private TransferSyntaxName transferSyntaxName = null;
private BerInteger providerReason = null;
@ -178,6 +187,7 @@ public class ResultList implements BerType, Serializable {
this.providerReason = providerReason;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -185,9 +195,7 @@ public class ResultList implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -223,58 +231,67 @@ public class ResultList implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
result = new Result();
subCodeLength += result.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += result.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
transferSyntaxName = new TransferSyntaxName();
subCodeLength += transferSyntaxName.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += transferSyntaxName.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
providerReason = new BerInteger();
subCodeLength += providerReason.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += providerReason.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -283,6 +300,7 @@ public class ResultList implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerOctetString;
import com.beanit.asn1bean.ber.types.BerOctetString;
public class SimplyEncodedData extends BerOctetString {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerObjectIdentifier;
import com.beanit.asn1bean.ber.types.BerObjectIdentifier;
public class TransferSyntaxName extends BerObjectIdentifier {

@ -1,9 +1,9 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -13,7 +13,7 @@ public class UserData implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private SimplyEncodedData simplyEncodedData = null;
private FullyEncodedData fullyEncodedData = null;
@ -39,12 +39,11 @@ public class UserData implements BerType, Serializable {
this.fullyEncodedData = fullyEncodedData;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -68,33 +67,34 @@ public class UserData implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.APPLICATION_CLASS, BerTag.PRIMITIVE, 0)) {
simplyEncodedData = new SimplyEncodedData();
codeLength += simplyEncodedData.decode(is, false);
return codeLength;
tlvByteCount += simplyEncodedData.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.APPLICATION_CLASS, BerTag.CONSTRUCTED, 1)) {
fullyEncodedData = new FullyEncodedData();
codeLength += fullyEncodedData.decode(is, false);
return codeLength;
tlvByteCount += fullyEncodedData.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -107,6 +107,7 @@ public class UserData implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.josistack.internal.presentation.asn1;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerBitString;
public class UserSessionRequirements extends BerBitString {

@ -1,9 +1,9 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -13,7 +13,7 @@ public class AccessResult implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private DataAccessError failure = null;
private Data success = null;
@ -39,12 +39,11 @@ public class AccessResult implements BerType, Serializable {
this.success = success;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -65,35 +64,38 @@ public class AccessResult implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
int numDecodedBytes;
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
failure = new DataAccessError();
codeLength += failure.decode(is, false);
return codeLength;
tlvByteCount += failure.decode(is, false);
return tlvByteCount;
}
success = new Data();
int choiceDecodeLength = success.decode(is, berTag);
if (choiceDecodeLength != 0) {
return codeLength + choiceDecodeLength;
numDecodedBytes = success.decode(is, berTag);
if (numDecodedBytes != 0) {
return tlvByteCount + numDecodedBytes;
} else {
success = null;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -106,6 +108,7 @@ public class AccessResult implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -17,9 +17,8 @@ public class AlternateAccess implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<CHOICE> seqOf = null;
public AlternateAccess() {
seqOf = new ArrayList<CHOICE>();
}
@ -35,6 +34,7 @@ public class AlternateAccess implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -42,9 +42,7 @@ public class AlternateAccess implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -65,36 +63,48 @@ public class AlternateAccess implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
CHOICE element = new CHOICE();
subCodeLength += element.decode(is, null);
numDecodedBytes = element.decode(is, berTag);
if (numDecodedBytes == 0) {
throw new IOException("Tag did not match");
}
vByteCount += numDecodedBytes;
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -103,6 +113,7 @@ public class AlternateAccess implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -142,7 +153,7 @@ public class AlternateAccess implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private AlternateAccessSelection unnamed = null;
public CHOICE() {}
@ -159,12 +170,11 @@ public class AlternateAccess implements BerType, Serializable {
this.unnamed = unnamed;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -177,29 +187,32 @@ public class AlternateAccess implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
int numDecodedBytes;
unnamed = new AlternateAccessSelection();
int choiceDecodeLength = unnamed.decode(is, berTag);
if (choiceDecodeLength != 0) {
return codeLength + choiceDecodeLength;
numDecodedBytes = unnamed.decode(is, berTag);
if (numDecodedBytes != 0) {
return tlvByteCount + numDecodedBytes;
} else {
unnamed = null;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -212,6 +225,7 @@ public class AlternateAccess implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerNull;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerNull;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,12 +15,11 @@ public class AlternateAccessSelection implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private SelectAlternateAccess selectAlternateAccess = null;
private SelectAccess selectAccess = null;
public AlternateAccessSelection() {}
public AlternateAccessSelection(byte[] code) {
this.code = code;
}
@ -41,12 +40,11 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.selectAccess = selectAccess;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -67,35 +65,38 @@ public class AlternateAccessSelection implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
int numDecodedBytes;
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
selectAlternateAccess = new SelectAlternateAccess();
codeLength += selectAlternateAccess.decode(is, false);
return codeLength;
tlvByteCount += selectAlternateAccess.decode(is, false);
return tlvByteCount;
}
selectAccess = new SelectAccess();
int choiceDecodeLength = selectAccess.decode(is, berTag);
if (choiceDecodeLength != 0) {
return codeLength + choiceDecodeLength;
numDecodedBytes = selectAccess.decode(is, berTag);
if (numDecodedBytes != 0) {
return tlvByteCount + numDecodedBytes;
} else {
selectAccess = null;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -108,6 +109,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -135,10 +137,9 @@ public class AlternateAccessSelection implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private AccessSelection accessSelection = null;
private AlternateAccess alternateAccess = null;
public SelectAlternateAccess() {}
public SelectAlternateAccess(byte[] code) {
@ -161,6 +162,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.alternateAccess = alternateAccess;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -168,9 +170,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -191,42 +191,58 @@ public class AlternateAccessSelection implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
int totalLength = length.val;
codeLength += totalLength;
subCodeLength += berTag.decode(is);
accessSelection = new AccessSelection();
subCodeLength += accessSelection.decode(is, berTag);
subCodeLength += berTag.decode(is);
numDecodedBytes = accessSelection.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(AlternateAccess.tag)) {
alternateAccess = new AlternateAccess();
subCodeLength += alternateAccess.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += alternateAccess.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -235,6 +251,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -277,14 +294,12 @@ public class AlternateAccessSelection implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
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;
}
@ -321,12 +336,11 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.allElements = allElements;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -370,46 +384,49 @@ public class AlternateAccessSelection implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
component = new Component();
codeLength += component.decode(is, null);
return codeLength;
tlvByteCount += component.decode(is, null);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
index = new Unsigned32();
codeLength += index.decode(is, false);
return codeLength;
tlvByteCount += index.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
indexRange = new IndexRange();
codeLength += indexRange.decode(is, false);
return codeLength;
tlvByteCount += indexRange.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
allElements = new BerNull();
codeLength += allElements.decode(is, false);
return codeLength;
tlvByteCount += allElements.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -423,6 +440,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -460,7 +478,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BasicIdentifier basic = null;
public Component() {}
@ -477,12 +495,11 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.basic = basic;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -495,27 +512,28 @@ public class AlternateAccessSelection implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BasicIdentifier.tag)) {
basic = new BasicIdentifier();
codeLength += basic.decode(is, false);
return codeLength;
tlvByteCount += basic.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -529,6 +547,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -550,7 +569,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Unsigned32 lowIndex = null;
private Unsigned32 numberOfElements = null;
@ -576,6 +595,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.numberOfElements = numberOfElements;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -583,9 +603,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -612,46 +630,57 @@ public class AlternateAccessSelection implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += lowIndex.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
numberOfElements = new Unsigned32();
subCodeLength += numberOfElements.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += numberOfElements.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -661,6 +690,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -704,14 +734,12 @@ public class AlternateAccessSelection implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
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;
}
@ -748,12 +776,11 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.allElements = allElements;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -797,46 +824,49 @@ public class AlternateAccessSelection implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
component = new Component();
codeLength += component.decode(is, null);
return codeLength;
tlvByteCount += component.decode(is, null);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
index = new Unsigned32();
codeLength += index.decode(is, false);
return codeLength;
tlvByteCount += index.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
indexRange = new IndexRange();
codeLength += indexRange.decode(is, false);
return codeLength;
tlvByteCount += indexRange.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
allElements = new BerNull();
codeLength += allElements.decode(is, false);
return codeLength;
tlvByteCount += allElements.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -849,6 +879,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -886,7 +917,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BasicIdentifier basic = null;
public Component() {}
@ -903,12 +934,11 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.basic = basic;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -921,27 +951,28 @@ public class AlternateAccessSelection implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BasicIdentifier.tag)) {
basic = new BasicIdentifier();
codeLength += basic.decode(is, false);
return codeLength;
tlvByteCount += basic.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -955,6 +986,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -976,7 +1008,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Unsigned32 lowIndex = null;
private Unsigned32 numberOfElements = null;
@ -1002,6 +1034,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.numberOfElements = numberOfElements;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -1009,9 +1042,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -1038,46 +1069,57 @@ public class AlternateAccessSelection implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += lowIndex.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
numberOfElements = new Unsigned32();
subCodeLength += numberOfElements.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += numberOfElements.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -1087,6 +1129,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.string.BerVisibleString;
import com.beanit.asn1bean.ber.types.string.BerVisibleString;
public class BasicIdentifier extends BerVisibleString {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerNull;
import com.beanit.asn1bean.ber.types.BerNull;
public class ConcludeRequestPDU extends BerNull {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class ConfirmedErrorPDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Unsigned32 invokeID = null;
private Unsigned32 modifierPosition = null;
private ServiceError serviceError = null;
@ -49,6 +49,7 @@ public class ConfirmedErrorPDU implements BerType, Serializable {
this.serviceError = serviceError;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -56,9 +57,7 @@ public class ConfirmedErrorPDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -92,52 +91,60 @@ public class ConfirmedErrorPDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += invokeID.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
modifierPosition = new Unsigned32();
subCodeLength += modifierPosition.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += modifierPosition.decode(is, false);
vByteCount += 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;
vByteCount += serviceError.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -146,6 +153,7 @@ public class ConfirmedErrorPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class ConfirmedRequestPDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Unsigned32 invokeID = null;
private ConfirmedServiceRequest service = null;
@ -40,6 +40,7 @@ public class ConfirmedRequestPDU implements BerType, Serializable {
this.service = service;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class ConfirmedRequestPDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -70,44 +69,55 @@ public class ConfirmedRequestPDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += invokeID.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
service = new ConfirmedServiceRequest();
subCodeLength += service.decode(is, berTag);
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = service.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -116,6 +126,7 @@ public class ConfirmedRequestPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class ConfirmedResponsePDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Unsigned32 invokeID = null;
private ConfirmedServiceResponse service = null;
@ -40,6 +40,7 @@ public class ConfirmedResponsePDU implements BerType, Serializable {
this.service = service;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class ConfirmedResponsePDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -70,44 +69,55 @@ public class ConfirmedResponsePDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += invokeID.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
service = new ConfirmedServiceResponse();
subCodeLength += service.decode(is, berTag);
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = service.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -116,6 +126,7 @@ public class ConfirmedResponsePDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class ConfirmedServiceRequest implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private GetNameListRequest getNameList = null;
private ReadRequest read = null;
private WriteRequest write = null;
@ -132,12 +132,11 @@ public class ConfirmedServiceRequest implements BerType, Serializable {
this.fileDirectory = fileDirectory;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -252,95 +251,100 @@ public class ConfirmedServiceRequest implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
getNameList = new GetNameListRequest();
codeLength += getNameList.decode(is, false);
return codeLength;
tlvByteCount += getNameList.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
read = new ReadRequest();
codeLength += read.decode(is, false);
return codeLength;
tlvByteCount += read.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
write = new WriteRequest();
codeLength += write.decode(is, false);
return codeLength;
tlvByteCount += write.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
getVariableAccessAttributes = new GetVariableAccessAttributesRequest();
codeLength += getVariableAccessAttributes.decode(is, null);
return codeLength;
tlvByteCount += getVariableAccessAttributes.decode(is, null);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 11)) {
defineNamedVariableList = new DefineNamedVariableListRequest();
codeLength += defineNamedVariableList.decode(is, false);
return codeLength;
tlvByteCount += defineNamedVariableList.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 12)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
getNamedVariableListAttributes = new GetNamedVariableListAttributesRequest();
codeLength += getNamedVariableListAttributes.decode(is, null);
return codeLength;
tlvByteCount += getNamedVariableListAttributes.decode(is, null);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 13)) {
deleteNamedVariableList = new DeleteNamedVariableListRequest();
codeLength += deleteNamedVariableList.decode(is, false);
return codeLength;
tlvByteCount += deleteNamedVariableList.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 72)) {
fileOpen = new FileOpenRequest();
codeLength += fileOpen.decode(is, false);
return codeLength;
tlvByteCount += fileOpen.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 73)) {
fileRead = new FileReadRequest();
codeLength += fileRead.decode(is, false);
return codeLength;
tlvByteCount += fileRead.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 74)) {
fileClose = new FileCloseRequest();
codeLength += fileClose.decode(is, false);
return codeLength;
tlvByteCount += fileClose.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 76)) {
fileDelete = new FileDeleteRequest();
codeLength += fileDelete.decode(is, false);
return codeLength;
tlvByteCount += fileDelete.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 77)) {
fileDirectory = new FileDirectoryRequest();
codeLength += fileDirectory.decode(is, false);
return codeLength;
tlvByteCount += fileDirectory.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -353,6 +357,7 @@ public class ConfirmedServiceRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,9 +1,9 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -13,7 +13,7 @@ public class ConfirmedServiceResponse implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private GetNameListResponse getNameList = null;
private ReadResponse read = null;
private WriteResponse write = null;
@ -131,12 +131,11 @@ public class ConfirmedServiceResponse implements BerType, Serializable {
this.fileDirectory = fileDirectory;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -245,93 +244,94 @@ public class ConfirmedServiceResponse implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
getNameList = new GetNameListResponse();
codeLength += getNameList.decode(is, false);
return codeLength;
tlvByteCount += getNameList.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
read = new ReadResponse();
codeLength += read.decode(is, false);
return codeLength;
tlvByteCount += read.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
write = new WriteResponse();
codeLength += write.decode(is, false);
return codeLength;
tlvByteCount += write.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
getVariableAccessAttributes = new GetVariableAccessAttributesResponse();
codeLength += getVariableAccessAttributes.decode(is, false);
return codeLength;
tlvByteCount += getVariableAccessAttributes.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) {
defineNamedVariableList = new DefineNamedVariableListResponse();
codeLength += defineNamedVariableList.decode(is, false);
return codeLength;
tlvByteCount += defineNamedVariableList.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 12)) {
getNamedVariableListAttributes = new GetNamedVariableListAttributesResponse();
codeLength += getNamedVariableListAttributes.decode(is, false);
return codeLength;
tlvByteCount += getNamedVariableListAttributes.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 13)) {
deleteNamedVariableList = new DeleteNamedVariableListResponse();
codeLength += deleteNamedVariableList.decode(is, false);
return codeLength;
tlvByteCount += deleteNamedVariableList.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 72)) {
fileOpen = new FileOpenResponse();
codeLength += fileOpen.decode(is, false);
return codeLength;
tlvByteCount += fileOpen.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 73)) {
fileRead = new FileReadResponse();
codeLength += fileRead.decode(is, false);
return codeLength;
tlvByteCount += fileRead.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 74)) {
fileClose = new FileCloseResponse();
codeLength += fileClose.decode(is, false);
return codeLength;
tlvByteCount += fileClose.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 76)) {
fileDelete = new FileDeleteResponse();
codeLength += fileDelete.decode(is, false);
return codeLength;
tlvByteCount += fileDelete.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 77)) {
fileDirectory = new FileDirectoryResponse();
codeLength += fileDirectory.decode(is, false);
return codeLength;
tlvByteCount += fileDirectory.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -344,6 +344,7 @@ public class ConfirmedServiceResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,14 +1,14 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerBitString;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.jasn1.ber.types.BerOctetString;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.jasn1.ber.types.string.BerVisibleString;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerBitString;
import com.beanit.asn1bean.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerOctetString;
import com.beanit.asn1bean.ber.types.BerType;
import com.beanit.asn1bean.ber.types.string.BerVisibleString;
import com.beanit.openiec61850.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
@ -22,7 +22,7 @@ public class Data implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Array array = null;
private Structure structure = null;
private BerBoolean bool = null;
@ -35,9 +35,7 @@ public class Data implements BerType, Serializable {
private TimeOfDay binaryTime = null;
private MMSString mMSString = null;
private UtcTime utcTime = null;
public Data() {}
public Data(byte[] code) {
this.code = code;
}
@ -138,12 +136,11 @@ public class Data implements BerType, Serializable {
this.utcTime = utcTime;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -247,93 +244,94 @@ public class Data implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
array = new Array();
codeLength += array.decode(is, false);
return codeLength;
tlvByteCount += array.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
structure = new Structure();
codeLength += structure.decode(is, false);
return codeLength;
tlvByteCount += structure.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
bool = new BerBoolean();
codeLength += bool.decode(is, false);
return codeLength;
tlvByteCount += bool.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
bitString = new BerBitString();
codeLength += bitString.decode(is, false);
return codeLength;
tlvByteCount += bitString.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) {
integer = new BerInteger();
codeLength += integer.decode(is, false);
return codeLength;
tlvByteCount += integer.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
unsigned = new BerInteger();
codeLength += unsigned.decode(is, false);
return codeLength;
tlvByteCount += unsigned.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) {
floatingPoint = new FloatingPoint();
codeLength += floatingPoint.decode(is, false);
return codeLength;
tlvByteCount += floatingPoint.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
octetString = new BerOctetString();
codeLength += octetString.decode(is, false);
return codeLength;
tlvByteCount += octetString.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) {
visibleString = new BerVisibleString();
codeLength += visibleString.decode(is, false);
return codeLength;
tlvByteCount += visibleString.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) {
binaryTime = new TimeOfDay();
codeLength += binaryTime.decode(is, false);
return codeLength;
tlvByteCount += binaryTime.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 16)) {
mMSString = new MMSString();
codeLength += mMSString.decode(is, false);
return codeLength;
tlvByteCount += mMSString.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 17)) {
utcTime = new UtcTime();
codeLength += utcTime.decode(is, false);
return codeLength;
tlvByteCount += utcTime.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -346,6 +344,7 @@ public class Data implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -423,7 +422,7 @@ public class Data implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<Data> seqOf = null;
public Array() {
@ -441,6 +440,7 @@ public class Data implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -448,9 +448,7 @@ public class Data implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -471,36 +469,48 @@ public class Data implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
Data element = new Data();
subCodeLength += element.decode(is, null);
numDecodedBytes = element.decode(is, berTag);
if (numDecodedBytes == 0) {
throw new IOException("Tag did not match");
}
vByteCount += numDecodedBytes;
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -509,6 +519,7 @@ public class Data implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -549,7 +560,7 @@ public class Data implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<Data> seqOf = null;
public Structure() {
@ -567,6 +578,7 @@ public class Data implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -574,9 +586,7 @@ public class Data implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -597,36 +607,48 @@ public class Data implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
Data element = new Data();
subCodeLength += element.decode(is, null);
numDecodedBytes = element.decode(is, berTag);
if (numDecodedBytes == 0) {
throw new IOException("Tag did not match");
}
vByteCount += numDecodedBytes;
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -635,6 +657,7 @@ public class Data implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class DataAccessError extends BerInteger {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class DefineNamedVariableListRequest implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ObjectName variableListName = null;
private VariableDefs listOfVariable = null;
@ -40,6 +40,7 @@ public class DefineNamedVariableListRequest implements BerType, Serializable {
this.listOfVariable = listOfVariable;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class DefineNamedVariableListRequest implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -73,42 +72,55 @@ public class DefineNamedVariableListRequest implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
subCodeLength += berTag.decode(is);
variableListName = new ObjectName();
subCodeLength += variableListName.decode(is, berTag);
subCodeLength += berTag.decode(is);
numDecodedBytes = variableListName.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
listOfVariable = new VariableDefs();
subCodeLength += listOfVariable.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += listOfVariable.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -117,6 +129,7 @@ public class DefineNamedVariableListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerNull;
import com.beanit.asn1bean.ber.types.BerNull;
public class DefineNamedVariableListResponse extends BerNull {

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -18,13 +18,11 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerInteger scopeOfDelete = null;
private ListOfVariableListName listOfVariableListName = null;
private DomainName domainName = null;
public DeleteNamedVariableListRequest() {}
public DeleteNamedVariableListRequest(byte[] code) {
this.code = code;
}
@ -53,6 +51,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
this.domainName = domainName;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -60,9 +59,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -104,60 +101,67 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
if (totalLength == 0) {
return codeLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
if (lengthVal == 0) {
return tlByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += 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;
vByteCount += scopeOfDelete.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += 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;
vByteCount += listOfVariableListName.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
domainName = new DomainName();
subCodeLength += domainName.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += domainName.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -166,6 +170,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -220,7 +225,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<ObjectName> seqOf = null;
public ListOfVariableListName() {
@ -238,6 +243,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -245,9 +251,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -268,36 +272,48 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
ObjectName element = new ObjectName();
subCodeLength += element.decode(is, null);
numDecodedBytes = element.decode(is, berTag);
if (numDecodedBytes == 0) {
throw new IOException("Tag did not match");
}
vByteCount += numDecodedBytes;
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -306,6 +322,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -346,7 +363,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BasicIdentifier basic = null;
public DomainName() {}
@ -363,12 +380,11 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
this.basic = basic;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -381,27 +397,28 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BasicIdentifier.tag)) {
basic = new BasicIdentifier();
codeLength += basic.decode(is, false);
return codeLength;
tlvByteCount += basic.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -414,6 +431,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class DeleteNamedVariableListResponse implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Unsigned32 numberMatched = null;
private Unsigned32 numberDeleted = null;
@ -40,6 +40,7 @@ public class DeleteNamedVariableListResponse implements BerType, Serializable {
this.numberDeleted = numberDeleted;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class DeleteNamedVariableListResponse implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -76,46 +75,54 @@ public class DeleteNamedVariableListResponse implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += numberMatched.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
numberDeleted = new Unsigned32();
subCodeLength += numberDeleted.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += numberDeleted.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -124,6 +131,7 @@ public class DeleteNamedVariableListResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class DirectoryEntry implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private FileName fileName = null;
private FileAttributes fileAttributes = null;
@ -40,6 +40,7 @@ public class DirectoryEntry implements BerType, Serializable {
this.fileAttributes = fileAttributes;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class DirectoryEntry implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -76,46 +75,54 @@ public class DirectoryEntry implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += fileName.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
fileAttributes = new FileAttributes();
subCodeLength += fileAttributes.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += fileAttributes.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -124,6 +131,7 @@ public class DirectoryEntry implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerGeneralizedTime;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerGeneralizedTime;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,7 +15,7 @@ public class FileAttributes implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Unsigned32 sizeOfFile = null;
private BerGeneralizedTime lastModified = null;
@ -41,6 +41,7 @@ public class FileAttributes implements BerType, Serializable {
this.lastModified = lastModified;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -48,9 +49,7 @@ public class FileAttributes implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -79,49 +78,55 @@ public class FileAttributes implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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;
vByteCount += sizeOfFile.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
lastModified = new BerGeneralizedTime();
subCodeLength += lastModified.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += lastModified.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -130,6 +135,7 @@ public class FileAttributes implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import java.math.BigInteger;

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerNull;
import com.beanit.asn1bean.ber.types.BerNull;
public class FileCloseResponse extends BerNull {

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
public class FileDeleteRequest extends FileName {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerNull;
import com.beanit.asn1bean.ber.types.BerNull;
public class FileDeleteResponse extends BerNull {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class FileDirectoryRequest implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private FileName fileSpecification = null;
private FileName continueAfter = null;
@ -40,6 +40,7 @@ public class FileDirectoryRequest implements BerType, Serializable {
this.continueAfter = continueAfter;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class FileDirectoryRequest implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -80,50 +79,56 @@ public class FileDirectoryRequest implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
if (totalLength == 0) {
return codeLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
if (lengthVal == 0) {
return tlByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += 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;
vByteCount += fileSpecification.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += 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;
vByteCount += continueAfter.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -132,6 +137,7 @@ public class FileDirectoryRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import com.beanit.openiec61850.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
@ -18,10 +18,9 @@ public class FileDirectoryResponse implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ListOfDirectoryEntry listOfDirectoryEntry = null;
private BerBoolean moreFollows = null;
public FileDirectoryResponse() {}
public FileDirectoryResponse(byte[] code) {
@ -44,6 +43,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
this.moreFollows = moreFollows;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -51,9 +51,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -86,50 +84,57 @@ public class FileDirectoryResponse implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
listOfDirectoryEntry = new ListOfDirectoryEntry();
subCodeLength += listOfDirectoryEntry.decode(is, true);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += listOfDirectoryEntry.decode(is, true);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
moreFollows = new BerBoolean();
subCodeLength += moreFollows.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += moreFollows.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -138,6 +143,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -177,7 +183,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<DirectoryEntry> seqOf = null;
public ListOfDirectoryEntry() {
@ -195,6 +201,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -202,9 +209,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -225,36 +230,46 @@ public class FileDirectoryResponse implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
if (!berTag.equals(DirectoryEntry.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
DirectoryEntry element = new DirectoryEntry();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -263,6 +278,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.jasn1.ber.types.string.BerGraphicString;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import com.beanit.asn1bean.ber.types.string.BerGraphicString;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -18,7 +18,7 @@ public class FileName implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<BerGraphicString> seqOf = null;
public FileName() {
@ -36,6 +36,7 @@ public class FileName implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -43,9 +44,7 @@ public class FileName implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -66,36 +65,46 @@ public class FileName implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
if (!berTag.equals(BerGraphicString.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
BerGraphicString element = new BerGraphicString();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -104,6 +113,7 @@ public class FileName implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class FileOpenRequest implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private FileName fileName = null;
private Unsigned32 initialPosition = null;
@ -40,6 +40,7 @@ public class FileOpenRequest implements BerType, Serializable {
this.initialPosition = initialPosition;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class FileOpenRequest implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -76,46 +75,54 @@ public class FileOpenRequest implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += fileName.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
initialPosition = new Unsigned32();
subCodeLength += initialPosition.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += initialPosition.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -124,6 +131,7 @@ public class FileOpenRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class FileOpenResponse implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Integer32 frsmID = null;
private FileAttributes fileAttributes = null;
@ -40,6 +40,7 @@ public class FileOpenResponse implements BerType, Serializable {
this.fileAttributes = fileAttributes;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +48,7 @@ public class FileOpenResponse implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -76,46 +75,54 @@ public class FileOpenResponse implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
int totalLength = length.val;
codeLength += totalLength;
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
frsmID = new Integer32();
subCodeLength += frsmID.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += frsmID.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
fileAttributes = new FileAttributes();
subCodeLength += fileAttributes.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += fileAttributes.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -124,6 +131,7 @@ public class FileOpenResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import java.math.BigInteger;

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerOctetString;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerOctetString;
import com.beanit.asn1bean.ber.types.BerType;
import com.beanit.openiec61850.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
@ -16,7 +16,7 @@ public class FileReadResponse implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerOctetString fileData = null;
private BerBoolean moreFollows = null;
@ -42,6 +42,7 @@ public class FileReadResponse implements BerType, Serializable {
this.moreFollows = moreFollows;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -49,9 +50,7 @@ public class FileReadResponse implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -80,49 +79,55 @@ public class FileReadResponse implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
int totalLength = length.val;
codeLength += totalLength;
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
fileData = new BerOctetString();
subCodeLength += fileData.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += fileData.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
moreFollows = new BerBoolean();
subCodeLength += moreFollows.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += moreFollows.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -131,6 +136,7 @@ public class FileReadResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerOctetString;
import com.beanit.asn1bean.ber.types.BerOctetString;
public class FloatingPoint extends BerOctetString {

@ -1,11 +1,11 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerNull;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerNull;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,11 +15,10 @@ public class GetNameListRequest implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ObjectClass objectClass = null;
private ObjectScope objectScope = null;
private Identifier continueAfter = null;
public GetNameListRequest() {}
public GetNameListRequest(byte[] code) {
@ -50,6 +49,7 @@ public class GetNameListRequest implements BerType, Serializable {
this.continueAfter = continueAfter;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -57,9 +57,7 @@ public class GetNameListRequest implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -99,59 +97,67 @@ public class GetNameListRequest implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
objectClass = new ObjectClass();
subCodeLength += objectClass.decode(is, null);
subCodeLength += berTag.decode(is);
vByteCount += objectClass.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
objectScope = new ObjectScope();
subCodeLength += objectScope.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += objectScope.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
continueAfter = new Identifier();
subCodeLength += continueAfter.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += continueAfter.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -160,6 +166,7 @@ public class GetNameListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -210,7 +217,7 @@ public class GetNameListRequest implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerNull vmdSpecific = null;
private Identifier domainSpecific = null;
private BerNull aaSpecific = null;
@ -245,12 +252,11 @@ public class GetNameListRequest implements BerType, Serializable {
this.aaSpecific = aaSpecific;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -282,39 +288,40 @@ public class GetNameListRequest implements BerType, Serializable {
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
vmdSpecific = new BerNull();
codeLength += vmdSpecific.decode(is, false);
return codeLength;
tlvByteCount += vmdSpecific.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
domainSpecific = new Identifier();
codeLength += domainSpecific.decode(is, false);
return codeLength;
tlvByteCount += domainSpecific.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
aaSpecific = new BerNull();
codeLength += aaSpecific.decode(is, false);
return codeLength;
tlvByteCount += aaSpecific.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -327,6 +334,7 @@ public class GetNameListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import com.beanit.openiec61850.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
@ -18,10 +18,9 @@ public class GetNameListResponse implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ListOfIdentifier listOfIdentifier = null;
private BerBoolean moreFollows = null;
public GetNameListResponse() {}
public GetNameListResponse(byte[] code) {
@ -44,6 +43,7 @@ public class GetNameListResponse implements BerType, Serializable {
this.moreFollows = moreFollows;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -51,9 +51,7 @@ public class GetNameListResponse implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -82,49 +80,55 @@ public class GetNameListResponse implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
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;
vByteCount += listOfIdentifier.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
subCodeLength += berTag.decode(is);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
moreFollows = new BerBoolean();
subCodeLength += moreFollows.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += moreFollows.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -133,6 +137,7 @@ public class GetNameListResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -172,7 +177,7 @@ public class GetNameListResponse implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<Identifier> seqOf = null;
public ListOfIdentifier() {
@ -190,6 +195,7 @@ public class GetNameListResponse implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -197,9 +203,7 @@ public class GetNameListResponse implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -220,36 +224,46 @@ public class GetNameListResponse implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
if (!berTag.equals(Identifier.tag)) {
throw new IOException("Tag does not match mandatory sequence of/set of component.");
}
Identifier element = new Identifier();
subCodeLength += element.decode(is, true);
vByteCount += element.decode(is, false);
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -258,6 +272,7 @@ public class GetNameListResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
public class GetNamedVariableListAttributesRequest extends ObjectName {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import com.beanit.openiec61850.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
@ -15,7 +15,7 @@ public class GetNamedVariableListAttributesResponse implements BerType, Serializ
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerBoolean mmsDeletable = null;
private VariableDefs listOfVariable = null;
@ -41,6 +41,7 @@ public class GetNamedVariableListAttributesResponse implements BerType, Serializ
this.listOfVariable = listOfVariable;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -48,9 +49,7 @@ public class GetNamedVariableListAttributesResponse implements BerType, Serializ
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -77,46 +76,54 @@ public class GetNamedVariableListAttributesResponse implements BerType, Serializ
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += mmsDeletable.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
listOfVariable = new VariableDefs();
subCodeLength += listOfVariable.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += listOfVariable.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -125,6 +132,7 @@ public class GetNamedVariableListAttributesResponse implements BerType, Serializ
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,7 +14,7 @@ public class GetVariableAccessAttributesRequest implements BerType, Serializable
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ObjectName name = null;
public GetVariableAccessAttributesRequest() {}
@ -31,12 +31,11 @@ public class GetVariableAccessAttributesRequest implements BerType, Serializable
this.name = name;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
return code.length;
}
@ -56,28 +55,31 @@ public class GetVariableAccessAttributesRequest implements BerType, Serializable
throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
}
@Override
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;
int tlvByteCount = 0;
boolean tagWasPassed = (berTag != null);
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
tlvByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
codeLength += BerLength.skip(is);
BerLength explicitTagLength = new BerLength();
tlvByteCount += explicitTagLength.decode(is);
name = new ObjectName();
codeLength += name.decode(is, null);
return codeLength;
tlvByteCount += name.decode(is, null);
tlvByteCount += explicitTagLength.readEocIfIndefinite(is);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -90,6 +92,7 @@ public class GetVariableAccessAttributesRequest implements BerType, Serializable
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import com.beanit.openiec61850.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
@ -15,7 +15,7 @@ public class GetVariableAccessAttributesResponse implements BerType, Serializabl
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerBoolean mmsDeletable = null;
private TypeDescription typeDescription = null;
@ -41,6 +41,7 @@ public class GetVariableAccessAttributesResponse implements BerType, Serializabl
this.typeDescription = typeDescription;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -48,9 +49,7 @@ public class GetVariableAccessAttributesResponse implements BerType, Serializabl
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -81,47 +80,56 @@ public class GetVariableAccessAttributesResponse implements BerType, Serializabl
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += mmsDeletable.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
typeDescription = new TypeDescription();
subCodeLength += typeDescription.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += typeDescription.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -130,6 +138,7 @@ public class GetVariableAccessAttributesResponse implements BerType, Serializabl
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.string.BerVisibleString;
import com.beanit.asn1bean.ber.types.string.BerVisibleString;
public class Identifier extends BerVisibleString {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -17,10 +17,9 @@ public class InformationReport implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private VariableAccessSpecification variableAccessSpecification = null;
private ListOfAccessResult listOfAccessResult = null;
public InformationReport() {}
public InformationReport(byte[] code) {
@ -44,6 +43,7 @@ public class InformationReport implements BerType, Serializable {
this.listOfAccessResult = listOfAccessResult;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -51,9 +51,7 @@ public class InformationReport implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -77,42 +75,55 @@ public class InformationReport implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
int totalLength = length.val;
codeLength += totalLength;
subCodeLength += berTag.decode(is);
variableAccessSpecification = new VariableAccessSpecification();
subCodeLength += variableAccessSpecification.decode(is, berTag);
subCodeLength += berTag.decode(is);
numDecodedBytes = variableAccessSpecification.decode(is, berTag);
if (numDecodedBytes != 0) {
vByteCount += numDecodedBytes;
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
listOfAccessResult = new ListOfAccessResult();
subCodeLength += listOfAccessResult.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += listOfAccessResult.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -121,6 +132,7 @@ public class InformationReport implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -163,7 +175,7 @@ public class InformationReport implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private List<AccessResult> seqOf = null;
public ListOfAccessResult() {
@ -181,6 +193,7 @@ public class InformationReport implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -188,9 +201,7 @@ public class InformationReport implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -211,36 +222,48 @@ public class InformationReport implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
int numDecodedBytes;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
tlByteCount += length.decode(is);
int lengthVal = length.val;
while (vByteCount < lengthVal || lengthVal < 0) {
vByteCount += berTag.decode(is);
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
while (subCodeLength < totalLength) {
AccessResult element = new AccessResult();
subCodeLength += element.decode(is, null);
numDecodedBytes = element.decode(is, berTag);
if (numDecodedBytes == 0) {
throw new IOException("Tag did not match");
}
vByteCount += numDecodedBytes;
seqOf.add(element);
}
if (subCodeLength != totalLength) {
if (lengthVal >= 0 && vByteCount != lengthVal) {
throw new IOException(
"Decoded SequenceOf or SetOf has wrong length. Expected "
+ totalLength
+ lengthVal
+ " but has "
+ subCodeLength);
+ vByteCount);
}
codeLength += subCodeLength;
return codeLength;
return tlByteCount + vByteCount;
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -249,6 +272,7 @@ public class InformationReport implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,4 +1,4 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
public class InitiateErrorPDU extends ServiceError {

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,13 +14,12 @@ public class InitiateRequestPDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private 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) {
@ -67,6 +66,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
this.initRequestDetail = initRequestDetail;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -74,9 +74,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -122,66 +120,74 @@ public class InitiateRequestPDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += localDetailCalling.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
proposedMaxServOutstandingCalling = new Integer16();
subCodeLength += proposedMaxServOutstandingCalling.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += proposedMaxServOutstandingCalling.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
proposedMaxServOutstandingCalled = new Integer16();
subCodeLength += proposedMaxServOutstandingCalled.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += proposedMaxServOutstandingCalled.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
proposedDataStructureNestingLevel = new Integer8();
subCodeLength += proposedDataStructureNestingLevel.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += proposedDataStructureNestingLevel.decode(is, false);
vByteCount += 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;
vByteCount += initRequestDetail.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -190,6 +196,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -261,7 +268,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Integer16 proposedVersionNumber = null;
private ParameterSupportOptions proposedParameterCBB = null;
private ServiceSupportOptions servicesSupportedCalling = null;
@ -296,6 +303,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
this.servicesSupportedCalling = servicesSupportedCalling;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -303,9 +311,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -337,54 +343,65 @@ public class InitiateRequestPDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += proposedVersionNumber.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
proposedParameterCBB = new ParameterSupportOptions();
subCodeLength += proposedParameterCBB.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += proposedParameterCBB.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
servicesSupportedCalling = new ServiceSupportOptions();
subCodeLength += servicesSupportedCalling.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += servicesSupportedCalling.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -393,6 +410,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,10 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.BerLength;
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
import com.beanit.asn1bean.ber.BerLength;
import com.beanit.asn1bean.ber.BerTag;
import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
import com.beanit.asn1bean.ber.types.BerType;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -14,13 +14,12 @@ public class InitiateResponsePDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private 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) {
@ -68,6 +67,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
this.initResponseDetail = initResponseDetail;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -75,9 +75,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -123,66 +121,74 @@ public class InitiateResponsePDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += localDetailCalled.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
negotiatedMaxServOutstandingCalling = new Integer16();
subCodeLength += negotiatedMaxServOutstandingCalling.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += negotiatedMaxServOutstandingCalling.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
negotiatedMaxServOutstandingCalled = new Integer16();
subCodeLength += negotiatedMaxServOutstandingCalled.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += negotiatedMaxServOutstandingCalled.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
negotiatedDataStructureNestingLevel = new Integer8();
subCodeLength += negotiatedDataStructureNestingLevel.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += negotiatedDataStructureNestingLevel.decode(is, false);
vByteCount += 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;
vByteCount += initResponseDetail.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
"Unexpected end of sequence, length tag: " + lengthVal + ", bytes decoded: " + vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -191,6 +197,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -264,7 +271,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Integer16 negotiatedVersionNumber = null;
private ParameterSupportOptions negotiatedParameterCBB = null;
private ServiceSupportOptions servicesSupportedCalled = null;
@ -299,6 +306,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
this.servicesSupportedCalled = servicesSupportedCalled;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -306,9 +314,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
if (code != null) {
for (int i = code.length - 1; i >= 0; i--) {
reverseOS.write(code[i]);
}
reverseOS.write(code);
if (withTag) {
return tag.encode(reverseOS) + code.length;
}
@ -340,54 +346,65 @@ public class InitiateResponsePDU implements BerType, Serializable {
return codeLength;
}
@Override
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;
int tlByteCount = 0;
int vByteCount = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
tlByteCount += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.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);
vByteCount += negotiatedVersionNumber.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
negotiatedParameterCBB = new ParameterSupportOptions();
subCodeLength += negotiatedParameterCBB.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += negotiatedParameterCBB.decode(is, false);
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
throw new IOException("Tag does not match mandatory sequence component.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
servicesSupportedCalled = new ServiceSupportOptions();
subCodeLength += servicesSupportedCalled.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += servicesSupportedCalled.decode(is, false);
if (lengthVal >= 0 && vByteCount == lengthVal) {
return tlByteCount + vByteCount;
}
vByteCount += berTag.decode(is);
} else {
throw new IOException("Tag does not match mandatory sequence component.");
}
if (lengthVal < 0) {
if (!berTag.equals(0, 0, 0)) {
throw new IOException("Decoded sequence has wrong end of contents octets");
}
vByteCount += BerLength.readEocByte(is);
return tlByteCount + vByteCount;
}
throw new IOException(
"Unexpected end of sequence, length tag: "
+ totalLength
+ ", actual sequence length: "
+ subCodeLength);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -396,6 +413,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class Integer16 extends BerInteger {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class Integer32 extends BerInteger {

@ -1,7 +1,7 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
/** This class file was automatically generated by ASN1bean (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
import com.beanit.jasn1.ber.types.BerInteger;
import com.beanit.asn1bean.ber.types.BerInteger;
import java.math.BigInteger;
public class Integer8 extends BerInteger {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save