All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv10 0/9] Provisioning plugin
@ 2011-10-18 11:04 Oleg Zhurakivskyy
  2011-10-18 11:04 ` [PATCHv10 1/9] mbpi: Minor style tweaks Oleg Zhurakivskyy
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 910 bytes --]

Hello,

Please find corrections to the remaining parts of the provisioning plugin ("Internet Access Provider database" TODO item).

Regards,
Oleg

Oleg Zhurakivskyy (9):
  mbpi: Minor style tweaks
  provision: Add provisioning plugin
  mbpi: Add mbpi_ap_type()
  lookup-apn: Use mbpi_ap_type()
  lookup-apn: Add command line option to control duplicates
  mbpi: Rename mbpi_provision_data_free()
  lookup-apn: Use mbpi_ap_free()
  mbpi: Minor style issues
  lookup-apn: Minor style issues

 Makefile.am         |    7 +++
 configure.ac        |   23 +++++++---
 plugins/mbpi.c      |   68 ++++++++++++++++++-----------
 plugins/mbpi.h      |    4 +-
 plugins/provision.c |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/lookup-apn.c  |   32 ++++++++------
 6 files changed, 204 insertions(+), 48 deletions(-)
 create mode 100644 plugins/provision.c

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCHv10 1/9] mbpi: Minor style tweaks
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
@ 2011-10-18 11:04 ` Oleg Zhurakivskyy
  2011-10-20 17:50   ` Denis Kenzior
  2011-10-18 11:04 ` [PATCHv10 2/9] provision: Add provisioning plugin Oleg Zhurakivskyy
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

---
 plugins/mbpi.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/plugins/mbpi.c b/plugins/mbpi.c
index ecb08eb..c5537d8 100644
--- a/plugins/mbpi.c
+++ b/plugins/mbpi.c
@@ -23,12 +23,13 @@
 #include <config.h>
 #endif
 
-#include <string.h>
-#include <fcntl.h>
+#include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
-#include <sys/types.h>
+
+#include <fcntl.h>
 #include <errno.h>
+#include <string.h>
 #include <unistd.h>
 
 #include <glib.h>
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv10 2/9] provision: Add provisioning plugin
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
  2011-10-18 11:04 ` [PATCHv10 1/9] mbpi: Minor style tweaks Oleg Zhurakivskyy
@ 2011-10-18 11:04 ` Oleg Zhurakivskyy
  2011-10-20 17:51   ` Denis Kenzior
  2011-10-18 11:04 ` [PATCHv10 3/9] mbpi: Add mbpi_ap_type() Oleg Zhurakivskyy
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 5566 bytes --]

---
 Makefile.am         |    7 +++
 configure.ac        |   23 +++++++---
 plugins/provision.c |  117 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 140 insertions(+), 7 deletions(-)
 create mode 100644 plugins/provision.c

diff --git a/Makefile.am b/Makefile.am
index 8771cb2..2704c75 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -381,6 +381,11 @@ builtin_libadd += @BLUEZ_LIBS@
 endif
 endif
 
+if PROVISION
+builtin_modules += provision
+builtin_sources += plugins/mbpi.c plugins/mbpi.h plugins/provision.c
+endif
+
 if MAINTAINER_MODE
 builtin_modules += example_history
 builtin_sources += examples/history.c
@@ -388,8 +393,10 @@ builtin_sources += examples/history.c
 builtin_modules += example_nettime
 builtin_sources += examples/nettime.c
 
+if !PROVISION
 builtin_modules += example_provision
 builtin_sources += examples/provision.c
+endif
 
 builtin_modules += example_emulator
 builtin_sources += examples/emulator.c
diff --git a/configure.ac b/configure.ac
index 5e4d34f..ab8345f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -197,14 +197,23 @@ AC_SUBST(BLUEZ_CFLAGS)
 AC_SUBST(BLUEZ_LIBS)
 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
 
