aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/misc.c
diff options
context:
space:
mode:
authorSimon Busch <morphis@gravedo.de>2011-10-20 07:53:17 +0200
committerSimon Busch <morphis@gravedo.de>2011-10-20 07:53:17 +0200
commiteb4b7e1bba7db0368042a44d7f1e44c70a3a5b70 (patch)
tree6eb3f12235ce8c3ca49a63a2832062a33bb07045 /samsung-ipc/misc.c
parent80080d0b0c13bf24368b84a7636ffd1557654216 (diff)
downloadexternal_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.zip
external_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.tar.gz
external_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.tar.bz2
Add helper method to parse imsi from response data
Signed-off-by: Simon Busch <morphis@gravedo.de>
Diffstat (limited to 'samsung-ipc/misc.c')
-rw-r--r--samsung-ipc/misc.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/samsung-ipc/misc.c b/samsung-ipc/misc.c
new file mode 100644
index 0000000..0bca9c0
--- /dev/null
+++ b/samsung-ipc/misc.c
@@ -0,0 +1,34 @@
+/**
+ * This file is part of libsamsung-ipc.
+ *
+ * Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <radio.h>
+#include <string.h>
+
+#define DEFAULT_IMSI_LENGTH 15
+
+char* ipc_parse_misc_me_imsi(uint8_t *data, unsigned int size)
+{
+ if (data == NULL || size != DEFAULT_IMSI_LENGTH + 1 || data[0] != DEFAULT_IMSI_LENGTH)
+ return NULL;
+
+ char *buffer = (char*) malloc(sizeof(char) * DEFAULT_IMSI_LENGTH);
+ memcpy(buffer, &data[1], DEFAULT_IMSI_LENGTH);
+ return buffer;
+}