From 5e988040575d346c4ca41061248e72d676467ed0 Mon Sep 17 00:00:00 2001 From: jserv Date: Wed, 17 Oct 2007 06:18:34 +0000 Subject: Improvement for find and read phonebooks in gsmd. From: Sean Chiang Subject: [PATCH] Improvement for find and read phonebooks in gsmd This patch is an improvement for find and read phonebooks. After clients make a request to find / read phonebooks, then clients should make a request to retrieve all the records. git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3202 99fdad57-331a-0410-800a-d7fa5415bdb3 --- include/gsmd/gsmd.h | 3 +++ include/gsmd/usock.h | 20 ++++++++++++++++++-- include/libgsmd/phonebook.h | 6 ++++++ 3 files changed, 27 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h index f1773c3..ed334f1 100644 --- a/include/gsmd/gsmd.h +++ b/include/gsmd/gsmd.h @@ -92,6 +92,9 @@ struct gsmd_user { struct gsmd *gsmd; struct gsmd_fd gfd; /* the socket */ u_int32_t subscriptions; /* bitmaks of subscribed event groups */ + + struct llist_head pb_readrg_list; /* our READRG phonebook list */ + struct llist_head pb_find_list; /* our FIND phonebook list */ }; #define GSMD_DEBUG 1 /* debugging information */ diff --git a/include/gsmd/usock.h b/include/gsmd/usock.h index c2f03f5..66cdf48 100644 --- a/include/gsmd/usock.h +++ b/include/gsmd/usock.h @@ -194,6 +194,8 @@ enum gsmd_msg_phonebook { GSMD_PHONEBOOK_GET_SUPPORT = 6, GSMD_PHONEBOOK_LIST_STORAGE = 7, GSMD_PHONEBOOK_SET_STORAGE = 8, + GSMD_PHONEBOOK_RETRIEVE_READRG = 9, + GSMD_PHONEBOOK_RETRIEVE_FIND = 10, }; /* Type-of-Address, Numbering-Plan-Identification field, GSM 03.40, 9.1.2.5 */ @@ -432,7 +434,6 @@ struct gsmd_phonebook { char text[GSMD_PB_TEXT_MAXLEN+1]; } __attribute__ ((packed)); - /* Refer to GSM 07.07 subclause 8.13 */ /* FIXME: the tlength depends on SIM, use +CPBR=? to get */ struct gsmd_phonebook_find { @@ -472,8 +473,18 @@ struct gsmd_msg_prefoper { char opname_longalpha[16]; }; +/* Refer to GSM 07.07 subclause 8.11 */ +struct gsmd_phonebook_mem { + u_int8_t type[3]; + u_int8_t pad; + u_int16_t used; + u_int16_t total; +} __attribute__ ((packed)); + struct gsmd_phonebook_storage { - char storage[3]; + /* FIXME the amount of phonebook storage should be dynamic */ + u_int8_t num; + struct gsmd_phonebook_mem mem[20]; } __attribute__ ((packed)); /* Subscriber number information from 3GPP TS 07.07, Clause 7.1 */ @@ -518,6 +529,11 @@ struct gsmd_ucmd { char buf[]; } __attribute__ ((packed)); +struct gsmd_phonebooks { + struct llist_head list; + struct gsmd_phonebook pb; +} __attribute__ ((packed)); + extern struct gsmd_ucmd *ucmd_alloc(int extra_size); extern int usock_init(struct gsmd *g); extern void usock_cmd_enqueue(struct gsmd_ucmd *ucmd, struct gsmd_user *gu); diff --git a/include/libgsmd/phonebook.h b/include/libgsmd/phonebook.h index badb76f..6e2d2b1 100644 --- a/include/libgsmd/phonebook.h +++ b/include/libgsmd/phonebook.h @@ -106,4 +106,10 @@ extern int lgsm_pb_write_entry(struct lgsm_handle *lh, /* Get the location range/nlength/tlength supported */ extern int lgsm_pb_get_support(struct lgsm_handle *lh); +/* Retrieve the records of READRG request */ +extern int lgsm_pb_retrieve_readrg(struct lgsm_handle *lh, int num); + +/* Retrieve the records of FIND request */ +extern int lgsm_pb_retrieve_find(struct lgsm_handle *lh, int num); + #endif -- cgit v1.2.3