Harald Welte | 1f6a035 | 2011-01-15 20:07:45 +0100 | [diff] [blame] | 1 | % RFC 3331 MTP2 User Adaption Layer coding / decoding |
| 2 | |
| 3 | % (C) 2011 by Harald Welte <laforge@gnumonks.org> |
| 4 | % |
| 5 | % All Rights Reserved |
| 6 | % |
| 7 | % This program is free software; you can redistribute it and/or modify |
| 8 | % it under the terms of the GNU Affero General Public License as |
| 9 | % published by the Free Software Foundation; either version 3 of the |
| 10 | % License, or (at your option) any later version. |
| 11 | % |
| 12 | % This program is distributed in the hope that it will be useful, |
| 13 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | % GNU General Public License for more details. |
| 16 | % |
| 17 | % You should have received a copy of the GNU Affero General Public License |
Harald Welte | ca80443 | 2024-06-05 16:41:15 +0200 | [diff] [blame^] | 18 | % along with this program. If not, see <https://www.gnu.org/licenses/>. |
Harald Welte | 1f6a035 | 2011-01-15 20:07:45 +0100 | [diff] [blame] | 19 | |
| 20 | -module(m2ua_codec). |
| 21 | -author('Harald Welte <laforge@gnumonks.org>'). |
Harald Welte | 231ae0b | 2012-04-01 20:13:23 +0200 | [diff] [blame] | 22 | -include("xua.hrl"). |
Harald Welte | 1f6a035 | 2011-01-15 20:07:45 +0100 | [diff] [blame] | 23 | -include("m2ua.hrl"). |
| 24 | |
| 25 | -export([parse_m2ua_msg/1, encode_m2ua_msg/1]). |
| 26 | |
Harald Welte | 1f6a035 | 2011-01-15 20:07:45 +0100 | [diff] [blame] | 27 | % parse a M2UA message binary into a record |
| 28 | parse_m2ua_msg(DataBin) when is_binary(DataBin) -> |
Harald Welte | 231ae0b | 2012-04-01 20:13:23 +0200 | [diff] [blame] | 29 | xua_codec:parse_msg(DataBin). |
Harald Welte | 1f6a035 | 2011-01-15 20:07:45 +0100 | [diff] [blame] | 30 | |
| 31 | % encode a message from record to binary |
Harald Welte | 231ae0b | 2012-04-01 20:13:23 +0200 | [diff] [blame] | 32 | encode_m2ua_msg(Msg) when is_record(Msg, xua_msg) -> |
| 33 | xua_codec:encode_msg(Msg). |