1 |
|
%%% @doc Encoder and decoder for MAM messages |
2 |
|
%%% |
3 |
|
%%% Default implementations are: |
4 |
|
%%% - mam_message_xml |
5 |
|
%%% - mam_message_eterm |
6 |
|
%%% - mam_message_compressed_eterm |
7 |
|
-module(mam_message). |
8 |
|
|
9 |
|
-ignore_xref([behaviour_info/1]). |
10 |
|
|
11 |
|
-callback encode(exml:element()) -> binary(). |
12 |
|
-callback decode(binary()) -> exml:element(). |
13 |
|
|
14 |
|
-export([encode/2, decode/2]). |
15 |
|
|
16 |
|
-spec encode(module(), exml:element()) -> binary(). |
17 |
:-( |
encode(Mod, Packet) -> Mod:encode(Packet). |
18 |
|
|
19 |
|
-spec decode(module(), binary()) -> exml:element(). |
20 |
:-( |
decode(Mod, Bin) -> Mod:decode(Bin). |
21 |
|
|