anchor.diff:  -module(m3ua_codec).
   -author('Harald Welte <laforge@gnumonks.org>').
   -include("m3ua.hrl").
  +-include("mtp3.hrl").
   
   -export([parse_m3ua_msg/1, encode_m3ua_msg/1]).
   
  
positive.code: 	OptBin = encode_m3ua_opt(Head),
  	encode_m3ua_opts(Tail, <<Bin/binary, OptBin/binary>>).
  
  encode_m3ua_opt({Iei, Data}) when is_integer(Iei), is_binary(Data) ->
  	Length = length(Data) + 4,
  	PadLen = get_num_pad_bytes(Length),
  
negative.code: 	PadLen = get_num_pad_bytes(Length),
  	LengthNet = Length - 4,
  	<<CurOpt:LengthNet/binary, 0:PadLen/integer-unit:8, Remain2/binary>> = Remain,
  	NewOpt = parse_m3ua_opt(Tag, CurOpt),
  	parse_m3ua_opts(Remain2, OptList ++ [NewOpt]).
  
  parse_m3ua_opt(Opt = ?M3UA_IEI_PROTOCOL_DATA, MsgBin) when is_binary(MsgBin) ->
  	<<Opc:32/big, Dpc:32/big, Si:8, Ni:8, Mp:8, Sls:8, Payload/binary>> = MsgBin,
  	{Opt, #mtp3_msg{network_ind = Ni, service_ind = Si,
  			routing_label = #mtp3_routing_label{sig_link_sel = Sls,
  							    origin_pc = Opc,
  							    dest_pc = Dpc},
  			payload = Payload}};
  parse_m3ua_opt(Opt, Msg) ->
  	{Opt, Msg}.
  
  
  
  encode_m3ua_msg(#m3ua_msg{version = Version, msg_class = MsgClass,
  			  msg_type = MsgType, payload = OptList}) ->
  