|
|
@ -1,17 +1,17 @@
|
|
|
|
/** This class file was automatically generated by jASN1 v1.9.1-SNAPSHOT (http://www.openmuc.org) */
|
|
|
|
/** This class file was automatically generated by jASN1 (http://www.beanit.com) */
|
|
|
|
package com.beanit.openiec61850.internal.mms.asn1;
|
|
|
|
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 java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import org.openmuc.jasn1.ber.BerLength;
|
|
|
|
|
|
|
|
import org.openmuc.jasn1.ber.BerTag;
|
|
|
|
|
|
|
|
import org.openmuc.jasn1.ber.ReverseByteArrayOutputStream;
|
|
|
|
|
|
|
|
import org.openmuc.jasn1.ber.types.BerNull;
|
|
|
|
|
|
|
|
import org.openmuc.jasn1.ber.types.string.BerVisibleString;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class AlternateAccessSelection implements Serializable {
|
|
|
|
public class AlternateAccessSelection implements BerType, Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
|
@ -20,7 +20,6 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
private SelectAccess selectAccess = null;
|
|
|
|
private SelectAccess selectAccess = null;
|
|
|
|
|
|
|
|
|
|
|
|
public AlternateAccessSelection() {}
|
|
|
|
public AlternateAccessSelection() {}
|
|
|
|
|
|
|
|
|
|
|
|
public AlternateAccessSelection(byte[] code) {
|
|
|
|
public AlternateAccessSelection(byte[] code) {
|
|
|
|
this.code = code;
|
|
|
|
this.code = code;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -41,25 +40,25 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
this.selectAccess = selectAccess;
|
|
|
|
this.selectAccess = selectAccess;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
if (code != null) {
|
|
|
|
if (code != null) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
os.write(code[i]);
|
|
|
|
reverseOS.write(code[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return code.length;
|
|
|
|
return code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int codeLength = 0;
|
|
|
|
int codeLength = 0;
|
|
|
|
if (selectAccess != null) {
|
|
|
|
if (selectAccess != null) {
|
|
|
|
codeLength += selectAccess.encode(os);
|
|
|
|
codeLength += selectAccess.encode(reverseOS);
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (selectAlternateAccess != null) {
|
|
|
|
if (selectAlternateAccess != null) {
|
|
|
|
codeLength += selectAlternateAccess.encode(os, false);
|
|
|
|
codeLength += selectAlternateAccess.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 0
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 0
|
|
|
|
os.write(0xA0);
|
|
|
|
reverseOS.write(0xA0);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -103,12 +102,11 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
ReverseByteArrayOutputStream reverseOS = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
encode(os);
|
|
|
|
encode(reverseOS);
|
|
|
|
code = os.getArray();
|
|
|
|
code = reverseOS.getArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
appendAsString(sb, 0);
|
|
|
|
appendAsString(sb, 0);
|
|
|
@ -132,14 +130,13 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
sb.append("<none>");
|
|
|
|
sb.append("<none>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class SelectAlternateAccess implements Serializable {
|
|
|
|
public static class SelectAlternateAccess implements BerType, Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
|
|
|
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
public byte[] code = null;
|
|
|
|
public byte[] code = null;
|
|
|
|
private AccessSelection accessSelection = null;
|
|
|
|
private AccessSelection accessSelection = null;
|
|
|
|
private AlternateAccess alternateAccess = null;
|
|
|
|
private AlternateAccess alternateAccess = null;
|
|
|
|
|
|
|
|
|
|
|
|
public SelectAlternateAccess() {}
|
|
|
|
public SelectAlternateAccess() {}
|
|
|
|
|
|
|
|
|
|
|
|
public SelectAlternateAccess(byte[] code) {
|
|
|
|
public SelectAlternateAccess(byte[] code) {
|
|
|
@ -162,31 +159,31 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
this.alternateAccess = alternateAccess;
|
|
|
|
this.alternateAccess = alternateAccess;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS) throws IOException {
|
|
|
|
return encode(os, true);
|
|
|
|
return encode(reverseOS, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os, boolean withTag) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
if (code != null) {
|
|
|
|
if (code != null) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
os.write(code[i]);
|
|
|
|
reverseOS.write(code[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (withTag) {
|
|
|
|
if (withTag) {
|
|
|
|
return tag.encode(os) + code.length;
|
|
|
|
return tag.encode(reverseOS) + code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return code.length;
|
|
|
|
return code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int codeLength = 0;
|
|
|
|
int codeLength = 0;
|
|
|
|
codeLength += alternateAccess.encode(os, true);
|
|
|
|
codeLength += alternateAccess.encode(reverseOS, true);
|
|
|
|
|
|
|
|
|
|
|
|
codeLength += accessSelection.encode(os);
|
|
|
|
codeLength += accessSelection.encode(reverseOS);
|
|
|
|
|
|
|
|
|
|
|
|
codeLength += BerLength.encodeLength(os, codeLength);
|
|
|
|
codeLength += BerLength.encodeLength(reverseOS, codeLength);
|
|
|
|
|
|
|
|
|
|
|
|
if (withTag) {
|
|
|
|
if (withTag) {
|
|
|
|
codeLength += tag.encode(os);
|
|
|
|
codeLength += tag.encode(reverseOS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
@ -231,12 +228,11 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
ReverseByteArrayOutputStream reverseOS = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
encode(os, false);
|
|
|
|
encode(reverseOS, false);
|
|
|
|
code = os.getArray();
|
|
|
|
code = reverseOS.getArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
appendAsString(sb, 0);
|
|
|
|
appendAsString(sb, 0);
|
|
|
@ -275,7 +271,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
sb.append("}");
|
|
|
|
sb.append("}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class AccessSelection implements Serializable {
|
|
|
|
public static class AccessSelection implements BerType, Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
|
@ -284,9 +280,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
private Unsigned32 index = null;
|
|
|
|
private Unsigned32 index = null;
|
|
|
|
private IndexRange indexRange = null;
|
|
|
|
private IndexRange indexRange = null;
|
|
|
|
private BerNull allElements = null;
|
|
|
|
private BerNull allElements = null;
|
|
|
|
|
|
|
|
|
|
|
|
public AccessSelection() {}
|
|
|
|
public AccessSelection() {}
|
|
|
|
|
|
|
|
|
|
|
|
public AccessSelection(byte[] code) {
|
|
|
|
public AccessSelection(byte[] code) {
|
|
|
|
this.code = code;
|
|
|
|
this.code = code;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -323,11 +317,11 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
this.allElements = allElements;
|
|
|
|
this.allElements = allElements;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
if (code != null) {
|
|
|
|
if (code != null) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
os.write(code[i]);
|
|
|
|
reverseOS.write(code[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return code.length;
|
|
|
|
return code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -336,35 +330,35 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
int sublength;
|
|
|
|
int sublength;
|
|
|
|
|
|
|
|
|
|
|
|
if (allElements != null) {
|
|
|
|
if (allElements != null) {
|
|
|
|
codeLength += allElements.encode(os, false);
|
|
|
|
codeLength += allElements.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 3
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 3
|
|
|
|
os.write(0x83);
|
|
|
|
reverseOS.write(0x83);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (indexRange != null) {
|
|
|
|
if (indexRange != null) {
|
|
|
|
codeLength += indexRange.encode(os, false);
|
|
|
|
codeLength += indexRange.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 2
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 2
|
|
|
|
os.write(0xA2);
|
|
|
|
reverseOS.write(0xA2);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (index != null) {
|
|
|
|
if (index != null) {
|
|
|
|
codeLength += index.encode(os, false);
|
|
|
|
codeLength += index.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
|
|
|
os.write(0x81);
|
|
|
|
reverseOS.write(0x81);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (component != null) {
|
|
|
|
if (component != null) {
|
|
|
|
sublength = component.encode(os);
|
|
|
|
sublength = component.encode(reverseOS);
|
|
|
|
codeLength += sublength;
|
|
|
|
codeLength += sublength;
|
|
|
|
codeLength += BerLength.encodeLength(os, sublength);
|
|
|
|
codeLength += BerLength.encodeLength(reverseOS, sublength);
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 0
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 0
|
|
|
|
os.write(0xA0);
|
|
|
|
reverseOS.write(0xA0);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -419,12 +413,12 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
ReverseByteArrayOutputStream reverseOS =
|
|
|
|
encode(os);
|
|
|
|
new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
code = os.getArray();
|
|
|
|
encode(reverseOS);
|
|
|
|
|
|
|
|
code = reverseOS.getArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
appendAsString(sb, 0);
|
|
|
|
appendAsString(sb, 0);
|
|
|
@ -458,7 +452,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
sb.append("<none>");
|
|
|
|
sb.append("<none>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class Component implements Serializable {
|
|
|
|
public static class Component implements BerType, Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
|
@ -479,18 +473,18 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
this.basic = basic;
|
|
|
|
this.basic = basic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
if (code != null) {
|
|
|
|
if (code != null) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
os.write(code[i]);
|
|
|
|
reverseOS.write(code[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return code.length;
|
|
|
|
return code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int codeLength = 0;
|
|
|
|
int codeLength = 0;
|
|
|
|
if (basic != null) {
|
|
|
|
if (basic != null) {
|
|
|
|
codeLength += basic.encode(os, true);
|
|
|
|
codeLength += basic.encode(reverseOS, true);
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -511,7 +505,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
codeLength += berTag.decode(is);
|
|
|
|
codeLength += berTag.decode(is);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (berTag.equals(BerVisibleString.tag)) {
|
|
|
|
if (berTag.equals(BasicIdentifier.tag)) {
|
|
|
|
basic = new BasicIdentifier();
|
|
|
|
basic = new BasicIdentifier();
|
|
|
|
codeLength += basic.decode(is, false);
|
|
|
|
codeLength += basic.decode(is, false);
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
@ -525,12 +519,12 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
ReverseByteArrayOutputStream reverseOS =
|
|
|
|
encode(os);
|
|
|
|
new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
code = os.getArray();
|
|
|
|
encode(reverseOS);
|
|
|
|
|
|
|
|
code = reverseOS.getArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
appendAsString(sb, 0);
|
|
|
|
appendAsString(sb, 0);
|
|
|
@ -548,7 +542,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class IndexRange implements Serializable {
|
|
|
|
public static class IndexRange implements BerType, Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
|
|
|
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
@ -578,37 +572,37 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
this.numberOfElements = numberOfElements;
|
|
|
|
this.numberOfElements = numberOfElements;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS) throws IOException {
|
|
|
|
return encode(os, true);
|
|
|
|
return encode(reverseOS, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os, boolean withTag) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
if (code != null) {
|
|
|
|
if (code != null) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
os.write(code[i]);
|
|
|
|
reverseOS.write(code[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (withTag) {
|
|
|
|
if (withTag) {
|
|
|
|
return tag.encode(os) + code.length;
|
|
|
|
return tag.encode(reverseOS) + code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return code.length;
|
|
|
|
return code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int codeLength = 0;
|
|
|
|
int codeLength = 0;
|
|
|
|
codeLength += numberOfElements.encode(os, false);
|
|
|
|
codeLength += numberOfElements.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
|
|
|
os.write(0x81);
|
|
|
|
reverseOS.write(0x81);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
|
|
|
|
|
|
|
|
codeLength += lowIndex.encode(os, false);
|
|
|
|
codeLength += lowIndex.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 0
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 0
|
|
|
|
os.write(0x80);
|
|
|
|
reverseOS.write(0x80);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
|
|
|
|
|
|
|
|
codeLength += BerLength.encodeLength(os, codeLength);
|
|
|
|
codeLength += BerLength.encodeLength(reverseOS, codeLength);
|
|
|
|
|
|
|
|
|
|
|
|
if (withTag) {
|
|
|
|
if (withTag) {
|
|
|
|
codeLength += tag.encode(os);
|
|
|
|
codeLength += tag.encode(reverseOS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
@ -657,12 +651,12 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
ReverseByteArrayOutputStream reverseOS =
|
|
|
|
encode(os, false);
|
|
|
|
new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
code = os.getArray();
|
|
|
|
encode(reverseOS, false);
|
|
|
|
|
|
|
|
code = reverseOS.getArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
appendAsString(sb, 0);
|
|
|
|
appendAsString(sb, 0);
|
|
|
@ -702,7 +696,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class SelectAccess implements Serializable {
|
|
|
|
public static class SelectAccess implements BerType, Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
|
@ -711,9 +705,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
private Unsigned32 index = null;
|
|
|
|
private Unsigned32 index = null;
|
|
|
|
private IndexRange indexRange = null;
|
|
|
|
private IndexRange indexRange = null;
|
|
|
|
private BerNull allElements = null;
|
|
|
|
private BerNull allElements = null;
|
|
|
|
|
|
|
|
|
|
|
|
public SelectAccess() {}
|
|
|
|
public SelectAccess() {}
|
|
|
|
|
|
|
|
|
|
|
|
public SelectAccess(byte[] code) {
|
|
|
|
public SelectAccess(byte[] code) {
|
|
|
|
this.code = code;
|
|
|
|
this.code = code;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -750,11 +742,11 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
this.allElements = allElements;
|
|
|
|
this.allElements = allElements;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
if (code != null) {
|
|
|
|
if (code != null) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
os.write(code[i]);
|
|
|
|
reverseOS.write(code[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return code.length;
|
|
|
|
return code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -763,35 +755,35 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
int sublength;
|
|
|
|
int sublength;
|
|
|
|
|
|
|
|
|
|
|
|
if (allElements != null) {
|
|
|
|
if (allElements != null) {
|
|
|
|
codeLength += allElements.encode(os, false);
|
|
|
|
codeLength += allElements.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 4
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 4
|
|
|
|
os.write(0x84);
|
|
|
|
reverseOS.write(0x84);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (indexRange != null) {
|
|
|
|
if (indexRange != null) {
|
|
|
|
codeLength += indexRange.encode(os, false);
|
|
|
|
codeLength += indexRange.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 3
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 3
|
|
|
|
os.write(0xA3);
|
|
|
|
reverseOS.write(0xA3);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (index != null) {
|
|
|
|
if (index != null) {
|
|
|
|
codeLength += index.encode(os, false);
|
|
|
|
codeLength += index.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 2
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 2
|
|
|
|
os.write(0x82);
|
|
|
|
reverseOS.write(0x82);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (component != null) {
|
|
|
|
if (component != null) {
|
|
|
|
sublength = component.encode(os);
|
|
|
|
sublength = component.encode(reverseOS);
|
|
|
|
codeLength += sublength;
|
|
|
|
codeLength += sublength;
|
|
|
|
codeLength += BerLength.encodeLength(os, sublength);
|
|
|
|
codeLength += BerLength.encodeLength(reverseOS, sublength);
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 1
|
|
|
|
// write tag: CONTEXT_CLASS, CONSTRUCTED, 1
|
|
|
|
os.write(0xA1);
|
|
|
|
reverseOS.write(0xA1);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -846,12 +838,11 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
ReverseByteArrayOutputStream reverseOS = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
encode(os);
|
|
|
|
encode(reverseOS);
|
|
|
|
code = os.getArray();
|
|
|
|
code = reverseOS.getArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
appendAsString(sb, 0);
|
|
|
|
appendAsString(sb, 0);
|
|
|
@ -885,7 +876,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
sb.append("<none>");
|
|
|
|
sb.append("<none>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class Component implements Serializable {
|
|
|
|
public static class Component implements BerType, Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
|
|
|
|
|
@ -906,18 +897,18 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
this.basic = basic;
|
|
|
|
this.basic = basic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
if (code != null) {
|
|
|
|
if (code != null) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
os.write(code[i]);
|
|
|
|
reverseOS.write(code[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return code.length;
|
|
|
|
return code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int codeLength = 0;
|
|
|
|
int codeLength = 0;
|
|
|
|
if (basic != null) {
|
|
|
|
if (basic != null) {
|
|
|
|
codeLength += basic.encode(os, true);
|
|
|
|
codeLength += basic.encode(reverseOS, true);
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -938,7 +929,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
codeLength += berTag.decode(is);
|
|
|
|
codeLength += berTag.decode(is);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (berTag.equals(BerVisibleString.tag)) {
|
|
|
|
if (berTag.equals(BasicIdentifier.tag)) {
|
|
|
|
basic = new BasicIdentifier();
|
|
|
|
basic = new BasicIdentifier();
|
|
|
|
codeLength += basic.decode(is, false);
|
|
|
|
codeLength += basic.decode(is, false);
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
@ -952,12 +943,12 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
ReverseByteArrayOutputStream reverseOS =
|
|
|
|
encode(os);
|
|
|
|
new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
code = os.getArray();
|
|
|
|
encode(reverseOS);
|
|
|
|
|
|
|
|
code = reverseOS.getArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
appendAsString(sb, 0);
|
|
|
|
appendAsString(sb, 0);
|
|
|
@ -975,7 +966,7 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class IndexRange implements Serializable {
|
|
|
|
public static class IndexRange implements BerType, Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
|
|
|
public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
@ -1005,37 +996,37 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
this.numberOfElements = numberOfElements;
|
|
|
|
this.numberOfElements = numberOfElements;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS) throws IOException {
|
|
|
|
return encode(os, true);
|
|
|
|
return encode(reverseOS, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int encode(OutputStream os, boolean withTag) throws IOException {
|
|
|
|
public int encode(OutputStream reverseOS, boolean withTag) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
if (code != null) {
|
|
|
|
if (code != null) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
for (int i = code.length - 1; i >= 0; i--) {
|
|
|
|
os.write(code[i]);
|
|
|
|
reverseOS.write(code[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (withTag) {
|
|
|
|
if (withTag) {
|
|
|
|
return tag.encode(os) + code.length;
|
|
|
|
return tag.encode(reverseOS) + code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return code.length;
|
|
|
|
return code.length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int codeLength = 0;
|
|
|
|
int codeLength = 0;
|
|
|
|
codeLength += numberOfElements.encode(os, false);
|
|
|
|
codeLength += numberOfElements.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 1
|
|
|
|
os.write(0x81);
|
|
|
|
reverseOS.write(0x81);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
|
|
|
|
|
|
|
|
codeLength += lowIndex.encode(os, false);
|
|
|
|
codeLength += lowIndex.encode(reverseOS, false);
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 0
|
|
|
|
// write tag: CONTEXT_CLASS, PRIMITIVE, 0
|
|
|
|
os.write(0x80);
|
|
|
|
reverseOS.write(0x80);
|
|
|
|
codeLength += 1;
|
|
|
|
codeLength += 1;
|
|
|
|
|
|
|
|
|
|
|
|
codeLength += BerLength.encodeLength(os, codeLength);
|
|
|
|
codeLength += BerLength.encodeLength(reverseOS, codeLength);
|
|
|
|
|
|
|
|
|
|
|
|
if (withTag) {
|
|
|
|
if (withTag) {
|
|
|
|
codeLength += tag.encode(os);
|
|
|
|
codeLength += tag.encode(reverseOS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return codeLength;
|
|
|
|
return codeLength;
|
|
|
@ -1084,12 +1075,12 @@ public class AlternateAccessSelection implements Serializable {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
public void encodeAndSave(int encodingSizeGuess) throws IOException {
|
|
|
|
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
ReverseByteArrayOutputStream reverseOS =
|
|
|
|
encode(os, false);
|
|
|
|
new ReverseByteArrayOutputStream(encodingSizeGuess);
|
|
|
|
code = os.getArray();
|
|
|
|
encode(reverseOS, false);
|
|
|
|
|
|
|
|
code = reverseOS.getArray();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
public String toString() {
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
appendAsString(sb, 0);
|
|
|
|
appendAsString(sb, 0);
|
|
|
|