From 75169f6022408b323ca32060554ef30771bac39d Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 16 Oct 2015 14:57:43 +0200 Subject: resort --- acse/acse.go | 16 +++------- csta/user-information.go | 83 ++++++++++++++++-------------------------------- 2 files changed, 32 insertions(+), 67 deletions(-) diff --git a/acse/acse.go b/acse/acse.go index 1ec4e56..3f882e7 100644 --- a/acse/acse.go +++ b/acse/acse.go @@ -63,16 +63,8 @@ type ABRT struct { } type External struct { - DirectReference asn1.ObjectIdentifier `asn1:"optional"` - Encoding ACSEUserInformationForCSTA `asn1:"tag:0,optional"` -} - -type ACSEUserInformationForCSTA struct { - NewDefinition `asn1:"tag:0"` -} - -type NewDefinition struct { - CSTAVersion asn1.BitString + DirectReference asn1.ObjectIdentifier `asn1:"optional"` + Encoding csta.ACSEUserInformationForCSTA `asn1:"tag:0,optional"` } var Version1 = asn1.BitString{Bytes: []byte{0x80}, BitLength: 1} @@ -84,8 +76,8 @@ func Associate() ([]byte, error) { UserInformation: UserInformation{ External{ DirectReference: csta.OID, - Encoding: ACSEUserInformationForCSTA{ - NewDefinition{ + Encoding: csta.ACSEUserInformationForCSTA{ + csta.NewDefinition{ CSTAVersion: csta.Version5, }, }, diff --git a/csta/user-information.go b/csta/user-information.go index 2fdd4c7..c7c859a 100644 --- a/csta/user-information.go +++ b/csta/user-information.go @@ -7,63 +7,36 @@ import "github.com/dim13/asn1" var ( CSTA = asn1.ObjectIdentifier([]int{1, 3, 12, 0, 218}) OID = asn1.ObjectIdentifier([]int{1, 3, 12, 0, 285, 200}) - Version1 = asn1.BitString{Bytes: []byte{0x80, 0x00}, BitLength: 16} - Version2 = asn1.BitString{Bytes: []byte{0x40, 0x00}, BitLength: 16} - Version3 = asn1.BitString{Bytes: []byte{0x20, 0x00}, BitLength: 16} - Version4 = asn1.BitString{Bytes: []byte{0x10, 0x00}, BitLength: 16} - Version5 = asn1.BitString{Bytes: []byte{0x08, 0x00}, BitLength: 16} - Version6 = asn1.BitString{Bytes: []byte{0x04, 0x00}, BitLength: 16} - Version7 = asn1.BitString{Bytes: []byte{0x02, 0x00}, BitLength: 16} - Version8 = asn1.BitString{Bytes: []byte{0x01, 0x00}, BitLength: 16} - Version9 = asn1.BitString{Bytes: []byte{0x00, 0x80}, BitLength: 16} - Version10 = asn1.BitString{Bytes: []byte{0x00, 0x40}, BitLength: 16} - Version11 = asn1.BitString{Bytes: []byte{0x00, 0x20}, BitLength: 16} - Version12 = asn1.BitString{Bytes: []byte{0x00, 0x10}, BitLength: 16} - Version13 = asn1.BitString{Bytes: []byte{0x00, 0x08}, BitLength: 16} - Version14 = asn1.BitString{Bytes: []byte{0x00, 0x04}, BitLength: 16} - Version15 = asn1.BitString{Bytes: []byte{0x00, 0x02}, BitLength: 16} - Version16 = asn1.BitString{Bytes: []byte{0x00, 0x01}, BitLength: 16} - Version17 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x80}, BitLength: 24} - Version18 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x40}, BitLength: 24} - Version19 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x20}, BitLength: 24} - Version20 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x10}, BitLength: 24} - Version21 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x08}, BitLength: 24} - Version22 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x04}, BitLength: 24} - Version23 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x02}, BitLength: 24} - Version24 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x01}, BitLength: 24} + Version1 = asn1.BitString{Bytes: []byte{0x80, 0x00}, BitLength: 16} // ECMA-180 + Version2 = asn1.BitString{Bytes: []byte{0x40, 0x00}, BitLength: 16} // ECMA-218 + Version3 = asn1.BitString{Bytes: []byte{0x20, 0x00}, BitLength: 16} // ECMA-285, 1st Edition + Version4 = asn1.BitString{Bytes: []byte{0x10, 0x00}, BitLength: 16} // ISO/IEC 18952 + Version5 = asn1.BitString{Bytes: []byte{0x08, 0x00}, BitLength: 16} // ECMA-285, 2nd Edition + Version6 = asn1.BitString{Bytes: []byte{0x04, 0x00}, BitLength: 16} // ECMA-323 + Version7 = asn1.BitString{Bytes: []byte{0x02, 0x00}, BitLength: 16} // ECMA-323, 2nd Edition + Version8 = asn1.BitString{Bytes: []byte{0x01, 0x00}, BitLength: 16} // ECMA-323, 3rd Edition + Version9 = asn1.BitString{Bytes: []byte{0x00, 0x80}, BitLength: 16} // ECMA-323, 4th Edition, Tag option + Version10 = asn1.BitString{Bytes: []byte{0x00, 0x40}, BitLength: 16} // ECMA-323, 4th Edition, short Tag option + Version11 = asn1.BitString{Bytes: []byte{0x00, 0x20}, BitLength: 16} // ECMA-323, 4th Edition, dynamic transformation option + Version12 = asn1.BitString{Bytes: []byte{0x00, 0x10}, BitLength: 16} // ECMA-323, 5th Edition, Tag option + Version13 = asn1.BitString{Bytes: []byte{0x00, 0x08}, BitLength: 16} // ECMA-323, 5th Edition, short option + Version14 = asn1.BitString{Bytes: []byte{0x00, 0x04}, BitLength: 16} // ECMA-323, 5th Edition, dynamic transformation option + Version15 = asn1.BitString{Bytes: []byte{0x00, 0x02}, BitLength: 16} // ECMA-285, 3rd Edition + Version16 = asn1.BitString{Bytes: []byte{0x00, 0x01}, BitLength: 16} // ECMA-323, 6th Edition, Tag option + Version17 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x80}, BitLength: 24} // ECMA-323, 6th Edition, short Tag option + Version18 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x40}, BitLength: 24} // ECMA-323, 6th Edition, dynamic transformatin option + Version19 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x20}, BitLength: 24} // ECMA-285, 4th Edition + Version20 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x10}, BitLength: 24} // Reserved for future use + Version21 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x08}, BitLength: 24} // Reserved for future use + Version22 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x04}, BitLength: 24} // Reserved for future use + Version23 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x02}, BitLength: 24} // Reserved for future use + Version24 = asn1.BitString{Bytes: []byte{0x00, 0x00, 0x01}, BitLength: 24} // Reserved for future use ) type ACSEUserInformationForCSTA struct { - NewDefinition struct { // 0 implicit - CSTAVersion CSTAVersion - } + NewDefinition `asn1:"tag:0"` } -type CSTAVersion int - -const ( - VersionOne CSTAVersion = 1 << iota // ECMA-180 - VersionTwo // ECMA-218 - VersionThree // ECMA-285, 1st Edition - VersionFour // ISO/IEC 18952 - VersionFive // ECMA-285, 2nd Edition - VersionSix // ECMA-323 - VersionSeven // ECMA-323, 2nd Edition - VersionEight // ECMA-323, 3rd Edition - VersionNine // ECMA-323, 4th Edition, Tag option - VersionTen // ECMA-323, 4th Edition, short Tag option - VersionEleven // ECMA-323, 4th Edition, dynamic transformation option - VersionTwelve // ECMA-323, 5th Edition, Tag option - VersionThirteen // ECMA-323, 5th Edition, short option - VersionFourteen // ECMA-323, 5th Edition, dynamic transformation option - VersionFifteen // ECMA-285, 3rd Edition - VersionSixteen // ECMA-323, 6th Edition, Tag option - VersionSeventeen // ECMA-323, 6th Edition, short Tag option - VersionEighteen // ECMA-323, 6th Edition, dynamic transformatin option - VersionNineteen // ECMA-285, 4th Edition - VersionTwenty // Reserved for future use - VersionTwentyone // Reserved for future use - VersionTwentytwo // Reserved for future use - VersionTwentythree // Reserved for future use - VersionTwentyfour // Reserved for future use -) +type NewDefinition struct { + CSTAVersion asn1.BitString +} -- cgit v1.2.3