sms: SVC center addr extract helper
authorPaul Kocialkowski <contact@paulk.fr>
Mon, 4 Aug 2014 10:56:45 +0000 (12:56 +0200)
committerPaul Kocialkowski <contact@paulk.fr>
Mon, 4 Aug 2014 10:56:45 +0000 (12:56 +0200)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
include/sms.h
samsung-ipc/sms.c

index 95b225d..957b10f 100644 (file)
@@ -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
 
index beacecc..0e0c807 100644 (file)
@@ -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