summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--src/ofono.h5
-rw-r--r--src/private-network.c91
3 files changed, 97 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index b4f83ef1..a1f30e56 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -389,7 +389,7 @@ src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \
src/cdma-connman.c src/gnss.c \
src/gnssagent.c src/gnssagent.h \
src/cdma-smsutil.h src/cdma-smsutil.c \
- src/cdma-sms.c
+ src/cdma-sms.c src/private-network.c
src_ofonod_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ @CAPNG_LIBS@ -ldl
diff --git a/src/ofono.h b/src/ofono.h
index 2a01fe3d..33eaf93d 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -470,3 +470,8 @@ void __ofono_gprs_provision_free_settings(
#include <ofono/emulator.h>
#include <ofono/gnss.h>
#include <ofono/cdma-sms.h>
+#include <ofono/private-network.h>
+
+void __ofono_private_network_release(int id);
+ofono_bool_t __ofono_private_network_request(ofono_private_network_cb_t cb,
+ int *id, void *data);
diff --git a/src/private-network.c b/src/private-network.c
new file mode 100644
index 00000000..4da68f88
--- /dev/null
+++ b/src/private-network.c
@@ -0,0 +1,91 @@
+/*
+ *
+ * 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 <string.h>
+#include <glib.h>
+#include "ofono.h"
+
+static GSList *g_drivers = NULL;
+
+void __ofono_private_network_release(int id)
+{
+ GSList *d;
+
+ DBG("");
+
+ for (d = g_drivers; d; d = d->next) {
+ const struct ofono_private_network_driver *driver = d->data;
+
+ if (!driver->release)
+ continue;
+
+ driver->release(id);
+
+ break;
+ }
+}
+
+ofono_bool_t __ofono_private_network_request(ofono_private_network_cb_t cb,
+ int *id, void *data)
+{
+ GSList *d;
+ int uid;
+
+ DBG("");
+
+ for (d = g_drivers; d; d = d->next) {
+ const struct ofono_private_network_driver *driver = d->data;
+
+ if (!driver->request)
+ continue;
+
+ uid = driver->request(cb, data);
+ if (uid <= 0)
+ continue;
+
+ *id = uid;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+int ofono_private_network_driver_register(
+ const struct ofono_private_network_driver *d)
+{
+ DBG("driver: %p, name: %s", d, d->name);
+
+ g_drivers = g_slist_prepend(g_drivers, (void *) d);
+
+ return 0;
+}
+
+void ofono_private_network_driver_unregister(
+ const struct ofono_private_network_driver *d)
+{
+ DBG("driver: %p, name: %s", d, d->name);
+
+ g_drivers = g_slist_remove(g_drivers, (void *) d);
+}