diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/common/gsmd_proto.h | 9 | ||||
-rw-r--r-- | include/common/linux_list.h | 364 | ||||
-rw-r--r-- | include/gsmd/event.h | 52 | ||||
-rw-r--r-- | include/gsmd/gsmd.h | 4 | ||||
-rw-r--r-- | include/gsmd/usock.h | 83 | ||||
-rw-r--r-- | include/libgsmd/event.h | 14 | ||||
-rw-r--r-- | include/libgsmd/handset.h | 15 | ||||
-rw-r--r-- | include/libgsmd/libgsmd.h | 50 | ||||
-rw-r--r-- | include/libgsmd/misc.h | 72 | ||||
-rw-r--r-- | include/libgsmd/phonebook.h | 51 | ||||
-rw-r--r-- | include/libgsmd/voicecall.h | 18 |
11 files changed, 732 insertions, 0 deletions
diff --git a/include/common/gsmd_proto.h b/include/common/gsmd_proto.h new file mode 100644 index 0000000..cf0f99d --- /dev/null +++ b/include/common/gsmd_proto.h @@ -0,0 +1,9 @@ +#ifndef _GSMD_PROTO_H +#define _GSMD_PROTO_H + +/* this header file describes the protocol between gsmd and libgsmd + * (C) 2006 by Harald Welte <hwelte@hmw-consulting.de> */ + + + +#endif /* _GSMD_PROTO_H */ diff --git a/include/common/linux_list.h b/include/common/linux_list.h new file mode 100644 index 0000000..05546ad --- /dev/null +++ b/include/common/linux_list.h @@ -0,0 +1,364 @@ +#ifndef _LINUX_LLIST_H +#define _LINUX_LLIST_H + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif + +#include <stddef.h> + +#ifndef inline +#define inline __inline__ +#endif + +static inline void prefetch(const void *x) {;} + +/** + * container_of - cast a member of a structure out to the containing structure + * + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + + +/* + * These are non-NULL pointers that will result in page faults + * under normal circumstances, used to verify that nobody uses + * non-initialized llist entries. + */ +#define LLIST_POISON1 ((void *) 0x00100100) +#define LLIST_POISON2 ((void *) 0x00200200) + +/* + * Simple doubly linked llist implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole llists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct llist_head { + struct llist_head *next, *prev; +}; + +#define LLIST_HEAD_INIT(name) { &(name), &(name) } + +#define LLIST_HEAD(name) \ + struct llist_head name = LLIST_HEAD_INIT(name) + +#define INIT_LLIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal llist manipulation where we know + * the prev/next entries already! + */ +static inline void __llist_add(struct llist_head *new, + struct llist_head *prev, + struct llist_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * llist_add - add a new entry + * @new: new entry to be added + * @head: llist head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void llist_add(struct llist_head *new, struct llist_head *head) +{ + __llist_add(new, head, head->next); +} + +/** + * llist_add_tail - add a new entry + * @new: new entry to be added + * @head: llist head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void llist_add_tail(struct llist_head *new, struct llist_head *head) +{ + __llist_add(new, head->prev, head); +} + +/* + * Delete a llist entry by making the prev/next entries + * point to each other. + * + * This is only for internal llist manipulation where we know + * the prev/next entries already! + */ +static inline void __llist_del(struct llist_head * prev, struct llist_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * llist_del - deletes entry from llist. + * @entry: the element to delete from the llist. + * Note: llist_empty on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void llist_del(struct llist_head *entry) +{ + __llist_del(entry->prev, entry->next); + entry->next = LLIST_POISON1; + entry->prev = LLIST_POISON2; +} + +/** + * llist_del_init - deletes entry from llist and reinitialize it. + * @entry: the element to delete from the llist. + */ +static inline void llist_del_init(struct llist_head *entry) +{ + __llist_del(entry->prev, entry->next); + INIT_LLIST_HEAD(entry); +} + +/** + * llist_move - delete from one llist and add as another's head + * @llist: the entry to move + * @head: the head that will precede our entry + */ +static inline void llist_move(struct llist_head *llist, struct llist_head *head) +{ + __llist_del(llist->prev, llist->next); + llist_add(llist, head); +} + +/** + * llist_move_tail - delete from one llist and add as another's tail + * @llist: the entry to move + * @head: the head that will follow our entry + */ +static inline void llist_move_tail(struct llist_head *llist, + struct llist_head *head) +{ + __llist_del(llist->prev, llist->next); + llist_add_tail(llist, head); +} + +/** + * llist_empty - tests whether a llist is empty + * @head: the llist to test. + */ +static inline int llist_empty(const struct llist_head *head) +{ + return head->next == head; +} + +static inline void __llist_splice(struct llist_head *llist, + struct llist_head *head) +{ + struct llist_head *first = llist->next; + struct llist_head *last = llist->prev; + struct llist_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * llist_splice - join two llists + * @llist: the new llist to add. + * @head: the place to add it in the first llist. + */ +static inline void llist_splice(struct llist_head *llist, struct llist_head *head) +{ + if (!llist_empty(llist)) + __llist_splice(llist, head); +} + +/** + * llist_splice_init - join two llists and reinitialise the emptied llist. + * @llist: the new llist to add. + * @head: the place to add it in the first llist. + * + * The llist at @llist is reinitialised + */ +static inline void llist_splice_init(struct llist_head *llist, + struct llist_head *head) +{ + if (!llist_empty(llist)) { + __llist_splice(llist, head); + INIT_LLIST_HEAD(llist); + } +} + +/** + * llist_entry - get the struct for this entry + * @ptr: the &struct llist_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the llist_struct within the struct. + */ +#define llist_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * llist_for_each - iterate over a llist + * @pos: the &struct llist_head to use as a loop counter. + * @head: the head for your llist. + */ +#define llist_for_each(pos, head) \ + for (pos = (head)->next, prefetch(pos->next); pos != (head); \ + pos = pos->next, prefetch(pos->next)) + +/** + * __llist_for_each - iterate over a llist + * @pos: the &struct llist_head to use as a loop counter. + * @head: the head for your llist. + * + * This variant differs from llist_for_each() in that it's the + * simplest possible llist iteration code, no prefetching is done. + * Use this for code that knows the llist to be very short (empty + * or 1 entry) most of the time. + */ +#define __llist_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * llist_for_each_prev - iterate over a llist backwards + * @pos: the &struct llist_head to use as a loop counter. + * @head: the head for your llist. + */ +#define llist_for_each_prev(pos, head) \ + for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ + pos = pos->prev, prefetch(pos->prev)) + +/** + * llist_for_each_safe - iterate over a llist safe against removal of llist entry + * @pos: the &struct llist_head to use as a loop counter. + * @n: another &struct llist_head to use as temporary storage + * @head: the head for your llist. + */ +#define llist_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * llist_for_each_entry - iterate over llist of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your llist. + * @member: the name of the llist_struct within the struct. + */ +#define llist_for_each_entry(pos, head, member) \ + for (pos = llist_entry((head)->next, typeof(*pos), member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = llist_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next)) + +/** + * llist_for_each_entry_reverse - iterate backwards over llist of given type. + * @pos: the type * to use as a loop counter. + * @head: the head for your llist. + * @member: the name of the llist_struct within the struct. + */ +#define llist_for_each_entry_reverse(pos, head, member) \ + for (pos = llist_entry((head)->prev, typeof(*pos), member), \ + prefetch(pos->member.prev); \ + &pos->member != (head); \ + pos = llist_entry(pos->member.prev, typeof(*pos), member), \ + prefetch(pos->member.prev)) + +/** + * llist_for_each_entry_continue - iterate over llist of given type + * continuing after existing point + * @pos: the type * to use as a loop counter. + * @head: the head for your llist. + * @member: the name of the llist_struct within the struct. + */ +#define llist_for_each_entry_continue(pos, head, member) \ + for (pos = llist_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = llist_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next)) + +/** + * llist_for_each_entry_safe - iterate over llist of given type safe against removal of llist entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your llist. + * @member: the name of the llist_struct within the struct. + */ +#define llist_for_each_entry_safe(pos, n, head, member) \ + for (pos = llist_entry((head)->next, typeof(*pos), member), \ + n = llist_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = llist_entry(n->member.next, typeof(*n), member)) + +/** + * llist_for_each_rcu - iterate over an rcu-protected llist + * @pos: the &struct llist_head to use as a loop counter. + * @head: the head for your llist. + */ +#define llist_for_each_rcu(pos, head) \ + for (pos = (head)->next, prefetch(pos->next); pos != (head); \ + pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next)) + +#define __llist_for_each_rcu(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next, ({ smp_read_barrier_depends(); 0;})) + +/** + * llist_for_each_safe_rcu - iterate over an rcu-protected llist safe + * against removal of llist entry + * @pos: the &struct llist_head to use as a loop counter. + * @n: another &struct llist_head to use as temporary storage + * @head: the head for your llist. + */ +#define llist_for_each_safe_rcu(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, ({ smp_read_barrier_depends(); 0;}), n = pos->next) + +/** + * llist_for_each_entry_rcu - iterate over rcu llist of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your llist. + * @member: the name of the llist_struct within the struct. + */ +#define llist_for_each_entry_rcu(pos, head, member) \ + for (pos = llist_entry((head)->next, typeof(*pos), member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = llist_entry(pos->member.next, typeof(*pos), member), \ + ({ smp_read_barrier_depends(); 0;}), \ + prefetch(pos->member.next)) + + +/** + * llist_for_each_continue_rcu - iterate over an rcu-protected llist + * continuing after existing point. + * @pos: the &struct llist_head to use as a loop counter. + * @head: the head for your llist. + */ +#define llist_for_each_continue_rcu(pos, head) \ + for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \ + (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next)) + + +#endif diff --git a/include/gsmd/event.h b/include/gsmd/event.h new file mode 100644 index 0000000..9403164 --- /dev/null +++ b/include/gsmd/event.h @@ -0,0 +1,52 @@ +#ifndef _GSMD_EVENT_H +#define _GSMD_EVENT_H + +enum gsmd_events { + GSMD_EVT_NONE = 0, + GSMD_EVT_IN_CALL = 1, /* Incoming call */ + GSMD_EVT_IN_SMS = 2, /* Incoming SMS */ + GSMD_EVT_IN_GPRS = 3, /* Network initiated GPRS */ + GSMD_EVT_IN_CLIP = 4, /* Incoming CLIP */ + GSMD_EVT_NETREG = 5, /* Network (un)registration event */ + GSMD_EVT_SIGNAL = 6, /* Signal quality event */ + GSMD_EVT_PIN = 7, /* Modem is waiting for some PIN/PUK */ + GSMD_EVT_OUT_STATUS = 8, /* Outgoing call status */ + GSMD_EVT_OUT_COLP = 9, /* Outgoing COLP */ + GSMD_EVT_CALL_WAIT = 10, /* Call Waiting */ +}; + +/* Chapter 8.3 */ +enum gsmd_pin_type { /* waiting for ... */ + GSMD_PIN_NONE = 0, /* not for any PIN */ + GSMD_PIN_SIM_PIN = 1, /* SIM PIN */ + GSMD_PIN_SIM_PUK = 2, /* SIM PUK */ + GSMD_PIN_PH_SIM_PIN = 3, /* phone-to-SIM passowrd */ + GSMD_PIN_PH_FSIM_PIN = 4, /* phone-to-very-first SIM password */ + GSMD_PIN_PH_FSIM_PUK = 5, /* phone-to-very-first SIM PUK password */ + GSMD_PIN_SIM_PIN2 = 6, /* SIM PIN2 */ + GSMD_PIN_SIM_PUK2 = 7, /* SIM PUK2 */ + GSMD_PIN_PH_NET_PIN = 8, /* netwokr personalisation password */ + GSMD_PIN_PH_NET_PUK = 9, /* network personalisation PUK */ + GSMD_PIN_PH_NETSUB_PIN = 10, /* network subset personalisation PIN */ + GSMD_PIN_PH_NETSUB_PUK = 11, /* network subset personalisation PUK */ + GSMD_PIN_PH_SP_PIN = 12, /* service provider personalisation PIN */ + GSMD_PIN_PH_SP_PUK = 13, /* service provider personalisation PUK */ + GSMD_PIN_PH_CORP_PIN = 14, /* corporate personalisation PIN */ + GSMD_PIN_PH_CORP_PUK = 15, /* corporate personalisation PUK */ +}; + +enum gsmd_call_type { + GSMD_CALL_NONE = 0, + GSMD_CALL_UNSPEC = 1, + GSMD_CALL_VOICE = 2, + GSMD_CALL_FAX = 4, + GSMD_CALL_DATA_SYNC = 5, + GSMD_CALL_DATA_REL_ASYNC= 6, + GSMD_CALL_DATA_REL_SYNC = 7, +}; + +enum gsmd_netreg_state { + GSMD_NETREG_NONE = 0, +}; + +#endif diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h new file mode 100644 index 0000000..f5b61d5 --- /dev/null +++ b/include/gsmd/gsmd.h @@ -0,0 +1,4 @@ +#ifndef _GSMD_H +#define _GSMD_H + +#endif /* _GSMD_H */ diff --git a/include/gsmd/usock.h b/include/gsmd/usock.h new file mode 100644 index 0000000..43ed792 --- /dev/null +++ b/include/gsmd/usock.h @@ -0,0 +1,83 @@ +#ifndef _GSMD_USOCK_H +#define _GSMD_USOCK_H + +#include <gsmd/event.h> + +#define GSMD_UNIX_SOCKET "\0gsmd" +#define GSMD_UNIX_SOCKET_TYPE SOCK_SEQPACKET + +#define GSMD_PROTO_VERSION 1 + +enum gsmd_prot_cmd { + GSMD_PCMD_NONE, + GSMD_PCMD_EVT_SUBSCRIPTIONS, /* alter event subscriptions */ + GSMD_PCMD_PASSTHROUGH, /* transparent atcmd passthrough */ +}; + +enum gsmd_pcmd_result { + GSMD_PCMD_OK = 0, + GSMD_PCMD_ERR_UNSPEC = 0xff, +}; + +struct gsmd_prot_hdr { + u_int16_t cmd; + u_int8_t result; + u_int8_t version; +} __attribute__((packed)); + + +enum gsmd_msg_type { + GSMD_MSG_NONE = 0, + GSMD_MSG_EVENT = 1, + GSMD_MSG_PASSTHROUGH = 2, +}; + +enum gsmd_passthrough_type { + GSMD_PASSTHROUGH_NONE = 0, + GSMD_PASSTHROUGH_REQ = 1, + GSMD_PASSTHROUGH_RESP = 2, +}; + +/* Length from 3GPP TS 04.08, Clause 10.5.4.7 */ + +#define GSMD_ADDR_MAXLEN 13 +struct gsmd_addr { + u_int8_t type; + char number[GSMD_ADDR_MAXLEN+1]; +}; + +struct gsmd_evt_auxdata { + union { + struct { + enum gsmd_call_type type; + } call; + struct { + struct gsmd_addr addr; + } clip; + struct { + struct gsmd_addr addr; + } colp; + struct { + /* TBD */ + struct gsmd_addr addr; + } sms; + struct { + enum gsmd_pin_type type; + } pin; + struct { + enum gsmd_netreg_state state; + u_int16_t lac; + u_int16_t ci; + } netreg; + } u; +}; + +struct gsmd_msg_hdr { + u_int8_t version; + u_int8_t msg_type; + u_int8_t msg_subtype; + u_int8_t len; +} __attribute__((packed)); + + +#endif diff --git a/include/libgsmd/event.h b/include/libgsmd/event.h new file mode 100644 index 0000000..d7faa9b --- /dev/null +++ b/include/libgsmd/event.h @@ -0,0 +1,14 @@ +#ifndef _LIBGSMD_EVENT_H +#define _LIBGSMD_EVENT_H + +#include <gsmd/event.h> + +/* Prototype of libgsmd callback handler function */ +typedef int evt_cb_func(struct lgsm_handle *lh, enum gsmd_events evt, + void *user); + +/* Register an event callback handler with libgsmd */ +extern int lgsm_register_evt_cb(struct lgsm_handle *lh, + evt_cb_func *cb, void *user); + +#endif diff --git a/include/libgsmd/handset.h b/include/libgsmd/handset.h new file mode 100644 index 0000000..c6b5ef8 --- /dev/null +++ b/include/libgsmd/handset.h @@ -0,0 +1,15 @@ +#ifndef _LIBGSMD_HANDSET_H +#define _LIBGSMD_HANDSET_H + +#include <libgsmd/libgsmd.h> +/* Set speaker level (Chapter 8.23) */ +extern int lgsm_set_spkr_level(struct lgsm_handle *lh, + u_int32_t level); + +/* Mute call during voice call */ +extern int lgsm_mute_set(struct lgsm_handle *lh, u_int8_t on); + +/* Get information on whether voice call is muted or not */ +extern int lgsm_mute_get(struct lgsm_handle *lh, u_int8_t *on); + +#endif diff --git a/include/libgsmd/libgsmd.h b/include/libgsmd/libgsmd.h new file mode 100644 index 0000000..579f13d --- /dev/null +++ b/include/libgsmd/libgsmd.h @@ -0,0 +1,50 @@ +#ifndef _LIBGSMD_H +#define _LIBGSMD_H + +/* libgsmd.h - Library API for gsmd, the GSM Daemon + * (C) 2006 by Harald Welte <hwelte@hmw-consulting.de> + * Development funded by First International Computers, Inc. + */ + +#include <sys/types.h> +#include <errno.h> + +/* Generic Information + * + * Return value: + * < 0 Error, see libgsmd/errno.h and errno.h + * = 0 Success + * > 0 Success, number of information elements returned + * + * Allocation: + * All data structures are caller-allocated. The only exception + * is struct lgsm_handle which is allocatedi in lgsm_init() and + * free'd in lgsm_exit() + * + * References: + * Recefences to "Chapter X" are referring to 3GPP TS 07.07 version 7.8.0 + */ + +/* Opaque data structure, content only known to libgsm implementation */ +struct lgsm_handle; + +/* initialize usage of libgsmd, obtain handle for othe API calls */ +extern struct lgsm_handle *lgsm_init(void); + +/* Terminate usage of libgsmd */ +extern int lgsm_exit(struct lgsm_handle *lh); + +/* Refer to GSM 04.08 [8] subclause 10.5.4.7 */ +enum lgsm_addr_type { + LGSM_ATYPE_ISDN_UNKN = 161, + LGSM_ATYPE_ISDN_INTL = , + LGSM_ATYPE_ISDN_NATIONAL = , +}; + +#define LGSM_ADDR_MAXLEN 31 +struct lgsm_addr { + char addr[LGSM_ADDR_MAXLEN+1]; + enum lgsm_addr_type tyoe; +}; + +#endif diff --git a/include/libgsmd/misc.h b/include/libgsmd/misc.h new file mode 100644 index 0000000..e191ce6 --- /dev/null +++ b/include/libgsmd/misc.h @@ -0,0 +1,72 @@ +#ifndef _LIBGSMD_H +#define _LIBGSMD_H + +/* libgsmd.h - Library API for gsmd, the GSM Daemon + * (C) 2006 by Harald Welte <hwelte@hmw-consulting.de> + * Development funded by First International Computers, Inc. + */ + +#include <libgsmd/libgsmd.h> + +enum lgsm_netreg_state { + LGSM_NETREG_ST_NOTREG = 0, + LGSM_NETREG_ST_REG_HOME = 1, + LGSM_NETREG_ST_NOTREG_SEARCH = 2, + LGSM_NETREG_ST_DENIED = 3, + LGSM_NETREG_ST_UNKNOWN = 4, + LGSM_NETREG_ST_REG_ROAMING = 5, +}; + +/* Get the current network registration status */ +extern int lgsm_get_netreg_state(struct lgsm_handle *lh, + enum lgsm_netreg_state *state); + +enum lgsm_info_type { + LGSM_INFO_TYPE_NONE = 0, + LGSM_INFO_TYPE_MANUF = 1, + LGSM_INFO_TYPE_MODEL = 2, + LGSM_INFO_TYPE_REVISION = 3, + LGSM_INFO_TYPE_SERIAL = 4, + LGSM_INFO_TYPE_IMSI = 5, +}; + +/* Get some information about the handset */ +extern int lgsm_get_info(struct lgsm_handle *lh, + enum lgsm_info_type type, + char *ret_string, u_int16_t len); + +/* Authenticate to SIM Card using specified null-terminated pin */ +extern int lgsm_pin_auth(struct lgsm_handle *lh, const char *pin); + + +/* General Commands */ + +/* Get Signal Strehngth (Chapter 8.5) */ +extern int lgsm_get_signal_quality(struct lgsm_handle *h, + unsigned int *rssi); + +/* Set voice mail number */ +extern int lgsm_voicemail_set(struct lgsm_handle *lh, + struct lgsm_addr *addr); + +/* Get currently configured voice mail number */ +extern int lgsm_voicemail_get(struct lgsm_handle *lh, + struct lgsm_addr *addr); + +/* Operator Selection, Network Registration */ +/* TBD */ + + +/* CLIP, CLIR, COLP, Call Forwarding, Call Waiting, Call Deflecting */ +/* TBD */ + + +/* SMS related functions */ +/* TBD */ + + +/* GPRS related functions */ +/* TBD */ + + +#endif diff --git a/include/libgsmd/phonebook.h b/include/libgsmd/phonebook.h new file mode 100644 index 0000000..92c3a7f --- /dev/null +++ b/include/libgsmd/phonebook.h @@ -0,0 +1,51 @@ +#ifndef _LIBGSMD_PBOOK_H +#define _LIBGSMD_PBOOK_H + +#include <libgsmd/libgsmd.h> + +/* Phonebook */ + +/* Chapter 8.11 */ +enum lgsm_pbook_type { + LGSM_PB_ME_DIALLED = 1, + LGSM_PB_SIM_EMERGENCY = 2, + LGSM_PB_SIM_FIXDIAL = 3, + LGSM_PB_SIM_DIALLED = 4, + LGSM_PB_ME_MISSED = 5, + LGSM_PB_ME_PHONEBOOK = 6, + LGSM_PB_COMB_PHONEBOOK = 7, + LGSM_PB_SIM_OWN_NUMBERS = 8, + LGSM_PB_ME_RECEIVED = 9, + LGSM_PB_SIM_PHONEBOOK = 10, + LGSM_PB_TA_PHONEBOOK = 11, +}; + +/* Get a bitmask of supported phonebook types */ +extern int lgsm_pb_get_types(struct lgsm_handle *lh, u_int32 *typemask); + +/* Get a range of supported indexes in given phonebook type, Chapter 8.12 */ +extern int lgsm_pb_get_range(struct lgsm_handle *lh, + enum lgsm_pbook_type type, + u_int32_t *from, u_int32_t *to, + u_int32_t *nlength, *u_int32_t tlength); + +#define LGSM_PB_TEXT_MAXLEN 31 + +struct lgsm_pb_entry { + struct lgsm_pb_entry *next; + enum lgsm_pbook_type type; + u_int32_t index; + char text[LGSM_PB_TEXT_MAXLEN+1]; +}; + +/* Get a specific phonebook entry and store it to 'pb' + * pb' is caller-allocated */ +extern int lgsm_pb_get_entry(struct lgsm_handle *lh, + struct lgsm_pb_entry *pb); + +/* Store a specific phonebook entry 'pb' into phone */ +extern int lgsm_pb_set_entry(struct lgsm_handle *lh, + struct lgsm_pb_entry *pb); + + +#endif diff --git a/include/libgsmd/voicecall.h b/include/libgsmd/voicecall.h new file mode 100644 index 0000000..4fffe4e --- /dev/null +++ b/include/libgsmd/voicecall.h @@ -0,0 +1,18 @@ +#ifndef _LIBGSMD_VCALL_H +#define _LIBGSMD_VCALL_H + +#include <libgsmd/libgsmd.h> + +/* Voice Calls */ + +/* Initiate an outgoing voice call */ +extern int lgsm_voice_out_init(struct lgsm_handle *lh, + const struct lgsm_addr *number); + +/* Accept incoming voice call */ +extern int lgsm_voice_in_accept(struct lgsm_handle *lh); + +/* Terminate outgoing (or incoming) voice call */ +extern int lgsm_voice_hangup(struct lgsm_handle *lh); + +#endif |