All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <james.prestwood@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 7/8] sim: implement create context with AID
Date: Wed, 01 Nov 2017 10:33:47 -0700	[thread overview]
Message-ID: <1509557628-15121-7-git-send-email-james.prestwood@linux.intel.com> (raw)
In-Reply-To: <1509557628-15121-1-git-send-email-james.prestwood@linux.intel.com>

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

API to create a sim context for a given AID. This AID based
context is only relevant for an ISIM application, so during
AID discovery, if an ISIM is found, a new fs object is
initialized for the ISIM. If any atom wants to create an
AID based context for the ISIM AID, the ISIM fs object will
be used.
---
 src/sim.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/src/sim.c b/src/sim.c
index 53eb048..8b466c9 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -122,6 +122,7 @@ struct ofono_sim {
 	unsigned int cphs_spn_short_watch;
 
 	struct sim_fs *simfs;
+	struct sim_fs *simfs_isim;
 	struct ofono_sim_context *context;
 	struct ofono_sim_context *early_context;
 
@@ -1477,6 +1478,14 @@ static void discover_apps_cb(const struct ofono_error *error,
 		memcpy(&s->record, app, sizeof(struct sim_app_record));
 		sim->aid_sessions = g_slist_prepend(sim->aid_sessions, s);
 
+		if (app->type == SIM_APP_TYPE_ISIM) {
+			/*
+			 * If an ISIM application is found, we should init
+			 * the FS structure so the ISIM EF's can be accessed.
+			 */
+			sim->simfs_isim = sim_fs_new(sim, sim->driver);
+		}
+
 		g_free(app);
 
 		iter = g_slist_next(iter);
@@ -2235,6 +2244,36 @@ struct ofono_sim_context *ofono_sim_context_create(struct ofono_sim *sim)
 	return sim_fs_context_new(sim->simfs);
 }
 
+struct ofono_sim_context *ofono_sim_context_create_isim(
+		struct ofono_sim *sim)
+{
+	GSList *iter = sim->aid_sessions;
+
+	if (sim == NULL || sim->simfs_isim == NULL)
+		return NULL;
+
+	/*
+	 * Check if the AID is even valid
+	 */
+	while (iter) {
+		struct sim_app_record *app = iter->data;
+
+		/*
+		 * This AID based context is only relevant for an ISIM AID. A
+		 * USIM application can be accessed with the 'default' FS
+		 * context API's.
+		 */
+		if (app->type == SIM_APP_TYPE_ISIM) {
+			return sim_fs_context_new_with_aid(sim->simfs_isim,
+					app->aid);
+		}
+
+		iter = g_slist_next(iter);
+	}
+
+	return NULL;
+}
+
 void ofono_sim_context_free(struct ofono_sim_context *context)
 {
 	return sim_fs_context_free(context);
@@ -3056,6 +3095,8 @@ static void sim_remove(struct ofono_atom *atom)
 
 	sim_fs_free(sim->simfs);
 	sim->simfs = NULL;
+	sim_fs_free(sim->simfs_isim);
+	sim->simfs_isim = NULL;
 
 	g_free(sim);
 }
-- 
2.7.4


  parent reply	other threads:[~2017-11-01 17:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 17:33 [PATCH 1/8] simutil: Added ISIM elementary file ID's James Prestwood
2017-11-01 17:33 ` [PATCH 2/8] sim: header definitions for AID session APIs James Prestwood
2017-11-02 16:55   ` Denis Kenzior
2017-11-01 17:33 ` [PATCH 3/8] sim: AID session management James Prestwood
2017-11-02 17:10   ` Denis Kenzior
2017-11-01 17:33 ` [PATCH 4/8] atmodem: implement new driver APIs for AID sessions James Prestwood
2017-11-01 17:33 ` [PATCH 5/8] simfs: read files from specific AID's James Prestwood
2017-11-01 17:33 ` [PATCH 6/8] sim: header definitions for AID sim context API James Prestwood
2017-11-01 17:33 ` James Prestwood [this message]
2017-11-01 17:33 ` [PATCH 8/8] sim: added NetworkAccessIdentifier to SimManager James Prestwood
2017-11-02 16:40 ` [PATCH 1/8] simutil: Added ISIM elementary file ID's Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509557628-15121-7-git-send-email-james.prestwood@linux.intel.com \
    --to=james.prestwood@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.