From 76e3d409b866f6dadc90e69f3d3e5e49f30a344b Mon Sep 17 00:00:00 2001 From: Simon Busch Date: Wed, 23 Nov 2011 19:18:10 +0100 Subject: vapi: bind SMS structures and methods Signed-off-by: Simon Busch --- samsung-ipc/sms.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 samsung-ipc/sms.c (limited to 'samsung-ipc/sms.c') diff --git a/samsung-ipc/sms.c b/samsung-ipc/sms.c new file mode 100644 index 0000000..f4b7a37 --- /dev/null +++ b/samsung-ipc/sms.c @@ -0,0 +1,49 @@ +/** + * This file is part of libsamsung-ipc. + * + * Copyright (C) 2011 Simon Busch + * + * libsamsung-ipc is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * libsamsung-ipc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libsamsung-ipc. If not, see . + * + */ + +#include +#include +#include + +unsigned char* ipc_sms_send_msg_pack(struct ipc_sms_send_msg *msg, char *smsc, + unsigned char *pdu, int pdu_length) +{ + unsigned char *data = NULL, *p = NULL; + unsigned int data_length = 0, smsc_len = 0; + + assert(smsc != NULL); + assert(pdu != NULL); + + smsc_len = strlen(smsc); + data_length = smsc_len + pdu_length + sizeof(struct ipc_sms_send_msg); + data = (unsigned char*) malloc(sizeof(unsigned char) * data_length); + memset(data, 0, data_length); + + p = data; + memcpy(p, &msg, sizeof(struct ipc_sms_send_msg)); + p += sizeof(struct ipc_sms_send_msg); + memcpy(p, (char*) (smsc + 1), smsc_len); + p += smsc_len; + memcpy(p, pdu, pdu_length); + + return data; +} + + -- cgit v1.1