summaryrefslogtreecommitdiff
path: root/src/acse.erl
blob: e8f0d708ab352f5e36dab923559ed1c6a026618d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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.