Skip to contentSkip to conversation

build: Fix typo that breaks --fsanitize=leak check

PATCH In review Denis Kenzior 1 participant 16 messages Dec 19, 2023 – Jan 2, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/15 build: Fix typo that breaks --fsanitize=leak check

---
 acinclude.m4 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
acinclude.m4 +1 -2
index 4932ac6b..656888d7 100644
@@ -23,8 +23,7 @@ AC_DEFUN([AC_PROG_CC_ASAN], [
 ])
 
 AC_DEFUN([AC_PROG_CC_LSAN], [
-	AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=leak], ac_cv_prog_cc
-_lsan, [
+	AC_CACHE_CHECK([whether ${CC-cc} accepts -fsanitize=leak], ac_cv_prog_cc_lsan, [
 		echo 'void f(){}' > conftest.c
 		if test -z "`${CC-cc} -fsanitize=leak -c conftest.c 2>&1`"; then
 			ac_cv_prog_cc_lsan=yes
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/15 include: Allow multiple context types

---
 include/gprs-context.h   | 8 ++++----
 include/gprs-provision.h | 4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)
include/gprs-context.h +4 -4
index 75958284..81055d89 100644
@@ -33,10 +33,10 @@ struct ofono_modem;
 
 enum ofono_gprs_context_type {
 	OFONO_GPRS_CONTEXT_TYPE_ANY = 0,
-	OFONO_GPRS_CONTEXT_TYPE_INTERNET,
-	OFONO_GPRS_CONTEXT_TYPE_MMS,
-	OFONO_GPRS_CONTEXT_TYPE_WAP,
-	OFONO_GPRS_CONTEXT_TYPE_IMS,
+	OFONO_GPRS_CONTEXT_TYPE_INTERNET	= 0x0001,
+	OFONO_GPRS_CONTEXT_TYPE_MMS		= 0x0002,
+	OFONO_GPRS_CONTEXT_TYPE_WAP		= 0x0004,
+	OFONO_GPRS_CONTEXT_TYPE_IMS		= 0x0008,
 };
 
 struct ofono_gprs_primary_context {
include/gprs-provision.h +3 -1
index 2dd792b5..75808e66 100644
@@ -26,10 +26,12 @@
 extern "C" {
 #endif
 
+#include <stdint.h>
+
 #include "gprs-context.h"
 
 struct ofono_gprs_provision_data {
-	enum ofono_gprs_context_type type;
+	uint32_t type; /* Multiple types can be set in a bitmap */
 	enum ofono_gprs_proto proto;
 	char *name;
 	char *apn;
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 3/15 module: Add support for ofono modules

In reply to Denis Kenzior

Modules are meant to replace manually calling various __foo_init and __foo_cleanup calls in main.c. Instead a single ofono_modules_init and ofono_modules_cleanup invocation will initialize / cleanup all registered ofono modules.

---
 Makefile.am   |  3 ++-
 src/main.c    | 11 ++++-------
 src/manager.c |  6 ++++--
 src/modem.c   |  7 +++++--
 src/module.c  | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/ofono.h   | 22 ++++++++++++++++++---
 6 files changed, 89 insertions(+), 15 deletions(-)
 create mode 100644 src/module.c
Makefile.am +2 -1
index e7fd030f..f7b59a47 100644
@@ -725,7 +725,8 @@ src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
 			src/handsfree-audio.c src/bluetooth.h \
 			src/hfp.h src/siri.c \
 			src/netmon.c src/lte.c src/ims.c \
-			src/netmonagent.c src/netmonagent.h
+			src/netmonagent.c src/netmonagent.h \
+			src/module.c
 
 src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) $(ell_ldadd) \
 			@GLIB_LIBS@ @DBUS_LIBS@ -ldl
src/main.c +4 -7
index 4529cde1..82157700 100644
@@ -274,12 +274,10 @@ int main(int argc, char **argv)
 
 	__ofono_dbus_init(conn);
 
-	__ofono_modemwatch_init();
-
-	__ofono_manager_init();
+	if (__ofono_modules_init() < 0)
+		goto fail_module_init;
 
 	__ofono_plugin_init(option_plugin, option_noplugin);
-
 	g_free(option_plugin);
 	g_free(option_noplugin);
 
@@ -287,10 +285,9 @@ int main(int argc, char **argv)
 
 	__ofono_plugin_cleanup();
 
-	__ofono_manager_cleanup();
-
-	__ofono_modemwatch_cleanup();
+	__ofono_modules_cleanup();
 
+fail_module_init:
 	__ofono_dbus_cleanup();
 	dbus_connection_unref(conn);
 
src/manager.c +4 -2
index 404f2cad..e3307adb 100644
@@ -95,7 +95,7 @@ static const GDBusSignalTable manager_signals[] = {
 	{ }
 };
 
-int __ofono_manager_init(void)
+static int manager_init(void)
 {
 	DBusConnection *conn = ofono_dbus_get_connection();
 	gboolean ret;
@@ -111,10 +111,12 @@ int __ofono_manager_init(void)
 	return 0;
 }
 
-void __ofono_manager_cleanup(void)
+static void manager_cleanup(void)
 {
 	DBusConnection *conn = ofono_dbus_get_connection();
 
 	g_dbus_unregister_interface(conn, OFONO_MANAGER_PATH,
 					OFONO_MANAGER_INTERFACE);
 }
+
+OFONO_MODULE(manager, manager_init, manager_cleanup)
src/modem.c +5 -2
index 60717717..354d2b86 100644
@@ -1918,12 +1918,13 @@ static void sim_watch(struct ofono_atom *atom,
 							modem, NULL);
 }
 
-void __ofono_modemwatch_init(void)
+static int modemwatch_init(void)
 {
 	g_modemwatches = __ofono_watchlist_new(g_free);
+	return 0;
 }
 
-void __ofono_modemwatch_cleanup(void)
+static void modemwatch_cleanup(void)
 {
 	__ofono_watchlist_free(g_modemwatches);
 }
@@ -2319,3 +2320,5 @@ void __ofono_modem_dec_emergency_mode(struct ofono_modem *modem)
 out:
 	modem->emergency--;
 }
+
+OFONO_MODULE(modemwatch, modemwatch_init, modemwatch_cleanup)
src/module.c new file +55 -0

55 lines not on this page · raw message

src/ofono.h +19 -3
index 2e51776b..e289ff08 100644
@@ -28,9 +28,6 @@
 
 void __ofono_exit(void);
 
-int __ofono_manager_init(void);
-void __ofono_manager_cleanup(void);
-
 int __ofono_handsfree_audio_manager_init(void);
 void __ofono_handsfree_audio_manager_cleanup(void);
 
@@ -97,6 +94,25 @@ gboolean __ofono_watchlist_remove_item(struct ofono_watchlist *watchlist,
 					unsigned int id);
 void __ofono_watchlist_free(struct ofono_watchlist *watchlist);
 
+struct ofono_module_desc {
+	const char *name;
+	int (*init)(void);
+	void (*exit)(void);
+} __attribute__((aligned(8)));
+
+#define OFONO_MODULE(name, init, exit)					\
+	_Pragma("GCC diagnostic push")					\
+	_Pragma("GCC diagnostic ignored \"-Wattributes\"")		\
+	static struct ofono_module_desc __ofono_module_ ## name		\
+		__attribute__((used, retain, section("__ofono_module"),	\
+			       aligned(8))) = {				\
+			#name, init, exit				\
+		};							\
+	_Pragma("GCC diagnostic pop")
+
+int __ofono_modules_init(void);
+void __ofono_modules_cleanup(void);
+
 #include <ofono/plugin.h>
 
 int __ofono_plugin_init(const char *pattern, const char *exclude);
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 4/15 doc: docs for intermediate provisioning db format

In reply to Denis Kenzior

Introduce a new provisioning file format to be used by oFono. This format will be an 'intermediate' format, that will be converted to a binary format for use on the actual device. This allows expensive and error prone (not to mention hard to secure) parsing of XML files (such asmobile-broadband-provider-info or Android apns-conf.xml) to be avoided.

JSON was chosen since it is a much more readable format compared to XML.

---
 doc/provision.rst | 139 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 doc/provision.rst
doc/provision.rst new file +139 -0
new file mode 100644
index 00000000..693b38a3
@@ -0,0 +1,139 @@
+Carrier Settings Provisioning Database
+======================================
+
+Carrier settings provisioning is performed automatically whenever a new,
+not previously used SIM card is detected for the first time.  Settings such as
+APN, username, password settings as well as the default bearer settings can be
+provisioned automatically if a matching database entry is found.
+
+Matches are performed based on the following information:
+    * SIM Mobile Country Code (MCC)
+    * SIM Mobile Network Code (MNC)
+    * SIM Service Provider Name (SPN)
+
+The carrier settings provisioning database is represented in JSON format and is
+converted to a binary format at installation time.
+
+JSON Structure
+--------------
+**(List):**
+    List of mobile network provider objects.  Top level element.
+
+    Example:
+    ``[{"name": "Operator XYZ", ...}, {"name": "Operator ZYX", ...}]``
+
+    - **name (String):**
+        The name of the mobile network provider.  This field is a freeform
+        string that identifies the provider.  This field is used purely for
+        human consumption and not used by the provisioning logic.
+
+        This field is `required`.
+
+        Example: "Operator XYZ"
+
+    - **ids (List of Strings):**
+        Unique identifiers associated with the mobile network provider.  This
+        is a list of all MCC+MNC identifiers associated with this provider.
+
+        This field is `required`.
+
+        Example: ``["99955", "99956", "99901", "99902"]``
+
+    - **spn (String):**
+        Service Provider Name associated with the mobile network provider.  This
+        field is typically used to differentiate MVNOs from non-MVNO providers.
+
+        This field is `optional`.
+
+        Example: "ZYX"
+
+    - **apns (List):**
+        List of access points associated with the mobile network provider.  At
+        least one entry must be present in the list.
+
+        This field is `required`.
+
+        - **name (String):**
+            The descriptive name of the access point.  If present, will be
+            reflected in the oFono context name after successful provisioning.
+
+            This field is `optional`.
+
+            Example: "Internet"
+
+        - **apn (String):**
+            Access Point Name - Setting required for successful bearer
+            activation.  Provided by the carrier.
+
+            This field is `required`.
+
+            Example: "internet"
+
+        - **type (List of Strings):**
+            The types of connections supported by the access point.  The
+            following types are recognized:
+
+            - "internet": Used for general internet access.
+            - "mms": Used for Multimedia Messaging Service (MMS).
+            - "wap": Used for Wireless Application Protocol (WAP).
+            - "ims": Used for IP Multimedia Subsystem (IMS).
+            - "supl": Used for Secure User Plane Location (SUPL).
+            - "ia": Used for Initial Attach in LTE networks.
+
+            This field is `required`.
+
+            Example: ``["internet", "mms"]``
+
+        - **authentication (String):**
+            Authentication method used for the connection.  The following types
+            are recognized:
+
+            - "chap": CHAP authentication
+            - "pap": PAP authentication
+            - "none": No authentication is used
+
+            This field is `optional`.
+
+            Example: "none"
+
+        - **username (String):**
+            Username used for autenticating to the access point.
+
+            This field is `optional`.
+
+            Example: "username"
+
+        - **password (String):**
+            Password used for autenticating to the access point.
+
+            This field is `optional`.
+
+            Example: "temp123"
+
+        - **protocol (String):**
+            Network protocol used for the connection.  The following types are
+            recognized:
+
+            - "ipv4": IPv4 only
+            - "ipv6": IPv6 only
+            - "ipv4v6": Dual protocol, both IPv4 and IPv6 will be negotiated
+
+            If omitted, then `"ipv4v6"` will be assumed.
+
+            This field is `optional`.
+
+            Example: "ipv4"
+
+        - **mmsc (String):**
+            Multimedia Messaging Service Center - URL for MMS.
+
+            This field is `required` for MMS contexts.
+
+            Example: "foobar.mmsc:80"
+
+        - **mmsproxy (String):**
+            Proxy server for Multimedia Messaging Service (MMS).
+
+            This field is `optional`.
+
+            Example: "mms.proxy.net"
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 5/15 tools: Add provision.py

In reply to Denis Kenzior

Introduce a new tool that will convert the intermediate JSON format (documented in doc/provision.rst) to the binary provisioning format, which will be used by ofonod's default provisioning plugin for automatically setting up carrier specific settings.

The tool also supports import of and conversion of 'mobile-broadband-provider-info' XML files to the new intermediate JSON file format. This is accomplished using:
% tools/provisiontool mbpi-convert --outfile=provision.json

Conversion of JSON intermediate format to binary format is accomplished using:
% tools/provisiontool generate --infile=provision.json

By default, the output will be placed in the same directory in the file 'provision.db'. Alternatively, the output file can be specified using the --outfile option.

Finally, the tool supports a simple selftest method, which can be invoked as follows:
% tools/provisiontool selftest

---
 tools/provisiontool | 727 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 727 insertions(+)
 create mode 100755 tools/provisiontool

v2
- Changed the name to tools/provisiontool instead of tools/provision.py

tools/provisiontool new file +727 -0
new file mode 100755
index 00000000..79273277
@@ -0,0 +1,727 @@
+#!/usr/bin/python3
+#
+# oFono - Open Source Telephony
+# Copyright (C) 2023  Cruise, LLC
+#
+# SPDX-License-Identifier: GPL-2.0-only
+import xml.etree.ElementTree as ET
+import sys
+import json
+import bisect
+from argparse import ArgumentParser, FileType
+from pathlib import Path
+import random
+import struct
+import ctypes
+
+class ProviderInfo:
+    sort_order_map = { v : pos for pos, v in
+                      enumerate( ['name',
+                                  'apn',
+                                  'type',
+                                  'protocol',
+                                  'mmsc',
+                                  'mmsproxy',
+                                  'authentication',
+                                  'username',
+                                  'password'] ) }
+
+    @classmethod
+    def rawimport(cls, entry):
+        if 'name' not in entry:
+            raise SystemExit('No name for entry: ' + str(entry))
+
+        info = ProviderInfo(entry['name'])
+
+        for networkid in entry.get('ids', []):
+            if not info.add_id(networkid):
+                raise SystemExit('Invalid network id: ' + str(networkid))
+
+        if 'spn' in entry:
+            if not info.set_spn(entry['spn']):
+                raise SystemExit('Invalid spn: ' + str(spn))
+
+        for apn in entry.get('apns', []):
+            if not info.add_context(apn):
+                raise SystemExit('Invalid apn: ' + str(apn))
+
+        if not info.is_valid():
+            raise SystemExit('Invalid entry: ' + str(entry))
+
+        return info
+
+    def __init__(self, name):
+        self.context_list = []
+        self.mccmnc_list = []
+        self.name = name
+        self.spn = None
+
+    @staticmethod
+    def is_valid_id(id_string, expected_lengths):
+        """
+        Check if the identifier string is valid.
+
+        Parameters:
+        - id_string: The id string to check.
+        - expected_lengths (tuple): A tuple representing the valid range of
+          lengths.
+
+        Returns:
+        - bool: True if the MCC string is valid, False otherwise.
+        """
+        if not id_string.isdigit():
+            return False
+
+        if len(id_string) not in expected_lengths:
+            return False
+
+        if int(id_string) == 0:
+            return False
+
+        return True
+
+    def add_mccmnc(self, mcc, mnc):
+        if not self.is_valid_id(mcc, (3,)) or not self.is_valid_id(mnc, (2, 3)):
+            return False
+
+        bisect.insort(self.mccmnc_list, mcc + mnc)
+        return True
+
+    def add_id(self, mccmnc):
+        if not self.is_valid_id(mccmnc, (5,6)):
+            return False
+
+        if int(mccmnc[:3]) == 0 or int(mccmnc[3:]) == 0:
+            return False
+
+        bisect.insort(self.mccmnc_list, mccmnc)
+        return True
+
+    def set_spn(self, spn):
+        if len(spn) == 0 or len(spn) > 254:
+            return False
+
+        self.spn = spn
+        return True
+
+    def add_context(self, info):
+        info = dict(sorted(info.items(),
+                      key = lambda pair: self.sort_order_map[pair[0]]))
+        self.context_list.append(info)
+
+        return True
+
+    def is_valid(self):
+        return len(self.context_list) and len(self.mccmnc_list)
+
+    def __str__(self):
+        s = 'Provider \'' + self.name + '\''
+
+        if (self.spn != None):
+            s += ' [SPN:\'' + self.spn + '\']'
+
+        s+= ' ' + str(self.mccmnc_list) + '\n'
+
+        for context in self.context_list:
+            s += '\t' + str(context) + '\n'
+
+        return s
+
+class MobileBroadbandProviderInfo:
+    usage_to_type = { 'internet' : ['internet'],
+                        'mms' : ['mms'],
+                        'wap' : ['wap'],
+                        'mms-internet-hipri' : ['internet', 'mms'],
+                        'mms-internet-hipri-fota' : ['internet','mms'],
+                     }
+    @classmethod
+    def type_from_usage(cls, usage):
+        return cls.usage_to_type[usage]
+
+    def __init__(self, xml_path):
+        self.tree = ET.parse(xml_path)
+
+    def parse(self, xml_path):
+        providers = []
+
+        try:
+            tree = ET.parse(xml_path)
+            root = tree.getroot()
+
+            for provider in root.findall('.//provider'):
+                name = provider.find('name')
+                if name is None or not name.text:
+                    continue;
+
+                info = ProviderInfo(name.text)
+
+                for networkid in provider.findall('gsm/network-id'):
+                    info.add_mccmnc(networkid.get('mcc'), networkid.get('mnc'))
+
+                for apn in provider.findall('gsm/apn'):
+                    context = {}
+
+                    context['apn'] = apn.get('value')
+                    if context['apn'] == None:
+                        continue
+
+                    # Usage is missing for some APNs, skip such contexts for now
+                    usage = apn.find('usage')
+                    if usage is None or usage.get('type') is None:
+                        continue;
+
+                    context['type'] = self.type_from_usage(usage.get('type'))
+                    if context['type'] == None:
+                        sys.stderr.write("Unable to convert type: %s\n" %
+                                            usage.get('type'))
+                        continue
+
+                    if 'mms' in context['type']:
+                        mmsc = apn.find('mmsc')
+
+                        # Ignore MMS contexts with no MMSC since it is needed
+                        # to send messages
+                        if mmsc is None or not mmsc.text:
+                            continue
+
+                        context['mmsc'] = mmsc.text
+
+                        mmsproxy = apn.find('mmsproxy')
+                        if mmsproxy is not None and mmsproxy.text:
+                            context['mmsproxy'] = mmsproxy.text
+
+                    username = apn.find('username')
+                    if username is not None and username.text:
+                        context['username'] = username.text
+
+                    password = apn.find('password')
+                    if password is not None and password.text:
+                        context['password'] = password.text
+
+                    authentication = apn.find('authentication')
+                    if authentication is not None:
+                        context['authentication'] = authentication.get('method')
+
+                    context_name = apn.find('name')
+                    if context_name != None:
+                        context['name'] = context_name.text
+
+                    info.add_context(context)
+
+                if info.is_valid():
+                    providers.append(info)
+
+        except ET.ParseError as e:
+            print(f"Error parsing XML: {e}")
+
+        return providers
+
+class ProvisionContext(ctypes.LittleEndianStructure):
+    _pack_ = 1
+    _fields_ = [
+        ('type', ctypes.c_uint32),
+        ('protocol', ctypes.c_uint32),
+        ('authentication', ctypes.c_uint32),
+        ('reserved', ctypes.c_uint32),
+        ('name_offset', ctypes.c_uint64),
+        ('apn_offset', ctypes.c_uint64),
+        ('username_offset', ctypes.c_uint64),
+        ('password_offset', ctypes.c_uint64),
+        ('mmsproxy_offset', ctypes.c_uint64),
+        ('mmsc_offset', ctypes.c_uint64)
+    ]
+
+    authentication_dict = { 'chap' : 0, 'pap' : 1, 'none' : 2 }
+    protocol_dict = { 'ipv4' : 0, 'ipv6' : 1, 'ipv4v6' : 2 }
+    attrs = ['name', 'apn', 'username', 'password', 'mmsproxy', 'mmsc']
+
+    @classmethod
+    def type_to_context_type(cls, types):
+        r = 0
+
+        for t in types:
+            if t == 'internet':
+                r |= 0x0001
+            elif t == 'mms':
+                r |= 0x0002
+            elif t == 'wap':
+                r |= 0x0004
+            elif t == 'ims':
+                r |= 0x0008
+            elif t == 'supl':
+                r |= 0x0010
+            elif t == 'ia':
+                r |= 0x0020
+
+        return r
+
+    def __init__(self, apn, strings):
+        self.type = self.type_to_context_type(apn['type'])
+        self.protocol = self.protocol_dict[apn.get('protocol', 'ipv4v6')]
+        self.authentication = self.authentication_dict[apn.get('authentication',
+                                                               'chap')]
+
+        for s in self.attrs:
+            offset = strings.add_string(apn.get(s, None))
+            setattr(self, s + '_offset', offset)
+
+class ProvisionData(ctypes.LittleEndianStructure):
+    _pack_ = 1
+    _fields_ = [
+        ('spn_offset', ctypes.c_uint64),
+        ('context_offset', ctypes.c_uint64)
+    ]
+
+    def __init__(self, spn, offset, strings):
+        self.spn_offset = strings.add_string(spn)
+        self.context_offset = offset
+
+class ProvisionNode(ctypes.LittleEndianStructure):
+    _pack_ = 1
+    _fields_ = [
+        ('bit_offsets', ctypes.c_uint64 * 2),
+        ('mccmnc', ctypes.c_uint32),
+        ('diff', ctypes.c_int32),
+        ('provision_data_count', ctypes.c_uint64)
+    ]
+
+    style = "bold"
+    fmt_connection = '\t"%s/%d" -> "%s/%d"[color="#%06x"];\n'
+    fmt_declaration = '\t"%s/%d"[style=%s, color="#%06x"];\n'
+    red = 0xff0000
+    green = 0x00ff00
+
+    def __init__(self, key, diff):
+        self.bit = [None, None]
+        self.key = key
+        self.diff = diff
+        self.entries = {}
+        self.node_offset = 0
+
+    def choose(self, key):
+        return (key >> (31 - self.diff)) & 1
+
+    def print_graphviz(self, f):
+        f.write(self.fmt_declaration % (format(self.key, '032b'),
+                                        self.diff, self.style,
+                                        random.randint(0, 0x00ffffff)))
+        f.write(self.fmt_connection % (format(self.key, '032b'), self.diff,
+                                       format(self.bit[0].key, '032b'),
+                                       self.bit[0].diff, self.red))
+        f.write(self.fmt_connection % (format(self.key, '032b'), self.diff,
+                                       format(self.bit[1].key, '032b'),
+                                       self.bit[1].diff, self.green))
+
+        if (self.diff < self.bit[0].diff):
+            self.bit[0].print_graphviz(f)
+
+        if (self.diff < self.bit[1].diff):
+            self.bit[1].print_graphviz(f)
+
+    def __str__(self):
+        s = format(self.key, '032b') + '/' + str(self.diff)
+        return s
+
+class MccMncTree:
+    @staticmethod
+    def clz(v):
+        count = 32
+        while count and v:
+            v = v >> 1
+            count = count - 1
+
+        return count
+
+    @staticmethod
+    def diff(key1, key2):
+        xor = key1 ^ key2;
+        return MccMncTree.clz(xor)
+
+    def __init__(self):
+        self.root = ProvisionNode(key = 0, diff = -1)
+        self.root.bit[0] = self.root
+        self.root.bit[1] = self.root
+        self.n_nodes = 1
+
+    def print_graphviz(self):
+        f = open("step%d.dot" % self.n_nodes, "w")
+        # Use 'dot -Tx11' to visualize
+        f.write('digraph trie {\n')
+        self.root.print_graphviz(f)
+        f.write('}\n')
+        f.close()
+
+    def find_closest(self, key):
+        parent = self.root
+        child = self.root.bit[0]
+
+        while parent.diff < child.diff:
+            parent = child
+            child = child.bit[child.choose(key)]
+
+        return child
+
+    def find(self, key):
+        found = self.find_closest(key)
+        if found.key == key:
+            return found
+
+        return None
+
+    def insert(self, key, attr, value):
+        node = self.find_closest(key);
+        if node.key == key:
+            node.entries[attr] = value
+            return
+
+        bit = self.diff(node.key, key)
+        parent = self.root
+        child = self.root.bit[0]
+
+        while (parent.diff < child.diff) and (child.diff < bit):
+            parent = child
+            child = child.bit[child.choose(key)]
+
+        node = ProvisionNode(key, bit)
+        bit = node.choose(key)
+        node.bit[bit] = node
+        node.bit[not bit] = child
+
+        node.entries[attr] = value
+
+        if parent == self.root:
+            self.root.bit[0] = node
+        else:
+            bit = parent.choose(key)
+            parent.bit[bit] = node
+
+        self.n_nodes += 1
+
+    def traverse_recursive(self, node, bit, visitor):
+        if node == self.root:
+            return
+
+        if node.diff <= bit:
+            visitor.visit(node)
+            return
+
+        self.traverse_recursive(node.bit[0], node.diff, visitor)
+        self.traverse_recursive(node.bit[1], node.diff, visitor)
+
+    def traverse(self, visitor):
+        self.traverse_recursive(self.root.bit[0], -1, visitor)
+
+class StringAccumulator:
+    def __init__(self):
+        self.data = bytearray(b'\x00') # So offsets are never 0 used for NULL
+        self.offsets = {}
+
+    def add_string(self, s):
+        if s is None:
+            return 0
+
+        if s in self.offsets:
+            return self.offsets[s]
+
+        offset = len(self.data)
+        self.data.extend(s.encode('utf-8'))
+        self.data.append(0)
+        self.offsets[s] = offset
+
+        return offset
+
+    def get_bytes(self):
+        return self.data
+
+class ProvisionDatabase(ctypes.LittleEndianStructure):
+    _pack_ = 1
+    _fields_ = [
+        ('version', ctypes.c_uint64),
+        ('file_size', ctypes.c_uint64),
+        ('header_size', ctypes.c_uint64),
+        ('node_struct_size', ctypes.c_uint64),
+        ('provision_data_struct_size', ctypes.c_uint64),
+        ('context_struct_size', ctypes.c_uint64),
+        ('nodes_offset', ctypes.c_uint64),
+        ('nodes_size', ctypes.c_uint64),
+        ('contexts_offset', ctypes.c_uint64),
+        ('contexts_size', ctypes.c_uint64),
+        ('strings_offset', ctypes.c_uint64),
+        ('strings_size', ctypes.c_uint64)
+    ]
+
+    class CalculateNodeOffsetVisitor:
+        def __init__(self):
+            self.current_offset = 0
+        def visit(self, node):
+            node.node_offset = self.current_offset
+
+            # Node data is followed by at least one ProvisionData object, with
+            # the only exception being root, which has no data by definition
+            self.current_offset += ctypes.sizeof(ProvisionNode)
+            self.current_offset += (ctypes.sizeof(ProvisionData) *
+                                    len(node.entries))
+
+    class SerializeVisitor:
+        def __init__(self, buffer):
+            self.buffer = buffer
+
+        def visit(self, node):
+            # Node doesn't quite fit the C structure definition, so do this
+            # manually by using struct.pack
+            self.buffer.extend(struct.pack('<QQIiQ',
+                                           node.bit[0].node_offset,
+                                           node.bit[1].node_offset,
+                                           node.key, node.diff,
+                                           len(node.entries)))
+
+            for spn in sorted(node.entries):
+                pd = node.entries[spn]
+                self.buffer.extend(bytes(pd))
+
+    def __init__(self, provider_infos):
+        self.strings = StringAccumulator()
+        self.contexts = bytearray()
+        self.tree = MccMncTree()
+
+        for info in provider_infos:
+            pd = ProvisionData(info.spn, len(self.contexts), self.strings)
+
+            self.contexts.extend(struct.pack('<Q', len(info.context_list)))
+
+            for context in info.context_list:
+                self.contexts.extend(bytes(ProvisionContext(context,
+                                                            self.strings)))
+
+            for mccmnc in info.mccmnc_list:
+                # Sort None spns as '' so they're first in the list when
+                # the SerializeVisitor sorts the entries dict
+                spn = info.spn if info.spn is not None else ''
+
+                # 2 and 3 byte MNCs are treated differently, even if evaluate
+                # to the same integer.  For example, 02 and 002 are different
+                # MNCs.  In practice this doesn't actually happen except on
+                # test networks, but account for this possibility by using the
+                # upper 10 bits for the MCC, followed by a single bit which
+                # signifies whether a 3 byte MNC is used, followed by 10 bits
+                # of the MNC
+                key = int(mccmnc[:3]) << 11 | int(mccmnc[3:])
+                if len(mccmnc[3:]) == 3:
+                    key |= 1 << 10
+
+                self.tree.insert(key, spn, pd)
+
+        visitor = self.CalculateNodeOffsetVisitor()
+        visitor.visit(self.tree.root)
+        self.tree.traverse(visitor)
+
+        self.version = 1
+        self.header_size = ctypes.sizeof(ProvisionDatabase)
+        self.file_size = self.header_size
+        self.node_struct_size = ctypes.sizeof(ProvisionNode)
+        self.provision_data_struct_size = ctypes.sizeof(ProvisionData)
+        self.context_struct_size = ctypes.sizeof(ProvisionContext)
+        self.nodes_offset = self.header_size
+        self.nodes_size = visitor.current_offset
+        self.file_size += self.nodes_size
+        self.contexts_offset = self.nodes_offset + self.nodes_size
+        self.contexts_size = len(self.contexts)
+        self.file_size += self.contexts_size
+        self.strings_offset = self.contexts_offset + self.contexts_size
+        self.strings_size = len(self.strings.get_bytes())
+        self.file_size += self.strings_size
+
+    def serialize(self):
+        buffer = bytearray()
+        buffer.extend(bytes(self))
+
+        visitor = self.SerializeVisitor(buffer)
+        visitor.visit(self.tree.root)
+        self.tree.traverse(visitor)
+
+        buffer.extend(self.contexts)
+        buffer.extend(self.strings.get_bytes())
+
+        return buffer
+
+class ProviderInfoJSONEncoder(json.JSONEncoder):
+    def default(self, obj):
+        if isinstance(obj, ProviderInfo):
+            asdict = { 'name' : obj.name, 'ids' : obj.mccmnc_list }
+
+            if (obj.spn != None):
+                asdict['spn'] = obj.spn
+
+            asdict.update({'apns' : obj.context_list})
+            return asdict
+
+        return json.JSONEncoder.default(self, obj)
+
+def mbpi_convert(args):
+    xml_path = '/usr/share/mobile-broadband-provider-info/serviceproviders.xml'
+    mbpi = MobileBroadbandProviderInfo(xml_path)
+    provider_infos = mbpi.parse(xml_path)
+
+    try:
+        if args.outfile is None:
+            out = sys.stdout
+        else:
+            out = args.outfile.open('w', encoding='utf-8')
+
+        with out as outfile:
+            json.dump(provider_infos, outfile, ensure_ascii=False, indent=2,
+                      cls=ProviderInfoJSONEncoder)
+    except ValueError as e:
+        raise SystemExit(e)
+
+def generate(args):
+    try:
+        json_dict = json.load(args.infile)
+    except ValueError as e:
+        raise SystemExit(e)
+
+    provider_infos = []
+
+    for entry in json_dict:
+        info = ProviderInfo.rawimport(entry)
+        provider_infos.append(info)
+
+    db = ProvisionDatabase(provider_infos)
+    with args.outfile.open('wb') as outfile:
+        outfile.write(db.serialize())
+
+def selftest(args):
+    tree = MccMncTree()
+
+    # Generate random key this many times and insert it into the tree
+    # There will be some collisions, so count the number of items inserted
+    # Then run the lookup and make sure the same number of items can be found
+    times = 100000
+    for i in range(0, times):
+        key = random.randint(10000, 999999)
+        tree.insert(key, None, None)
+
+    n_inserted = tree.n_nodes
+    print("Created a tree with %d nodes (1 root)" % n_inserted)
+
+    n_found = 0
+    expected_keys = []
+
+    for i in range(10000, 1000000):
+        if tree.find(i):
+            n_found += 1
+            expected_keys.append(i)
+
+    expected_keys = sorted(expected_keys)
+
+    print("Found %d nodes (not including root)" % n_found)
+    assert n_found == n_inserted - 1
+
+    class GetKeysVisitor:
+        def __init__(self):
+            self.keys = []
+
+        def visit(self, node):
+            self.keys.append(node.key)
+
+    visitor = GetKeysVisitor()
+    tree.traverse(visitor)
+    assert visitor.keys == expected_keys
+
+    sample_json = """[
+    {
+      "name": "Operator XYZ",
+      "ids": [
+        "99955", "99956", "99901", "99902"
+      ],
+      "apns": [
+        {
+          "name": "Internet",
+          "apn": "internet",
+          "type": [
+            "internet"
+          ],
+          "authentication": "none",
+          "protocol": "ipv4"
+        },
+        {
+          "name": "IMS+MMS",
+          "apn": "imsmms",
+          "type": [
+            "ims", "mms"
+          ],
+          "mmsc": "foobar.mmsc:80",
+          "mmsproxy": "mms.proxy.net",
+          "authentication": "pap",
+          "protocol": "ipv6"
+        }
+      ]
+    },
+    {
+      "name": "Operator ZYX",
+      "ids": [
+        "99998", "99999", "99901", "99902"
+      ],
+      "spn": "ZYX",
+      "apns": [
+        {
+          "name": "ZYX",
+          "apn": "zyx",
+          "type": [
+            "internet"
+          ],
+          "authentication": "none",
+          "protocol": "ipv4"
+        }
+      ]
+    }
+    ]"""
+    try:
+        json_dict = json.loads(sample_json)
+    except ValueError as e:
+        raise SystemExit(e)
+
+    provider_infos = []
+
+    for entry in json_dict:
+        info = ProviderInfo.rawimport(entry)
+        provider_infos.append(info)
+
+    db = ProvisionDatabase(provider_infos)
+    expected_strings = bytearray(b'\x00Internet\x00internet\x00IMS+MMS\x00' +
+                b'imsmms\x00mms.proxy.net\x00foobar.mmsc:80\x00ZYX\x00zyx\x00')
+    assert(expected_strings == db.strings.get_bytes())
+
+    with open('sample.db', 'wb') as outfile:
+        outfile.write(db.serialize())
+
+if __name__ == "__main__":
+    parser = ArgumentParser(description='Parse command line arguments')
+    subparsers = parser.add_subparsers(title='subcommands', dest='command')
+
+    # mbpi-convert command
+    mbpi_convert_parser = subparsers.add_parser('mbpi-convert',
+                        help='Convert mobile-broadband-provider-info database')
+    mbpi_convert_parser.add_argument('--outfile', type=Path, default=None,
+                        help='Output file path', required=False,)
+    mbpi_convert_parser.set_defaults(func=mbpi_convert)
+
+    # generate command
+    generate_parser = subparsers.add_parser('generate',
+                                            help='Generate binary provider db')
+    generate_parser.add_argument('--outfile', type=Path, default='provision.db',
+                                 help='Output file path', required=False)
+    generate_parser.add_argument('--infile', type=FileType(encoding='utf-8'),
+                                 help='Input JSON db', default=sys.stdin)
+    generate_parser.set_defaults(func=generate)
+
+    # selftest command
+    selftest_parser = subparsers.add_parser('selftest',
+                        help='Run self-tests')
+    selftest_parser.set_defaults(func=selftest)
+
+    args = parser.parse_args()
+    if hasattr(args, 'func'):
+        args.func(args)
+    else:
+        parser.print_help()
Signature · 1 line
2.43.0
#5 lore raw

PATCH v2 6/15 core: Add utilities to read the provisioning db

In reply to Denis Kenzior

Binary provisioning format is based on a patricia trie / crit-bit tree, with each MCC + MNC combination represented by a single node. Each node contains an array of { SPN, offset } pairs, with the offset pointing to the region of memory where the context information resides.

Each node also has two offsets, corresponding to left and right children of the node, as well as the position of the critical bit, based on which the tree is traversed.

All strings are placed in the last section and are nil terminated. Structures are designed with 8-byte alignment and stored in little endian format, which will require no conversion for the vast majority of platforms in use.

---
 Makefile.am       |   3 +-
 src/provisiondb.c | 439 ++++++++++++++++++++++++++++++++++++++++++++++
 src/provisiondb.h |  18 ++
 3 files changed, 459 insertions(+), 1 deletion(-)
 create mode 100644 src/provisiondb.c
 create mode 100644 src/provisiondb.h

v2

- Changed license to LGPL in case the provisiondb code needs to be linked against in other applications.
- Moved provisiondb utilities to the core

Makefile.am +2 -1
index f7b59a47..b3a016cf 100644
@@ -726,7 +726,8 @@ src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
 			src/hfp.h src/siri.c \
 			src/netmon.c src/lte.c src/ims.c \
 			src/netmonagent.c src/netmonagent.h \
-			src/module.c
+			src/module.c \
+			src/provisiondb.h src/provisiondb.c
 
 src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) $(ell_ldadd) \
 			@GLIB_LIBS@ @DBUS_LIBS@ -ldl
src/provisiondb.c new file +439 -0

439 lines not on this page · raw message

src/provisiondb.h new file +18 -0
new file mode 100644
index 00000000..d7381b94
@@ -0,0 +1,18 @@
+/*
+ *  oFono - Open Source Telephony
+ *  Copyright (C) 2023  Cruise, LLC
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+struct ofono_gprs_provision_data;
+struct provision_db;
+
+struct provision_db *provision_db_new(const char *pathname);
+struct provision_db *provision_db_new_default(void);
+void provision_db_free(struct provision_db *pdb);
+
+int provision_db_lookup(struct provision_db *pdb,
+			const char *mcc, const char *mnc, const char *spn,
+			struct ofono_gprs_provision_data **items,
+			size_t *n_items);
Signature · 1 line
2.43.0
#6 lore raw

PATCH v2 7/15 tools: lookup-apn: Use the new provision_db utils

In reply to Denis Kenzior

Migrate lookup-apn tool to use the new provision.db binary file format.

The typical usage is now changed as follows:
% tools/lookup-apn --file=sample.db 999 02

---
 Makefile.am        |   6 +-
 tools/lookup-apn.c | 173 ++++++++++++++++++++++++++-------------------
 2 files changed, 103 insertions(+), 76 deletions(-)
Makefile.am +3 -3
index b3a016cf..3023ed0c 100644
@@ -661,7 +661,6 @@ builtin_sources += plugins/provision.c
 
 builtin_modules += file_provision
 builtin_sources += plugins/file-provision.c
-
 endif
 
 if MAINTAINER_MODE
@@ -1010,8 +1009,9 @@ tools_auto_enable_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
 tools_get_location_SOURCES = tools/get-location.c
 tools_get_location_LDADD = @GLIB_LIBS@ @DBUS_LIBS@
 
-tools_lookup_apn_SOURCES = plugins/mbpi.c plugins/mbpi.h tools/lookup-apn.c
-tools_lookup_apn_LDADD = @GLIB_LIBS@
+tools_lookup_apn_SOURCES = src/provisiondb.h src/provisiondb.c \
+				tools/lookup-apn.c
+tools_lookup_apn_LDADD = $(ell_ldadd)
 
 tools_tty_redirector_SOURCES = tools/tty-redirector.c
 tools_tty_redirector_LDADD = @GLIB_LIBS@
tools/lookup-apn.c +100 -73

215 lines not on this page · raw message

Signature · 1 line
2.43.0
#7 lore raw

PATCH v2 8/15 provision: Import initial JSON db

In reply to Denis Kenzior

This database is based on mobile-broadband-provider-info, which is in the public domain. Import was performed using:
% tools/provisiontool mbpi-convert --outfile=provision.json

---
 provision.json | 15022 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 15022 insertions(+)
 create mode 100644 provision.json
provision.json new file +15022 -0
new file mode 100644
index 00000000..c52d5752
@@ -0,0 +1,15022 @@
+[
+  {
+    "name": "Andorra Telecom (Mobiland)",
+    "ids": [
+      "21303"
+    ],
+    "apns": [
+      {
+        "name": "Mobiland",
+        "apn": "internetand",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Mobiland Click!",
+        "apn": "internetclic",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Andorra Telecom MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.ad/mmsc",
+        "mmsproxy": "192.168.21.50:8080"
+      }
+    ]
+  },
+  {
+    "name": "Etisalat",
+    "ids": [
+      "42402"
+    ],
+    "apns": [
+      {
+        "name": "Etisalat",
+        "apn": "mnet",
+        "type": [
+          "internet"
+        ],
+        "username": "mnet",
+        "password": "mnet"
+      },
+      {
+        "name": "Etisalat 3G",
+        "apn": "etisalat.ae",
+        "type": [
+          "internet"
+        ],
+        "username": "etisalat.ae",
+        "password": "etisalat.ae"
+      },
+      {
+        "name": "etisalat MMS",
+        "apn": "etisalat",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://10.99.52.150/servlets/mms",
+        "mmsproxy": "10.12.0.30:8080"
+      },
+      {
+        "name": "etisalat MMS",
+        "apn": "etisalat",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms/servlets/mms",
+        "mmsproxy": "10.12.0.32:8080"
+      }
+    ]
+  },
+  {
+    "name": "du",
+    "ids": [
+      "42403"
+    ],
+    "apns": [
+      {
+        "apn": "du",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "du MMS",
+        "apn": "du",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.du.ae",
+        "mmsproxy": "10.19.18.4:8080"
+      }
+    ]
+  },
+  {
+    "name": "AWCC",
+    "ids": [
+      "41201"
+    ],
+    "apns": [
+      {
+        "apn": "internet",
+        "type": [
+          "internet"
+        ],
+        "username": "awcc",
+        "password": "1111"
+      },
+      {
+        "name": "AWCC MMS",
+        "apn": "mms1",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://172.17.81.2:8002",
+        "mmsproxy": "172.17.81.2:8002"
+      }
+    ]
+  },
+  {
+    "name": "Vodafone",
+    "ids": [
+      "27602"
+    ],
+    "apns": [
+      {
+        "name": "TWA",
+        "apn": "Twa",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Vodafone Web",
+        "apn": "vodafoneweb",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Vodafone MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://217.31.233.18:6001/MM1Servlet",
+        "mmsproxy": "217.31.233.18:9401",
+        "username": "vodafone",
+        "password": "vodafone"
+      },
+      {
+        "name": "Vodafone MMS",
+        "apn": "portalnmms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms1.live.vodafone.in/mms/",
+        "mmsproxy": "10.10.1.100:9401"
+      }
+    ]
+  },
+  {
+    "name": "Albania Mobile Communications (AMC)",
+    "ids": [
+      "27601"
+    ],
+    "apns": [
+      {
+        "name": "AMC internet",
+        "apn": "Internet",
+        "type": [
+          "internet"
+        ],
+        "username": "internet"
+      }
+    ]
+  },
+  {
+    "name": "Beeline",
+    "ids": [
+      "28301"
+    ],
+    "apns": [
+      {
+        "apn": "internet.beeline.am",
+        "type": [
+          "internet"
+        ],
+        "username": "internet",
+        "password": "internet"
+      },
+      {
+        "name": "Beeline MMS",
+        "apn": "mms.beeline.ua",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms/",
+        "mmsproxy": "10.11.8.18:8080"
+      },
+      {
+        "name": "Beeline MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms",
+        "mmsproxy": "10.16.70.199:8080",
+        "username": "mms",
+        "password": "mms"
+      }
+    ]
+  },
+  {
+    "name": "Orange",
+    "ids": [
+      "28310"
+    ],
+    "apns": [
+      {
+        "name": "Internet Hima (USB)",
+        "apn": "internet.orange",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Mobile Broadband",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.orange.nl:8002",
+        "mmsproxy": "10.250.255.183:5080"
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "orangemms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.orange.es",
+        "mmsproxy": "wapmms.orange.es:8080",
+        "username": "orange",
+        "password": "orange"
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://192.168.151.3:8002",
+        "mmsproxy": "192.168.151.2:8080"
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "orange.mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.orange.at/mms/wapenc",
+        "mmsproxy": "194.24.128.118:8080",
+        "username": "mms",
+        "password": "mms"
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "orangemms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.orange.co.uk/",
+        "mmsproxy": "192.168.224.10:8080"
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "mms.orange.dk",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.orange.dk:8002",
+        "mmsproxy": "172.18.251.11:8080"
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "mms.orange.md",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms/mms",
+        "mmsproxy": "192.168.127.125:3128"
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "mms.orange.jo",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://172.16.1.96/servlets/mms",
+        "mmsproxy": "172.16.1.2:8080",
+        "username": "mmc",
+        "password": "mmc"
+      },
+      {
+        "name": "Orange MMS",
+        "apn": "orangerun.acte",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.orange.re",
+        "mmsproxy": "192.168.10.200:8080"
+      }
+    ]
+  },
+  {
+    "name": "VivaCell/MTS",
+    "ids": [
+      "28305"
+    ],
+    "apns": [
+      {
+        "name": "MTS connect",
+        "apn": "connect.vivacell.am",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Mobile Broadband",
+        "apn": "inet.vivacell.am",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Karabakh Telecom",
+    "ids": [
+      "28304"
+    ],
+    "apns": [
+      {
+        "name": "KT_MARK",
+        "apn": "connect.kt.am",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Unitel",
+    "ids": [
+      "63102"
+    ],
+    "apns": [
+      {
+        "apn": "internet.unitel.co.ao",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "unitel mms",
+        "apn": "unitel",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http//mms.unitel.com"
+      }
+    ]
+  },
+  {
+    "name": "Personal",
+    "ids": [
+      "72234",
+      "722341"
+    ],
+    "apns": [
+      {
+        "name": "GPRS",
+        "apn": "gprs.personal.com",
+        "type": [
+          "internet"
+        ],
+        "username": "gprs",
+        "password": "adgj"
+      },
+      {
+        "name": "DATOS",
+        "apn": "datos.personal.com",
+        "type": [
+          "internet"
+        ],
+        "username": "datos",
+        "password": "datos"
+      }
+    ]
+  },
+  {
+    "name": "Arnet",
+    "ids": [
+      "722340"
+    ],
+    "apns": [
+      {
+        "apn": "arnet.personal.com",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Personal MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.personal.com/",
+        "mmsproxy": "172.25.7.31:8080",
+        "username": "mms",
+        "password": "mms"
+      },
+      {
+        "name": "MMS Personal",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms",
+        "mmsproxy": "172.16.192.7:8080"
+      }
+    ]
+  },
+  {
+    "name": "Claro",
+    "ids": [
+      "722310",
+      "722320",
+      "722330"
+    ],
+    "apns": [
+      {
+        "name": "3G Internet",
+        "apn": "gprs.claro.com.ar",
+        "type": [
+          "internet"
+        ],
+        "username": "clarogprs",
+        "password": "clarogprs999"
+      },
+      {
+        "name": "GPRS",
+        "apn": "internet.ctimovil.com.ar",
+        "type": [
+          "internet"
+        ],
+        "username": "clarogprs",
+        "password": "clarogprs999"
+      },
+      {
+        "name": "Claro Foto",
+        "apn": "mms.claro.com.br",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.claro.com.br/",
+        "mmsproxy": "200.169.126.10:8799",
+        "username": "claro",
+        "password": "claro"
+      }
+    ]
+  },
+  {
+    "name": "Movistar",
+    "ids": [
+      "722010",
+      "722070"
+    ],
+    "apns": [
+      {
+        "name": "WAP",
+        "apn": "internet.gprs.unifon.com.ar",
+        "type": [
+          "internet"
+        ],
+        "username": "wap",
+        "password": "wap"
+      },
+      {
+        "name": "Internet",
+        "apn": "internet.gprs.unifon.com.ar",
+        "type": [
+          "internet"
+        ],
+        "username": "Internet",
+        "password": "Internet"
+      }
+    ]
+  },
+  {
+    "name": "A1/Telekom Austria",
+    "ids": [
+      "23201"
+    ],
+    "apns": [
+      {
+        "name": "A1 Breitband",
+        "apn": "a1.net",
+        "type": [
+          "internet"
+        ],
+        "username": "[email protected]",
+        "password": "ppp"
+      },
+      {
+        "name": "aon (Flex, Breitband-Duo, BusinessFlex)",
+        "apn": "aon.data",
+        "type": [
+          "internet"
+        ],
+        "username": "[email protected]",
+        "password": "ppp"
+      },
+      {
+        "name": "aonMobile",
+        "apn": "aon.at",
+        "type": [
+          "internet"
+        ],
+        "username": "[email protected]",
+        "password": "ppp"
+      },
+      {
+        "name": "A1MMS",
+        "apn": "free.A1.net",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.A1.net",
+        "mmsproxy": "gateway.A1.net:8001",
+        "username": "[email protected]",
+        "password": "ppp"
+      }
+    ]
+  },
+  {
+    "name": "ABroadband",
+    "ids": [
+      "23201"
+    ],
+    "apns": [
+      {
+        "name": "International Roaming",
+        "apn": "mdata.com",
+        "type": [
+          "internet"
+        ],
+        "username": "[email protected]",
+        "password": "ppp"
+      }
+    ]
+  },
+  {
+    "name": "Bob",
+    "ids": [
+      "23211"
+    ],
+    "apns": [
+      {
+        "apn": "bob.at",
+        "type": [
+          "internet"
+        ],
+        "username": "[email protected]",
+        "password": "ppp"
+      },
+      {
+        "apn": "bob.at",
+        "type": [
+          "internet"
+        ],
+        "username": "[email protected]",
+        "password": "ppp"
+      },
+      {
+        "apn": "mms.bob.at",
+        "type": [
+          "internet"
+        ],
+        "username": "[email protected]",
+        "password": "ppp"
+      },
+      {
+        "name": "data bob MMS",
+        "apn": "mms.bob.at",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.bob.at",
+        "mmsproxy": "194.48.124.7:8001",
+        "username": "[email protected]",
+        "password": "ppp"
+      }
+    ]
+  },
+  {
+    "name": "HoT",
+    "ids": [
+      "23207"
+    ],
+    "apns": [
+      {
+        "apn": "webaut",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "HoT MMS",
+        "apn": "mmsaut",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsaut.at/send",
+        "mmsproxy": "212.95.31.50:80"
+      }
+    ]
+  },
+  {
+    "name": "Lycamobile",
+    "ids": [
+      "23208"
+    ],
+    "apns": [
+      {
+        "apn": "data.lycamobile.at",
+        "type": [
+          "internet"
+        ],
+        "username": "lmat",
+        "password": "plus"
+      }
+    ]
+  },
+  {
+    "name": "T-Mobile",
+    "ids": [
+      "23203"
+    ],
+    "apns": [
+      {
+        "name": "WAP",
+        "apn": "gprswap",
+        "type": [
+          "wap"
+        ],
+        "username": "t-mobile",
+        "password": "tm"
+      },
+      {
+        "name": "Internet",
+        "apn": "gprsinternet",
+        "type": [
+          "internet"
+        ],
+        "username": "t-mobile",
+        "password": "tm"
+      },
+      {
+        "name": "Business Internet",
+        "apn": "business.gprsinternet",
+        "type": [
+          "internet"
+        ],
+        "username": "t-mobile",
+        "password": "tm"
+      },
+      {
+        "name": "T-Mobile MMS",
+        "apn": "general.t-mobile.uk",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.t-mobile.co.uk:8002",
+        "mmsproxy": "149.254.201.135:8080",
+        "username": "user",
+        "password": "wap"
+      },
+      {
+        "name": "MMS",
+        "apn": "wap.voicestream.com",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://216.155.174.84/servlets/mms",
+        "mmsproxy": "216.155.165.50:8080",
+        "username": "nokia",
+        "password": "6600"
+      }
+    ]
+  },
+  {
+    "name": "tele.ring",
+    "ids": [
+      "23207"
+    ],
+    "apns": [
+      {
+        "name": "Ge org:)",
+        "apn": "web",
+        "type": [
+          "internet"
+        ],
+        "username": "[email protected]",
+        "password": "web"
+      },
+      {
+        "name": "tele ring mms",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://relay.mms.telering.at",
+        "mmsproxy": "212.95.31.50:8080",
+        "username": "[email protected]",
+        "password": "wap"
+      }
+    ]
+  },
+  {
+    "name": "Drei (3)",
+    "ids": [
+      "23205",
+      "23210"
+    ],
+    "apns": [
+      {
+        "apn": "drei.at",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "3MMS",
+        "apn": "drei.at",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc",
+        "mmsproxy": "213.94.78.133:8799"
+      },
+      {
+        "name": "3 MMS",
+        "apn": "three.co.uk",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.um.three.co.uk:10021/mmsc",
+        "mmsproxy": "mms.three.co.uk:8799"
+      },
+      {
+        "name": "3MMS",
+        "apn": "mobile.three.com.hk",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.um.three.com.hk:10021/mmsc",
+        "mmsproxy": "172.20.97.116:8799"
+      },
+      {
+        "name": "3 MMS",
+        "apn": "3services",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.three.net.au:10021/mmsc",
+        "mmsproxy": "mmscprox.three.net.au:8799"
+      },
+      {
+        "name": "3mms",
+        "apn": "3mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.three.co.id",
+        "mmsproxy": "10.4.0.10:3128",
+        "username": "3mms",
+        "password": "3mms"
+      }
+    ]
+  },
+  {
+    "name": "Yesss",
+    "ids": [
+      "23212"
+    ],
+    "apns": [
+      {
+        "apn": "web.yesss.at",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "VOLmobil",
+    "ids": [
+      "23203"
+    ],
+    "apns": [
+      {
+        "apn": "volmobil",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "T-Mobile MMS",
+        "apn": "gprsmms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.t-mobile.at/servlets/mms",
+        "mmsproxy": "10.12.0.20:80",
+        "username": "t-mobile",
+        "password": "tm"
+      }
+    ]
+  },
+  {
+    "name": "Aldi Mobile AU",
+    "ids": [
+      "50501"
+    ],
+    "apns": [
+      {
+        "name": "Mobile Data",
+        "apn": "mdata.net.au",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.mdata.net.au:8003",
+        "mmsproxy": "10.1.1.180"
+      }
+    ]
+  },
+  {
+    "name": "Amaysim",
+    "ids": [
+      "50502"
+    ],
+    "apns": [
+      {
+        "name": "Optus MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.optus.com.au:8002/",
+        "mmsproxy": "61.88.190.10:8070"
+      }
+    ]
+  },
+  {
+    "name": "Crazy John's",
+    "ids": [
+      "50503",
+      "50538"
+    ],
+    "apns": [
+      {
+        "name": "Crazy NET",
+        "apn": "purtona.net",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Crazy WAP/MMS",
+        "apn": "purtona.wap",
+        "type": [
+          "wap"
+        ]
+      },
+      {
+        "name": "Crazy MMS",
+        "apn": "purtona.wap",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://purtona.mms/mmssend",
+        "mmsproxy": "10.202.2.20:8080"
+      }
+    ]
+  },
+  {
+    "name": "iiNet",
+    "ids": [
+      "50502"
+    ],
+    "apns": [
+      {
+        "apn": "iinet",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Internode",
+    "ids": [
+      "50502"
+    ],
+    "apns": [
+      {
+        "name": "NodeMobile Data",
+        "apn": "internode",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Old NodeMobile Data (before 2009-08-26)",
+        "apn": "splns333a1",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Lycamobile",
+    "ids": [
+      "50519"
+    ],
+    "apns": [
+      {
+        "apn": "data.lycamobile.com.au",
+        "type": [
+          "internet"
+        ],
+        "username": "lmau",
+        "password": "plus"
+      }
+    ]
+  },
+  {
+    "name": "Optus",
+    "ids": [
+      "50502"
+    ],
+    "apns": [
+      {
+        "name": "Mobile Internet (handsets)",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Optus Yes Internet",
+        "apn": "yesinternet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Wireless Broadband",
+        "apn": "connect",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Post-Paid Mobile Broadband",
+        "apn": "connectcap",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Pre-Paid Mobile Broadband",
+        "apn": "preconnect",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "TPG Mobile",
+    "ids": [
+      "50502"
+    ],
+    "apns": [
+      {
+        "name": "TPG (all except iPhone)",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Telstra",
+    "ids": [
+      "50501"
+    ],
+    "apns": [
+      {
+        "apn": "telstra.wap",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Telstra (3G data pack)",
+        "apn": "telstra.datapack",
+        "type": [
+          "internet"
+        ],
+        "password": "Telstra"
+      },
+      {
+        "name": "Telstra (Next G)",
+        "apn": "telstra.internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Telstra (3G PC pack - pay by time)",
+        "apn": "telstra.pcpack",
+        "type": [
+          "internet"
+        ],
+        "password": "Telstra"
+      },
+      {
+        "name": "Telstra Internet/Wap",
+        "apn": "telstra.iph",
+        "type": [
+          "wap"
+        ]
+      },
+      {
+        "name": "Telstra BigPond",
+        "apn": "telstra.bigpond",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Telstra MMS",
+        "apn": "telstra.mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.telstra.com:8002",
+        "mmsproxy": "10.1.1.180:80"
+      }
+    ]
+  },
+  {
+    "name": "Three",
+    "ids": [
+      "50506"
+    ],
+    "apns": [
+      {
+        "apn": "3netaccess",
+        "type": [
+          "internet"
+        ],
+        "username": "a",
+        "password": "a"
+      },
+      {
+        "name": "Three Prepaid",
+        "apn": "3services",
+        "type": [
+          "internet"
+        ],
+        "username": "a",
+        "password": "a"
+      }
+    ]
+  },
+  {
+    "name": "Virgin Mobile",
+    "ids": [
+      "50502"
+    ],
+    "apns": [
+      {
+        "name": "Mobile Internet",
+        "apn": "VirginInternet",
+        "type": [
+          "internet"
+        ],
+        "username": "guest",
+        "password": "guest"
+      },
+      {
+        "name": "Mobile Broadband",
+        "apn": "VirginBroadband",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Vodafone",
+    "ids": [
+      "50503"
+    ],
+    "apns": [
+      {
+        "name": "Postpaid and some prepaid phone plans",
+        "apn": "vfinternet.au",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Prepaid",
+        "apn": "vfprepaymbb",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Vodafone Internet",
+        "apn": "live.vodafone.com",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Azercell",
+    "ids": [
+      "40001"
+    ],
+    "apns": [
+      {
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Azercell MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.azercell.com/cMMSC/post",
+        "mmsproxy": "10.0.154.101:8080"
+      }
+    ]
+  },
+  {
+    "name": "Bakcell",
+    "ids": [
+      "40002"
+    ],
+    "apns": [
+      {
+        "apn": "mms",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Azerfon",
+    "ids": [
+      "40004"
+    ],
+    "apns": [
+      {
+        "apn": "azerfon",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "BH GSM",
+    "ids": [
+      "21890"
+    ],
+    "apns": [
+      {
+        "name": "BHMobileMMS",
+        "apn": "mms.bhmobile.ba",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.bhmobile.ba/cmmsc/post",
+        "mmsproxy": "195.222.56.41:8080"
+      }
+    ]
+  },
+  {
+    "name": "m:tel",
+    "ids": [
+      "21805"
+    ],
+    "apns": [
+      {
+        "name": "Package 1",
+        "apn": "mtelgprs1",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Package 2",
+        "apn": "mtelgprs2",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Package 3",
+        "apn": "mtelgprs3",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Package 4",
+        "apn": "mtelgprs4",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Prepaid",
+        "apn": "mtelfun",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "mobismms",
+        "apn": "mobismms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.065mobis.com/mms/wapenc",
+        "mmsproxy": "192.168.61.11:80"
+      }
+    ]
+  },
+  {
+    "name": "HT-ERONET",
+    "ids": [
+      "21803"
+    ],
+    "apns": [
+      {
+        "apn": "gprs.eronet.ba",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "ERONET MMS",
+        "apn": "mms.eronet.ba",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.gprs.eronet.ba/mms/wapenc",
+        "mmsproxy": "10.12.3.11:8080"
+      }
+    ]
+  },
+  {
+    "name": "Digicel",
+    "ids": [
+      "342750"
+    ],
+    "apns": [
+      {
+        "apn": "isp.digicelbarbados.com",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Robi (AKTel)",
+    "ids": [
+      "47002"
+    ],
+    "apns": [
+      {
+        "name": "Robi Internet",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Robi Internet",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Robi MMS",
+        "apn": "wap",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://192.168.23.4/was",
+        "mmsproxy": "192.168.23.7:9028"
+      }
+    ]
+  },
+  {
+    "name": "Banglalink",
+    "ids": [
+      "47003"
+    ],
+    "apns": [
+      {
+        "name": "Banglalink Web",
+        "apn": "blweb",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Banglalink Web",
+        "apn": "blweb",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Banglalink MMS",
+        "apn": "blmms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc1:10021/mmsc/01",
+        "mmsproxy": "10.10.55.34:8799"
+      }
+    ]
+  },
+  {
+    "name": "GrameenPhone",
+    "ids": [
+      "47001"
+    ],
+    "apns": [
+      {
+        "name": "GP Internet",
+        "apn": "gpinternet",
+        "type": [
+          "internet"
+        ],
+        "username": "gp",
+        "password": "gp"
+      },
+      {
+        "name": "GP Internet",
+        "apn": "gpinternet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "GP MMS",
+        "apn": "gpmms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.gpsurf.net/servlets/mms",
+        "mmsproxy": "10.128.1.2:8080"
+      }
+    ]
+  },
+  {
+    "name": "Airtel (Warid)",
+    "ids": [
+      "47007"
+    ],
+    "apns": [
+      {
+        "name": "Airtel Internet",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Airtel Internet",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Airtel MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://10.6.0.21/servlets/mms",
+        "mmsproxy": "10.6.0.2:8080"
+      }
+    ]
+  },
+  {
+    "name": "Teletalk",
+    "ids": [
+      "47004"
+    ],
+    "apns": [
+      {
+        "name": "Teletalk Internet",
+        "apn": "wap",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Teletalk MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://10.5.4.22:38090/was",
+        "mmsproxy": "10.5.4.40:8080"
+      }
+    ]
+  },
+  {
+    "name": "Lycamobile",
+    "ids": [
+      "20606"
+    ],
+    "apns": [
+      {
+        "apn": "data.lycamobile.be",
+        "type": [
+          "internet"
+        ],
+        "username": "lmbe",
+        "password": "plus"
+      }
+    ]
+  },
+  {
+    "name": "Mobistar",
+    "ids": [
+      "20610"
+    ],
+    "apns": [
+      {
+        "name": "Business",
+        "apn": "web.pro.be",
+        "type": [
+          "internet"
+        ],
+        "username": "mobistar",
+        "password": "mobistar"
+      },
+      {
+        "name": "Personal",
+        "apn": "internet.be",
+        "type": [
+          "internet"
+        ],
+        "username": "mobistar",
+        "password": "mobistar"
+      },
+      {
+        "name": "Internet Everywhere",
+        "apn": "iew.be",
+        "type": [
+          "internet"
+        ],
+        "username": "mobistar",
+        "password": "mobistar"
+      },
+      {
+        "apn": "mworld.be",
+        "type": [
+          "internet"
+        ],
+        "username": "mobistar",
+        "password": "mobistar"
+      },
+      {
+        "name": "Mobistar MMS",
+        "apn": "mms.be",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.mobistar.be",
+        "mmsproxy": "212.65.63.143:8080"
+      }
+    ]
+  },
+  {
+    "name": "Telenet Mobile",
+    "ids": [
+      "20610"
+    ],
+    "apns": [
+      {
+        "name": "Old Walk & Surf",
+        "apn": "mobile.internet.be",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Walk & Talk",
+        "apn": "telenetwap.be",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Walk & Surf",
+        "apn": "telenetwap.be",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Orange",
+    "ids": [
+      "20610"
+    ],
+    "apns": [
+      {
+        "apn": "orangeinternet",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Proximus",
+    "ids": [
+      "20601"
+    ],
+    "apns": [
+      {
+        "name": "Inter",
+        "apn": "internet.proximus.be",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Intra",
+        "apn": "intraprox.be",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "MMS",
+        "apn": "event.proximus.be",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.proximus.be/mms",
+        "mmsproxy": "10.55.14.75:8080",
+        "username": "mms",
+        "password": "mms"
+      }
+    ]
+  },
+  {
+    "name": "Base",
+    "ids": [
+      "20620"
+    ],
+    "apns": [
+      {
+        "apn": "gprs.base.be",
+        "type": [
+          "internet"
+        ],
+        "username": "base",
+        "password": "base"
+      },
+      {
+        "name": "BASE MMS",
+        "apn": "mms.base.be",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.base.be",
+        "mmsproxy": "217.72.235.1:8080",
+        "username": "base",
+        "password": "base"
+      }
+    ]
+  },
+  {
+    "name": "Mobile Vikings",
+    "ids": [
+      "20620"
+    ],
+    "apns": [
+      {
+        "apn": "web.be",
+        "type": [
+          "internet"
+        ],
+        "username": "web",
+        "password": "web"
+      }
+    ]
+  },
+  {
+    "name": "Airtel 3G",
+    "ids": [
+      "61302"
+    ],
+    "apns": [
+      {
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "GloBul",
+    "ids": [
+      "28405"
+    ],
+    "apns": [
+      {
+        "apn": "internet.globul.bg",
+        "type": [
+          "internet"
+        ],
+        "username": "globul"
+      },
+      {
+        "name": "GLOBUL MMS GPRS",
+        "apn": "mms.globul.bg",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc1.mms.globul.bg:8002",
+        "mmsproxy": "192.168.87.11:8004",
+        "username": "mms"
+      }
+    ]
+  },
+  {
+    "name": "M-Tel",
+    "ids": [
+      "28401"
+    ],
+    "apns": [
+      {
+        "apn": "inet-gprs.mtel.bg",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "MMS M-Tel GPRS",
+        "apn": "mms-gprs.mtel.bg",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc/",
+        "mmsproxy": "10.150.0.33:8080",
+        "username": "mtel",
+        "password": "mtel"
+      }
+    ]
+  },
+  {
+    "name": "Vivacom",
+    "ids": [
+      "28403"
+    ],
+    "apns": [
+      {
+        "name": "Vivacom Internet (Postpaid)",
+        "apn": "internet.vivacom.bg",
+        "type": [
+          "internet"
+        ],
+        "username": "vivacom",
+        "password": "vivacom"
+      },
+      {
+        "name": "Vivatel (old)",
+        "apn": "internet.vivatel.bg",
+        "type": [
+          "internet"
+        ],
+        "username": "vivatel",
+        "password": "vivatel"
+      },
+      {
+        "name": "vivacom MMS",
+        "apn": "mms.vivacom.bg",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.vivacom.bg",
+        "mmsproxy": "192.168.123.123:8080",
+        "username": "mms",
+        "password": "mms"
+      }
+    ]
+  },
+  {
+    "name": "Batelco",
+    "ids": [
+      "42601"
+    ],
+    "apns": [
+      {
+        "name": "oNet",
+        "apn": "internet.batelco.com",
+        "type": [
+          "internet"
+        ],
+        "username": "wap",
+        "password": "wap"
+      },
+      {
+        "name": "Batelco MMS",
+        "apn": "mms.batelco.com",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://192.168.36.10/servlets/mms",
+        "mmsproxy": "192.168.1.2:80",
+        "username": "wap",
+        "password": "wap"
+      }
+    ]
+  },
+  {
+    "name": "Zain BH",
+    "ids": [
+      "42602"
+    ],
+    "apns": [
+      {
+        "name": "Internet",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ],
+        "username": "internet",
+        "password": "internet"
+      },
+      {
+        "name": "eGO",
+        "apn": "hsdpa",
+        "type": [
+          "internet"
+        ],
+        "username": "hsdpa",
+        "password": "hsdpa"
+      },
+      {
+        "name": "mms",
+        "apn": "http://172.18.83.129",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://172.18.83.129",
+        "mmsproxy": "172.18.85.34:80",
+        "username": "mms",
+        "password": "mms"
+      }
+    ]
+  },
+  {
+    "name": "STC",
+    "ids": [
+      "42604"
+    ],
+    "apns": [
+      {
+        "name": "Viva",
+        "apn": "viva.bh",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Brasil Telecom",
+    "ids": [
+      "72416"
+    ],
+    "apns": [
+      {
+        "apn": "brt.br",
+        "type": [
+          "internet"
+        ],
+        "username": "BrT",
+        "password": "BrT"
+      },
+      {
+        "name": "BrT MMS",
+        "apn": "mms.brt.br",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.brasiltelecom.com.br/",
+        "mmsproxy": "200.96.8.29:8080",
+        "username": "brt",
+        "password": "brt"
+      }
+    ]
+  },
+  {
+    "name": "Claro",
+    "ids": [
+      "72405"
+    ],
+    "apns": [
+      {
+        "apn": "claro.com.br",
+        "type": [
+          "internet"
+        ],
+        "username": "claro",
+        "password": "claro"
+      },
+      {
+        "name": "3G",
+        "apn": "bandalarga.claro.com.br",
+        "type": [
+          "internet"
+        ],
+        "username": "claro",
+        "password": "claro"
+      }
+    ]
+  },
+  {
+    "name": "CTBC",
+    "ids": [
+      "72407",
+      "72432",
+      "72433",
+      "72434"
+    ],
+    "apns": [
+      {
+        "apn": "ctbc.br",
+        "type": [
+          "internet"
+        ],
+        "username": "ctbc",
+        "password": "1212"
+      },
+      {
+        "name": "CTBC MMS",
+        "apn": "mms.ctbc.br",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.ctbccelular.com.br/was",
+        "mmsproxy": "172.29.7.70:8080",
+        "username": "ctbc",
+        "password": "1212"
+      }
+    ]
+  },
+  {
+    "name": "Oi",
+    "ids": [
+      "72416",
+      "72424",
+      "72431"
+    ],
+    "apns": [
+      {
+        "apn": "gprs.oi.com.br",
+        "type": [
+          "internet"
+        ],
+        "password": "oioioi"
+      },
+      {
+        "name": "WAP",
+        "apn": "wapgprs.oi.com.br",
+        "type": [
+          "wap"
+        ],
+        "username": "oiwap",
+        "password": "oioioi"
+      },
+      {
+        "name": "Oi MMS",
+        "apn": "mmsgprs.oi.com.br",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://200.222.42.204:8002",
+        "mmsproxy": "192.168.10.50:3128",
+        "username": "oimms",
+        "password": "oioioi"
+      }
+    ]
+  },
+  {
+    "name": "TIM",
+    "ids": [
+      "72402",
+      "72403",
+      "72404",
+      "72408"
+    ],
+    "apns": [
+      {
+        "apn": "tim.br",
+        "type": [
+          "internet"
+        ],
+        "username": "tim",
+        "password": "tim"
+      },
+      {
+        "name": "iTIM",
+        "apn": "unico.tim.it",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.tim.it/servlets/mms",
+        "mmsproxy": "213.230.130.89:80"
+      },
+      {
+        "name": "TIM MMS",
+        "apn": "timbrasil.br",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.tim.br",
+        "mmsproxy": "200.179.66.242:8080",
+        "username": "tim",
+        "password": "tim"
+      }
+    ]
+  },
+  {
+    "name": "Vivo",
+    "ids": [
+      "72406",
+      "72410",
+      "72411",
+      "72423"
+    ],
+    "apns": [
+      {
+        "apn": "zap.vivo.com.br",
+        "type": [
+          "internet"
+        ],
+        "username": "vivo",
+        "password": "vivo"
+      },
+      {
+        "name": "Vivo MMS",
+        "apn": "mms.vivo.com.br",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://termnat.vivomms.com.br:8088/mms",
+        "mmsproxy": "200.142.130.104:80",
+        "username": "vivo",
+        "password": "vivo"
+      }
+    ]
+  },
+  {
+    "name": "Aliv",
+    "ids": [
+      "36449"
+    ],
+    "apns": [
+      {
+        "apn": "pda.newcomobile.com",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Batelco",
+    "ids": [
+      "364390"
+    ],
+    "apns": [
+      {
+        "apn": "internet.btcbahamas.com",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "B-Mobile",
+    "ids": [
+      "52802"
+    ],
+    "apns": [
+      {
+        "apn": "bmobilewap",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "B-mobile MMS",
+        "apn": "bmobilemms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.bmobile.com.bn/was",
+        "mmsproxy": "129.9.10.20:6500"
+      }
+    ]
+  },
+  {
+    "name": "DSTCOM",
+    "ids": [
+      "52811"
+    ],
+    "apns": [
+      {
+        "apn": "dst.wap",
+        "type": [
+          "internet"
+        ],
+        "username": "wap",
+        "password": "wap"
+      },
+      {
+        "name": "Movistar MMS",
+        "apn": "mms.movistar.es",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.movistar.com",
+        "mmsproxy": "10.138.255.5:8080",
+        "username": "MOVISTAR@mms",
+        "password": "MOVISTAR"
+      }
+    ]
+  },
+  {
+    "name": "velcom",
+    "ids": [
+      "25701"
+    ],
+    "apns": [
+      {
+        "name": "GPRS WAP",
+        "apn": "wap.velcom.by",
+        "type": [
+          "wap"
+        ],
+        "username": "wap",
+        "password": "wap"
+      },
+      {
+        "name": "GPRS WEB",
+        "apn": "web.velcom.by",
+        "type": [
+          "internet"
+        ],
+        "username": "web",
+        "password": "web"
+      },
+      {
+        "name": "GPRS WEB PLUS",
+        "apn": "plus.velcom.by",
+        "type": [
+          "internet"
+        ],
+        "username": "plus",
+        "password": "plus"
+      },
+      {
+        "name": "GPRS PRIVET",
+        "apn": "privet.velcom.by",
+        "type": [
+          "internet"
+        ],
+        "username": "privet",
+        "password": "privet"
+      },
+      {
+        "name": "WEB BASIC",
+        "apn": "web1.velcom.by",
+        "type": [
+          "internet"
+        ],
+        "username": "web1",
+        "password": "web1"
+      },
+      {
+        "name": "WEB 25",
+        "apn": "web2.velcom.by",
+        "type": [
+          "internet"
+        ],
+        "username": "web2",
+        "password": "web2"
+      },
+      {
+        "name": "WEB 150",
+        "apn": "web3.velcom.by",
+        "type": [
+          "internet"
+        ],
+        "username": "web3",
+        "password": "web3"
+      },
+      {
+        "name": "WEB 500",
+        "apn": "vmi.velcom.by",
+        "type": [
+          "internet"
+        ],
+        "username": "vmi",
+        "password": "vmi"
+      },
+      {
+        "name": "VELCOM MMS",
+        "apn": "mms.velcom.by",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.velcom.by/servlets/mms",
+        "mmsproxy": "10.200.15.15:8080"
+      }
+    ]
+  },
+  {
+    "name": "MTS",
+    "ids": [
+      "25702"
+    ],
+    "apns": [
+      {
+        "apn": "internet.mts.by",
+        "type": [
+          "internet"
+        ],
+        "username": "mts",
+        "password": "mts"
+      },
+      {
+        "name": "MTS MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.mts064.telekom.yu/mms/wapenc",
+        "mmsproxy": "172.17.85.131:8080"
+      },
+      {
+        "name": "MTS MMS",
+        "apn": "mms.mts.ru",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc/",
+        "mmsproxy": "192.168.192.192:9201",
+        "username": "mts",
+        "password": "mts"
+      },
+      {
+        "name": "UMC MMS GPRS",
+        "apn": "mms.umc.ua",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc:8002/",
+        "mmsproxy": "192.168.10.10:8080"
+      },
+      {
+        "name": "MTS MMS",
+        "apn": "sp.mts",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc2.mts.net",
+        "mmsproxy": "209.4.229.90:9401"
+      }
+    ]
+  },
+  {
+    "name": "life:)",
+    "ids": [
+      "25704"
+    ],
+    "apns": [
+      {
+        "apn": "internet.life.com.by",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Mascom Wireless",
+    "ids": [
+      "65201"
+    ],
+    "apns": [
+      {
+        "apn": "internet.mascom",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "life:) MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.life.com.ua/cmmsc/post",
+        "mmsproxy": "212.58.162.230:8080"
+      }
+    ]
+  },
+  {
+    "name": "Orange",
+    "ids": [
+      "65202"
+    ],
+    "apns": [
+      {
+        "apn": "internet.orange.co.bw",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Leo/UCom",
+    "ids": [
+      "64203"
+    ],
+    "apns": [
+      {
+        "apn": "ucnet",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Tempo/Africell",
+    "ids": [
+      "64202"
+    ],
+    "apns": [
+      {
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Mascom MMS",
+        "apn": "mms.mascom",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://192.168.33.50/mms",
+        "mmsproxy": "192.168.33.138:8080"
+      }
+    ]
+  },
+  {
+    "name": "Fido",
+    "ids": [
+      "302370"
+    ],
+    "apns": [
+      {
+        "apn": "ltemobile.apn",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Fido MMS",
+        "apn": "mms.fido.ca",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.fido.ca",
+        "mmsproxy": "mm1.fido.ca:80"
+      }
+    ]
+  },
+  {
+    "name": "Rogers",
+    "ids": [
+      "302720"
+    ],
+    "apns": [
+      {
+        "apn": "internet.com",
+        "type": [
+          "internet"
+        ],
+        "username": "wapuser1",
+        "password": "wap"
+      },
+      {
+        "name": "Rogers Internet",
+        "apn": "ltemobile.apn",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Rogers Tethering",
+        "apn": "ltedata.apn",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Rogers Media",
+        "apn": "media.com",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.gprs.rogers.com",
+        "mmsproxy": "10.128.1.69:80",
+        "username": "media",
+        "password": "mda01"
+      }
+    ]
+  },
+  {
+    "name": "Bell Mobility",
+    "ids": [
+      "302610",
+      "302640",
+      "302651",
+      "302880"
+    ],
+    "apns": [
+      {
+        "name": "Internet",
+        "apn": "inet.bell.ca",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Mobile Web",
+        "apn": "pda.bell.ca",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Mobile Fast Web",
+        "apn": "pda2.bell.ca",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Bell MMS",
+        "apn": "pda.bell.ca",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.bell.ca/mms/wapenc",
+        "mmsproxy": "web.wireless.bell.ca:80"
+      }
+    ]
+  },
+  {
+    "name": "Telus Mobility",
+    "ids": [
+      "302220",
+      "302860",
+      "302880"
+    ],
+    "apns": [
+      {
+        "name": "Internet",
+        "apn": "isp.telus.com",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Internet (with VPN)",
+        "apn": "vpn.telus.com",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Blackberry",
+        "apn": "bb.telus.com",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Mobile Web/Smartphone",
+        "apn": "sp.telus.com",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "TELUS MMS",
+        "apn": "sp.telus.com",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://aliasredirect.net/proxy/mmsc",
+        "mmsproxy": "74.49.0.18:80"
+      }
+    ]
+  },
+  {
+    "name": "SaskTel Mobility",
+    "ids": [
+      "302680",
+      "302750",
+      "302780",
+      "302880"
+    ],
+    "apns": [
+      {
+        "name": "Data Device or Tethering",
+        "apn": "inet.stm.sk.ca",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Vidéotron",
+    "ids": [
+      "302500",
+      "302510"
+    ],
+    "apns": [
+      {
+        "name": "Telephony data",
+        "apn": "media.videotron",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "IHVM",
+        "apn": "ihvm.videotron",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Media",
+        "apn": "media.videotron",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://media.videotron.com",
+        "mmsproxy": "10.208.89.17:8080"
+      }
+    ]
+  },
+  {
+    "name": "Freedom Mobile",
+    "ids": [
+      "302490"
+    ],
+    "apns": [
+      {
+        "name": "Internet",
+        "apn": "internet.freedommobile.ca",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "MMS",
+        "apn": "mms.freedommobile.ca",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.freedommobile.ca",
+        "mmsproxy": "74.115.197.70:8080"
+      }
+    ]
+  },
+  {
+    "name": "Mobilicity",
+    "ids": [
+      "302320"
+    ],
+    "apns": [
+      {
+        "name": "Mobile Web",
+        "apn": "wap.davewireless.com",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Mobile Broadband",
+        "apn": "internet.davewireless.com",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "MoMMS",
+        "apn": "mms.davewireless.com",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.mobilicity.net",
+        "mmsproxy": "10.100.3.4:8080"
+      }
+    ]
+  },
+  {
+    "name": "Public Mobile",
+    "ids": [
+      "302220"
+    ],
+    "apns": [
+      {
+        "name": "Internet",
+        "apn": "sp.mb.com",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Public Mobile MMS",
+        "apn": "sp.mb.com",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://aliasredirect.net/proxy/mb/mmsc",
+        "mmsproxy": "74.49.0.18:80"
+      }
+    ]
+  },
+  {
+    "name": "Vodacom",
+    "ids": [
+      "63001"
+    ],
+    "apns": [
+      {
+        "apn": "vodanet",
+        "type": [
+          "internet"
+        ],
+        "username": "vodalive"
+      },
+      {
+        "name": "Vodalive",
+        "apn": "vodalive",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://172.24.97.1/mmsc",
+        "mmsproxy": "172.24.97.1:3128"
+      }
+    ]
+  },
+  {
+    "name": "Lycamobile",
+    "ids": [
+      "22854"
+    ],
+    "apns": [
+      {
+        "apn": "data.lycamobile.ch",
+        "type": [
+          "internet"
+        ],
+        "username": "lmch",
+        "password": "plus"
+      }
+    ]
+  },
+  {
+    "name": "Salt",
+    "ids": [
+      "22803"
+    ],
+    "apns": [
+      {
+        "name": "Salt World - Prepaid",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Salt Internet - Postpaid",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Salt MMS",
+        "apn": "mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://192.168.151.3:8002",
+        "mmsproxy": "192.168.151.2:8080"
+      }
+    ]
+  },
+  {
+    "name": "Sunrise",
+    "ids": [
+      "22802"
+    ],
+    "apns": [
+      {
+        "apn": "internet",
+        "type": [
+          "internet"
+        ],
+        "username": "internet",
+        "password": "internet"
+      },
+      {
+        "name": "Sunrise MMS",
+        "apn": "mms.sunrise.ch",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mmsc.sunrise.ch",
+        "mmsproxy": "212.35.34.75:8080",
+        "username": "mms",
+        "password": "mms"
+      }
+    ]
+  },
+  {
+    "name": "Swisscom",
+    "ids": [
+      "22801"
+    ],
+    "apns": [
+      {
+        "name": "Swisscom GPRS",
+        "apn": "gprs.swisscom.ch",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Swisscom CAA",
+        "apn": "corporate.swisscom.ch",
+        "type": [
+          "internet"
+        ],
+        "username": "testprofil",
+        "password": "temporary"
+      },
+      {
+        "name": "Swisscom MMS",
+        "apn": "event.swisscom.ch",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "Swisscom MMS",
+        "apn": "event.swisscom.ch",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.natel.ch:8079",
+        "mmsproxy": "192.168.210.2:8080"
+      }
+    ]
+  },
+  {
+    "name": "M-Budget",
+    "ids": [
+      "22801"
+    ],
+    "apns": [
+      {
+        "name": "Migros Data",
+        "apn": "gprs.swisscom.ch",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "MTN",
+    "ids": [
+      "61205"
+    ],
+    "apns": [
+      {
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      },
+      {
+        "name": "MTN MMS",
+        "apn": "fast-mms",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://192.168.97.1/mmsc",
+        "mmsproxy": "192.168.97.1:3130",
+        "username": "mms"
+      },
+      {
+        "name": "MTN-MMS",
+        "apn": "myMTN",
+        "type": [
+          "mms"
+        ],
+        "mmsc": "http://mms.mtn.co.za/mms/wapenc",
+        "mmsproxy": "196.11.240.241:8080",
+        "username": "mtnmms",
+        "password": "mtnmms"
+      }
+    ]
+  },
+  {
+    "name": "Claro Chile",
+    "ids": [
+      "73003"
+    ],
+    "apns": [
+      {
+        "name": "Internet Movil",
+        "apn": "bam.clarochile.cl",
+        "type": [
+          "internet"
+        ],
+        "username": "clarochile",
+        "password": "clarochile"
+      },
+      {
+        "name": "Internet Movil",
+        "apn": "bap.clarochile.cl",
+        "type": [
+          "internet"
+        ],
+        "username": "clarochile",
+        "password": "clarochile"
+      }
+    ]
+  },
+  {
+    "name": "Entel PCS",
+    "ids": [
+      "73001"
+    ],
+    "apns": [
+      {
+        "name": "Banda Ancha Movil",
+        "apn": "imovil.entelpcs.cl",
+        "type": [
+          "internet"
+        ],
+        "username": "entelpcs",
+        "password": "entelpcs"
+      },
+      {
+        "name": "Internet Movil",
+        "apn": "bam.entelpcs.cl",
+        "type": [
+          "internet"
+        ],
+        "username": "entelpcs",
+        "password": "entelpcs"
+      }
+    ]
+  },
+  {
+    "name": "Movistar",
+    "ids": [
+      "73002"
+    ],
+    "apns": [
+      {
+        "name": "Banda Ancha Movil",
+        "apn": "web.tmovil.cl",
+        "type": [
+          "internet"
+        ],
+        "username": "web",
+        "password": "web"
+      },
+      {
+        "name": "Internet Movil",
+        "apn": "wap.tmovil.cl",
+        "type": [
+          "internet"
+        ],
+        "username": "wap",
+        "password": "wap"
+      }
+    ]
+  },
+  {
+    "name": "GTD Movil",
+    "ids": [
+      "73007"
+    ],
+    "apns": [
+      {
+        "name": "Internet Movil",
+        "apn": "web.gtdmovil.cl",
+        "type": [
+          "internet"
+        ],
+        "username": "webgtd",
+        "password": "webgtd"
+      }
+    ]
+  },
+  {
+    "name": "Virgin Mobile",
+    "ids": [
+      "73007"
+    ],
+    "apns": [
+      {
+        "name": "Internet Movil",
+        "apn": "imovil.virginmobile.cl",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "VTR Movil",
+    "ids": [
+      "73008"
+    ],
+    "apns": [
+      {
+        "name": "Internet Movil",
+        "apn": "movil.vtr.com",
+        "type": [
+          "internet"
+        ],
+        "username": "vtrmovil",
+        "password": "vtrmovil"
+      }
+    ]
+  },
+  {
+    "name": "Wom",
+    "ids": [
+      "73009"
+    ],
+    "apns": [
+      {
+        "name": "Internet Movil",
+        "apn": "internet",
+        "type": [
+          "internet"
+        ]
+      }
+    ]
+  },
+  {
+    "name": "Orange",
+    "ids": [
+      "62402"
+    ],
+    "apns": [
+      {
+        "apn": "orangecmgprs",
+        "type": [
+          "internet"
+        ],
+        "username": "orange",
+        "password": "orange"
+      }
+    ]
+  },
+  {
+    "name": "MTN",
+    "ids": [
+      "62401"
+    ],
+    "apns": [
+      {
+        "apn": "INTERNET",
+        "type": [
+          "internet"
+        ],
+        "username": "guest",
+        "password": "guest"
+      }
+    ]
+  },
+  {
+    "name": "China Mobile",
+    "ids": [
+      "46002"
+    ],
+    "apns": [
+      {
+        "name": "WAP",
+        "apn": "cmwap",
+        "type": [
+          "wap"
+        ],
+        "username": "guest",
+        "password": "guest"
+      },
+      {
+        "name": "Internet",
+        "apn": "cmnet",
+        "type": [
+          "internet"
+        ],
+        "username": "guest",
+        "password": "guest"
+      },
+      {
+        "name": "移动彩信",
+        "apn": "cmwap",
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#8 lore raw

PATCH v2 9/15 provision: Add new module

In reply to Denis Kenzior

This module will replace the gprs-provision module. The new provisiondb supercedes all other plugins in capability and there's no desire to maintain the old code any longer.

---
 Makefile.am     |  3 +-
 src/ofono.h     |  5 ++++
 src/provision.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 src/provision.c
Makefile.am +2 -1
index 3023ed0c..cfa05bf7 100644
@@ -726,7 +726,8 @@ src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
 			src/netmon.c src/lte.c src/ims.c \
 			src/netmonagent.c src/netmonagent.h \
 			src/module.c \
-			src/provisiondb.h src/provisiondb.c
+			src/provisiondb.h src/provisiondb.c \
+			src/provision.c
 
 src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) $(ell_ldadd) \
 			@GLIB_LIBS@ @DBUS_LIBS@ -ldl
src/ofono.h +5 -0
index e289ff08..6a8c53a1 100644
@@ -582,6 +582,11 @@ void __ofono_nettime_info_received(struct ofono_modem *modem,
 #include <ofono/sim-auth.h>
 
 #include <ofono/gprs-provision.h>
+bool __ofono_provision_get_settings(const char *mcc,
+				const char *mnc, const char *spn,
+				struct ofono_gprs_provision_data **settings,
+				size_t *count);
+
 ofono_bool_t __ofono_gprs_provision_get_settings(const char *mcc,
 				const char *mnc, const char *spn,
 				struct ofono_gprs_provision_data **settings,
src/provision.c new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
2.43.0
#9 lore raw

PATCH v2 10/15 gprs: Use the new provisioning module

In reply to Denis Kenzior
---
 src/gprs.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
src/gprs.c +16 -7
index 27aeb68c..40642324 100644
@@ -2376,6 +2376,7 @@ static void provision_context(const struct ofono_gprs_provision_data *ap,
 {
 	unsigned int id;
 	struct pri_context *context = NULL;
+	enum ofono_gprs_context_type type;
 
 	/* Sanity check */
 	if (ap == NULL)
@@ -2408,10 +2409,19 @@ static void provision_context(const struct ofono_gprs_provision_data *ap,
 							gprs->last_context_id);
 	else
 		id = l_uintset_find_unused_min(gprs->used_pids);
+
 	if (id > l_uintset_get_max(gprs->used_pids))
 		return;
 
-	context = pri_context_create(gprs, ap->name, ap->type);
+	/*
+	 * Right now oFono is not setup to handle contexts with multiple
+	 * types due to the way the D-Bus API is structured.  This mainly
+	 * affects Internet + MMS contexts.  For now, work around this
+	 * by selecting the primary (lowest bit) context type
+	 */
+	type = 1 << (__builtin_ffs(ap->type) - 1);
+
+	context = pri_context_create(gprs, ap->name, type);
 	if (context == NULL)
 		return;
 
@@ -2429,7 +2439,7 @@ static void provision_context(const struct ofono_gprs_provision_data *ap,
 	strcpy(context->context.apn, ap->apn);
 	context->context.proto = ap->proto;
 
-	if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS) {
+	if (type == OFONO_GPRS_CONTEXT_TYPE_MMS) {
 		if (ap->message_proxy != NULL)
 			strcpy(context->message_proxy, ap->message_proxy);
 
@@ -2454,11 +2464,10 @@ static void provision_contexts(struct ofono_gprs *gprs, const char *mcc,
 				const char *mnc, const char *spn)
 {
 	struct ofono_gprs_provision_data *settings;
-	int count;
-	int i;
+	size_t count;
+	size_t i;
 
-	if (__ofono_gprs_provision_get_settings(mcc, mnc, spn,
-						&settings, &count) == FALSE) {
+	if (!__ofono_provision_get_settings(mcc, mnc, spn, &settings, &count)) {
 		ofono_warn("Provisioning failed");
 		return;
 	}
@@ -2466,7 +2475,7 @@ static void provision_contexts(struct ofono_gprs *gprs, const char *mcc,
 	for (i = 0; i < count; i++)
 		provision_context(&settings[i], gprs);
 
-	__ofono_gprs_provision_free_settings(settings, count);
+	l_free(settings);
 }
 
 static void remove_non_active_context(struct ofono_gprs *gprs,
Signature · 1 line
2.43.0
#10 lore raw

PATCH v2 11/15 plugins: Remove support for file-provision plugin

In reply to Denis Kenzior
---
 Makefile.am              |   3 -
 plugins/file-provision.c | 172 ---------------------------------------
 2 files changed, 175 deletions(-)
 delete mode 100644 plugins/file-provision.c
Makefile.am +0 -3
index cfa05bf7..a7404121 100644
@@ -658,9 +658,6 @@ builtin_sources += plugins/mbpi.h plugins/mbpi.c
 
 builtin_modules += provision
 builtin_sources += plugins/provision.c
-
-builtin_modules += file_provision
-builtin_sources += plugins/file-provision.c
 endif
 
 if MAINTAINER_MODE
plugins/file-provision.c deleted +0 -172

172 lines not on this page · raw message

Signature · 1 line
2.43.0
#11 lore raw

PATCH v2 12/15 plugins: provision: Remove mbpi support

In reply to Denis Kenzior

This is now completely superceded by the provisiondb infrastructure.

---
 Makefile.am         |   7 -
 configure.ac        |  24 ---
 plugins/mbpi.c      | 506 --------------------------------------------
 plugins/mbpi.h      |  27 ---
 plugins/provision.c | 118 -----------
 5 files changed, 682 deletions(-)
 delete mode 100644 plugins/mbpi.c
 delete mode 100644 plugins/mbpi.h
 delete mode 100644 plugins/provision.c
Makefile.am +0 -7
index a7404121..447f2466 100644
@@ -653,13 +653,6 @@ builtin_sources += plugins/upower.c
 endif
 endif
 
-if PROVISION
-builtin_sources += plugins/mbpi.h plugins/mbpi.c
-
-builtin_modules += provision
-builtin_sources += plugins/provision.c
-endif
-
 if MAINTAINER_MODE
 builtin_modules += example_history
 builtin_sources += examples/history.c
configure.ac +0 -24
index 626055ad..d48235b6 100644
@@ -239,30 +239,6 @@ fi
 AM_CONDITIONAL(BLUEZ4, test "${enable_bluetooth}" != "no" && test "${enable_bluez4}" = "yes")
 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
 
-AC_ARG_WITH([provisiondb], AS_HELP_STRING([--with-provisiondb=FILE],
-	[location of provision database]), [path_provisiondb=${withval}])
-
-AC_ARG_ENABLE(provision, AS_HELP_STRING([--disable-provision],
-				[disable provisioning support]),
-					[enable_provision=${enableval}])
-if (test "${enable_provision}" != "no"); then
-	if (test -n "${path_provisiondb}"); then
-		AC_DEFINE_UNQUOTED(PROVIDER_DATABASE, "${path_provisiondb}",
-						[Mobile provider database])
-	else
-		AC_MSG_CHECKING([for mobile-broadband-provider-info])
-		PKG_CHECK_EXISTS(mobile-broadband-provider-info,
-			_PKG_CONFIG(PROVIDER_DATABASE, [variable=database],
-					[mobile-broadband-provider-info])
-			AC_DEFINE_UNQUOTED(PROVIDER_DATABASE,
-						"$pkg_cv_PROVIDER_DATABASE",
-						[Mobile provider database])
-			AC_MSG_RESULT([yes]),
-			AC_MSG_ERROR(Mobile broadband provider database is required))
-	fi
-fi
-AM_CONDITIONAL(PROVISION, test "${enable_provision}" != "no")
-
 AC_ARG_ENABLE(upower, AS_HELP_STRING([--disable-upower],
 			[disable UPower plugin]),
 					[enable_upower=${enableval}])
plugins/mbpi.c deleted +0 -506

506 lines not on this page · raw message

plugins/mbpi.h deleted +0 -27
deleted file mode 100644
index 6d343584..00000000
@@ -1,27 +0,0 @@
-/*
- *
- *  oFono - Open Source Telephony
- *
- *  Copyright (C) 2008-2011  Intel Corporation. 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 version 2 as
- *  published by the Free Software Foundation.
- *
- *  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 St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-const char *mbpi_ap_type(enum ofono_gprs_context_type type);
-
-void mbpi_ap_free(struct ofono_gprs_provision_data *data);
-
-GSList *mbpi_lookup_apn(const char *mcc, const char *mnc,
-			gboolean allow_duplicates, GError **error);
plugins/provision.c deleted +0 -118

118 lines not on this page · raw message

Signature · 1 line
2.43.0
#12 lore raw

PATCH v2 13/15 examples: Remove provision example

In reply to Denis Kenzior
---
 Makefile.am          |   3 --
 examples/provision.c | 101 -------------------------------------------
 2 files changed, 104 deletions(-)
 delete mode 100644 examples/provision.c
Makefile.am +0 -3
index 447f2466..1a97a1f1 100644
@@ -660,9 +660,6 @@ builtin_sources += examples/history.c
 builtin_modules += example_nettime
 builtin_sources += examples/nettime.c
 
-builtin_modules += example_provision
-builtin_sources += examples/provision.c
-
 builtin_modules += example_emulator
 builtin_sources += examples/emulator.c
 
examples/provision.c deleted +0 -101

101 lines not on this page · raw message

Signature · 1 line
2.43.0
#13 lore raw

PATCH v2 14/15 gprs-provision: Remove no longer used atom/driver

In reply to Denis Kenzior
---
 Makefile.am              |   2 +-
 include/gprs-provision.h |  13 -----
 src/gprs-provision.c     | 101 ---------------------------------------
 3 files changed, 1 insertion(+), 115 deletions(-)
 delete mode 100644 src/gprs-provision.c
Makefile.am +1 -1
index 1a97a1f1..15d220f7 100644
@@ -702,7 +702,7 @@ src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
 			src/simfs.c src/simfs.h src/audio-settings.c \
 			src/smsagent.c src/smsagent.h src/ctm.c \
 			src/sim-auth.c \
-			src/message.h src/message.c src/gprs-provision.c \
+			src/message.h src/message.c \
 			src/emulator.c src/location-reporting.c \
 			src/gnss.c \
 			src/gnssagent.c src/gnssagent.h \
include/gprs-provision.h +0 -13
index 75808e66..ac0f5905 100644
@@ -42,19 +42,6 @@ struct ofono_gprs_provision_data {
 	char *message_center;
 };
 
-struct ofono_gprs_provision_driver {
-	const char *name;
-	int priority;
-	int (*get_settings)(const char *mcc, const char *mnc, const char *spn,
-				struct ofono_gprs_provision_data **settings,
-				int *count);
-};
-
-int ofono_gprs_provision_driver_register(
-			const struct ofono_gprs_provision_driver *driver);
-void ofono_gprs_provision_driver_unregister(
-			const struct ofono_gprs_provision_driver *driver);
-
 #ifdef __cplusplus
 }
 #endif
src/gprs-provision.c deleted +0 -101

101 lines not on this page · raw message

Signature · 1 line
2.43.0
#14 lore raw

PATCH v2 15/15 provision: Detect duplicates

In reply to Denis Kenzior

Duplicate contexts can't really be handled without user intervention, in which case it is better to fail provisioning entirely. Most vendors will choose to ship a custom provisioning database to ensure that duplicate contexts do not happen for the supported operators.

---
 src/provision.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
src/provision.c +15 -0
index e419d15c..cd5cf569 100644
@@ -25,6 +25,7 @@ bool __ofono_provision_get_settings(const char *mcc,
 	struct ofono_gprs_provision_data *contexts;
 	int r;
 	size_t i;
+	uint32_t type;
 
 	if (mcc == NULL || strlen(mcc) == 0 || mnc == NULL || strlen(mnc) == 0)
 		return false;
@@ -47,6 +48,20 @@ bool __ofono_provision_get_settings(const char *mcc,
 					ap->message_center);
 	}
 
+	/* Make sure there are no duplicates */
+	for (i = 0, type = 0; i < n_contexts; i++) {
+		struct ofono_gprs_provision_data *ap = contexts + i;
+
+		if (type & ap->type) {
+			ofono_warn("Duplicate detected for %s%s, spn: %s",
+					mcc, mnc, spn);
+			l_free(contexts);
+			return false;
+		}
+
+		type |= ap->type;
+	}
+
 	*count = n_contexts;
 	*settings = contexts;
 
Signature · 1 line
2.43.0
#15 lore raw
In reply to Denis Kenzior
Quoted 4 lines · Denis Kenzior
---
  acinclude.m4 | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

I went ahead and applied this build patch from this series

Regards,
-Denis