diff options
author | Simon Busch <morphis@gravedo.de> | 2011-10-24 18:28:10 +0200 |
---|---|---|
committer | Simon Busch <morphis@gravedo.de> | 2011-10-24 18:33:55 +0200 |
commit | ffc43da883c6c4905f27bb02986a1422ef492d92 (patch) | |
tree | e65880bc90fe83199d9472ddc58970cc2d60fe2c | |
parent | 9b58ea4d833f17f5c6848fbf84139f1eba899946 (diff) | |
download | external_libsamsung-ipc-ffc43da883c6c4905f27bb02986a1422ef492d92.zip external_libsamsung-ipc-ffc43da883c6c4905f27bb02986a1422ef492d92.tar.gz external_libsamsung-ipc-ffc43da883c6c4905f27bb02986a1422ef492d92.tar.bz2 |
Various updates and corrections
Signed-off-by: Simon Busch <morphis@gravedo.de>
-rw-r--r-- | include/net.h | 2 | ||||
-rw-r--r-- | include/sec.h | 109 | ||||
-rw-r--r-- | samsung-ipc/Makefile.am | 1 | ||||
-rw-r--r-- | samsung-ipc/sec.c | 33 | ||||
-rw-r--r-- | vapi/samsung-ipc-1.0.vapi | 15 |
5 files changed, 106 insertions, 54 deletions
diff --git a/include/net.h b/include/net.h index 9a6e821..9fbf698 100644 --- a/include/net.h +++ b/include/net.h @@ -58,7 +58,7 @@ struct ipc_net_current_plmn { char unk; - unsigned char reg_state; // IPC_NET_REGISTRATION_STATE_... + unsigned char slevel; char plmn[6]; unsigned char type; // IPC_NET_SERVICE_TYPE_... ? unsigned short lac; diff --git a/include/sec.h b/include/sec.h index 30df617..a5f7651 100644 --- a/include/sec.h +++ b/include/sec.h @@ -21,53 +21,60 @@ #ifndef __SEC_H__ #define __SEC_H__ -#define IPC_SEC_PIN_STATUS 0x0501 -#define IPC_SEC_PHONE_LOCK 0x0502 -#define IPC_SEC_CHANGE_LOCKING_PW 0x0503 -#define IPC_SEC_SIM_LANG 0x0504 -#define IPC_SEC_RSIM_ACCESS 0x0505 -#define IPC_SEC_GSIM_ACCESS 0x0506 -#define IPC_SEC_SIM_ICC_TYPE 0x0507 -#define IPC_SEC_LOCK_INFO 0x0508 -#define IPC_SEC_ISIM_AUTH 0x0509 - -#define IPC_SEC_PIN_SIM_INITIALIZING 0x00 -#define IPC_SEC_PIN_SIM_SIM_LOCK_REQUIRED 0x01 -#define IPC_SEC_PIN_SIM_INSIDE_PF_ERROR 0x02 -#define IPC_SEC_PIN_SIM_LOCK_SC 0x03 -#define IPC_SEC_PIN_SIM_LOCK_FD 0x04 -#define IPC_SEC_PIN_SIM_LOCK_PN 0x05 -#define IPC_SEC_PIN_SIM_LOCK_PU 0x06 -#define IPC_SEC_PIN_SIM_LOCK_PP 0x07 -#define IPC_SEC_PIN_SIM_LOCK_PC 0x08 -#define IPC_SEC_PIN_SIM_CARD_NOT_PRESENT 0x80 -#define IPC_SEC_PIN_SIM_CARD_ERROR 0x81 -#define IPC_SEC_PIN_SIM_INIT_COMPLETE 0x82 -#define IPC_SEC_PIN_SIM_PB_INIT_COMPLETE 0x83 +struct ipc_response; + +#define IPC_SEC_PIN_STATUS 0x0501 +#define IPC_SEC_PHONE_LOCK 0x0502 +#define IPC_SEC_CHANGE_LOCKING_PW 0x0503 +#define IPC_SEC_SIM_LANG 0x0504 +#define IPC_SEC_RSIM_ACCESS 0x0505 +#define IPC_SEC_GSIM_ACCESS 0x0506 +#define IPC_SEC_SIM_ICC_TYPE 0x0507 +#define IPC_SEC_LOCK_INFO 0x0508 +#define IPC_SEC_ISIM_AUTH 0x0509 + +#define IPC_SEC_PIN_SIM_INITIALIZING 0x00 +#define IPC_SEC_PIN_SIM_SIM_LOCK_REQUIRED 0x01 +#define IPC_SEC_PIN_SIM_INSIDE_PF_ERROR 0x02 +#define IPC_SEC_PIN_SIM_LOCK_SC 0x03 +#define IPC_SEC_PIN_SIM_LOCK_FD 0x04 +#define IPC_SEC_PIN_SIM_LOCK_PN 0x05 +#define IPC_SEC_PIN_SIM_LOCK_PU 0x06 +#define IPC_SEC_PIN_SIM_LOCK_PP 0x07 +#define IPC_SEC_PIN_SIM_LOCK_PC 0x08 +#define IPC_SEC_PIN_SIM_CARD_NOT_PRESENT 0x80 +#define IPC_SEC_PIN_SIM_CARD_ERROR 0x81 +#define IPC_SEC_PIN_SIM_INIT_COMPLETE 0x82 +#define IPC_SEC_PIN_SIM_PB_INIT_COMPLETE 0x83 /* Key types for the SIM card (SC) facility */ -#define IPC_SEC_PIN_SIM_LOCK_SC_PIN1_REQ 0x01 -#define IPC_SEC_PIN_SIM_LOCK_SC_PUK_REQ 0x02 -#define IPC_SEC_PIN_SIM_LOCK_SC_CARD_BLOCKED 0x05 +#define IPC_SEC_PIN_SIM_LOCK_SC_PIN1_REQ 0x01 +#define IPC_SEC_PIN_SIM_LOCK_SC_PUK_REQ 0x02 +#define IPC_SEC_PIN_SIM_LOCK_SC_CARD_BLOCKED 0x05 -#define IPC_SEC_PIN_TYPE_PIN1 0x03 -#define IPC_SEC_PIN_TYPE_PIN2 0x09 +#define IPC_SEC_PIN_TYPE_PIN1 0x03 +#define IPC_SEC_PIN_TYPE_PIN2 0x09 -#define IPC_SEC_SIM_CARD_TYPE_UNKNOWN 0x00 -#define IPC_SEC_SIM_CARD_TYPE_SIM 0x01 -#define IPC_SEC_SIM_CARD_TYPE_USIM 0x02 +#define IPC_SEC_SIM_CARD_TYPE_UNKNOWN 0x00 +#define IPC_SEC_SIM_CARD_TYPE_SIM 0x01 +#define IPC_SEC_SIM_CARD_TYPE_USIM 0x02 + +#define IPC_SEC_RSIM_COMMAND_READ_BINARY 0xb0 +#define IPC_SEC_RSIM_COMMAND_READ_RECORD 0xc0 +#define IPC_SEC_RSIM_COMMAND_UPDATE_BINARY 0xd6 +#define IPC_SEC_RSIM_COMMAND_STATUS 0xf2 struct ipc_sec_pin_status_noti { - unsigned char type; - unsigned char key; + unsigned char type; + unsigned char key; } __attribute__((__packed__)); struct ipc_sec_pin_status_set { - unsigned char type; - unsigned char length1; - unsigned char length2; - unsigned char pin1[8]; - unsigned char pin2[8]; + unsigned char type; + unsigned char length1; + unsigned char length2; + unsigned char pin1[8]; + unsigned char pin2[8]; } __attribute__((__packed__)); struct ipc_sec_phone_lock_request { @@ -75,19 +82,19 @@ struct ipc_sec_phone_lock_request { }; struct ipc_sec_phone_lock_response { - unsigned char type; - unsigned char status; + unsigned char type; + unsigned char status; } __attribute__((__packed__)); struct ipc_sec_rsim_access_request { - unsigned char command; - unsigned short fileid; - unsigned char p1, p2, p3; + unsigned char command; + unsigned short fileid; + unsigned char p1, p2, p3; } __attribute__((__packed__)); struct ipc_sec_rsim_access_response { - unsigned char sw1, sw2; - unsigned char len; + unsigned char sw1, sw2; + unsigned char len; } __attribute__((__packed__)); struct ipc_sec_lock_info_request { @@ -96,15 +103,13 @@ struct ipc_sec_lock_info_request { } __attribute__((__packed__)); struct ipc_sec_lock_info_response { - unsigned char num; - unsigned char type; - unsigned char key; - unsigned char attempts; + unsigned char num; + unsigned char type; + unsigned char key; + unsigned char attempts; } __attribute__((__packed__)); -void ipc_sec_rsim_access(unsigned char command, unsigned short file_id, - unsigned char p1, unsigned char p2, unsigned char p3, - unsigned char *rdata, unsigned int length, int request_id); +char* ipc_sec_rsim_access_response_get_file_data(struct ipc_response *response); #endif diff --git a/samsung-ipc/Makefile.am b/samsung-ipc/Makefile.am index 01962a4..eea752b 100644 --- a/samsung-ipc/Makefile.am +++ b/samsung-ipc/Makefile.am @@ -17,6 +17,7 @@ libsamsung_ipc_la_SOURCES = \ ipc_util.c \ util.c \ misc.c \ + sec.c \ $(NULL) libsamsung_ipc_la_LIBADD = \ diff --git a/samsung-ipc/sec.c b/samsung-ipc/sec.c new file mode 100644 index 0000000..1a7f154 --- /dev/null +++ b/samsung-ipc/sec.c @@ -0,0 +1,33 @@ +/** + * 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> + +char* ipc_sec_rsim_access_response_get_file_data(struct ipc_response *response) +{ + if (response == NULL) + return NULL; + + struct ipc_sec_rsim_access_response *rsimresp = (struct ipc_sec_rsim_access_response*) response->data; + char *file_data = (char*) malloc(sizeof(char) * rsimresp->len); + memcpy(file_data, response->data + sizeof(struct ipc_sec_rsim_access_response), rsimresp->len); + return file_data; +} diff --git a/vapi/samsung-ipc-1.0.vapi b/vapi/samsung-ipc-1.0.vapi index daf661a..47869f3 100644 --- a/vapi/samsung-ipc-1.0.vapi +++ b/vapi/samsung-ipc-1.0.vapi @@ -255,6 +255,15 @@ namespace SamsungIpc USIM, } + [CCode (cname = "gint8", cprefix = "IPC_SEC_RSIM_COMMAND_", has_type_id = false)] + public enum RSimCommandType + { + READ_BINARY, + READ_RECORD, + UPDATE_BINARY, + STATUS, + } + [CCode (cname = "struct ipc_sec_pin_status_noti", destroy_function = "")] public struct SimStatusMessage { @@ -292,7 +301,7 @@ namespace SamsungIpc [CCode (cname = "struct ipc_sec_rsim_access_request", destroy_function = "")] public struct RSimAccessRequestMessage { - public uint8 command; + public RSimCommandType command; public uint16 fileid; public uint8 p1; public uint8 p2; @@ -410,6 +419,7 @@ namespace SamsungIpc { public uint8 unk; public uint8 slevel; + [CCode (array_length_cname = "")] public uint8[] plmn; public uint8 type; public uint16 lac; @@ -600,6 +610,9 @@ namespace SamsungIpc public uint32 data_length; [CCode (array_length_cname = "data_length")] public uint8[] data; + + [CCode (cprefix = "ipc_")] + public string sec_rsim_access_response_get_file_data(); } public delegate int TransportCb(uint8[] data); |