From 1279085f7ee5e3434eaa3c467a7a2955b092be9d Mon Sep 17 00:00:00 2001 From: herlesupreeth Date: Thu, 24 Dec 2020 09:38:42 +0100 Subject: [PATCH] sysmoISIM-SJA2: Add support for programming IPv4 address for PCSCF This commit allows programming of IPv4 or FQDN in EF.PCSCF Example: ./pySim-prog.py -p 0 -x 001 -y 01 -s 8988211900000000004 -i 001011234567895 -k 8baf473f2f8fd09487cccbd7097c6862 --op 11111111111111111111111111111111 -o 8E27B6AF0E692E750F32667A3B14605D -a 85524953 -n isim.test --msisdn 0598765432100 --epdgid 172.24.15.20 --pcscf 99.100.80.102 --ims-hdomain testims.org Change-Id: I247a5413e9e5fef6b9d7b6cb8442313e72f9156a --- pySim/cards.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pySim/cards.py b/pySim/cards.py index b7be6e88..17da5064 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -336,12 +336,16 @@ class IsimCard(Card): def update_pcscf(self, pcscf): if len(pcscf) > 0: - content = enc_addr_tlv(pcscf) + addr_type = get_addr_type(pcscf) + if addr_type == None: + raise ValueError("Unknown PCSCF address type or invalid address provided") + content = enc_addr_tlv(pcscf, ('%02x' % addr_type)) else: # Just the tag value content = '80' rec_size_bytes = self._scc.record_size(EF_ISIM_ADF_map['PCSCF']) - data, sw = self._scc.update_record(EF_ISIM_ADF_map['PCSCF'], 1, rpad(content, rec_size_bytes*2)) + pcscf_tlv = rpad(content, rec_size_bytes*2) + data, sw = self._scc.update_record(EF_ISIM_ADF_map['PCSCF'], 1, pcscf_tlv) return sw def read_domain(self):