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.
This commit is contained in:
Andrzej Zaborowski 2011-01-29 01:29:20 +01:00 committed by Denis Kenzior
parent 0cde90ff8e
commit 0ecc99973a
1 changed files with 7 additions and 3 deletions

View File

@ -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