aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-08-04 12:56:45 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-08-04 12:56:45 +0200
commitd0de45e9191fd8c9a99487f5123844b86f07d5de (patch)
treebe0d68c2a3b2d3cb7f870f8b5214a3ab1267e9d8
parentc48926e382b68d0764c88b453711a9b269735537 (diff)
downloadexternal_libsamsung-ipc-d0de45e9191fd8c9a99487f5123844b86f07d5de.zip
external_libsamsung-ipc-d0de45e9191fd8c9a99487f5123844b86f07d5de.tar.gz
external_libsamsung-ipc-d0de45e9191fd8c9a99487f5123844b86f07d5de.tar.bz2
sms: SVC center addr extract helper
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--include/sms.h2
-rw-r--r--samsung-ipc/sms.c25
2 files changed, 27 insertions, 0 deletions
diff --git a/include/sms.h b/include/sms.h
index 95b225d..957b10f 100644
--- a/include/sms.h
+++ b/include/sms.h
@@ -147,6 +147,8 @@ void *ipc_sms_save_msg_setup(struct ipc_sms_save_msg_request_header *header,
const void *smsc, size_t smsc_size, const void *pdu, size_t pdu_size);
int ipc_sms_del_msg_setup(struct ipc_sms_del_msg_request_data *data,
unsigned short index);
+size_t ipc_sms_svc_center_addr_smsc_size_extract(const void *data, size_t size);
+void *ipc_sms_svc_center_addr_smsc_extract(const void *data, size_t size);
#endif
diff --git a/samsung-ipc/sms.c b/samsung-ipc/sms.c
index beacecc..0e0c807 100644
--- a/samsung-ipc/sms.c
+++ b/samsung-ipc/sms.c
@@ -176,4 +176,29 @@ int ipc_sms_del_msg_setup(struct ipc_sms_del_msg_request_data *data,
return 0;
}
+size_t ipc_sms_svc_center_addr_smsc_size_extract(const void *data, size_t size)
+{
+ struct ipc_sms_svc_center_addr_header *header;
+
+ header = (struct ipc_sms_svc_center_addr_header *) data;
+ if (header->length == 0 || header->length > size - sizeof(struct ipc_sms_svc_center_addr_header))
+ return 0;
+
+ return (size_t) header->length;
+}
+
+void *ipc_sms_svc_center_addr_smsc_extract(const void *data, size_t size)
+{
+ struct ipc_sms_svc_center_addr_header *header;
+ void *smsc;
+
+ header = (struct ipc_sms_svc_center_addr_header *) data;
+ if (header->length == 0 || header->length > size - sizeof(struct ipc_sms_svc_center_addr_header))
+ return NULL;
+
+ smsc = (void *) ((unsigned char *) data + sizeof(struct ipc_sms_svc_center_addr_header));
+
+ return smsc;
+}
+
// vim:ts=4:sw=4:expandtab