-AC_MSG_CHECKING([for mobile-broadband-provider-info])
-PKG_CHECK_EXISTS(mobile-broadband-provider-info,
-	_PKG_CONFIG(PROVIDER_DATABASE, [variable=database],
+AC_ARG_ENABLE(provision, AC_HELP_STRING([--enable-provision],
+				[enable GPRS context settings provisioning]),
+					[enable_provision=${enableval}])
+if (test "${enable_provision}" == "yes"); then
+	AC_MSG_CHECKING([for mobile-broadband-provider-info])
+	PKG_CHECK_EXISTS(mobile-broadband-provider-info,
+			_PKG_CONFIG(MBPI_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_RESULT([no]))
+		AC_DEFINE_UNQUOTED(MBPI_DATABASE,
+					"$pkg_cv_MBPI_DATABASE",
+					[Provisioning database
+					(mobile-broadband-provider-info
+					package)])
+		AC_MSG_RESULT([yes]),
+		AC_MSG_ERROR(mobile-broadband-provider-info package is required))
+fi
+AM_CONDITIONAL(PROVISION, test "${enable_provision}" == "yes")
 
 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
 			[don't install configuration and data files]),
diff --git a/plugins/provision.c b/plugins/provision.c
new file mode 100644
index 0000000..3adc220
--- /dev/null
+++ b/plugins/provision.c
@@ -0,0 +1,117 @@
+/*
+ *
+ *  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
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+
+#include <glib.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/types.h>
+#include <ofono/log.h>
+#include <ofono/plugin.h>
+#include <ofono/modem.h>
+#include <ofono/gprs-provision.h>
+
+#include "mbpi.h"
+
+static int provision_get_settings(const char *mcc, const char *mnc,
+				const char *spn,
+				struct ofono_gprs_provision_data **settings,
+				int *count)
+{
+	GSList *l;
+	GSList *apns;
+	GError *error = NULL;
+	int ap_count;
+	int i;
+
+	DBG("Provisioning for MCC %s, MNC %s, SPN '%s'", mcc, mnc, spn);
+
+	apns = mbpi_lookup(mcc, mnc, FALSE, &error);
+	if (apns == NULL) {
+		if (error != NULL) {
+			ofono_error("%s", error->message);
+			g_error_free(error);
+		}
+
+		return -ENOENT;
+	}
+
+	ap_count = g_slist_length(apns);
+
+	DBG("Found %d APs", ap_count);
+
+	*settings = g_try_new0(struct ofono_gprs_provision_data, ap_count);
+	if (*settings == NULL) {
+		ofono_error("Provisioning failed: %s", g_strerror(errno));
+
+		for (l = apns; l; l = l->next)
+			mbpi_provision_data_free(l->data);
+
+		g_slist_free(apns);
+
+		return -ENOMEM;
+	}
+
+	*count = ap_count;
+
+	for (l = apns, i = 0; l; l = l->next, i++) {
+		struct ofono_gprs_provision_data *ap = l->data;
+
+		DBG("Name: '%s'", ap->name);
+		DBG("APN: '%s'", ap->apn);
+		DBG("Username: '%s'", ap->username);
+		DBG("Password: '%s'", ap->password);
+
+		memcpy(*settings + i, ap,
+			sizeof(struct ofono_gprs_provision_data));
+
+		g_free(ap);
+	}
+
+	g_slist_free(apns);
+
+	return 0;
+}
+
+static struct ofono_gprs_provision_driver provision_driver = {
+	.name		= "Provisioning",
+	.get_settings	= provision_get_settings
+};
+
+static int provision_init(void)
+{
+	return ofono_gprs_provision_driver_register(&provision_driver);
+}
+
+static void provision_exit(void)
+{
+	ofono_gprs_provision_driver_unregister(&provision_driver);
+}
+
+OFONO_PLUGIN_DEFINE(provision, "Provisioning Plugin", VERSION,
+			OFONO_PLUGIN_PRIORITY_DEFAULT,
+			provision_init, provision_exit)
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv10 3/9] mbpi: Add mbpi_ap_type()
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
  2011-10-18 11:04 ` [PATCHv10 1/9] mbpi: Minor style tweaks Oleg Zhurakivskyy
  2011-10-18 11:04 ` [PATCHv10 2/9] provision: Add provisioning plugin Oleg Zhurakivskyy
@ 2011-10-18 11:04 ` Oleg Zhurakivskyy
  2011-10-20 17:51   ` Denis Kenzior
  2011-10-18 11:05 ` [PATCHv10 4/9] lookup-apn: Use mbpi_ap_type() Oleg Zhurakivskyy
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1729 bytes --]

---
 plugins/mbpi.c      |   15 +++++++++++++++
 plugins/mbpi.h      |    2 ++
 plugins/provision.c |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/plugins/mbpi.c b/plugins/mbpi.c
index c5537d8..7f533bc 100644
--- a/plugins/mbpi.c
+++ b/plugins/mbpi.c
@@ -45,6 +45,8 @@
 
 #include "mbpi.h"
 
+#define _(x) case x: return (#x)
+
 enum MBPI_ERROR {
 	MBPI_ERROR_DUPLICATE,
 };
@@ -57,6 +59,19 @@ struct gsm_data {
 	gboolean allow_duplicates;
 };
 
+const char *mbpi_ap_type(enum ofono_gprs_context_type type)
+{
+	switch (type) {
+		_(OFONO_GPRS_CONTEXT_TYPE_ANY);
+		_(OFONO_GPRS_CONTEXT_TYPE_INTERNET);
+		_(OFONO_GPRS_CONTEXT_TYPE_MMS);
+		_(OFONO_GPRS_CONTEXT_TYPE_WAP);
+		_(OFONO_GPRS_CONTEXT_TYPE_IMS);
+	}
+
+	return "OFONO_GPRS_CONTEXT_TYPE_<UNKNOWN>";
+}
+
 static GQuark mbpi_error_quark(void)
 {
 	return g_quark_from_static_string("ofono-mbpi-error-quark");
diff --git a/plugins/mbpi.h b/plugins/mbpi.h
index fc9f738..5a844d1 100644
--- a/plugins/mbpi.h
+++ b/plugins/mbpi.h
@@ -19,6 +19,8 @@
  *
  */
 
+const char *mbpi_ap_type(enum ofono_gprs_context_type type);
+
 void mbpi_provision_data_free(struct ofono_gprs_provision_data *data);
 
 GSList *mbpi_lookup(const char *mcc, const char *mnc,
diff --git a/plugins/provision.c b/plugins/provision.c
index 3adc220..ca59c6a 100644
--- a/plugins/provision.c
+++ b/plugins/provision.c
@@ -83,6 +83,7 @@ static int provision_get_settings(const char *mcc, const char *mnc,
 
 		DBG("Name: '%s'", ap->name);
 		DBG("APN: '%s'", ap->apn);
+		DBG("Type: %s", mbpi_ap_type(ap->type));
 		DBG("Username: '%s'", ap->username);
 		DBG("Password: '%s'", ap->password);
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv10 4/9] lookup-apn: Use mbpi_ap_type()
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
                   ` (2 preceding siblings ...)
  2011-10-18 11:04 ` [PATCHv10 3/9] mbpi: Add mbpi_ap_type() Oleg Zhurakivskyy
@ 2011-10-18 11:05 ` Oleg Zhurakivskyy
  2011-10-18 11:05 ` [PATCHv10 5/9] lookup-apn: Add command line option to control duplicates Oleg Zhurakivskyy
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]

---
 tools/lookup-apn.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c
index 2fa6b5b..c14cced 100644
--- a/tools/lookup-apn.c
+++ b/tools/lookup-apn.c
@@ -59,6 +59,7 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc)
 		printf("\n");
 		printf("Name: %s\n", apn->name);
 		printf("APN: %s\n", apn->apn);
+		printf("Type: %s\n", mbpi_ap_type(apn->type));
 		printf("Username: %s\n", apn->username);
 		printf("Password: %s\n", apn->password);
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv10 5/9] lookup-apn: Add command line option to control duplicates
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
                   ` (3 preceding siblings ...)
  2011-10-18 11:05 ` [PATCHv10 4/9] lookup-apn: Use mbpi_ap_type() Oleg Zhurakivskyy
@ 2011-10-18 11:05 ` Oleg Zhurakivskyy
  2011-10-18 11:05 ` [PATCHv10 6/9] mbpi: Rename mbpi_provision_data_free() Oleg Zhurakivskyy
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

---
 tools/lookup-apn.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c
index c14cced..83a94bb 100644
--- a/tools/lookup-apn.c
+++ b/tools/lookup-apn.c
@@ -34,7 +34,8 @@
 
 #include "plugins/mbpi.h"
 
-static void lookup_apn(const char *match_mcc, const char *match_mnc)
+static void lookup_apn(const char *match_mcc, const char *match_mnc,
+						gboolean allow_duplicates)
 {
 	GSList *l;
 	GSList *apns;
@@ -42,7 +43,7 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc)
 
 	printf("Searching for info for network: %s%s\n", match_mcc, match_mnc);
 
-	apns = mbpi_lookup(match_mcc, match_mnc, TRUE, &error);
+	apns = mbpi_lookup(match_mcc, match_mnc, allow_duplicates, &error);
 
 	if (apns == NULL) {
 		if (error != NULL) {
@@ -70,10 +71,13 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc)
 }
 
 static gboolean option_version = FALSE;
+static gboolean option_duplicates = FALSE;
 
 static GOptionEntry options[] = {
 	{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
 				"Show version information and exit" },
+	{ "allow-duplicates", 0, 0, G_OPTION_ARG_NONE, &option_duplicates,
+				"Allow duplicate access point types" },
 	{ NULL },
 };
 
@@ -106,7 +110,7 @@ int main(int argc, char **argv)
 		exit(1);
 	}
 
