mirror of git://git.sysmocom.de/ofono
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:
parent
0cde90ff8e
commit
0ecc99973a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue