MTP3: Add field where M3UA msg can store the message priority.

Normal MTP3 headers don't have this, but for the sake of consistency
we need to store the M3UA specific MP somewhere...
This commit is contained in:
Harald Welte 2011-04-03 01:43:38 +02:00
parent 0dc999f174
commit 9586f95efb
3 changed files with 5 additions and 4 deletions

View File

@ -15,6 +15,7 @@
network_ind,
service_ind,
routing_label,
m3ua_mp, % Message Priority, only in M3UA based msg
payload
}).

View File

@ -63,7 +63,7 @@ parse_m3ua_opt(Opt = ?M3UA_IEI_PROTOCOL_DATA, MsgBin) when is_binary(MsgBin) ->
routing_label = #mtp3_routing_label{sig_link_sel = Sls,
origin_pc = Opc,
dest_pc = Dpc},
payload = Payload}};
payload = Payload, m3ua_mp = Mp}};
parse_m3ua_opt(Opt, Msg) ->
{Opt, Msg}.
@ -89,8 +89,8 @@ encode_m3ua_opt(?M3UA_IEI_PROTOCOL_DATA, Mtp3) when is_record(Mtp3, mtp3_msg) ->
routing_label = #mtp3_routing_label{sig_link_sel = Sls,
origin_pc = Opc,
dest_pc = Dpc},
payload = Payload} = Mtp3,
PayBin = <<Opc:32/big, Dpc:32/big, Si:8, Ni:8, 0:8, Sls:8, Payload/binary>>,
payload = Payload, m3ua_mp = Mp} = Mtp3,
PayBin = <<Opc:32/big, Dpc:32/big, Si:8, Ni:8, Mp:8, Sls:8, Payload/binary>>,
encode_m3ua_opt(?M3UA_IEI_PROTOCOL_DATA, PayBin);
encode_m3ua_opt(Iei, Data) when is_integer(Iei), is_binary(Data) ->
Length = byte_size(Data) + 4,

View File

@ -6,7 +6,7 @@
-include("mtp3.hrl").
-define(MTP3_MSG_BIN, <<131,92,64,0,192,9,0,3,13,24,10,18,7,0,18,4,83,132,9,0,23,11,18,6,0,18,4,68,119,88,16,70,35,67,100,65,73,4,81,1,2,200,107,42,40,40,6,7,0,17,134,5,1,1,1,160,29,97,27,128,2,7,128,161,9,6,7,4,0,0,1,0,1,3,162,3,2,1,0,163,5,161,3,2,1,0,108,13,163,11,2,1,64,2,1,8,48,3,10,1,0>>).
-define(MTP3_MSG_DEC, {mtp3_msg,2,3,{mtp3_routing_label,5,12544,192},<<9,0,3,13,24,10,18,7,0,18,4,83,132,9,0,23,11,18,6,0,18,4,68,119,88,16,70,35,67,100,65,73,4,81,1,2,200,107,42,40,40,6,7,0,17,134,5,1,1,1,160,29,97,27,128,2,7,128,161,9,6,7,4,0,0,1,0,1,3,162,3,2,1,0,163,5,161,3,2,1,0,108,13,163,11,2,1,64,2,1,8,48,3,10,1,0>>}).
-define(MTP3_MSG_DEC, {mtp3_msg,2,3,{mtp3_routing_label,5,12544,192},undefined,<<9,0,3,13,24,10,18,7,0,18,4,83,132,9,0,23,11,18,6,0,18,4,68,119,88,16,70,35,67,100,65,73,4,81,1,2,200,107,42,40,40,6,7,0,17,134,5,1,1,1,160,29,97,27,128,2,7,128,161,9,6,7,4,0,0,1,0,1,3,162,3,2,1,0,163,5,161,3,2,1,0,108,13,163,11,2,1,64,2,1,8,48,3,10,1,0>>}).
parse_test() ->
?assertEqual(?MTP3_MSG_DEC, mtp3_codec:parse_mtp3_msg(?MTP3_MSG_BIN)).