add map_codec wrapper module to be consistent with isup/sccp and other code

This commit is contained in:
Harald Welte 2011-02-09 14:38:15 +01:00
parent 67799636d7
commit 268c57291a
2 changed files with 37 additions and 1 deletions

View File

@ -1,7 +1,7 @@
{application, osmo_map,
[{description, "Osmocom SS7 MAP"},
{vsn, "1"},
{modules, [map]},
{modules, [map, map_codec]},
{registered, []},
{mod, {map, []}},
{applications, []},

36
src/map_codec.erl Normal file
View File

@ -0,0 +1,36 @@
% GSM MAP codec wrapper functions
% (C) 2011 by Harald Welte <laforge@gnumonks.org>
%
% All Rights Reserved
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU Affero General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU Affero General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
-module(map_codec).
-author('Harald Welte <laforge@gnumonks.org>').
-include("map.hrl").
-export([parse_tcap_msg/1, encode_tcap_msgt/2]).
parse_tcap_msg(MsgBin) when is_binary(MsgBin) ->
case asn1rt:decode('map', 'MapSpecificPDUs', MsgBin) of
{ok, {Type, TcapMsgDec}} ->
{Type, TcapMsgDec};
Error ->
Error
end.
encode_tcap_msgt(Type, TcapMsgDec) ->
asn1rt:encode('map', Type, TcapMsgDec).