aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-07-05 20:16:07 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-07-05 20:16:20 +0200
commitc0eabb682988712185515a8ea8c360fd72d74811 (patch)
tree72679cb04ba92abd8aa72e24fcc2bc9a1783d688
parent87fdd4b6c8a8a0cc22e53cdb239b56dc95ee6f74 (diff)
downloadexternal_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>
-rw-r--r--include/sms.h37
-rw-r--r--samsung-ipc/sms.c21
2 files changed, 42 insertions, 16 deletions
diff --git a/include/sms.h b/include/sms.h
index 2d05571..b1b7518 100644
--- a/include/sms.h
+++ b/include/sms.h
@@ -92,15 +92,17 @@ struct ipc_sms_incoming_msg_header {
unsigned char length;
} __attribute__((__packed__));
-struct ipc_sms_deliver_report_request_data {
- unsigned char type; // IPC_SMS_TYPE
- unsigned short ack; // IPC_SMS_ACK
- unsigned char id;
- unsigned char unknown;
+struct ipc_sms_save_msg_request_data {
+ unsigned char magic;
+ unsigned short index;
+ unsigned char status; // IPC_SMS_STATUS
+ unsigned char length;
} __attribute__((__packed__));
-struct ipc_sms_deliver_report_response_data {
- unsigned short ack; // IPC_SMS_ACK
+struct ipc_sms_save_msg_response_data {
+ unsigned char magic;
+ unsigned short error;
+ unsigned short index;
} __attribute__((__packed__));
struct ipc_sms_del_msg_request_data {
@@ -114,17 +116,19 @@ struct ipc_sms_del_msg_response_data {
unsigned short index;
} __attribute__((__packed__));
-struct ipc_sms_save_msg_request_data {
- unsigned char magic;
- unsigned short index;
- unsigned char status; // IPC_SMS_STATUS
- unsigned char length;
+struct ipc_sms_deliver_report_request_data {
+ unsigned char type; // IPC_SMS_TYPE
+ unsigned short ack; // IPC_SMS_ACK
+ unsigned char id;
+ unsigned char unknown;
} __attribute__((__packed__));
-struct ipc_sms_save_msg_response_data {
- unsigned char magic;
- unsigned short error;
- unsigned short index;
+struct ipc_sms_deliver_report_response_data {
+ unsigned short ack; // IPC_SMS_ACK
+} __attribute__((__packed__));
+
+struct ipc_sms_svc_center_addr_header {
+ unsigned char length;
} __attribute__((__packed__));
/*
@@ -133,6 +137,7 @@ struct ipc_sms_save_msg_response_data {
void *ipc_sms_send_msg_setup(struct ipc_sms_send_msg_request_header *header,
const char *smsc, const char *pdu);
+char *ipc_sms_incoming_msg_pdu_extract(const void *data, size_t size);
#endif
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