diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2014-07-05 20:16:07 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2014-07-05 20:16:20 +0200 |
commit | c0eabb682988712185515a8ea8c360fd72d74811 (patch) | |
tree | 72679cb04ba92abd8aa72e24fcc2bc9a1783d688 /samsung-ipc | |
parent | 87fdd4b6c8a8a0cc22e53cdb239b56dc95ee6f74 (diff) | |
download | external_libsamsung-ipc-c0eabb682988712185515a8ea8c360fd72d74811.zip external_libsamsung-ipc-c0eabb682988712185515a8ea8c360fd72d74811.tar.gz external_libsamsung-ipc-c0eabb682988712185515a8ea8c360fd72d74811.tar.bz2 |
sms: Headers sort, pdu extract helper
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc')
-rw-r--r-- | samsung-ipc/sms.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/samsung-ipc/sms.c b/samsung-ipc/sms.c index bb9e026..6743776 100644 --- a/samsung-ipc/sms.c +++ b/samsung-ipc/sms.c @@ -22,6 +22,7 @@ #include <string.h> #include <samsung-ipc.h> +#include <utils.h> void *ipc_sms_send_msg_setup(struct ipc_sms_send_msg_request_header *header, const char *smsc, const char *pdu) @@ -58,4 +59,24 @@ void *ipc_sms_send_msg_setup(struct ipc_sms_send_msg_request_header *header, return data; } +char *ipc_sms_incoming_msg_pdu_extract(const void *data, size_t size) +{ + struct ipc_sms_incoming_msg_header *header; + char *string; + void *pdu; + + if (data == NULL || size < sizeof(struct ipc_sms_incoming_msg_header)) + return NULL; + + header = (struct ipc_sms_incoming_msg_header *) data; + if (header->length == 0 || header->length > size - sizeof(struct ipc_sms_incoming_msg_header)) + return NULL; + + pdu = (void *) ((unsigned char *) data + sizeof(struct ipc_sms_incoming_msg_header)); + + string = data2string(pdu, header->length); + + return string; +} + // vim:ts=4:sw=4:expandtab |