-	lookup_apn(argv[1], argv[2]);
+	lookup_apn(argv[1], argv[2], option_duplicates);
 
 	return 0;
 }
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv10 6/9] mbpi: Rename mbpi_provision_data_free()
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
                   ` (4 preceding siblings ...)
  2011-10-18 11:05 ` [PATCHv10 5/9] lookup-apn: Add command line option to control duplicates Oleg Zhurakivskyy
@ 2011-10-18 11:05 ` Oleg Zhurakivskyy
  2011-10-18 11:05 ` [PATCHv10 7/9] lookup-apn: Use mbpi_ap_free() Oleg Zhurakivskyy
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2330 bytes --]

---
 plugins/mbpi.c      |    8 ++++----
 plugins/mbpi.h      |    2 +-
 plugins/provision.c |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/plugins/mbpi.c b/plugins/mbpi.c
index 7f533bc..5e42287 100644
--- a/plugins/mbpi.c
+++ b/plugins/mbpi.c
@@ -77,7 +77,7 @@ static GQuark mbpi_error_quark(void)
 	return g_quark_from_static_string("ofono-mbpi-error-quark");
 }
 
-void mbpi_provision_data_free(struct ofono_gprs_provision_data *data)
+void mbpi_ap_free(struct ofono_gprs_provision_data *data)
 {
 	g_free(data->name);
 	g_free(data->apn);
@@ -191,7 +191,7 @@ static void apn_error(GMarkupParseContext *context, GError *error,
 	 * be called.  So we always perform cleanup of the allocated
 	 * provision data
 	 */
-	mbpi_provision_data_free(userdata);
+	mbpi_ap_free(userdata);
 }
 
 static const GMarkupParser apn_parser = {
@@ -332,7 +332,7 @@ static void gsm_end(GMarkupParseContext *context, const gchar *element_name,
 						MBPI_ERROR_DUPLICATE,
 						"Duplicate context detected");
 
-			mbpi_provision_data_free(apn);
+			mbpi_ap_free(apn);
 			return;
 		}
 	}
