From 3103c04c8d1a48370f950801a0533fe5f7578070 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Thu, 15 Oct 2015 17:21:06 +0200 Subject: Encapsulate --- acse/acse.go | 21 ++++++++++----------- csta/user-information.go | 7 +++++-- 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 { -- cgit v1.2.3