diff options
-rw-r--r-- | include/sms.h | 2 | ||||
-rw-r--r-- | samsung-ipc/sms.c | 25 |
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 |