@@ -444,7 +444,7 @@ GSList *mbpi_lookup(const char *mcc, const char *mnc,
 
 	if (mbpi_parse(db, st.st_size, &gsm, error) == FALSE) {
 		for (l = gsm.apns; l; l = l->next)
-			mbpi_provision_data_free(l->data);
+			mbpi_ap_free(l->data);
 
 		g_slist_free(gsm.apns);
 		gsm.apns = NULL;
diff --git a/plugins/mbpi.h b/plugins/mbpi.h
index 5a844d1..42e439b 100644
--- a/plugins/mbpi.h
+++ b/plugins/mbpi.h
@@ -21,7 +21,7 @@
 
 const char *mbpi_ap_type(enum ofono_gprs_context_type type);
 
-void mbpi_provision_data_free(struct ofono_gprs_provision_data *data);
+void mbpi_ap_free(struct ofono_gprs_provision_data *data);
 
 GSList *mbpi_lookup(const char *mcc, const char *mnc,
 			gboolean allow_duplicates, GError **error);
diff --git a/plugins/provision.c b/plugins/provision.c
index ca59c6a..06cba6f 100644
--- a/plugins/provision.c
+++ b/plugins/provision.c
@@ -69,7 +69,7 @@ static int provision_get_settings(const char *mcc, const char *mnc,
 		ofono_error("Provisioning failed: %s", g_strerror(errno));
 
 		for (l = apns; l; l = l->next)
-			mbpi_provision_data_free(l->data);
+			mbpi_ap_free(l->data);
 
 		g_slist_free(apns);
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv10 7/9] lookup-apn: Use mbpi_ap_free()
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
                   ` (5 preceding siblings ...)
  2011-10-18 11:05 ` [PATCHv10 6/9] mbpi: Rename mbpi_provision_data_free() Oleg Zhurakivskyy
@ 2011-10-18 11:05 ` Oleg Zhurakivskyy
  2011-10-18 11:05 ` [PATCHv10 8/9] mbpi: Minor style issues Oleg Zhurakivskyy
  2011-10-18 11:05 ` [PATCHv10 9/9] lookup-apn: " Oleg Zhurakivskyy
  8 siblings, 0 replies; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

---
 tools/lookup-apn.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c
index 83a94bb..f2727d3 100644
--- a/tools/lookup-apn.c
+++ b/tools/lookup-apn.c
@@ -64,7 +64,7 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc,
 		printf("Username: %s\n", apn->username);
 		printf("Password: %s\n", apn->password);
 
-		mbpi_provision_data_free(apn);
+		mbpi_ap_free(apn);
 	}
 
 	g_slist_free(apns);
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv10 8/9] mbpi: Minor style issues
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
                   ` (6 preceding siblings ...)
  2011-10-18 11:05 ` [PATCHv10 7/9] lookup-apn: Use mbpi_ap_free() Oleg Zhurakivskyy
@ 2011-10-18 11:05 ` Oleg Zhurakivskyy
  2011-10-18 11:05 ` [PATCHv10 9/9] lookup-apn: " Oleg Zhurakivskyy
  8 siblings, 0 replies; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3031 bytes --]

---
 plugins/mbpi.c |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/plugins/mbpi.c b/plugins/mbpi.c
index 5e42287..6f77d9a 100644
--- a/plugins/mbpi.c
+++ b/plugins/mbpi.c
@@ -77,16 +77,16 @@ static GQuark mbpi_error_quark(void)
 	return g_quark_from_static_string("ofono-mbpi-error-quark");
 }
 
-void mbpi_ap_free(struct ofono_gprs_provision_data *data)
+void mbpi_ap_free(struct ofono_gprs_provision_data *ap)
 {
-	g_free(data->name);
-	g_free(data->apn);
-	g_free(data->username);
-	g_free(data->password);
-	g_free(data->message_proxy);
-	g_free(data->message_center);
-
-	g_free(data);
+	g_free(ap->name);
+	g_free(ap->apn);
+	g_free(ap->username);
+	g_free(ap->password);
+	g_free(ap->message_proxy);
+	g_free(ap->message_center);
+
+	g_free(ap);
 }
 
 static void mbpi_g_set_error(GMarkupParseContext *context, GError **error,
@@ -250,7 +250,7 @@ static void apn_handler(GMarkupParseContext *context, struct gsm_data *gsm,
 			const gchar **attribute_values,
 			GError **error)
 {
-	struct ofono_gprs_provision_data *pd;
+	struct ofono_gprs_provision_data *ap;
 	const char *apn;
 	int i;
 
@@ -274,12 +274,12 @@ static void apn_handler(GMarkupParseContext *context, struct gsm_data *gsm,
 		return;
 	}
 
-	pd = g_new0(struct ofono_gprs_provision_data, 1);
-	pd->apn = g_strdup(apn);
-	pd->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
-	pd->proto = OFONO_GPRS_PROTO_IP;
+	ap = g_new0(struct ofono_gprs_provision_data, 1);
+	ap->apn = g_strdup(apn);
+	ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
+	ap->proto = OFONO_GPRS_PROTO_IP;
 
-	g_markup_parse_context_push(context, &apn_parser, pd);
+	g_markup_parse_context_push(context, &apn_parser, ap);
 }
 
 static void gsm_start(GMarkupParseContext *context, const gchar *element_name,
@@ -308,15 +308,15 @@ static void gsm_end(GMarkupParseContext *context, const gchar *element_name,
 			gpointer userdata, GError **error)
 {
 	struct gsm_data *gsm;
-	struct ofono_gprs_provision_data *apn;
+	struct ofono_gprs_provision_data *ap;
 
 	if (!g_str_equal(element_name, "apn"))
 		return;
 
 	gsm = userdata;
 
-	apn = g_markup_parse_context_pop(context);
-	if (apn == NULL)
+	ap = g_markup_parse_context_pop(context);
+	if (ap == NULL)
 		return;
 
 	if (gsm->allow_duplicates == FALSE) {
@@ -325,19 +325,19 @@ static void gsm_end(GMarkupParseContext *context, const gchar *element_name,
 		for (l = gsm->apns; l; l = l->next) {
 			struct ofono_gprs_provision_data *pd = l->data;
 
-			if (pd->type != apn->type)
+			if (pd->type != ap->type)
 				continue;
 
 			mbpi_g_set_error(context, error, mbpi_error_quark(),
 						MBPI_ERROR_DUPLICATE,
 						"Duplicate context detected");
 
-			mbpi_ap_free(apn);
+			mbpi_ap_free(ap);
 			return;
 		}
 	}
 
-	gsm->apns = g_slist_append(gsm->apns, apn);
+	gsm->apns = g_slist_append(gsm->apns, ap);
 }
 
 static const GMarkupParser gsm_parser = {
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv10 9/9] lookup-apn: Minor style issues
  2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
                   ` (7 preceding siblings ...)
  2011-10-18 11:05 ` [PATCHv10 8/9] mbpi: Minor style issues Oleg Zhurakivskyy
@ 2011-10-18 11:05 ` Oleg Zhurakivskyy
  8 siblings, 0 replies; 13+ messages in thread
From: Oleg Zhurakivskyy @ 2011-10-18 11:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1860 bytes --]

---
 tools/lookup-apn.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c
index f2727d3..b833b6c 100644
--- a/tools/lookup-apn.c
+++ b/tools/lookup-apn.c
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
 #include <stdlib.h>
 
 #include <glib.h>
@@ -41,7 +40,7 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc,
 	GSList *apns;
 	GError *error = NULL;
 
-	printf("Searching for info for network: %s%s\n", match_mcc, match_mnc);
+	g_print("Searching for info for network: %s%s\n", match_mcc, match_mnc);
 
 	apns = mbpi_lookup(match_mcc, match_mnc, allow_duplicates, &error);
 
@@ -55,16 +54,16 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc,
 	}
 
 	for (l = apns; l; l = l->next) {
-		struct ofono_gprs_provision_data *apn = l->data;
+		struct ofono_gprs_provision_data *ap = l->data;
 
-		printf("\n");
-		printf("Name: %s\n", apn->name);
-		printf("APN: %s\n", apn->apn);
-		printf("Type: %s\n", mbpi_ap_type(apn->type));
-		printf("Username: %s\n", apn->username);
-		printf("Password: %s\n", apn->password);
+		g_print("\n");
+		g_print("Name: %s\n", ap->name);
+		g_print("APN: %s\n", ap->apn);
+		g_print("Type: %s\n", mbpi_ap_type(ap->type));
+		g_print("Username: %s\n", ap->username);
+		g_print("Password: %s\n", ap->password);
 
-		mbpi_ap_free(apn);
+		mbpi_ap_free(ap);
 	}
 
 	g_slist_free(apns);
