Compare commits

..

56 Commits

Author SHA1 Message Date
Stefan Feuerhahn c5acb251b7 Merge branch 'master' of github.com:beanit/openiec61850 2 years ago
Stefan Feuerhahn 0d652ed0d0 updated windows batch script to work with Java 17 2 years ago
sfeuerhahn 0508da4073
Merge pull request #35 from SteffenBrauns/patch-1
Bugfix NPE in ClientAssociation#close()
2 years ago
SteffenBrauns 6d8859f6f6
Bugfix NPE in ClientAssociation#close()
Added null check for reportListener
2 years ago
sfeuerhahn f9f34cde0c
Merge pull request #23 from pavel-ch/master
ClientAssociation: store servicesSupported from InitiateResponsePDU for a later access
4 years ago
pavel-ch fa62271c46 Merge branch 'master' of https://github.com/beanit/iec61850bean 4 years ago
pavel-ch cb903a3f61 ClientAssociation: storing servicesSupported from InitiateResponsePDU for a later access 4 years ago
Stefan Feuerhahn 77c7b009b4 removed unnecessary setters, removed exposing proposedParameterCbbBitString 5 years ago
Matthias Kruse e0770f03e6 reverted change of other commit 5 years ago
Matthias Kruse ef06aea374 fixed #10 5 years ago
Matthias Kruse 0afb4f56a1 fixes #18 5 years ago
Stefan Feuerhahn eccb578588 updated errorprone version to 2.5.1 5 years ago
Stefan Feuerhahn 1f01fcac02 enhanced SequenceNumber class 5 years ago
Stefan Feuerhahn 05d75db9db upgraded gradle plugin dependency versions and java dependency versions 5 years ago
Stefan Feuerhahn cd11b7c9ff fixed setting reportTimestamp field in OptFlds class, thanks to Krzysztof Pasierbski 5 years ago
Stefan Feuerhahn 24cee0d77e removed unnecessary files from gradle tar task 5 years ago
Stefan Feuerhahn fc8ec39ed9 set version to 1.9.1-SNAPSHOT 5 years ago
Stefan Feuerhahn fef09d40c8 release v1.9.0 5 years ago
Stefan Feuerhahn 48531ffd8d windows run scripts now support white space in paths 5 years ago
Stefan Feuerhahn b3e45e0f16 minor format fix 5 years ago
Stefan Feuerhahn 69a1c96c04 updated changelog 5 years ago
Stefan Feuerhahn 792afe0ce8 removed code smells detected by IntelliJ and Error Prone SCA, removed the GUI's jcalendar dependency 5 years ago
Stefan Feuerhahn 6c89bb3639 added error prone SCA plugin to gradle build file 5 years ago
Stefan Feuerhahn 49a6743e50 updated gradle wrapper to v6.5 5 years ago
Stefan Feuerhahn 63db1782d1 combined asn1 compile scripts 5 years ago
Stefan Feuerhahn 667ae70c35 regenerated asn1/ber classes with newest asn1bean compiler 5 years ago
Stefan Feuerhahn f416a33418 renamed OpenIEC61850 to IEC61850bean 5 years ago
Stefan Feuerhahn 75ad0eb76c updated build plugins/dependencies: spotless, bnd, junit, archunit 5 years ago
Stefan Feuerhahn 066a034c49 further improved support for white space in parameter 5 years ago
Stefan Feuerhahn 8e4a1b0f81 added quotes around in bash scripts to allow for white spaces in parameter paths 5 years ago
Stefan Feuerhahn d7d87c6004 switched to newest snapshot of jasn1 which was renamed to asn1bean 5 years ago
Stefan Feuerhahn e37e072144 removed redundant repository declaration in build script 5 years ago
Stefan Feuerhahn 92705822d6 moved HexConverter to internal package and renamed it to HexString 5 years ago
Stefan Feuerhahn 7552c59319 fixed compile bug introduced in latest fix to reset data sets in the scl parser 5 years ago
Stefan Feuerhahn 9b7e830559 minor code clean up 5 years ago
Stefan Feuerhahn 983fbbddb4 Merge branch 'master' of github.com:beanit/openiec61850 5 years ago
Stefan Feuerhahn 9fc7d2376c added eclipse output dirs bin/main and bin/test to gitignore, and ignore them when creating tar file 5 years ago
sfeuerhahn fb6dded6c9
Merge pull request #11 from MoheyEl-DinBadr/patch-1
fix parsing multiple IEDs in SCL file by clearing data set map
5 years ago
MoheyEl-DinBadr 10dd18750a
Update SclParser.java
The library has a problem of importing a whole SCD file which consists of several IEDs and that is because The dataSets Map is not cleared between switching of creating the next ServerModel of next IED.
5 years ago
Stefan Feuerhahn cbac75d770 added first ArchUnit test 5 years ago
Stefan Feuerhahn 42e855fce6 converted gradle build file from groovy dsl to kotlin dsl 6 years ago
Stefan Feuerhahn d1237d2e45 removed itest source set 6 years ago
Stefan Feuerhahn 476bed5898 renamed thread factory 6 years ago
Stefan Feuerhahn 9d01e8b867 minor update to gradle version 6 years ago
Stefan Feuerhahn 193e76209e minor updated in general build script 6 years ago
Stefan Feuerhahn c7c69b6294 moved jar config in afterEvaluate 6 years ago
Stefan Feuerhahn 7c4961db5f changed gradle to insert automatic module name into manifest file and to link generated javadoc to java se 8 6 years ago
Stefan Feuerhahn 9aa85d1a90 converted junit 4 tests to junit 5 tests 6 years ago
Stefan Feuerhahn 5235f51e32 changed java version from 7 to 8 6 years ago
Stefan Feuerhahn 249b7c6dd9 gradle wrapper and spotless gradle plugin update 6 years ago
Stefan Feuerhahn 7e9eb53e0f minor change in naming of threads created by the library 6 years ago
Stefan Feuerhahn 1cc94089f4 updated doc to reflect changes in the way client parses an scl file 6 years ago
Stefan Feuerhahn bbc98a065a moved all start scripts to bin folder 6 years ago
Stefan Feuerhahn d2c53aeb94 updated links in readme 6 years ago
Stefan Feuerhahn a3a11ed52c switched to gradle java-library plugin 7 years ago
Stefan Feuerhahn e8bb35fd02 set version to 1.8.1-SNAPSHOT 7 years ago

2
.gitignore vendored

@ -12,3 +12,5 @@ out/
.project
.classpath
.metadata/
**/bin/main/
**/bin/test/

@ -1,4 +1,4 @@
# OpenIEC61850
OpenIEC61850 is a library implementing the IEC 61850 standard based on the MMS mapping for client and server communication.
# IEC61850bean
IEC61850bean (previously known as OpenIEC61850) is a library implementing the IEC 61850 standard based on the MMS mapping for client and server communication.
For detailed information on OpenIEC61850 visit https://www.beanit.com/iec-61850/. OpenIEC61850 has recently been moved from openmuc.org to beanit.com.
For detailed information on IEC61850bean visit https://www.beanit.com/iec-61850/.

