summaryrefslogtreecommitdiff
path: root/src/acse.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/acse.erl')
-rw-r--r--src/acse.erl35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/acse.erl b/src/acse.erl
new file mode 100644
index 0000000..e8f0d70
--- /dev/null
+++ b/src/acse.erl
@@ -0,0 +1,35 @@
+-module(acse).
+
+-include("ACSE-1.hrl").
+-include("CSTA-application-context-information-csta3.hrl").
+
+-export([associate/0, release/0]).
+-export([decode/1, dispatch/1]).
+
+ui() ->
+ {ok, UI} = 'CSTA-application-context-information-csta3':encode(
+ 'ACSEUserInformationForCSTA', {newDefinition,
+ #'NewACSEUserInformationForCSTA'{cSTAVersion = [versionFive]}}),
+ {'single-ASN1-type', UI}.
+
+associate() ->
+ 'ACSE-1':encode('ACSE-apdu', {aarq, #'AARQ-apdu'{
+ 'protocol-version' = [version1],
+ 'application-context-name' = {1, 3, 12, 0, 218},
+ 'user-information' = [#'EXTERNAL'{
+ 'direct-reference' = {1, 3, 12, 0, 285, 200},
+ encoding = ui()}]}}).
+
+release() -> 'ACSE-1':encode('ACSE-apdu', {rlrq, #'RLRQ-apdu'{}}).
+
+decode(Msg) -> 'ACSE-1':decode('ACSE-apdu', Msg).
+
+dispatch({aare, #'AARE-apdu'{result = Result}}) ->
+ case Result of
+ accepted -> ok;
+ _ -> error
+ end;
+
+dispatch({rlre, _}) -> ok;
+
+dispatch({abrt, _}) -> error.