@@ -101,12 +100,12 @@ int main(int argc, char **argv)
 	g_option_context_free(context);
 
 	if (option_version == TRUE) {
-		printf("%s\n", VERSION);
+		g_print("%s\n", VERSION);
 		exit(0);
 	}
 
 	if (argc < 2) {
-		fprintf(stderr, "Missing parameters\n");
+		g_printerr("Missing parameters\n");
 		exit(1);
 	}
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCHv10 1/9] mbpi: Minor style tweaks
  2011-10-18 11:04 ` [PATCHv10 1/9] mbpi: Minor style tweaks Oleg Zhurakivskyy
@ 2011-10-20 17:50   ` Denis Kenzior
  0 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2011-10-20 17:50 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

Hi Oleg,

On 10/18/2011 06:04 AM, Oleg Zhurakivskyy wrote:
> ---
>  plugins/mbpi.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/plugins/mbpi.c b/plugins/mbpi.c
> index ecb08eb..c5537d8 100644
> --- a/plugins/mbpi.c
> +++ b/plugins/mbpi.c
> @@ -23,12 +23,13 @@
>  #include <config.h>
>  #endif
>  
> -#include <string.h>
> -#include <fcntl.h>
> +#include <sys/types.h>
>  #include <sys/mman.h>
>  #include <sys/stat.h>
> -#include <sys/types.h>
> +
> +#include <fcntl.h>
>  #include <errno.h>
> +#include <string.h>
>  #include <unistd.h>
>  
>  #include <glib.h>

