2 * This file is part of libsamsung-ipc.
4 * Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
5 * Copyright (C) 2011-2014 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 int ipc_sec_pin_status_setup(struct ipc_sec_pin_status_request_data *data,
27 unsigned char type, const char *pin1, const char *pin2)
35 memset(data, 0, sizeof(struct ipc_sec_pin_status_request_data));
39 pin1_length = strlen(pin1);
40 if (pin1_length > sizeof(data->pin1))
41 pin1_length = sizeof(data->pin1);
43 strncpy((char *) data->pin1, pin1, pin1_length);
47 pin2_length = strlen(pin2);
48 if (pin2_length > sizeof(data->pin2))
49 pin2_length = sizeof(data->pin2);
51 strncpy((char *) data->pin2, pin2, pin2_length);
57 int ipc_sec_phone_lock_request_set_setup(struct ipc_sec_phone_lock_request_set_data *data,
58 unsigned char facility_type, unsigned char active, const char *password)
60 size_t password_length;
65 memset(data, 0, sizeof(struct ipc_sec_phone_lock_request_set_data));
66 data->facility_type = facility_type;
67 data->active = active;
69 if (password != NULL) {
70 password_length = strlen(password);
71 if (password_length > sizeof(data->password))
72 password_length = sizeof(data->password);
74 data->password_length = (unsigned char) password_length;
75 strncpy((char *) data->password, password, password_length);
77 data->password_length = 0;
83 int ipc_sec_change_locking_pw_setup(struct ipc_sec_change_locking_pw_data *data,
84 unsigned char facility_type, const char *password_old,
85 const char *password_new)
87 size_t password_old_length;
88 size_t password_new_length;
93 data->facility_type = facility_type;
95 if (password_old != NULL) {
96 password_old_length = strlen(password_old);
97 if (password_old_length > sizeof(data->password_old_length))
98 password_old_length = sizeof(data->password_old_length);
100 data->password_old_length = (unsigned char) password_old_length;
101 strncpy((char *) data->password_old, password_old, password_old_length);
103 data->password_old_length = 0;
106 if (password_new != NULL) {
107 password_new_length = strlen(password_new);
108 if (password_new_length > sizeof(data->password_new_length))
109 password_new_length = sizeof(data->password_new_length);
111 data->password_new_length = (unsigned char) password_new_length;
112 strncpy((char *) data->password_new, password_new, password_new_length);
114 data->password_new_length = 0;
120 void *ipc_sec_rsim_access_get_file_data(const void *data, size_t size)
122 struct ipc_sec_rsim_access_response_header *header;
125 if (data == NULL || size < sizeof(struct ipc_sec_rsim_access_response_header))
128 header = (struct ipc_sec_rsim_access_response_header *) data;
130 file_data = calloc(1, header->length);
132 memcpy(file_data, (void *) ((unsigned char *) data + sizeof(struct ipc_sec_rsim_access_response_header)), header->length);
137 int ipc_sec_lock_infomation_setup(struct ipc_sec_lock_infomation_request_data *data,
143 memset(data, 0, sizeof(struct ipc_sec_lock_infomation_request_data));
150 // vim:ts=4:sw=4:expandtab