@ -0,0 +1,12 @@
#!/bin/bash
cd `dirname $0`
rm ../src/main/java-gen/com/beanit/josistack/internal/acse/asn1/*
asn1bean-compiler -o "../src/main/java-gen/" -p "com.beanit.josistack.internal.acse" -f iso-acse-layer.asn -dv
rm ../src/main/java-gen/com/beanit/josistack/internal/presentation/asn1/*
asn1bean-compiler -o "../src/main/java-gen/" -p "com.beanit.josistack.internal.presentation" -f iso-presentation-layer.asn -dv
rm -r ../src/main/java-gen/com/beanit/iec61850bean/internal/mms/asn1/*
asn1bean-compiler -o "../src/main/java-gen" -p "com.beanit.iec61850bean.internal.mms" -f mms.asn -dv

@ -1,7 +0,0 @@
#!/bin/bash
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

@ -1,6 +0,0 @@
#!/bin/bash
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

@ -1,7 +0,0 @@
#!/bin/bash
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

@ -1,5 +0,0 @@
#!/bin/bash
cd `dirname $0`
find ../../ -iname "*.java" | xargs sed -i 's/import com\.beanit\.jasn1\.ber\.types\.BerBoolean/import com\.beanit\.openiec61850\.internal\.BerBoolean/g'

@ -0,0 +1,10 @@
steps to follow:
1) compile classes by executing compile.sh
2) format everything using IntelliJ
3) execute replace-berboolean.sh (this step does not work if step 2
is not executed)
4) again format everyting using IntelliJ

@ -0,0 +1,6 @@
#!/bin/bash
cd `dirname $0`
# replace BerBoolean from ASN1bean with special one for IEC 61850 so that true is coded as 0x01 instead of 0xff
find ../ -iname "*.java" | xargs sed -i 's/import com\.beanit\.asn1bean\.ber\.types\.BerBoolean/import com\.beanit\.iec61850bean\.internal\.BerBoolean/g'

@ -1,20 +0,0 @@
#!/bin/bash
JARS_LOCATION="../../build/libs-all"
MAIN_CLASS="com.beanit.openiec61850.app.ConsoleClient"
SYSPROPS=""
PARAMS=""
SCRIPT_HOME=`dirname $0`
CLASSPATH=$(JARS=("$SCRIPT_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}")
for i in $@; do
if [[ $i == -D* ]]; then
SYSPROPS="$SYSPROPS $i";
else
PARAMS="$PARAMS $i";
fi
done
java $SYSPROPS -cp $CLASSPATH $MAIN_CLASS $PARAMS

@ -1,6 +0,0 @@
::BATCH file for windows
set BATDIR=%~dp0
set LIBDIR=%BATDIR%..\..\build\libs-all
java -Djava.ext.dirs=%LIBDIR% com.beanit.openiec61850.app.ConsoleClient %*

@ -1,6 +0,0 @@
::BATCH file to windows
set BATDIR=%~dp0
set LIBDIR=%BATDIR%..\..\build\libs-all
java -Dlogback.configurationFile=logback.xml -Djava.ext.dirs=%LIBDIR% com.beanit.openiec61850.app.ConsoleServer %*

@ -1,39 +0,0 @@
#!/bin/bash
JARS_LOCATION="../../build/libs-all"
MAIN_CLASS="com.beanit.openiec61850.clientgui.ClientGui"
SYSPROPS=""
PARAMS=""
# from gradle start script:
# Attempt to set SCRIPT_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
SCRIPT_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$(JARS=("$SCRIPT_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}")
for i in $@; do
if [[ $i == -D* ]]; then
SYSPROPS="$SYSPROPS $i";
else
PARAMS="$PARAMS $i";
fi
done
java $SYSPROPS -cp $CLASSPATH $MAIN_CLASS $PARAMS

@ -1,6 +0,0 @@
::BATCH file to windows
set BATDIR=%~dp0
set LIBDIR=%BATDIR%..\..\build\libs-all
java -Djava.ext.dirs=%LIBDIR% com.beanit.openiec61850.clientgui.ClientGui %*

@ -0,0 +1,38 @@
#!/bin/bash
JARS_LOCATION="build/libs-all"
MAIN_CLASS="com.beanit.iec61850bean.app.ConsoleClient"
SYSPROPS=""
PARAMS=""
# Attempt to set APP_HOME (from Gradle start script)
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/.." >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$(JARS=("$APP_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}")
PARAMS=( )
SYSPROPS=( )
for i in "$@"; do
if [[ $i == -D* ]]; then
SYSPROPS+=( "$i" )
else
PARAMS+=( "$i" )
fi
done
java "${SYSPROPS[@]}" -cp "$CLASSPATH" $MAIN_CLASS "${PARAMS[@]}"

@ -0,0 +1,7 @@
::BATCH file to windows
@echo off
set BATDIR=%~dp0
set LIBDIR="%BATDIR%..\build\libs-all\*"
java -cp %LIBDIR% com.beanit.iec61850bean.app.ConsoleClient %*

@ -1,11 +1,10 @@
#!/bin/bash
JARS_LOCATION="../../build/libs-all"
MAIN_CLASS="com.beanit.openiec61850.app.ConsoleServer"
JARS_LOCATION="build/libs-all"
MAIN_CLASS="com.beanit.iec61850bean.app.ConsoleServer"
SYSPROPS="-Dlogback.configurationFile=logback.xml"
# from gradle start script:
# Attempt to set SCRIPT_HOME
# Attempt to set APP_HOME (from Gradle start script)
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
@ -19,19 +18,20 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
SCRIPT_HOME="`pwd -P`"
cd "`dirname \"$PRG\"`/.." >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$(JARS=("$APP_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}")
CLASSPATH=$(JARS=("$SCRIPT_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}")
for i in $@; do
PARAMS=( )
SYSPROPS=( )
for i in "$@"; do
if [[ $i == -D* ]]; then
SYSPROPS="$SYSPROPS $i";
SYSPROPS+=( "$i" )
else
PARAMS="$PARAMS $i";
PARAMS+=( "$i" )
fi
done
java $SYSPROPS -cp $CLASSPATH $MAIN_CLASS $PARAMS
java "${SYSPROPS[@]}" -cp "$CLASSPATH" $MAIN_CLASS "${PARAMS[@]}"

@ -0,0 +1,8 @@
::BATCH file to windows
@echo off
set BATDIR=%~dp0
set LIBDIR="%BATDIR%..\build\libs-all\*"
java -Dlogback.configurationFile=logback.xml -cp %LIBDIR% com.beanit.iec61850bean.app.ConsoleServer %*

@ -0,0 +1,38 @@
#!/bin/bash
JARS_LOCATION="build/libs-all"
MAIN_CLASS="com.beanit.iec61850bean.clientgui.ClientGui"
SYSPROPS=""
PARAMS=""
# Attempt to set APP_HOME (from Gradle start script)
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/.." >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$(JARS=("$APP_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}")
PARAMS=( )
SYSPROPS=( )
for i in "$@"; do
if [[ $i == -D* ]]; then
SYSPROPS+=( "$i" )
else
PARAMS+=( "$i" )
fi
done
java "${SYSPROPS[@]}" -cp "$CLASSPATH" $MAIN_CLASS "${PARAMS[@]}"

@ -0,0 +1,7 @@
::BATCH file to windows
@echo off
set BATDIR=%~dp0
set LIBDIR="%BATDIR%..\build\libs-all\*"
java -cp %LIBDIR% com.beanit.iec61850bean.clientgui.ClientGui %*

@ -1,219 +0,0 @@
plugins {
id("biz.aQute.bnd.builder") version "4.1.0"
id("com.diffplug.gradle.spotless") version "3.19.0" apply false
id("io.codearte.nexus-staging") version "0.20.0"
}
apply from: "configuration.gradle"
configure(allprojects) {
version = cfgVersion
}
nexusStaging {
packageGroup = cfgGroup
username = cfgRepositoryUser
password = cfgRepositoryPass
stagingProfileId = cfgStagingProfileId
}
configure(javaProjects) {
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "maven"
apply plugin: "signing"
apply plugin: "biz.aQute.bnd.builder"
apply plugin: "com.diffplug.gradle.spotless"
uploadArchives.enabled = false
group = cfgGroup
if (!project.properties.containsKey('cfgJavaVersion')) {
project.ext {
cfgJavaVersion = '1.8'
}
}
sourceCompatibility = cfgJavaVersion
targetCompatibility = cfgJavaVersion
repositories {
mavenCentral()
mavenLocal()
}
sourceSets {
itest {
compileClasspath += sourceSets.main.runtimeClasspath
}
}
dependencies {
testCompile group: "junit", name: "junit", version: "4.12"
itestCompile group: "junit", name: "junit", version: "4.12"
}
jar {
manifest {
version = project.version.replace("-", ".")
}
}
spotless {
java {
googleJavaFormat()
}
}
tasks.withType(JavaCompile) {
doFirst {
if (sourceCompatibility == '1.7' && System.env.JDK7_HOME != null) {
options.fork = true
options.bootstrapClasspath = files("$System.env.JDK7_HOME/jre/lib/rt.jar")
}
}
}
task jarAll(type: Copy) {
dependsOn(configurations.default.getAllArtifacts().getBuildDependencies())
//only the jar file created:
from configurations.default.getAllArtifacts().getFiles()
if (cfgCopyDependencies) {
if (cfgCopyToRoot) {
into rootDir.getPath() + "/build/libs-all"
} else {
into "build/libs-all"
}
//includes all the dependencies:
from configurations.default
} else {
if (cfgCopyToRoot) {
into rootDir.getPath() + "/build/libs-all"
} else {
into "build/libs-all"
}
}
}
build.dependsOn { jarAll }
eclipse.pathVariables([GRADLE_USER_HOME: file(gradle.gradleUserHomeDir)])
tasks.eclipse.dependsOn(cleanEclipse)
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
javadoc {
exclude "**/internal/**"
exclude "**/java-gen/**"
exclude "**/app/**"
}
}
configure(repositoryProjects) {
uploadArchives.enabled = true
if (cfgSignPom) {
signing {
if (project.hasProperty("signing.keyId")) {
sign configurations.archives
}
}
}
uploadArchives {
repositories {
mavenDeployer {
if (cfgSignPom) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
repository(url: cfgRepository) {
authentication(userName: cfgRepositoryUser, password: cfgRepositoryPass)
if (cfgRepository != null && System.getProperty("https.proxyHost") != null && ((System.getProperty("https.nonProxyHosts") == null) || !cfgRepository.contains(System.getProperty("https.nonProxyHosts")))) {
proxy(host: System.getProperty("https.proxyHost"), port: Integer.parseInt(System.getProperty("https.proxyPort")), type: "https")
}
}
snapshotRepository(url: cfgSnapshotRepository) {
authentication(userName: cfgRepositoryUser, password: cfgRepositoryPass)
if (cfgSnapshotRepository != null && System.getProperty("https.proxyHost") != null && ((System.getProperty("https.nonProxyHosts") == null) || !cfgSnapshotRepository.contains(System.getProperty("https.nonProxyHosts")))) {
proxy(host: System.getProperty("https.proxyHost"), port: Integer.parseInt(System.getProperty("https.proxyPort")), type: "https")
}
}
pom.project {
//additional pom information can be found in subproject build.gradle files
packaging "jar"
url "http://www.beanit.com/"
scm {
url "none"
connection "none"
}
developers {
developer {
id "beanit"
name "Beanit GmbH"
}
}
}
}
}
}
}
task javadocAll(type: Javadoc) {
source docProjects.collect {
project -> project.sourceSets.main.allJava
}
exclude "**/internal/**"
exclude "**/java-gen/**"
exclude "**/app/**"
destinationDir = new File(buildDir, "docs/javadoc-all")
classpath = files(distributionProjects.collect { project ->
project.sourceSets.main.compileClasspath
})
classpath += files(distributionProjects.collect { project ->
project.sourceSets.main.output
})
}
tasks.withType(Tar) {
dependsOn(distributionProjects.build)
dependsOn(javadocAll)
compression = Compression.GZIP
destinationDir = file("build/distributions/")
}
task(tar, type: Tar) {
archiveName = project.name + "-" + project.version + ".tgz"
}

@ -0,0 +1,317 @@
import net.ltgt.gradle.errorprone.errorprone
plugins {
`java-library`
`maven-publish`
signing
eclipse
id("biz.aQute.bnd.builder") version "5.1.1"
id("com.diffplug.spotless") version "5.9.0"
id("io.codearte.nexus-staging") version "0.22.0"
id("net.ltgt.errorprone") version "1.3.0"
}
var cfgJavaVersion = JavaVersion.VERSION_1_8
val sonatypeRepository: String? by project
val sonatypeSnapshotRepository: String? by project
val sonatypeUser: String? by project
val sonatypePass: String? by project
val sonatypeStagingProfileId: String? by project
//----------- project specific configuration start --------------------
val cfgVersion = "1.9.1-SNAPSHOT"
val cfgGroup = "com.beanit"
val cfgCopyToRoot = false
val cfgSignPom = true
val cfgRepository: String? = sonatypeRepository
val cfgSnapshotRepository: String? = sonatypeSnapshotRepository
val cfgRepositoryUser: String? = sonatypeUser
val cfgRepositoryPass: String? = sonatypePass
val cfgStagingProfileId: String? = sonatypeStagingProfileId
val javaProjects: Set<Project> = allprojects
val distributionProjects = javaProjects
val docProjects = javaProjects
val repositoryProjects = javaProjects
val cfgModuleName = "com.beanit.iec61850bean"
tasks.register<Tar>("tar") {
into(project.name) {
from("./") {
include("build.gradle.kts")
include("LICENSE.txt")
include("doc/**")
include("bin/**")
exclude("bin/main/")
exclude("bin/test/")
include("gradle/wrapper/**")
include("gradlew")
include("gradlew.bat")
include("build/libs-all/**")
include("src/**")
include("asn1/**")
}
}
into(project.name + "/doc/") {
from("./build/docs/") {
include("javadoc/**")
}
}
}
//-----java root project configurations
dependencies {
implementation("com.beanit:asn1bean:1.12.0")
implementation("org.slf4j:slf4j-api:1.7.25")
runtimeOnly("ch.qos.logback:logback-classic:1.2.3")
}
project.extra["cfgModuleName"] = "com.beanit.iec61850bean"
tasks["jar"].withConvention(aQute.bnd.gradle.BundleTaskConvention::class) {
bnd("""
Bundle-Name: IEC61850bean
Bundle-SymbolicName: ${project.extra["cfgModuleName"]}
-exportcontents: !*.internal.*,*
Import-Package: com.beanit.asn1bean.*,javax.net,*;resolution:=optional
""")
}
sourceSets {
main {
java {
setSrcDirs(listOf("src/main/java", "src/main/java-gen"))
}
}
}
publishing {
publications {
maybeCreate<MavenPublication>("mavenJava").pom {
name.set("IEC61850bean")
description.set("IEC61850bean is a Java library implementing the IEC 61850 MMS communication standard for clients and servers.")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}
}
}
//----------- project specific configuration end ---------------------
configure(allprojects) {
version = cfgVersion
group = cfgGroup
}
nexusStaging {
packageGroup = cfgGroup
username = cfgRepositoryUser
password = cfgRepositoryPass
stagingProfileId = cfgStagingProfileId
}
configure(javaProjects) {
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "signing")
apply(plugin = "eclipse")
apply(plugin = "biz.aQute.bnd.builder")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "net.ltgt.errorprone")
tasks.publish {
enabled = false
}
repositories {
mavenCentral()
}
java {
sourceCompatibility = cfgJavaVersion
targetCompatibility = cfgJavaVersion
withSourcesJar()
withJavadocJar()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.7.0")
testImplementation("com.tngtech.archunit:archunit-junit5:0.15.0")
errorprone("com.google.errorprone:error_prone_core:2.5.1")
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<JavaCompile>().configureEach {
options.errorprone.excludedPaths.set(".*java-gen.*")
if (!JavaVersion.current().isJava9Compatible) {
options.errorprone.isEnabled.set(false)
}
}
afterEvaluate {
tasks.jar {
manifest {
attributes["Automatic-Module-Name"] = project.extra["cfgModuleName"]
}
}
}
spotless {
java {
googleJavaFormat()
}
}
tasks.register<Copy>("jarAll") {
from(configurations.runtimeClasspath) // all runtime dependencies
from(tasks.jar) // the jar file created
if (cfgCopyToRoot) {
into(rootDir.path + "/build/libs-all")
} else {
into("build/libs-all")
}
}
tasks.build {
dependsOn("jarAll")
}
eclipse.pathVariables(mapOf("GRADLE_USER_HOME" to file(gradle.gradleUserHomeDir)))
tasks.eclipse { dependsOn(tasks.cleanEclipse) }
tasks.javadoc {
exclude("**/internal/**")
exclude("**/java-gen/**")
exclude("**/app/**")
//linking Javadoc in version prior 9 does not work well because Javadoc uses html frames.
if (cfgJavaVersion.isJava9Compatible) {
if (cfgJavaVersion.isJava11Compatible) {
(options as StandardJavadocDocletOptions).links?.add("https://docs.oracle.com/en/java/javase/${cfgJavaVersion.majorVersion}/docs/api/")
} else {
(options as StandardJavadocDocletOptions).links?.add("https://docs.oracle.com/javase/${cfgJavaVersion.majorVersion}/docs/api/")
}
}
}
}
configure(repositoryProjects) {
tasks.publish {
enabled = true
}
}
configure(repositoryProjects) {
publishing {
publications {
val mvnPublication: MavenPublication = maybeCreate<MavenPublication>("mavenJava")
mvnPublication.from(components["java"])
mvnPublication.versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
mvnPublication.pom {
url.set("http://www.beanit.com/")
developers {
developer {
id.set("beanit")
name.set("Beanit GmbH")
}
}
scm {
connection.set("none")
url.set("none")
}
}
}
repositories {
maven {
val releasesRepoUrl = uri(cfgRepository ?: "")
val snapshotsRepoUrl = uri(cfgSnapshotRepository ?: "")
// val releasesRepoUrl = uri("$buildDir/repos/releases")
// val snapshotsRepoUrl = uri("$buildDir/repos/snapshots")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = cfgRepositoryUser
password = cfgRepositoryPass
}
}
}
}
if (cfgSignPom) {
signing {
sign(publishing.publications["mavenJava"])
}
}
}
tasks.register<Javadoc>("javadocAll") {
source(docProjects.map { project ->
project.sourceSets["main"].allJava
})
exclude("**/internal/**")
exclude("**/java-gen/**")
exclude("**/app/**")
setDestinationDir(File(buildDir, "docs/javadoc-all"))
classpath = files(distributionProjects.map { project ->
project.sourceSets["main"].compileClasspath
})
classpath += files(distributionProjects.map { project ->
project.sourceSets["main"].output
})
//linking Javadoc in version prior 9 does not work well because Javadoc uses html frames.
if (cfgJavaVersion.isJava9Compatible) {
if (cfgJavaVersion.isJava11Compatible) {
(options as StandardJavadocDocletOptions).links?.add("https://docs.oracle.com/en/java/javase/${cfgJavaVersion.majorVersion}/docs/api/")
} else {
(options as StandardJavadocDocletOptions).links?.add("https://docs.oracle.com/javase/${cfgJavaVersion.majorVersion}/docs/api/")
}
}
}
tasks.named<Tar>("tar") {
archiveFileName.set(project.name + "-" + project.version + ".tgz")
dependsOn(distributionProjects.map { "${it.path}:build" })
distributionProjects.forEach {
println("project: "
+ it.path)
}
dependsOn(tasks.named("javadocAll"))
compression = Compression.GZIP
destinationDirectory.set(File("build/distributions/"))
}

@ -1,110 +0,0 @@
project.ext {
cfgVersion = "1.8.0"
cfgGroup = "com.beanit"
cfgCopyDependencies = true
cfgCopyToRoot = false
cfgSignPom = true
cfgJavaVersion = "1.7"
cfgRepository = project.properties.sonatypeRepository
cfgSnapshotRepository = project.properties.sonatypeSnapshotRepository
cfgRepositoryUser = project.properties.sonatypeUser
cfgRepositoryPass = project.properties.sonatypePass
cfgStagingProfileId = project.properties.sonatypeStagingProfileId
javaProjects = allprojects
distributionProjects = javaProjects
docProjects = javaProjects
repositoryProjects = javaProjects
}
tasks.withType(Tar) {
into(project.name) {
from("./") {
include "build.gradle"
include "configuration.gradle"
include "settings.gradle"
include "LICENSE.txt"
include "doc/**"
include "bin/**"
include "gradle/wrapper/**"
include "gradlew"
include "gradlew.bat"
include "build/libs-all/**"
include "src/**"
include "asn1/**"
}
}
into(project.name + "/doc/") {
from("./build/docs/") {
include "javadoc/**"
}
}
}
//------------------project specific configurations--------------------
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "maven"
apply plugin: "signing"
def projectName = "OpenIEC61850"
dependencies {
compile group: "org.slf4j", name: "slf4j-api", version: "1.7.25"
compile group: "com.beanit", name: "jasn1", version: "1.11.0"
compile group: "ch.qos.logback", name: "logback-classic", version: "1.2.3"
compile group: "com.toedter", name: "jcalendar", version: "1.4"
}
jar {
bnd("Bundle-Name": "OpenIEC61850",
"Bundle-SymbolicName": "com.beanit.openiec61850",
"-exportcontents": "!*.internal.*,*",
"Import-Package": "com.beanit.jasn1.*,javax.net,*;resolution:=optional")
}
sourceSets {
main {
java.srcDirs = ["src/main/java", "src/main/java-gen"]
}
}
uploadArchives {
repositories {
mavenDeployer {
pom.project {
name "OpenIEC61850"
description "OpenIEC61850 is a Java library implementing the IEC 61850 MMS communication standard for clients and servers."
licenses {
license {
name "Apache License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0"
distribution "repo"
}
}
}
}
}
}

@ -1,3 +1,16 @@
v1.9.0 30-Jun-2020
--------------------
- renamed OpenIEC61850 to IEC61850bean
- moved from Java 7 to 8
- run scripts support white space in paths
- BdaTimestamp's getters and setters take Instant instead of Date now
- significant code clean up
v1.8.0 22-Mar-2019
--------------------

@ -1,27 +1,26 @@
# OpenIEC61850 User Guide
# IEC61850bean User Guide
* unnumbered toc
{:toc}
## Intro
OpenIEC61850 is a library implementing the IEC 61850 standard based on the MMS mapping for client and server communication. It is licensed under the Apache 2.0 license. OpenIEC61850 includes a console client and server as well as a GUI client.
IEC61850bean (previously known as OpenIEC61850) is a library implementing the IEC 61850 standard based on the MMS mapping for client and server communication. It is licensed under the Apache 2.0 license. IEC61850bean includes a console client and server as well as a GUI client.
### Distribution
After extracting the distribution tar file, the OpenIEC61850 library can be found in the folder *build/libs-all*.
After extracting the distribution tar file, the IEC61850bean library can be found in the folder *build/libs-all*.
#### Dependencies
Besides the OpenIEC61850 library the folder *build/libs-all/* contains the following external libraries:
Besides the IEC61850bean 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
* *slf4j-api* - a popular logging API. It is only needed if iec61850bean is used to implement a server. The client part does not log anything. License: MIT, http://www.slf4j.org
* *logback-core/logback-classic* - an actual logger implementation of the slf4-api. It is used by the console server application to output log information. It can be replaced by a logger of your choice that supports the slf4j API. Like slf4j it is only needed for server implementations. License: EPLv1.0 and LGPLv2.1, http://logback.qos.ch
* *jcalendar* - a calendar library needed by the client GUI. You don't need this dependency if you don't use the client gui. (C)1999-2011 Kai Toedter, License: LGPLv3, http://toedter.com/jcalendar/
### Console & GUI Applications
@ -30,16 +29,16 @@ You can execute the console client and server through the scripts found in the *
### OSI Stack
The OpenIEC61850 library includes an OSI stack implementation as it is needed by the IEC 61850 MMS mapping. The API of the OSI stack and the OSI transport layers are made public so that they can be used by other projects.
The IEC61850bean library includes an OSI stack implementation as it is needed by the IEC 61850 MMS mapping. The API of the OSI stack and the OSI transport layers are made public so that they can be used by other projects.
* *josistack* - implements the Application Control Service Element (ACSE) protocol as defined by ISO 8650 or ITU X.217/X.227, the lower ISO Presentation Layer as defined by ISO 8823/ITU X226, and the ISO Session Layer as defined by 8327/ITU X.225.
* *jositransport* - implements RFC 1006 and the OSI Transport Service Layer.
## Using OpenIEC61850
## Using IEC61850bean
The easiest way to learn how OpenIEC61850 works is by running and analyzing the console client and server applications. You might want to look at the source code of the console applications to get an understanding of how they work. They can be used as a basis for you to code your individual client or server applications. An IEC 61850 device that is to be controlled or monitored is called an IEC 61850 server. An IEC 61850 server normally listens on port 102 for incoming connection requests by IEC 61850 clients.
The easiest way to learn how IEC61850bean works is by running and analyzing the console client and server applications. You might want to look at the source code of the console applications to get an understanding of how they work. They can be used as a basis for you to code your individual client or server applications. An IEC 61850 device that is to be controlled or monitored is called an IEC 61850 server. An IEC 61850 server normally listens on port 102 for incoming connection requests by IEC 61850 clients.
### Client
@ -53,9 +52,9 @@ First get a List of ServerSaps using the method ServerSap.getSapsFromSclFile().
An IEC 61850 server contains a treelike data model that contains at its leafs the data (integers, boolean, strings etc) that can be accessed by clients. Clients can also retrieve the whole data model from the server.
The upper most model node is called "server". In OpenIEC61850 it is an object of type ServerModel. The server node contains 1..n logical devices (LD). A logical device may contain 1..n logical nodes (LN). A logical node may contain 1..n data objects. In OpenIEC61850 the logical nodes do not contain complete data objects but instead contain so called functionally constraint data objects (FCDO). An FCDO is a data object that is split up by functional constraint. An FCDO can contain a combination of other FCDOs, arrays, constructed data attributes and/or basic data attributes.
The upper most model node is called "server". In IEC61850bean it is an object of type ServerModel. The server node contains 1..n logical devices (LD). A logical device may contain 1..n logical nodes (LN). A logical node may contain 1..n data objects. In IEC61850bean the logical nodes do not contain complete data objects but instead contain so called functionally constraint data objects (FCDO). An FCDO is a data object that is split up by functional constraint. An FCDO can contain a combination of other FCDOs, arrays, constructed data attributes and/or basic data attributes.
All nodes of the server model in OpenIEC61850 are of one of the following seven types:
All nodes of the server model in IEC61850bean are of one of the following seven types:
* ServerModel
* LogicalDevice
@ -67,7 +66,7 @@ All nodes of the server model in OpenIEC61850 are of one of the following seven
They all implement the ModelNode interface. The nodes FcDataObject, Array, ConstructedDataAttribute and BasicDataAttribute also implement the interface called FcModelNode because they are considered functionally constraint data in the standard. Many of the services of IEC 61850 can only be applied to functionally constraint data (e.g. GetDataValues and SetDataValues).
When programming a client you get a copy of the server model either through ClientAssociation.retrieveModel() or ClientAssociation.getModelFromSclFile(). When programming a server you get a copy of the server model through the ServerSap.getModelCopy() function.
When programming a client you get a copy of the server model either through ClientAssociation.retrieveModel from the server device or through SclParser.parse from an SCL file. When using the second approach, the model has to be set in the client association using ClientAssociation.setServerModel. When programming a server you get a copy of the server model through the ServerSap.getModelCopy() function.
You can then navigate through the model using several functions:
@ -79,6 +78,6 @@ You can then navigate through the model using several functions:
## Modifying and Compiling OpenIEC61850
## Modifying and Compiling IEC61850bean
We use the Gradle build automation tool. The distribution contains a fully functional gradle build file (*build.gradle*). Thus if you changed code and want to rebuild a library you can do it easily with Gradle.

Binary file not shown.

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

53
gradlew vendored

@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -66,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

22
gradlew.bat vendored

@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

@ -0,0 +1,5 @@
#Tue Jun 30 15:11:36 CEST 2020
tselLocal=0,0
serverAddress=127.0.0.1
tselRemote=0,1
serverPort=10002

@ -1,9 +1,12 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +16,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 +42,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 +67,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 +111,7 @@ public class AccessResult implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +20,7 @@ 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() {
@ -35,6 +38,7 @@ public class AlternateAccess implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -42,9 +46,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 +67,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 +117,7 @@ public class AlternateAccess implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -142,7 +157,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 +174,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 +191,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 +229,7 @@ public class AlternateAccess implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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,7 +18,7 @@ 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;
@ -41,12 +44,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 +69,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 +113,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -135,7 +141,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 AccessSelection accessSelection = null;
private AlternateAccess alternateAccess = null;
@ -161,6 +167,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.alternateAccess = alternateAccess;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -168,9 +175,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 +196,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);
int totalLength = length.val;
codeLength += totalLength;
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
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 +256,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -277,7 +299,7 @@ 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;
@ -321,12 +343,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 +391,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 length = new BerLength();
tlvByteCount += length.decode(is);
component = new Component();
codeLength += component.decode(is, null);
return codeLength;
tlvByteCount += component.decode(is, null);
tlvByteCount += length.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 +447,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -460,7 +485,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 +502,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 +519,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 +554,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -550,7 +576,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 +602,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.numberOfElements = numberOfElements;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -583,9 +610,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 +637,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 +697,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -704,7 +741,7 @@ 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;
@ -748,12 +785,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 +833,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 length = new BerLength();
tlvByteCount += length.decode(is);
component = new Component();
codeLength += component.decode(is, null);
return codeLength;
tlvByteCount += component.decode(is, null);
tlvByteCount += length.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 +888,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -886,7 +926,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 +943,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 +960,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 +995,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -976,7 +1017,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 +1043,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
this.numberOfElements = numberOfElements;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -1009,9 +1051,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 +1078,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);
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)) {
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 +1138,7 @@ public class AlternateAccessSelection implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

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

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +52,7 @@ public class ConfirmedErrorPDU implements BerType, Serializable {
this.serviceError = serviceError;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -56,9 +60,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 +94,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 +156,7 @@ public class ConfirmedErrorPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +43,7 @@ public class ConfirmedRequestPDU implements BerType, Serializable {
this.service = service;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +51,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 +72,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 +129,7 @@ public class ConfirmedRequestPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +43,7 @@ public class ConfirmedResponsePDU implements BerType, Serializable {
this.service = service;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +51,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 +72,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 +129,7 @@ public class ConfirmedResponsePDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +135,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 +254,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 length = new BerLength();
tlvByteCount += length.decode(is);
getVariableAccessAttributes = new GetVariableAccessAttributesRequest();
codeLength += getVariableAccessAttributes.decode(is, null);
return codeLength;
tlvByteCount += getVariableAccessAttributes.decode(is, null);
tlvByteCount += length.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 length = new BerLength();
tlvByteCount += length.decode(is);
getNamedVariableListAttributes = new GetNamedVariableListAttributesRequest();
codeLength += getNamedVariableListAttributes.decode(is, null);
return codeLength;
tlvByteCount += getNamedVariableListAttributes.decode(is, null);
tlvByteCount += length.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 +360,7 @@ public class ConfirmedServiceRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,9 +1,12 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +16,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 +134,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 +247,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 +347,7 @@ public class ConfirmedServiceResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,15 +1,18 @@
/** This class file was automatically generated by jASN1 (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.openiec61850.internal.BerBoolean;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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.iec61850bean.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -22,7 +25,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;
@ -138,12 +141,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 +249,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 +349,7 @@ public class Data implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -423,7 +427,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 +445,7 @@ public class Data implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -448,9 +453,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 +474,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 +524,7 @@ public class Data implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -549,7 +565,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 +583,7 @@ public class Data implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -574,9 +591,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 +612,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 +662,7 @@ public class Data implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +43,7 @@ public class DefineNamedVariableListRequest implements BerType, Serializable {
this.listOfVariable = listOfVariable;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +51,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 +75,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);
tlByteCount += length.decode(is);
int lengthVal = length.val;
vByteCount += berTag.decode(is);
int totalLength = length.val;
codeLength += totalLength;
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 +132,7 @@ public class DefineNamedVariableListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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,7 +21,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 BerInteger scopeOfDelete = null;
private ListOfVariableListName listOfVariableListName = null;
private DomainName domainName = null;
@ -53,6 +56,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
this.domainName = domainName;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -60,9 +64,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 +106,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 +175,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -220,7 +230,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 +248,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -245,9 +256,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 +277,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 +327,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -346,7 +368,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 +385,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 +402,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 +436,7 @@ public class DeleteNamedVariableListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +43,7 @@ public class DeleteNamedVariableListResponse implements BerType, Serializable {
this.numberDeleted = numberDeleted;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +51,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 +78,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 +134,7 @@ public class DeleteNamedVariableListResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +43,7 @@ public class DirectoryEntry implements BerType, Serializable {
this.fileAttributes = fileAttributes;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +51,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 +78,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 +134,7 @@ public class DirectoryEntry implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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 +18,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 +44,7 @@ public class FileAttributes implements BerType, Serializable {
this.lastModified = lastModified;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -48,9 +52,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 +81,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);
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)) {
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 +138,7 @@ public class FileAttributes implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

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

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

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

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +43,7 @@ public class FileDirectoryRequest implements BerType, Serializable {
this.continueAfter = continueAfter;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +51,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 +82,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 +140,7 @@ public class FileDirectoryRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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.openiec61850.internal.BerBoolean;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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.iec61850bean.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -18,7 +21,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 ListOfDirectoryEntry listOfDirectoryEntry = null;
private BerBoolean moreFollows = null;
@ -44,6 +47,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
this.moreFollows = moreFollows;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -51,9 +55,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 +88,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 +147,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -177,7 +187,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 +205,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -202,9 +213,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 +234,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 +282,7 @@ public class FileDirectoryResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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 +21,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 +39,7 @@ public class FileName implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -43,9 +47,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 +68,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);
while (subCodeLength < totalLength) {
if (lengthVal < 0 && berTag.equals(0, 0, 0)) {
vByteCount += BerLength.readEocByte(is);
break;
}
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 +116,7 @@ public class FileName implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +43,7 @@ public class FileOpenRequest implements BerType, Serializable {
this.initialPosition = initialPosition;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +51,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 +78,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 +134,7 @@ public class FileOpenRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +43,7 @@ public class FileOpenResponse implements BerType, Serializable {
this.fileAttributes = fileAttributes;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -47,9 +51,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 +78,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 +134,7 @@ public class FileOpenResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

@ -1,12 +1,15 @@
/** This class file was automatically generated by jASN1 (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.openiec61850.internal.BerBoolean;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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.iec61850bean.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -16,7 +19,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 +45,7 @@ public class FileReadResponse implements BerType, Serializable {
this.moreFollows = moreFollows;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -49,9 +53,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 +82,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 +139,7 @@ public class FileReadResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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,7 +18,7 @@ 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;
@ -50,6 +53,7 @@ public class GetNameListRequest implements BerType, Serializable {
this.continueAfter = continueAfter;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -57,9 +61,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 +101,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);
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)) {
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 +170,7 @@ public class GetNameListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -210,7 +221,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 +256,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 +292,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 +338,7 @@ public class GetNameListRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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.openiec61850.internal.BerBoolean;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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.iec61850bean.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -18,7 +21,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 ListOfIdentifier listOfIdentifier = null;
private BerBoolean moreFollows = null;
@ -44,6 +47,7 @@ public class GetNameListResponse implements BerType, Serializable {
this.moreFollows = moreFollows;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -51,9 +55,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 +84,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 +141,7 @@ public class GetNameListResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -172,7 +181,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 +199,7 @@ public class GetNameListResponse implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -197,9 +207,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 +228,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 +276,7 @@ public class GetNameListResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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.openiec61850.internal.BerBoolean;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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.iec61850bean.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,7 +18,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 +44,7 @@ public class GetNamedVariableListAttributesResponse implements BerType, Serializ
this.listOfVariable = listOfVariable;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -48,9 +52,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 +79,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);
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)) {
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 +135,7 @@ public class GetNamedVariableListAttributesResponse implements BerType, Serializ
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 +34,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 +58,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 length = new BerLength();
tlvByteCount += length.decode(is);
name = new ObjectName();
codeLength += name.decode(is, null);
return codeLength;
tlvByteCount += name.decode(is, null);
tlvByteCount += length.readEocIfIndefinite(is);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -90,6 +95,7 @@ public class GetVariableAccessAttributesRequest implements BerType, Serializable
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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.openiec61850.internal.BerBoolean;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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.iec61850bean.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,7 +18,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 +44,7 @@ public class GetVariableAccessAttributesResponse implements BerType, Serializabl
this.typeDescription = typeDescription;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -48,9 +52,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 +83,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);
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)) {
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 +141,7 @@ public class GetVariableAccessAttributesResponse implements BerType, Serializabl
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -0,0 +1,18 @@
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
import com.beanit.asn1bean.ber.types.string.BerVisibleString;
public class Identifier extends BerVisibleString {
private static final long serialVersionUID = 1L;
public Identifier() {}
public Identifier(byte[] value) {
super(value);
}
}

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +20,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 VariableAccessSpecification variableAccessSpecification = null;
private ListOfAccessResult listOfAccessResult = null;
@ -44,6 +47,7 @@ public class InformationReport implements BerType, Serializable {
this.listOfAccessResult = listOfAccessResult;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -51,9 +55,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 +79,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 +136,7 @@ public class InformationReport implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -163,7 +179,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 +197,7 @@ public class InformationReport implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -188,9 +205,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 +226,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 +276,7 @@ public class InformationReport implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 Integer32 localDetailCalling = null;
private Integer16 proposedMaxServOutstandingCalling = null;
private Integer16 proposedMaxServOutstandingCalled = null;
@ -67,6 +70,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
this.initRequestDetail = initRequestDetail;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -74,9 +78,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 +124,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 +200,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -261,7 +272,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 +307,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
this.servicesSupportedCalling = servicesSupportedCalling;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -303,9 +315,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 +347,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 +414,7 @@ public class InitiateRequestPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,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 Integer32 localDetailCalled = null;
private Integer16 negotiatedMaxServOutstandingCalling = null;
private Integer16 negotiatedMaxServOutstandingCalled = null;
@ -68,6 +71,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
this.initResponseDetail = initResponseDetail;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -75,9 +79,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 +125,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 +201,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -264,7 +275,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 +310,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
this.servicesSupportedCalled = servicesSupportedCalled;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -306,9 +318,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 +350,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 +417,7 @@ public class InitiateResponsePDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

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

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

@ -0,0 +1,18 @@
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
import com.beanit.asn1bean.ber.types.string.BerVisibleString;
public class MMSString extends BerVisibleString {
private static final long serialVersionUID = 1L;
public MMSString() {}
public MMSString(byte[] value) {
super(value);
}
}

@ -1,9 +1,12 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +16,7 @@ public class MMSpdu implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private ConfirmedRequestPDU confirmedRequestPDU = null;
private ConfirmedResponsePDU confirmedResponsePDU = null;
private ConfirmedErrorPDU confirmedErrorPDU = null;
@ -102,12 +105,11 @@ public class MMSpdu implements BerType, Serializable {
this.concludeRequestPDU = concludeRequestPDU;
}
@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;
}
@ -187,75 +189,76 @@ public class MMSpdu 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)) {
confirmedRequestPDU = new ConfirmedRequestPDU();
codeLength += confirmedRequestPDU.decode(is, false);
return codeLength;
tlvByteCount += confirmedRequestPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
confirmedResponsePDU = new ConfirmedResponsePDU();
codeLength += confirmedResponsePDU.decode(is, false);
return codeLength;
tlvByteCount += confirmedResponsePDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
confirmedErrorPDU = new ConfirmedErrorPDU();
codeLength += confirmedErrorPDU.decode(is, false);
return codeLength;
tlvByteCount += confirmedErrorPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
unconfirmedPDU = new UnconfirmedPDU();
codeLength += unconfirmedPDU.decode(is, false);
return codeLength;
tlvByteCount += unconfirmedPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
rejectPDU = new RejectPDU();
codeLength += rejectPDU.decode(is, false);
return codeLength;
tlvByteCount += rejectPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) {
initiateRequestPDU = new InitiateRequestPDU();
codeLength += initiateRequestPDU.decode(is, false);
return codeLength;
tlvByteCount += initiateRequestPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) {
initiateResponsePDU = new InitiateResponsePDU();
codeLength += initiateResponsePDU.decode(is, false);
return codeLength;
tlvByteCount += initiateResponsePDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 10)) {
initiateErrorPDU = new InitiateErrorPDU();
codeLength += initiateErrorPDU.decode(is, false);
return codeLength;
tlvByteCount += initiateErrorPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) {
concludeRequestPDU = new ConcludeRequestPDU();
codeLength += concludeRequestPDU.decode(is, false);
return codeLength;
tlvByteCount += concludeRequestPDU.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -268,6 +271,7 @@ public class MMSpdu implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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;
@ -14,7 +17,7 @@ public class ObjectClass implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerInteger basicObjectClass = null;
public ObjectClass() {}
@ -31,12 +34,11 @@ public class ObjectClass implements BerType, Serializable {
this.basicObjectClass = basicObjectClass;
}
@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;
}
@ -52,27 +54,28 @@ public class ObjectClass 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)) {
basicObjectClass = new BerInteger();
codeLength += basicObjectClass.decode(is, false);
return codeLength;
tlvByteCount += basicObjectClass.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -85,6 +88,7 @@ public class ObjectClass implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,7 @@ public class ObjectName implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private Identifier vmdSpecific = null;
private DomainSpecific domainSpecific = null;
private Identifier aaSpecific = null;
@ -49,12 +52,11 @@ public class ObjectName 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;
}
@ -86,39 +88,40 @@ public class ObjectName 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 Identifier();
codeLength += vmdSpecific.decode(is, false);
return codeLength;
tlvByteCount += vmdSpecific.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
domainSpecific = new DomainSpecific();
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 Identifier();
codeLength += aaSpecific.decode(is, false);
return codeLength;
tlvByteCount += aaSpecific.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -131,6 +134,7 @@ public class ObjectName implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -162,7 +166,7 @@ public class ObjectName 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 Identifier domainID = null;
private Identifier itemID = null;
@ -188,6 +192,7 @@ public class ObjectName implements BerType, Serializable {
this.itemID = itemID;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -195,9 +200,7 @@ public class ObjectName 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;
}
@ -218,46 +221,57 @@ public class ObjectName 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(Identifier.tag)) {
domainID = new Identifier();
subCodeLength += domainID.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += domainID.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(Identifier.tag)) {
itemID = new Identifier();
subCodeLength += itemID.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += itemID.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 +280,7 @@ public class ObjectName implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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.openiec61850.internal.BerBoolean;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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.iec61850bean.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -15,7 +18,7 @@ public class ReadRequest 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 BerBoolean specificationWithResult = null;
private VariableAccessSpecification variableAccessSpecification = null;
@ -42,6 +45,7 @@ public class ReadRequest implements BerType, Serializable {
this.variableAccessSpecification = variableAccessSpecification;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -49,9 +53,7 @@ public class ReadRequest 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;
}
@ -84,45 +86,54 @@ public class ReadRequest 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)) {
specificationWithResult = new BerBoolean();
subCodeLength += specificationWithResult.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += specificationWithResult.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
variableAccessSpecification = new VariableAccessSpecification();
subCodeLength += variableAccessSpecification.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += variableAccessSpecification.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 {
@ -131,6 +142,7 @@ public class ReadRequest implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +20,7 @@ public class ReadResponse 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;
@ -44,6 +47,7 @@ public class ReadResponse implements BerType, Serializable {
this.listOfAccessResult = listOfAccessResult;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -51,9 +55,7 @@ public class ReadResponse 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,45 +88,54 @@ public class ReadResponse 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)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
variableAccessSpecification = new VariableAccessSpecification();
subCodeLength += variableAccessSpecification.decode(is, null);
subCodeLength += berTag.decode(is);
vByteCount += variableAccessSpecification.decode(is, null);
vByteCount += length.readEocIfIndefinite(is);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
listOfAccessResult = new ListOfAccessResult();
subCodeLength += listOfAccessResult.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
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 {
@ -133,6 +144,7 @@ public class ReadResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -177,7 +189,7 @@ public class ReadResponse 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() {
@ -195,6 +207,7 @@ public class ReadResponse implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -202,9 +215,7 @@ public class ReadResponse 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 +236,48 @@ public class ReadResponse 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 {
@ -263,6 +286,7 @@ public class ReadResponse implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,11 +1,14 @@
/** This class file was automatically generated by jASN1 (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;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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 +18,7 @@ public class RejectPDU 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 originalInvokeID = null;
private RejectReason rejectReason = null;
@ -41,6 +44,7 @@ public class RejectPDU implements BerType, Serializable {
this.rejectReason = rejectReason;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -48,9 +52,7 @@ public class RejectPDU 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,42 +78,53 @@ public class RejectPDU 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(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
originalInvokeID = new Unsigned32();
subCodeLength += originalInvokeID.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += originalInvokeID.decode(is, false);
vByteCount += berTag.decode(is);
}
rejectReason = new RejectReason();
subCodeLength += rejectReason.decode(is, berTag);
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = rejectReason.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 {
@ -120,6 +133,7 @@ public class RejectPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -163,7 +177,7 @@ public class RejectPDU implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerInteger confirmedRequestPDU = null;
private BerInteger confirmedResponsePDU = null;
private BerInteger confirmedErrorPDU = null;
@ -270,12 +284,11 @@ public class RejectPDU implements BerType, Serializable {
this.concludeErrorPDU = concludeErrorPDU;
}
@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;
}
@ -371,87 +384,88 @@ public class RejectPDU 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, 1)) {
confirmedRequestPDU = new BerInteger();
codeLength += confirmedRequestPDU.decode(is, false);
return codeLength;
tlvByteCount += confirmedRequestPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
confirmedResponsePDU = new BerInteger();
codeLength += confirmedResponsePDU.decode(is, false);
return codeLength;
tlvByteCount += confirmedResponsePDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
confirmedErrorPDU = new BerInteger();
codeLength += confirmedErrorPDU.decode(is, false);
return codeLength;
tlvByteCount += confirmedErrorPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
unconfirmedPDU = new BerInteger();
codeLength += unconfirmedPDU.decode(is, false);
return codeLength;
tlvByteCount += unconfirmedPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) {
pduError = new BerInteger();
codeLength += pduError.decode(is, false);
return codeLength;
tlvByteCount += pduError.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
cancelRequestPDU = new BerInteger();
codeLength += cancelRequestPDU.decode(is, false);
return codeLength;
tlvByteCount += cancelRequestPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) {
cancelResponsePDU = new BerInteger();
codeLength += cancelResponsePDU.decode(is, false);
return codeLength;
tlvByteCount += cancelResponsePDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
cancelErrorPDU = new BerInteger();
codeLength += cancelErrorPDU.decode(is, false);
return codeLength;
tlvByteCount += cancelErrorPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
concludeRequestPDU = new BerInteger();
codeLength += concludeRequestPDU.decode(is, false);
return codeLength;
tlvByteCount += concludeRequestPDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) {
concludeResponsePDU = new BerInteger();
codeLength += concludeResponsePDU.decode(is, false);
return codeLength;
tlvByteCount += concludeResponsePDU.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) {
concludeErrorPDU = new BerInteger();
codeLength += concludeErrorPDU.decode(is, false);
return codeLength;
tlvByteCount += concludeErrorPDU.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -464,6 +478,7 @@ public class RejectPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,12 +1,15 @@
/** This class file was automatically generated by jASN1 (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.jasn1.ber.types.string.BerVisibleString;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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 com.beanit.asn1bean.ber.types.string.BerVisibleString;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -16,7 +19,7 @@ public class ServiceError 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 ErrorClass errorClass = null;
private BerInteger additionalCode = null;
private BerVisibleString additionalDescription = null;
@ -51,6 +54,7 @@ public class ServiceError implements BerType, Serializable {
this.additionalDescription = additionalDescription;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -58,9 +62,7 @@ public class ServiceError 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;
}
@ -100,59 +102,66 @@ public class ServiceError 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);
errorClass = new ErrorClass();
subCodeLength += errorClass.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += errorClass.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, 1)) {
additionalCode = new BerInteger();
subCodeLength += additionalCode.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += additionalCode.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)) {
additionalDescription = new BerVisibleString();
subCodeLength += additionalDescription.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += additionalDescription.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 {
@ -161,6 +170,7 @@ public class ServiceError implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -208,7 +218,7 @@ public class ServiceError implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private BerInteger vmdState = null;
private BerInteger applicationReference = null;
private BerInteger definition = null;
@ -333,12 +343,11 @@ public class ServiceError implements BerType, Serializable {
this.others = others;
}
@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;
}
@ -450,99 +459,100 @@ public class ServiceError 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)) {
vmdState = new BerInteger();
codeLength += vmdState.decode(is, false);
return codeLength;
tlvByteCount += vmdState.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
applicationReference = new BerInteger();
codeLength += applicationReference.decode(is, false);
return codeLength;
tlvByteCount += applicationReference.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
definition = new BerInteger();
codeLength += definition.decode(is, false);
return codeLength;
tlvByteCount += definition.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
resource = new BerInteger();
codeLength += resource.decode(is, false);
return codeLength;
tlvByteCount += resource.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
service = new BerInteger();
codeLength += service.decode(is, false);
return codeLength;
tlvByteCount += service.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 5)) {
servicePreempt = new BerInteger();
codeLength += servicePreempt.decode(is, false);
return codeLength;
tlvByteCount += servicePreempt.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
timeResolution = new BerInteger();
codeLength += timeResolution.decode(is, false);
return codeLength;
tlvByteCount += timeResolution.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) {
access = new BerInteger();
codeLength += access.decode(is, false);
return codeLength;
tlvByteCount += access.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
initiate = new BerInteger();
codeLength += initiate.decode(is, false);
return codeLength;
tlvByteCount += initiate.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 9)) {
conclude = new BerInteger();
codeLength += conclude.decode(is, false);
return codeLength;
tlvByteCount += conclude.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 10)) {
cancel = new BerInteger();
codeLength += cancel.decode(is, false);
return codeLength;
tlvByteCount += cancel.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 11)) {
file = new BerInteger();
codeLength += file.decode(is, false);
return codeLength;
tlvByteCount += file.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 12)) {
others = new BerInteger();
codeLength += others.decode(is, false);
return codeLength;
tlvByteCount += others.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -555,6 +565,7 @@ public class ServiceError implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

@ -0,0 +1,18 @@
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
import com.beanit.asn1bean.ber.types.BerOctetString;
public class TimeOfDay extends BerOctetString {
private static final long serialVersionUID = 1L;
public TimeOfDay() {}
public TimeOfDay(byte[] value) {
super(value);
}
}

@ -1,12 +1,15 @@
/** This class file was automatically generated by jASN1 (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.openiec61850.internal.BerBoolean;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
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 com.beanit.iec61850bean.internal.BerBoolean;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -19,7 +22,7 @@ public class TypeDescription 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 BerNull bool = null;
@ -135,12 +138,11 @@ public class TypeDescription 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;
}
@ -244,93 +246,94 @@ public class TypeDescription 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 BerNull();
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 Integer32();
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 Unsigned8();
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 Unsigned8();
codeLength += unsigned.decode(is, false);
return codeLength;
tlvByteCount += unsigned.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 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 Integer32();
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 Integer32();
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 BerBoolean();
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 Integer32();
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 BerNull();
codeLength += utcTime.decode(is, false);
return codeLength;
tlvByteCount += utcTime.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -343,6 +346,7 @@ public class TypeDescription implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -421,7 +425,7 @@ public class TypeDescription 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 BerBoolean packed = null;
private Unsigned32 numberOfElements = null;
private TypeSpecification elementType = null;
@ -456,6 +460,7 @@ public class TypeDescription implements BerType, Serializable {
this.elementType = elementType;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -463,9 +468,7 @@ public class TypeDescription 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;
}
@ -503,53 +506,65 @@ public class TypeDescription 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)) {
packed = new BerBoolean();
subCodeLength += packed.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += packed.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
numberOfElements = new Unsigned32();
subCodeLength += numberOfElements.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += numberOfElements.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);
elementType = new TypeSpecification();
subCodeLength += elementType.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += elementType.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);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -558,6 +573,7 @@ public class TypeDescription implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -612,7 +628,7 @@ public class TypeDescription 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 BerBoolean packed = null;
private Components components = null;
@ -638,6 +654,7 @@ public class TypeDescription implements BerType, Serializable {
this.components = components;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -645,9 +662,7 @@ public class TypeDescription 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;
}
@ -676,44 +691,55 @@ public class TypeDescription 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)) {
packed = new BerBoolean();
subCodeLength += packed.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += packed.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
components = new Components();
subCodeLength += components.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += components.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 {
@ -722,6 +748,7 @@ public class TypeDescription implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -765,7 +792,7 @@ public class TypeDescription 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 Components() {
@ -783,6 +810,7 @@ public class TypeDescription implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -790,9 +818,7 @@ public class TypeDescription 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;
}
@ -813,36 +839,46 @@ public class TypeDescription 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(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 {
@ -852,6 +888,7 @@ public class TypeDescription implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -891,7 +928,7 @@ public class TypeDescription 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 Identifier componentName = null;
private TypeSpecification componentType = null;
@ -917,6 +954,7 @@ public class TypeDescription implements BerType, Serializable {
this.componentType = componentType;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -924,9 +962,7 @@ public class TypeDescription 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;
}
@ -959,45 +995,57 @@ public class TypeDescription 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)) {
componentName = new Identifier();
subCodeLength += componentName.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += componentName.decode(is, false);
vByteCount += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
subCodeLength += length.decode(is);
vByteCount += length.decode(is);
componentType = new TypeSpecification();
subCodeLength += componentType.decode(is, null);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += componentType.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);
+ lengthVal
+ ", bytes decoded: "
+ vByteCount);
}
public void encodeAndSave(int encodingSizeGuess) throws IOException {
@ -1007,6 +1055,7 @@ public class TypeDescription implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -1053,7 +1102,7 @@ public class TypeDescription 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 Unsigned8 formatWidth = null;
private Unsigned8 exponentWidth = null;
@ -1079,6 +1128,7 @@ public class TypeDescription implements BerType, Serializable {
this.exponentWidth = exponentWidth;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -1086,9 +1136,7 @@ public class TypeDescription 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;
}
@ -1109,46 +1157,57 @@ public class TypeDescription 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(Unsigned8.tag)) {
formatWidth = new Unsigned8();
subCodeLength += formatWidth.decode(is, false);
subCodeLength += berTag.decode(is);
vByteCount += formatWidth.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(Unsigned8.tag)) {
exponentWidth = new Unsigned8();
subCodeLength += exponentWidth.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += exponentWidth.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 {
@ -1157,6 +1216,7 @@ public class TypeDescription implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,9 +1,12 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +16,7 @@ public class TypeSpecification implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private TypeDescription typeDescription = null;
public TypeSpecification() {}
@ -30,12 +33,11 @@ public class TypeSpecification implements BerType, Serializable {
this.typeDescription = typeDescription;
}
@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,29 +50,32 @@ public class TypeSpecification 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;
typeDescription = new TypeDescription();
int choiceDecodeLength = typeDescription.decode(is, berTag);
if (choiceDecodeLength != 0) {
return codeLength + choiceDecodeLength;
numDecodedBytes = typeDescription.decode(is, berTag);
if (numDecodedBytes != 0) {
return tlvByteCount + numDecodedBytes;
} else {
typeDescription = null;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -83,6 +88,7 @@ public class TypeSpecification implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,7 @@ public class UnconfirmedPDU 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 UnconfirmedService service = null;
public UnconfirmedPDU() {}
@ -31,6 +34,7 @@ public class UnconfirmedPDU implements BerType, Serializable {
this.service = service;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -38,9 +42,7 @@ public class UnconfirmedPDU 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;
}
@ -59,36 +61,47 @@ public class UnconfirmedPDU 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);
service = new UnconfirmedService();
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 {
@ -97,6 +110,7 @@ public class UnconfirmedPDU implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,9 +1,12 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
import com.beanit.jasn1.ber.BerTag;
import com.beanit.jasn1.ber.ReverseByteArrayOutputStream;
import com.beanit.jasn1.ber.types.BerType;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +16,7 @@ public class UnconfirmedService implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private InformationReport informationReport = null;
public UnconfirmedService() {}
@ -30,12 +33,11 @@ public class UnconfirmedService implements BerType, Serializable {
this.informationReport = informationReport;
}
@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;
}
@ -51,27 +53,28 @@ public class UnconfirmedService 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)) {
informationReport = new InformationReport();
codeLength += informationReport.decode(is, false);
return codeLength;
tlvByteCount += informationReport.decode(is, false);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -84,6 +87,7 @@ public class UnconfirmedService implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

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

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

@ -0,0 +1,18 @@
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
package com.beanit.iec61850bean.internal.mms.asn1;
import com.beanit.asn1bean.ber.types.BerOctetString;
public class UtcTime extends BerOctetString {
private static final long serialVersionUID = 1L;
public UtcTime() {}
public UtcTime(byte[] value) {
super(value);
}
}

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +17,7 @@ public class VariableAccessSpecification implements BerType, Serializable {
private static final long serialVersionUID = 1L;
public byte[] code = null;
private byte[] code = null;
private VariableDefs listOfVariable = null;
private ObjectName variableListName = null;
@ -40,12 +43,11 @@ public class VariableAccessSpecification implements BerType, Serializable {
this.variableListName = variableListName;
}
@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;
}
@ -73,34 +75,37 @@ public class VariableAccessSpecification 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)) {
listOfVariable = new VariableDefs();
codeLength += listOfVariable.decode(is, false);
return codeLength;
tlvByteCount += listOfVariable.decode(is, false);
return tlvByteCount;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
codeLength += BerLength.skip(is);
BerLength length = new BerLength();
tlvByteCount += length.decode(is);
variableListName = new ObjectName();
codeLength += variableListName.decode(is, null);
return codeLength;
tlvByteCount += variableListName.decode(is, null);
tlvByteCount += length.readEocIfIndefinite(is);
return tlvByteCount;
}
if (passedTag != null) {
if (tagWasPassed) {
return 0;
}
@ -113,6 +118,7 @@ public class VariableAccessSpecification implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

@ -1,10 +1,13 @@
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
package com.beanit.openiec61850.internal.mms.asn1;
/*
* This class file was automatically generated by ASN1bean (http://www.beanit.com)
*/
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;
package com.beanit.iec61850bean.internal.mms.asn1;
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 +20,7 @@ public class VariableDefs 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 VariableDefs() {
@ -35,6 +38,7 @@ public class VariableDefs implements BerType, Serializable {
return seqOf;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -42,9 +46,7 @@ public class VariableDefs 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 +67,46 @@ public class VariableDefs 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(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 +115,7 @@ public class VariableDefs implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);
@ -142,7 +155,7 @@ public class VariableDefs 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 VariableSpecification variableSpecification = null;
private AlternateAccess alternateAccess = null;
@ -168,6 +181,7 @@ public class VariableDefs implements BerType, Serializable {
this.alternateAccess = alternateAccess;
}
@Override
public int encode(OutputStream reverseOS) throws IOException {
return encode(reverseOS, true);
}
@ -175,9 +189,7 @@ public class VariableDefs 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;
}
@ -203,45 +215,59 @@ public class VariableDefs 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);
variableSpecification = new VariableSpecification();
subCodeLength += variableSpecification.decode(is, berTag);
if (subCodeLength == totalLength) {
return codeLength;
numDecodedBytes = variableSpecification.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.");
}
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
alternateAccess = new AlternateAccess();
subCodeLength += alternateAccess.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
vByteCount += alternateAccess.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 {
@ -250,6 +276,7 @@ public class VariableDefs implements BerType, Serializable {
code = reverseOS.getArray();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
appendAsString(sb, 0);

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

Loading…
Cancel
Save