summaryrefslogtreecommitdiffstats
path: root/include/sim.h
diff options
context:
space:
mode:
authorAndrzej Zaborowski <andrew.zaborowski@intel.com>2011-01-29 01:29:20 +0100
committerDenis Kenzior <denkenz@gmail.com>2011-02-03 13:13:33 -0600
commit0ecc99973a2ccafcacd1c24c976d85950fb6cbae (patch)
tree01f764c9f380ad462e273b50b550f3e97b67c8ae /include/sim.h
parent0cde90ff8e9b1461604d25b1433888a8003f16be (diff)
downloadofono-0ecc99973a2ccafcacd1c24c976d85950fb6cbae.tar.bz2
sim: ofono_sim_context api header changes
This patch introduces sim FS contexts which are used to queue file read and write operations. When a context is freed all pending operations in that context are cancelled preventing callbacks from being called causing segfaults.
Diffstat (limited to 'include/sim.h')
-rw-r--r--include/sim.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/sim.h b/include/sim.h
index 5e3ba5ba..137e8253 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -29,6 +29,7 @@ extern "C" {
#include <ofono/types.h>
struct ofono_sim;
+struct ofono_sim_context;
/* 51.011 Section 9.3 */
enum ofono_sim_file_structure {
@@ -195,6 +196,9 @@ enum ofono_sim_state ofono_sim_get_state(struct ofono_sim *sim);
void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted);
+struct ofono_sim_context *ofono_sim_context_create(struct ofono_sim *sim);
+void ofono_sim_context_free(struct ofono_sim_context *context);
+
/* This will queue an operation to read all available records with id from the
* SIM. Callback cb will be called every time a record has been read, or once
* if an error has occurred. For transparent files, the callback will only
@@ -202,16 +206,16 @@ void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted);
*
* Returns 0 if the request could be queued, -1 otherwise.
*/
-int ofono_sim_read(struct ofono_sim *sim, int id,
+int ofono_sim_read(struct ofono_sim_context *context, int id,
enum ofono_sim_file_structure expected,
ofono_sim_file_read_cb_t cb, void *data);
-int ofono_sim_write(struct ofono_sim *sim, int id,
+int ofono_sim_write(struct ofono_sim_context *context, int id,
ofono_sim_file_write_cb_t cb,
enum ofono_sim_file_structure structure, int record,
const unsigned char *data, int length, void *userdata);
-int ofono_sim_read_bytes(struct ofono_sim *sim, int id,
+int ofono_sim_read_bytes(struct ofono_sim_context *context, int id,
unsigned short offset, unsigned short num_bytes,
ofono_sim_file_read_cb_t cb, void *data);
#ifdef __cplusplus