aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-15 17:21:06 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-10-15 17:21:06 +0200
commit3103c04c8d1a48370f950801a0533fe5f7578070 (patch)
tree0b38e6f2ea6a768f3f0a4d60264dee7e747dea3b
parent5cc436168231d723793464bd2e770427d7d83df8 (diff)
Encapsulate
-rw-r--r--acse/acse.go21
-rw-r--r--csta/user-information.go7
2 files changed, 15 insertions, 13 deletions
diff --git a/acse/acse.go b/acse/acse.go
index 5fb1786..1ec4e56 100644
--- a/acse/acse.go
+++ b/acse/acse.go
@@ -1,6 +1,9 @@
package acse
-import "github.com/dim13/asn1"
+import (
+ "dim13.org/asn1/csta"
+ "github.com/dim13/asn1"
+)
// 2.2.0.0.1
@@ -72,22 +75,18 @@ type NewDefinition struct {
CSTAVersion asn1.BitString
}
+var Version1 = asn1.BitString{Bytes: []byte{0x80}, BitLength: 1}
+
func Associate() ([]byte, error) {
aarq := AARQ{
- ProtocolVersion: asn1.BitString{
- Bytes: []byte{0x80},
- BitLength: 1,
- },
- ApplicationContextName: asn1.ObjectIdentifier([]int{1, 3, 12, 0, 218}),
+ ProtocolVersion: Version1,
+ ApplicationContextName: csta.CSTA,
UserInformation: UserInformation{
External{
- DirectReference: asn1.ObjectIdentifier([]int{1, 3, 12, 0, 285, 200}),
+ DirectReference: csta.OID,
Encoding: ACSEUserInformationForCSTA{
NewDefinition{
- CSTAVersion: asn1.BitString{
- Bytes: []byte{0x08, 0x00},
- BitLength: 16,
- },
+ CSTAVersion: csta.Version5,
},
},
},
diff --git a/csta/user-information.go b/csta/user-information.go
index eb5c2d8..f960383 100644
--- a/csta/user-information.go
+++ b/csta/user-information.go
@@ -2,9 +2,12 @@ package csta
// 1.3.12.0.285.200
+import "github.com/dim13/asn1"
+
var (
- CSTA2 = []int{1, 3, 12, 0, 218}
- OID = []int{1, 3, 12, 0, 285, 200}
+ CSTA = asn1.ObjectIdentifier([]int{1, 3, 12, 0, 218})
+ OID = asn1.ObjectIdentifier([]int{1, 3, 12, 0, 285, 200})
+ Version5 = asn1.BitString{Bytes: []byte{0x08, 0x00}, BitLength: 16}
)
type ACSEUserInformationForCSTA struct {