diff options
author | Simon Busch <morphis@gravedo.de> | 2011-10-20 07:53:17 +0200 |
---|---|---|
committer | Simon Busch <morphis@gravedo.de> | 2011-10-20 07:53:17 +0200 |
commit | eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70 (patch) | |
tree | 6eb3f12235ce8c3ca49a63a2832062a33bb07045 /samsung-ipc/misc.c | |
parent | 80080d0b0c13bf24368b84a7636ffd1557654216 (diff) | |
download | hardware_replicant_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.tar.gz hardware_replicant_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.tar.bz2 hardware_replicant_libsamsung-ipc-eb4b7e1bba7db0368042a44d7f1e44c70a3a5b70.zip |
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.c | 34 |
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; +} |