I decided to drop this patch since we really have no rule to separate
sys/ includes from regular ones.  The current style is fine.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCHv10 2/9] provision: Add provisioning plugin
  2011-10-18 11:04 ` [PATCHv10 2/9] provision: Add provisioning plugin Oleg Zhurakivskyy
@ 2011-10-20 17:51   ` Denis Kenzior
  0 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2011-10-20 17:51 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

Hi Oleg,

On 10/18/2011 06:04 AM, Oleg Zhurakivskyy wrote:
> ---
>  Makefile.am         |    7 +++
>  configure.ac        |   23 +++++++---
>  plugins/provision.c |  117 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 140 insertions(+), 7 deletions(-)
>  create mode 100644 plugins/provision.c

Patch has been applied, but I dropped Makefile.am and configure.ac
changes.  Marcel has historically taken care of the build system details.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCHv10 3/9] mbpi: Add mbpi_ap_type()
  2011-10-18 11:04 ` [PATCHv10 3/9] mbpi: Add mbpi_ap_type() Oleg Zhurakivskyy
@ 2011-10-20 17:51   ` Denis Kenzior
  0 siblings, 0 replies; 13+ messages in thread
From: Denis Kenzior @ 2011-10-20 17:51 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

Hi Oleg,

On 10/18/2011 06:04 AM, Oleg Zhurakivskyy wrote:
> ---
>  plugins/mbpi.c      |   15 +++++++++++++++
>  plugins/mbpi.h      |    2 ++
>  plugins/provision.c |    1 +
>  3 files changed, 18 insertions(+), 0 deletions(-)
> 

