aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/h323test.erl
blob: c4eaa75c9a56d4317b2a0be9bed7717ac039577a (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1999-2017. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%%     http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%
%%
%%
-module(h323test).

-export([run/1]).
-include_lib("common_test/include/ct.hrl").

run(per)     -> run();
run(_Rules)  -> ok.

run() ->
    roundtrip('EndpointType', endpoint()),
    roundtrip('Alerting-UUIE', alerting_uuie()),
    roundtrip('H323-UserInformation', alerting_val(), alerting_enc()),
    roundtrip('H323-UserInformation', connect_val(), connect_enc()),
    general_string(),
    ok.

alerting_val() ->
    {'H323-UserInformation',
     {'H323-UU-PDU',
      {alerting,
       alerting_uuie()},
      asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE},
     asn1_NOVALUE}.

endpoint() ->
    {'EndpointType',asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,
     asn1_NOVALUE,asn1_NOVALUE,
     {'TerminalInfo',asn1_NOVALUE},
     false,false}.

alerting_uuie() ->
    {'Alerting-UUIE',
     {0,0,8,2250,0,2},
     endpoint(),
     asn1_NOVALUE,
     {'CallIdentifier',<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>},
     asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}.

alerting_enc() ->
    "0380060008914a0002020120110000000000000000000000000000000000".

connect_val() ->
    {'H323-UserInformation',
     {'H323-UU-PDU',
      {connect,
       {'Connect-UUIE',
	{0,0,8,2250,0,2},
	{ipAddress,
	 {'TransportAddress_ipAddress',<<136,225,41,58>>,1187}},
	{'EndpointType',asn1_NOVALUE,
	 {'VendorIdentifier',
	  {'H221NonStandard',181,0,21324},
	  <<77,105,99,114,111,115,111,102,116,174,32,78,101,116,
	   77,101,100,116,105,110,103,174,0>>,
	  <<51,46,48,0>>},
	 asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,
	 {'TerminalInfo',asn1_NOVALUE},
	 false,false},
	<<22,137,237,197,191,35,211,17,140,45,0,192,79,75,28,208>>,
	{'CallIdentifier',<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>},
	asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE}},
      asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE},
     asn1_NOVALUE}.

connect_enc() ->
    "02c0060008914a00020088e1293a04a322c0b500534c164d6963726f736f6674ae204e65744d656474696e67ae0003332e3000001689edc5bf23d3118c2d00c04f4b1cd00900110000000000000000000000000000000000".

general_string() ->
    Type = 'MultimediaSystemControlMessage',
    UI = <<109,64,1,57>>,
    {ok, _V} = 'MULTIMEDIA-SYSTEM-CONTROL':decode(Type, UI).

roundtrip(T, V) ->
    asn1_test_lib:roundtrip('H323-MESSAGES', T, V).

roundtrip(T, V, HexString) ->
    Enc = asn1_test_lib:hex_to_bin(HexString),
    Enc = asn1_test_lib:roundtrip_enc('H323-MESSAGES', T, V),
    ok.