tizen 2.4 release
[apps/home/starter.git] / lock_pwd / include / lock_pwd_verification.h
1 /*
2  * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __LOCK_PWD_VERIFICATION_H__
18 #define __LOCK_PWD_VERIFICATION_H__
19
20 #include <vconf.h>
21
22 #define PASSWORD_ATTEMPTS_MAX_NUM 5
23 #define MAX_SIMPLE_PASSWORD_NUM 4
24 #define INFINITE_ATTEMPT 0
25 #define PASSWORD_BLOCK_SECONDS 30
26 #define PASSWORD_TIMESTAMP_STR_LENGTH 512
27 #define VCONFKEY_SETAPPL_PASSWORD_TIMESTAMP_STR VCONFKEY_SETAPPL_PREFIX"/phone_lock_timestamp"
28
29 typedef enum {
30         PWD_EVENT_CORRECT = 0,
31         PWD_EVENT_INCORRECT_WARNING = 1,
32         PWD_EVENT_INCORRECT,
33         PWD_EVENT_INPUT_BLOCK_WARNING,
34         PWD_EVENT_INPUT_BLOCK,
35         PWD_EVENT_EMPTY,
36         PWD_EVENT_OVER,
37 } lock_pwd_event_e;
38
39 typedef struct {
40         unsigned int current_attempt;
41         unsigned int block_attempt;
42         unsigned int max_attempt;
43         unsigned int expire_sec;
44         unsigned int incorrect_count;
45         void *data;
46 } lock_pwd_policy;
47
48 int lock_pwd_verification_current_attempt_get(void);
49 int lock_pwd_verification_remain_attempt_get(void);
50
51 lock_pwd_event_e lock_pwd_verification_verify(const char *password);
52 void lock_pwd_verification_policy_create(void);
53
54 void lock_pwd_verification_popup_create(lock_pwd_event_e event);
55
56 #endif