From 429456f13f59ed5ecf996caa59e76ee9bdd9bb24 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 16 Jan 2012 20:03:37 +0100 Subject: MTP3: parsing of mgmt messages --- src/mtp3_codec.erl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/mtp3_codec.erl') diff --git a/src/mtp3_codec.erl b/src/mtp3_codec.erl index 0fca990..ae86cdd 100644 --- a/src/mtp3_codec.erl +++ b/src/mtp3_codec.erl @@ -48,19 +48,24 @@ encode_mtp3_routing_label(#mtp3_routing_label{sig_link_sel = Sls, origin_pc = Op encode_mtp3_msg(#mtp3_msg{network_ind = NetInd, service_ind = ServiceInd, routing_label = RoutLbl, payload = Payload}) -> RoutLblBin = encode_mtp3_routing_label(RoutLbl), - PayloadBin = payload_to_binary(Payload), + PayloadBin = payload_to_binary(ServiceInd, Payload), <>. -decode_payload(?MTP3_SERV_MGMT, Payload) -> +decode_payload(?MTP3_SERV_MTN, Payload) -> <> = Payload, - #mtp3mg_msg{h0 = H0, h1 = H1, test_pattern = TP}; + #mtp3mg_msg{h0 = H0, h1 = H1, payload = TP}; +decode_payload(?MTP3_SERV_MGMT, Payload) -> + <> = Payload, + #mtp3mg_msg{h0 = H0, h1 = H1, payload = Payload}; decode_payload(_, Payload) -> Payload. -payload_to_binary(#mtp3mg_msg{h0=H0, h1=H1, test_pattern=TP}) -> +payload_to_binary(?MTP3_SERV_MTN, #mtp3mg_msg{h0=H0, h1=H1, payload=TP}) -> Len = byte_size(TP), <>; -payload_to_binary(Whatever) -> +payload_to_binary(?MTP3_SERV_MGMT, #mtp3mg_msg{h0=H0, h1=H1, payload=Payload}) -> + <>; +payload_to_binary(_, Whatever) -> Whatever. -- cgit v1.2.3