The rest of the patches in this series have been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-10-20 17:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18 11:04 [PATCHv10 0/9] Provisioning plugin Oleg Zhurakivskyy
2011-10-18 11:04 ` [PATCHv10 1/9] mbpi: Minor style tweaks Oleg Zhurakivskyy
2011-10-20 17:50   ` Denis Kenzior
2011-10-18 11:04 ` [PATCHv10 2/9] provision: Add provisioning plugin Oleg Zhurakivskyy
2011-10-20 17:51   ` Denis Kenzior
2011-10-18 11:04 ` [PATCHv10 3/9] mbpi: Add mbpi_ap_type() Oleg Zhurakivskyy
2011-10-20 17:51   ` Denis Kenzior
2011-10-18 11:05 ` [PATCHv10 4/9] lookup-apn: Use mbpi_ap_type() Oleg Zhurakivskyy
2011-10-18 11:05 ` [PATCHv10 5/9] lookup-apn: Add command line option to control duplicates Oleg Zhurakivskyy
2011-10-18 11:05 ` [PATCHv10 6/9] mbpi: Rename mbpi_provision_data_free() Oleg Zhurakivskyy
2011-10-18 11:05 ` [PATCHv10 7/9] lookup-apn: Use mbpi_ap_free() Oleg Zhurakivskyy
2011-10-18 11:05 ` [PATCHv10 8/9] mbpi: Minor style issues Oleg Zhurakivskyy
2011-10-18 11:05 ` [PATCHv10 9/9] lookup-apn: " Oleg Zhurakivskyy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.