diff options
Diffstat (limited to 'src/tcap_udp_server.erl')
-rw-r--r-- | src/tcap_udp_server.erl | 120 |
1 files changed, 98 insertions, 22 deletions
diff --git a/src/tcap_udp_server.erl b/src/tcap_udp_server.erl index fc1a2b1..9abc03f 100644 --- a/src/tcap_udp_server.erl +++ b/src/tcap_udp_server.erl @@ -1,4 +1,24 @@ +% MAP masquerading application +% (C) 2010 by Harald Welte <laforge@gnumonks.org> +% (C) 2010 by On-Waves +% +% All Rights Reserved +% +% This program is free software; you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation; either version 2 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., +% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + -module(tcap_udp_server). -compile(export_all). @@ -50,7 +70,7 @@ patch_InsertSubscriberDataArg(Arg) -> patch_oBcsmCamelTDPDataList(List) -> % we reverse the origianl list, as the tail recursive _acc function % will invert the order of components again - handle_tcap_components_acc(lists:reverse(List), []). + patch_oBcsmCamelTDPDataList_acc(lists:reverse(List), []). patch_oBcsmCamelTDPDataList_acc([], NewList) -> NewList; patch_oBcsmCamelTDPDataList_acc([TdpData|Tail], NewList) -> case TdpData of @@ -61,24 +81,11 @@ patch_oBcsmCamelTDPDataList_acc([TdpData|Tail], NewList) -> end, patch_oBcsmCamelTDPDataList_acc(Tail, [NewTdpData|NewList]). -patch_vlrCamelSubscrInfo(VlrCamel) -> - case VlrCamel of - asn1_NOVALUE -> - % return the original (empty) VlrCamelSubscrInfo - VlrCamel; - #'VlrCamelSubscriptionInfo'{'o-CSI'={#'O-CSI'{'o-BcsmCamelTDPDataList'=TdpList}}} -> - NewTdpList = patch_oBcsmCamelTDPDataList(TdpList), - % return the VlrCamelSubscrInfo with replaced TdpList - VlrCamel#'VlrCamelSubscriptionInfo'{'o-CSI'={#'O-CSI'{'o-BcsmCamelTDPDataList'=NewTdpList}}}; - _ -> - % return the original VlrCamelSubscrInfo without TdpList - VlrCamel - end. patch_GprsCamelTDPDataList(List) -> % we reverse the origianl list, as the tail recursive _acc function % will invert the order of components again - handle_tcap_components_acc(lists:reverse(List), []). + patch_GprsCamelTDPDataList_acc(lists:reverse(List), []). patch_GprsCamelTDPDataList_acc([], NewList) -> NewList; patch_GprsCamelTDPDataList_acc([TdpData|Tail], NewList) -> case TdpData of @@ -90,18 +97,87 @@ patch_GprsCamelTDPDataList_acc([TdpData|Tail], NewList) -> patch_GprsCamelTDPDataList_acc(Tail, [NewTdpData|NewList]). +patch_SmsCamelTDPDataList(List) -> + % we reverse the origianl list, as the tail recursive _acc function + % will invert the order of components again + patch_SmsCamelTDPDataList_acc(lists:reverse(List), []). +patch_SmsCamelTDPDataList_acc([], NewList) -> NewList; +patch_SmsCamelTDPDataList_acc([TdpData|Tail], NewList) -> + case TdpData of + #'SMS-CAMEL-TDP-Data'{'gsmSCF-Address'=ScfAddr} -> + NewTdpData = TdpData#'SMS-CAMEL-TDP-Data'{'gsmSCF-Address'=?PATCH_GSMSCF_ADDRESS}; + _ -> + NewTdpData = TdpData + end, + patch_GprsCamelTDPDataList_acc(Tail, [NewTdpData|NewList]). + + +patch_vlrCamelSubscrInfo(VlrCamel) -> + case VlrCamel of + asn1_NOVALUE -> + % return the original (empty) VlrCamelSubscrInfo + VlrCamel; + #'VlrCamelSubscriptionInfo'{} -> + case VlrCamel of + #'VlrCamelSubscriptionInfo'{'o-CSI'={#'O-CSI'{'o-BcsmCamelTDPDataList'=TdpList}}} -> + NewTdpList = patch_oBcsmCamelTDPDataList(TdpList), + VlrCamel1 = VlrCamel#'VlrCamelSubscriptionInfo'{'o-CSI'={#'O-CSI'{'o-BcsmCamelTDPDataList'=NewTdpList}}}; + _ -> + VlrCamel1 = VlrCamel + end, + case VlrCamel1 of + #'VlrCamelSubscriptionInfo'{'mo-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=MoSmsTdpList}}} -> + NewMoSmsTdpList = patch_SmsCamelTDPDataList(MoSmsTdpList), + VlrCamel2 = VlrCamel1#'VlrCamelSubscriptionInfo'{'mo-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=NewMoSmsTdpList}}}; + _ -> + VlrCamel2 = VlrCamel1 + end, + case VlrCamel2 of + #'VlrCamelSubscriptionInfo'{'mt-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=MtSmsTdpList}}} -> + NewMtSmsTdpList = patch_SmsCamelTDPDataList(MtSmsTdpList), + VlrCamel3 = VlrCamel2#'VlrCamelSubscriptionInfo'{'mt-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=NewMtSmsTdpList}}}; + _ -> + VlrCamel3 = VlrCamel2 + end, + case VlrCamel3 of + #'VlrCamelSubscriptionInfo'{'ss-CSI'={#'SS-CSI'{'ss-CamelData'=#'SS-CamelData'{'gsmSCF-Address'=SSgsmSCF}}}} -> + VlrCamel4 = #'VlrCamelSubscriptionInfo'{'ss-CSI'={#'SS-CSI'{'ss-CamelData'=#'SS-CamelData'{'gsmSCF-Address'=?PATCH_GSMSCF_ADDRESS}}}}; + _ -> + VlrCamel4 = VlrCamel3 + end, + % return the VlrCamelSubscrInfo with replaced TdpList + VlrCamel4; + _ -> + % return the original VlrCamelSubscrInfo without TdpList + VlrCamel + end. + + patch_sgsnCamelSubscrInfo(SgsnCamel) -> case SgsnCamel of asn1_NOVALUE -> % return the original (empty) SgsnCamelSubscrInfo SgsnCamel; -% {'SGSN-CAMEL-SubscriptionInfo', SubInf} -> -% if {'gprs-CSI'={#'GPRS-CSI'{'gprs-CamelTDPDataList'=GprsTdpList}} -% 'mo-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=MoSmsTdpList}}, -% -% } -> -% NewGprsTdpList = patch_GprsCamelTDPDataList(GprsTdpList), -% SgsnCamel#'SGSN-CAMEL-SubscriptionInfo'{'gprs-CSI'={#'GPRS-CSI'{'gprs-CamelTDPDataList'=NewGprsTdpList}}}; + #'SGSN-CAMEL-SubscriptionInfo'{} -> + case SgsnCamel of #'SGSN-CAMEL-SubscriptionInfo'{'gprs-CSI'={#'GPRS-CSI'{'gprs-CamelTDPDataList'=GprsTdpList}}} -> + NewGprsTdpList = patch_GprsCamelTDPDataList(GprsTdpList), + SgsnCamel1 = SgsnCamel#'SGSN-CAMEL-SubscriptionInfo'{'gprs-CSI'={#'GPRS-CSI'{'gprs-CamelTDPDataList'=NewGprsTdpList}}}; + _ -> + SgsnCamel1 = SgsnCamel + end, + case SgsnCamel1 of #'SGSN-CAMEL-SubscriptionInfo'{'mo-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=MoSmsTdpList}}} -> + NewMoSmsTdpList = patch_SmsCamelTDPDataList(MoSmsTdpList), + SgsnCamel2 = SgsnCamel1#'SGSN-CAMEL-SubscriptionInfo'{'mo-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=NewMoSmsTdpList}}}; + _ -> + SgsnCamel2 = SgsnCamel1 + end, + case SgsnCamel1 of #'SGSN-CAMEL-SubscriptionInfo'{'mt-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=MtSmsTdpList}}} -> + NewMtSmsTdpList = patch_SmsCamelTDPDataList(MtSmsTdpList), + SgsnCamel3 = SgsnCamel2#'SGSN-CAMEL-SubscriptionInfo'{'mt-sms-CSI'={#'SMS-CSI'{'sms-CAMEL-TDP-DataList'=NewMtSmsTdpList}}}; + _ -> + SgsnCamel3 = SgsnCamel2 + end, + SgsnCamel3; _ -> % return the original VlrCamelSubscrInfo without TdpList SgsnCamel |