From 092443629b7de87f4cd2d0fc0de13da3e5a50203 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 16 Jan 2012 21:39:48 +0100 Subject: MTP3: fix encoding of bit/byte ordering in routing label --- src/mtp3_codec.erl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mtp3_codec.erl b/src/mtp3_codec.erl index ae86cdd..cbb9052 100644 --- a/src/mtp3_codec.erl +++ b/src/mtp3_codec.erl @@ -28,7 +28,10 @@ % Parse standard routing label according to Section 2.2 of ITU-T Q.704 parse_mtp3_routing_label(_, LabelBin) when is_binary(LabelBin) -> - <> = LabelBin, + % we need to swap the four bytes and then parse the fields + <> = LabelBin, + LabelRev = <>, + <> = LabelRev, {ok, #mtp3_routing_label{sig_link_sel = Sls, origin_pc = Opc, dest_pc = Dpc}, Remain}. parse_mtp3_msg(DataBin) when is_binary(DataBin) -> @@ -43,7 +46,9 @@ encode_mtp3_routing_label(#mtp3_routing_label{sig_link_sel = Sls, origin_pc = Op dest_pc = DpcIn}) -> Opc = osmo_util:pointcode2int(OpcIn), Dpc = osmo_util:pointcode2int(DpcIn), - <>. + % we need to swap the four bytes after encoding the fields + <> = <>, + <>. encode_mtp3_msg(#mtp3_msg{network_ind = NetInd, service_ind = ServiceInd, routing_label = RoutLbl, payload = Payload}) -> -- cgit v1.2.3