2 * This file is part of libsamsung-ipc.
4 * Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
5 * Copyright (C) 2011 Paul Kocialkowski <contact@paulk.fr>
7 * libsamsung-ipc is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
12 * libsamsung-ipc is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>.
24 #include <samsung-ipc.h>
26 void ipc_sec_pin_status_setup(struct ipc_sec_pin_status_request_data *message,
27 unsigned char pin_type, char *pin1, char *pin2)
32 memset(message, 0, sizeof(struct ipc_sec_pin_status_request_data));
34 message->type = pin_type;
38 strncpy((char *) message->pin1, pin1, 8);
39 message->pin1_length = strlen(pin1);
44 strncpy((char *) message->pin2, pin2, 8);
45 message->pin2_length = strlen(pin2);
49 void ipc_sec_lock_infomation_setup(struct ipc_sec_lock_infomation_request_data *message,
50 unsigned char pin_type)
56 message->type = pin_type;
59 char *ipc_sec_rsim_access_response_get_file_data(struct ipc_message_info *response)
62 int offset = (int) sizeof(struct ipc_sec_rsim_access_response_header);
68 struct ipc_sec_rsim_access_response_header *rsimresp = (struct ipc_sec_rsim_access_response_header*) response->data;
69 char *file_data = (char *) malloc(sizeof(char) * rsimresp->length);
71 for (n = 0; n < rsimresp->length; n++)
73 if (response->data[offset + n] == 0x0)
75 else if (response->data[offset + n] == 0xff)
78 file_data[size] = response->data[offset + n];
83 if (size < rsimresp->length)
84 file_data = (char *) realloc(file_data, sizeof(char) * size);
89 void ipc_sec_phone_lock_request_set_setup(struct ipc_sec_phone_lock_request_set_data *message,
90 int pin_type, int enable, char *passwd)
92 message->facility_type = pin_type;
93 message->active = enable ? 1 : 0;
97 strncpy((char *) message->password, passwd, 39);
98 message->password_length = strlen(passwd);
102 void ipc_sec_change_locking_pw_setup(struct ipc_sec_change_locking_pw_data *message,
103 int type, char *passwd_old, char *passwd_new)
105 message->facility_type = type;
107 if (passwd_old != NULL)
109 strncpy((char *) message->password_old, passwd_old, 39);
110 message->password_old_length = strlen(passwd_old);
113 if (passwd_new != NULL)
115 strncpy((char *) message->password_new, passwd_new, 39);
116 message->password_new_length = strlen(passwd_new);
120 // vim:ts=4:sw=4:expandtab