add map_codec wrapper module to be consistent with isup/sccp and other code
diff --git a/ebin/osmo_map.app b/ebin/osmo_map.app
index cc054ed..b1d5f14 100644
--- a/ebin/osmo_map.app
+++ b/ebin/osmo_map.app
@@ -1,7 +1,7 @@
 {application, osmo_map,
 	[{description, "Osmocom SS7 MAP"},
 	 {vsn, "1"},
-	 {modules, [map]},
+	 {modules, [map, map_codec]},
 	 {registered, []},
 	 {mod, {map, []}},
 	 {applications, []},
diff --git a/src/map_codec.erl b/src/map_codec.erl
new file mode 100644
index 0000000..a1aaacd
--- /dev/null
+++ b/src/map_codec.erl
@@ -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).