From 6c8fc1b7c2b5d01542893bfb37c892d365f30722 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 24 Oct 2015 01:00:48 +0200 Subject: Disable default values or they get omited --- acse.erl | 38 ++++++++++---------------------------- acse.hrl | 4 ++-- lib/ACSE-1.asn1 | 4 ++-- tda.erl | 2 +- 4 files changed, 15 insertions(+), 33 deletions(-) diff --git a/acse.erl b/acse.erl index 4331686..4f852c7 100644 --- a/acse.erl +++ b/acse.erl @@ -2091,14 +2091,9 @@ end, {_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10, Cindex11, Cindex12, Cindex13, Cindex14} = Val, %%------------------------------------------------- -%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] +%% attribute protocol-version(1) with type BIT STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = case Cindex1 of - asn1_DEFAULT -> {<<>>,0}; - [version1] -> {<<>>,0}; - _ -> - encode_named_bit_string(Cindex1, [{version1,0}], [<<128>>]) - end, + {EncBytes1,EncLen1} = encode_named_bit_string(Cindex1, [{version1,0}], [<<128>>]), %%------------------------------------------------- %% attribute application-context-name(2) with type OBJECT IDENTIFIER @@ -2220,14 +2215,10 @@ encode_tags(TagIn, BytesSoFar, LenSoFar). Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] +%% attribute protocol-version(1) with type BIT STRING %%------------------------------------------------- -{Term1,Tlv2} = case Tlv1 of -[{131072,V1}|TempTlv2] -> - {decode_named_bit_string(V1, [{version1,0}], []), TempTlv2}; - _ -> - {[version1],Tlv1} -end, +[V1|Tlv2] = Tlv1, +Term1 = decode_named_bit_string(V1, [{version1,0}], [131072]), %%------------------------------------------------- %% attribute application-context-name(2) with type OBJECT IDENTIFIER @@ -2372,14 +2363,9 @@ end, {_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9, Cindex10, Cindex11, Cindex12, Cindex13, Cindex14, Cindex15, Cindex16} = Val, %%------------------------------------------------- -%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] +%% attribute protocol-version(1) with type BIT STRING %%------------------------------------------------- - {EncBytes1,EncLen1} = case Cindex1 of - asn1_DEFAULT -> {<<>>,0}; - [version1] -> {<<>>,0}; - _ -> - encode_named_bit_string(Cindex1, [{version1,0}], [<<128>>]) - end, + {EncBytes1,EncLen1} = encode_named_bit_string(Cindex1, [{version1,0}], [<<128>>]), %%------------------------------------------------- %% attribute application-context-name(2) with type OBJECT IDENTIFIER @@ -2527,14 +2513,10 @@ encode_tags(TagIn, BytesSoFar, LenSoFar). Tlv1 = match_tags(Tlv, TagIn), %%------------------------------------------------- -%% attribute protocol-version(1) with type BIT STRING DEFAULT = [version1] +%% attribute protocol-version(1) with type BIT STRING %%------------------------------------------------- -{Term1,Tlv2} = case Tlv1 of -[{131072,V1}|TempTlv2] -> - {decode_named_bit_string(V1, [{version1,0}], []), TempTlv2}; - _ -> - {[version1],Tlv1} -end, +[V1|Tlv2] = Tlv1, +Term1 = decode_named_bit_string(V1, [{version1,0}], [131072]), %%------------------------------------------------- %% attribute application-context-name(2) with type OBJECT IDENTIFIER diff --git a/acse.hrl b/acse.hrl index 4b3551c..3b3ddda 100644 --- a/acse.hrl +++ b/acse.hrl @@ -39,13 +39,13 @@ reason = asn1_NOVALUE, 'user-information' = asn1_NOVALUE}). -record('AARE-apdu',{ -'protocol-version' = asn1_DEFAULT, 'application-context-name', result, 'result-source-diagnostic', 'responding-AP-title' = asn1_NOVALUE, 'responding-AE-qualifier' = asn1_NOVALUE, 'responding-AP-invocation-identifier' = asn1_NOVALUE, 'responding-AE-invocation-identifier' = asn1_NOVALUE, 'responder-acse-requirements' = asn1_NOVALUE, 'mechanism-name' = asn1_NOVALUE, 'responding-authentication-value' = asn1_NOVALUE, 'application-context-name-list' = asn1_NOVALUE, 'implementation-information' = asn1_NOVALUE, +'protocol-version', 'application-context-name', result, 'result-source-diagnostic', 'responding-AP-title' = asn1_NOVALUE, 'responding-AE-qualifier' = asn1_NOVALUE, 'responding-AP-invocation-identifier' = asn1_NOVALUE, 'responding-AE-invocation-identifier' = asn1_NOVALUE, 'responder-acse-requirements' = asn1_NOVALUE, 'mechanism-name' = asn1_NOVALUE, 'responding-authentication-value' = asn1_NOVALUE, 'application-context-name-list' = asn1_NOVALUE, 'implementation-information' = asn1_NOVALUE, %% with extensions %% end of extensions 'user-information' = asn1_NOVALUE}). -record('AARQ-apdu',{ -'protocol-version' = asn1_DEFAULT, 'application-context-name', 'called-AP-title' = asn1_NOVALUE, 'called-AE-qualifier' = asn1_NOVALUE, 'called-AP-invocation-identifier' = asn1_NOVALUE, 'called-AE-invocation-identifier' = asn1_NOVALUE, 'calling-AP-title' = asn1_NOVALUE, 'calling-AE-qualifier' = asn1_NOVALUE, 'calling-AP-invocation-identifier' = asn1_NOVALUE, 'calling-AE-invocation-identifier' = asn1_NOVALUE, 'sender-acse-requirements' = asn1_NOVALUE, 'mechanism-name' = asn1_NOVALUE, 'calling-authentication-value' = asn1_NOVALUE, 'application-context-name-list' = asn1_NOVALUE, 'implementation-information' = asn1_NOVALUE, +'protocol-version', 'application-context-name', 'called-AP-title' = asn1_NOVALUE, 'called-AE-qualifier' = asn1_NOVALUE, 'called-AP-invocation-identifier' = asn1_NOVALUE, 'called-AE-invocation-identifier' = asn1_NOVALUE, 'calling-AP-title' = asn1_NOVALUE, 'calling-AE-qualifier' = asn1_NOVALUE, 'calling-AP-invocation-identifier' = asn1_NOVALUE, 'calling-AE-invocation-identifier' = asn1_NOVALUE, 'sender-acse-requirements' = asn1_NOVALUE, 'mechanism-name' = asn1_NOVALUE, 'calling-authentication-value' = asn1_NOVALUE, 'application-context-name-list' = asn1_NOVALUE, 'implementation-information' = asn1_NOVALUE, %% with extensions %% end of extensions 'user-information' = asn1_NOVALUE}). diff --git a/lib/ACSE-1.asn1 b/lib/ACSE-1.asn1 index 6768034..6307857 100644 --- a/lib/ACSE-1.asn1 +++ b/lib/ACSE-1.asn1 @@ -40,7 +40,7 @@ ACSE-apdu ::= CHOICE { AARQ-apdu ::= [APPLICATION 0] IMPLICIT SEQUENCE { protocol-version - [0] IMPLICIT BIT STRING {version1(0)} DEFAULT {version1}, + [0] IMPLICIT BIT STRING {version1(0)}, application-context-name [1] Application-context-name, called-AP-title [2] AP-title OPTIONAL, called-AE-qualifier [3] AE-qualifier OPTIONAL, @@ -68,7 +68,7 @@ AARQ-apdu ::= [APPLICATION 0] IMPLICIT SEQUENCE { AARE-apdu ::= [APPLICATION 1] IMPLICIT SEQUENCE { protocol-version - [0] IMPLICIT BIT STRING {version1(0)} DEFAULT {version1}, + [0] IMPLICIT BIT STRING {version1(0)}, application-context-name [1] Application-context-name, result [2] Associate-result, result-source-diagnostic [3] Associate-source-diagnostic, diff --git a/tda.erl b/tda.erl index c87ef58..5e4e46d 100644 --- a/tda.erl +++ b/tda.erl @@ -26,7 +26,7 @@ associate_request() -> Ver = #'NewACSEUserInformationForCSTA'{cSTAVersion = [versionFive]}, {ok, Enc} = acse:encode('ACSEUserInformationForCSTA', {newDefinition, Ver}), Pdu = #'AARQ-apdu'{ - 'protocol-version' = <<0>>, % hack + 'protocol-version' = [version1], 'application-context-name' = {1, 3, 12, 0, 218}, 'user-information' = [#'EXTERNAL'{ 'direct-reference' = {1, 3, 12, 0, 285, 200}, -- cgit v1.2.3