Change getters to use methodCallForce
[platform/core/security/dpm-auth.git] / api / auth.h
1 /*
2  *  Copyright (c) 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 __CAPI_PASSWORD_POLICY_H__
18 #define __CAPI_PASSWORD_POLICY_H__
19
20 #include <dpm/device-policy-manager.h>
21
22 /**
23  * @file password.h
24  * @brief This file provides APIs to control password functionality
25  */
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 /**
32  * @addtogroup  CAPI_DPM_PASSWORD_POLICY_MODULE
33  * @{
34  */
35
36 /**
37  * @brief       Enumeration for dpm password quality type
38  * @since_tizen 3.0
39  */
40 typedef enum {
41         DPM_PASSWORD_QUALITY_UNSPECIFIED     = 0x00,    /**< No requirements for password. */
42         DPM_PASSWORD_QUALITY_SIMPLE_PASSWORD = 0x01,    /**< EAS(Exchange ActiveSync) requirement for simple password */
43         DPM_PASSWORD_QUALITY_SOMETHING       = 0x10,    /**< Some kind password is required, but doesn't care what it is */
44         DPM_PASSWORD_QUALITY_NUMERIC         = 0x20,    /**< Containing at least numeric characters */
45         DPM_PASSWORD_QUALITY_ALPHABETIC      = 0x40,    /**< Containing at least alphabetic (or other symbol) characters */
46         DPM_PASSWORD_QUALITY_ALPHANUMERIC    = 0x80,    /**< Containing at least numeric and alphabetic characters */
47 } dpm_password_quality_e;
48
49 /**
50  * @brief       Enumeration for dpm password status type
51  * @since_tizen 3.0
52  */
53 typedef enum {
54         DPM_PASSWORD_STATUS_NORMAL,                     /**< Password normal status */
55         DPM_PASSWORD_STATUS_CHANGED,                    /**< Password successfully changed */
56         DPM_PASSWORD_STATUS_NOT_CHANGED,                /**< Password not changed */
57         DPM_PASSWORD_STATUS_CHANGE_REQUIRED ,           /**< Password change required */
58         DPM_PASSWORD_STATUS_MAX_ATTEMPTS_EXCEEDED,      /**< Password Max Attempts Exceeded*/
59
60         DPM_PASSWORD_STATUS_EXPIRED,                    /**< Password expired */
61         DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_FAILED,   /**< Device unlock failed by Password Recovery */
62         DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_SUCCEEDED,/**< Device unlock succeeded by Password Recovery */
63
64         DPM_PASSWORD_STATUS_QUALITY_CHANGED,            /**< Password quality successfully changed */
65         DPM_PASSWORD_STATUS_MIN_LENGTH_CHANGED,         /**< Password min_length successfully changed */
66         DPM_PASSWORD_STATUS_COMPLEX_CHAR_CHANGED,       /**< Password complex_char successfully changed */
67         DPM_PASSWORD_STATUS_PATTERN_CHANGED             /**< Password pattern successfully changed */
68 } dpm_password_status_e;
69
70 /**
71  * @partner
72  * @brief       Sets password quality.
73  * @details     An administrator can set the password restrictions it is imposing.
74  *              After setting this, the user will not be able to
75  *              enter a new password that is not at least as restrictive as what has been set.
76  * @since_tizen 3.0
77  * @privlevel   partner
78  * @privilege   %http://tizen.org/privilege/dpm.password
79  * @param[in]   handle Device policy manager handle
80  * @param[in]   quality Password quality type, values of #dpm_password_quality_e combined with bitwise 'or'
81  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
82  * @retval      #DPM_ERROR_NONE Successful
83  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
84  * @retval      #DPM_ERROR_TIMED_OUT Time out
85  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
86  *              the privilege to call this API
87  * @pre         The handle must be created by dpm_manager_create().
88  * @see         dpm_manager_create()
89  */
90 int dpm_password_set_quality(device_policy_manager_h handle, int quality);
91
92 /**
93  * @partner
94  * @brief       Gets password quality.
95  * @details     An administrator can get the password restrictions it is imposing.
96  * @since_tizen 3.0
97  * @privlevel   partner
98  * @privilege   %http://tizen.org/privilege/dpm.password
99  * @param[in]   handle Device policy manager handle
100  * @param[out]   quality Password quality type, values of #dpm_password_quality_e combined with bitwise 'or'
101  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
102  * @retval      #DPM_ERROR_NONE Successful
103  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
104  * @retval      #DPM_ERROR_TIMED_OUT Time out
105  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
106  *              the privilege to call this API
107  * @pre         The handle must be created by dpm_manager_create().
108  * @see         dpm_manager_create()
109  */
110 int dpm_password_get_quality(device_policy_manager_h handle, int *quality);
111
112 /**
113  * @partner
114  * @brief       Sets password minimum length.
115  * @details     Sets the minimum allowed password length. After setting this,
116  *              the user will not be able to enter a new password that is
117  *              shorter than the setting length.
118  * @since_tizen 3.0
119  * @privlevel   partner
120  * @privilege   %http://tizen.org/privilege/dpm.password
121  * @param[in]   handle Device policy manager handle
122  * @param[in]   value Allowed minimum password length
123  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
124  * @retval      #DPM_ERROR_NONE Successful
125  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
126  * @retval      #DPM_ERROR_TIMED_OUT Time out
127  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
128  *              the privilege to call this API
129  * @pre         The handle must be created by dpm_manager_create().
130  * @see         dpm_manager_create()
131  */
132 int dpm_password_set_minimum_length(device_policy_manager_h handle, int value);
133
134 /**
135  * @partner
136  * @brief       Gets password minimum length.
137  * @details     Gets the minimum allowed password length.
138  * @since_tizen 3.0
139  * @privlevel   partner
140  * @privilege   %http://tizen.org/privilege/dpm.password
141  * @param[in]   handle Device policy manager handle
142  * @param[out]   value Allowed minimum password length
143  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
144  * @retval      #DPM_ERROR_NONE Successful
145  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
146  * @retval      #DPM_ERROR_TIMED_OUT Time out
147  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
148  *              the privilege to call this API
149  * @pre         The handle must be created by dpm_manager_create().
150  * @see         dpm_manager_create()
151  */
152 int dpm_password_get_minimum_length(device_policy_manager_h handle, int *value);
153
154 /**
155  * @partner
156  * @brief       Sets minimum complex char in password.
157  * @details     Complex characters are all non-alphabetic characters;
158  *              that is, numbers and symbols. Admin can configure this
159  *              setting and make the password more secure.
160  * @since_tizen 3.0
161  * @privlevel   partner
162  * @privilege   %http://tizen.org/privilege/dpm.password
163  * @param[in]   handle Device policy manager handle
164  * @param[in]   value Number of minimum complex char in password.
165  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
166  * @retval      #DPM_ERROR_NONE Successful
167  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
168  * @retval      #DPM_ERROR_TIMED_OUT Time out
169  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
170  *              the privilege to call this API
171  * @pre         The handle must be created by dpm_manager_create().
172  * @see         dpm_manager_create()
173  */
174 int dpm_password_set_min_complex_chars(device_policy_manager_h handle, int value);
175
176 /**
177  * @partner
178  * @brief       Gets minimum complex char in password.
179  * @details     Complex characters are all non-alphabetic characters;
180  *              that is, numbers and symbols.
181  * @since_tizen 3.0
182  * @privlevel   partner
183  * @privilege   %http://tizen.org/privilege/dpm.password
184  * @param[in]   handle Device policy manager handle
185  * @param[out]   value Number of minimum complex char in password.
186  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
187  * @retval      #DPM_ERROR_NONE Successful
188  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
189  * @retval      #DPM_ERROR_TIMED_OUT Time out
190  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
191  *              the privilege to call this API
192  * @pre         The handle must be created by dpm_manager_create().
193  * @see         dpm_manager_create()
194  */
195 int dpm_password_get_min_complex_chars(device_policy_manager_h handle, int *value);
196
197 /**
198  * @partner
199  * @brief       Sets maximum number of failed attempts before device is wiped.
200  * @details     If user fails the last attempt, device will be wiped.
201  * @since_tizen 3.0
202  * @privlevel   partner
203  * @privilege   %http://tizen.org/privilege/dpm.password
204  * @param[in]   handle Device policy manager handle
205  * @param[in]   value Maximum count for failed passwords.
206  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
207  * @retval      #DPM_ERROR_NONE Successful
208  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
209  * @retval      #DPM_ERROR_TIMED_OUT Time out
210  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
211  *              the privilege to call this API
212  * @pre         The handle must be created by dpm_manager_create().
213  * @see         dpm_manager_create()
214  */
215 int dpm_password_set_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int value);
216
217 /**
218  * @partner
219  * @brief       Gets maximum number of failed attempts before device is wiped.
220  * @details     If user fails the last attempt, device will be wiped.
221  * @since_tizen 3.0
222  * @privlevel   partner
223  * @privilege   %http://tizen.org/privilege/dpm.password
224  * @param[in]   handle Device policy manager handle
225  * @param[out]   value Maximum count for failed passwords.
226  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
227  * @retval      #DPM_ERROR_NONE Successful
228  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
229  * @retval      #DPM_ERROR_TIMED_OUT Time out
230  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
231  *              the privilege to call this API
232  * @pre         The handle must be created by dpm_manager_create().
233  * @see         dpm_manager_create()
234  */
235 int dpm_password_get_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int *value);
236
237 /**
238  * @partner
239  * @brief       Sets the number of days password expires.
240  * @details     An administrator can configure the password age to force
241  *              the user to enter a new password after every expiration period.
242  * @since_tizen 3.0
243  * @privlevel   partner
244  * @privilege   %http://tizen.org/privilege/dpm.password
245  * @param[in]   handle Device policy manager handle
246  * @param[in]   value Number of days after which the password expires.
247  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
248  * @retval      #DPM_ERROR_NONE Successful
249  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
250  * @retval      #DPM_ERROR_TIMED_OUT Time out
251  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
252  *              the privilege to call this API
253  * @pre         The handle must be created by dpm_manager_create().
254  * @see         dpm_manager_create()
255  */
256 int dpm_password_set_expires(device_policy_manager_h handle, int value);
257
258 /**
259  * @partner
260  * @brief       Gets the number of days password expires.
261  * @details     An administrator can get the password age to force
262  *              the user to enter a new password after every expiration period.
263  * @since_tizen 3.0
264  * @privlevel   partner
265  * @privilege   %http://tizen.org/privilege/dpm.password
266  * @param[in]   handle Device policy manager handle
267  * @param[out]   value Number of days after which the password expires.
268  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
269  * @retval      #DPM_ERROR_NONE Successful
270  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
271  * @retval      #DPM_ERROR_TIMED_OUT Time out
272  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
273  *              the privilege to call this API
274  * @pre         The handle must be created by dpm_manager_create().
275  * @see         dpm_manager_create()
276  */
277 int dpm_password_get_expires(device_policy_manager_h handle, int *value);
278
279 /**
280  * @partner
281  * @brief       Sets the number of min password history to avoid previous password.
282  * @details     An administrator can configure the number of previous
283  *              passwords which cannot be used when entering a new password.
284  * @since_tizen 3.0
285  * @privlevel   partner
286  * @privilege   %http://tizen.org/privilege/dpm.password
287  * @param[in]   handle Device policy manager handle
288  * @param[in]   value Number of previous passwords which cannot be used when
289  *              settings a new password.
290  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
291  * @retval      #DPM_ERROR_NONE Successful
292  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
293  * @retval      #DPM_ERROR_TIMED_OUT Time out
294  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
295  *              the privilege to call this API
296  * @pre         The handle must be created by dpm_manager_create().
297  * @see         dpm_manager_create()
298  */
299 int dpm_password_set_history(device_policy_manager_h handle, int value);
300
301 /**
302  * @partner
303  * @brief       Gets the number of min password history to avoid previous password.
304  * @details     An administrator can get the number of previous
305  *              passwords which cannot be used when entering a new password.
306  * @since_tizen 3.0
307  * @privlevel   partner
308  * @privilege   %http://tizen.org/privilege/dpm.password
309  * @param[in]   handle Device policy manager handle
310  * @param[out]   value Number of previous passwords which cannot be used when
311  *              settings a new password.
312  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
313  * @retval      #DPM_ERROR_NONE Successful
314  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
315  * @retval      #DPM_ERROR_TIMED_OUT Time out
316  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
317  *              the privilege to call this API
318  * @pre         The handle must be created by dpm_manager_create().
319  * @see         dpm_manager_create()
320  */
321 int dpm_password_get_history(device_policy_manager_h handle, int *value);
322
323 /**
324  * @partner
325  * @brief       Sets the required password pattern.
326  * @details     An administrator can force User to enter password based on
327  *              a regular expression.
328  * @since_tizen 3.0
329  * @privlevel   partner
330  * @privilege   %http://tizen.org/privilege/dpm.password
331  * @param[in]   handle Device policy manager handle
332  * @param[in]   pattern Password pattern. If regular expression is
333  *              [a-zA-Z]{4}[0-9]{4}, we can force user to enter a 8 character
334  *              password with first 4 alphabetic characters and next 4
335  *              numeric characters. An administrator must take care when
336  *              setting this pattern.
337  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
338  * @retval      #DPM_ERROR_NONE Successful
339  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
340  * @retval      #DPM_ERROR_TIMED_OUT Time out
341  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
342  *              the privilege to call this API
343  * @pre         The handle must be created by dpm_manager_create().
344  * @see         dpm_manager_create()
345  */
346 int dpm_password_set_pattern(device_policy_manager_h handle, const char *pattern);
347
348 /**
349  * @partner
350  * @brief       Resets password.
351  * @details     This takes effect immediately to the device password.
352  * @since_tizen 3.0
353  * @privlevel   partner
354  * @privilege   %http://tizen.org/privilege/dpm.password
355  * @param[in]   handle Device policy manager handle
356  * @param[in]   password New password
357  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
358  * @retval      #DPM_ERROR_NONE Successful
359  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
360  * @retval      #DPM_ERROR_TIMED_OUT Time out
361  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
362  *              the privilege to call this API
363  * @pre         The handle must be created by dpm_manager_create().
364  * @see         dpm_manager_create()
365  */
366 int dpm_password_reset(device_policy_manager_h handle, const char *password);
367
368 /**
369  * @partner
370  * @brief       Enforces password change.
371  * @details     An administrator can enforce password change. PasswordPolicy
372  *              change setting is launched.
373  * @since_tizen 3.0
374  * @privlevel   partner
375  * @privilege   %http://tizen.org/privilege/dpm.password
376  * @param[in]   handle Device policy manager handle
377  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
378  * @retval      #DPM_ERROR_NONE Successful
379  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
380  * @retval      #DPM_ERROR_TIMED_OUT Time out
381  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
382  *              the privilege to call this API
383  * @pre         The handle must be created by dpm_manager_create().
384  * @see         dpm_manager_create()
385  */
386 int dpm_password_enforce_change(device_policy_manager_h handle);
387
388 /**
389  * @partner
390  * @brief       Sets the maximum number of seconds of inactivity time
391  *              before the screen timeout occurs.
392  * @details     An administrator sets the maximum number of seconds of inactivity
393  *              time before the screen timeout occurs and a device user must
394  *              type the password to unlock the device.
395  * @since_tizen 3.0
396  * @privlevel   partner
397  * @privilege   %http://tizen.org/privilege/dpm.password
398  * @param[in]   handle Device policy manager handle
399  * @param[in]   value Maximum inactivity time for device lock. Specifies how soon
400  *              the device can be unlocked again after use, without reprompting for
401  *              the passcode.
402  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
403  * @retval      #DPM_ERROR_NONE Successful
404  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
405  * @retval      #DPM_ERROR_TIMED_OUT Time out
406  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
407  *              the privilege to call this API
408  * @pre         The handle must be created by dpm_manager_create().
409  * @see         dpm_manager_create()
410  */
411 int dpm_password_set_max_inactivity_time_device_lock(device_policy_manager_h handle, int value);
412
413 /**
414  * @partner
415  * @brief       Gets the maximum number of seconds of inactivity time
416  *              before the screen timeout occurs.
417  * @details     Called by an application that is managing the device to get
418  *              the value of timeout period.
419  * @since_tizen 3.0
420  * @privlevel   partner
421  * @privilege   %http://tizen.org/privilege/dpm.password
422  * @param[in]   handle Device policy manager handle
423  * @param[out]  value Pointer of Maximum inactivity time for device lock.
424  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
425  * @retval      #DPM_ERROR_NONE Successful
426  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
427  * @retval      #DPM_ERROR_TIMED_OUT Time out
428  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
429  *              the privilege to call this API
430  * @pre         The handle must be created by dpm_manager_create().
431  * @see         dpm_manager_create()
432  */
433 int dpm_password_get_max_inactivity_time_device_lock(device_policy_manager_h handle, int *value);
434
435 /**
436  * @partner
437  * @brief       Sets password status
438  * @details     An administrator can know password status for this API.
439  * @since_tizen 3.0
440  * @privlevel   partner
441  * @privilege   %http://tizen.org/privilege/dpm.password
442  * @param[in]   handle Device policy manager handle
443  * @param[in]   status Password status
444  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
445  * @retval      #DPM_ERROR_NONE Successful
446  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
447  * @retval      #DPM_ERROR_TIMED_OUT Time out
448  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
449  *              the privilege to call this API
450  * @pre         The handle must be created by dpm_manager_create().
451  * @see         dpm_manager_create()
452  */
453 int dpm_password_set_status(device_policy_manager_h handle, dpm_password_status_e status);
454
455 /**
456  * @partner
457  * @brief       Gets password status
458  * @details     An administrator can know password status for this API.
459  * @since_tizen 3.0
460  * @param[in]   handle Device policy manager handle
461  * @param[out]   status Password status
462  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
463  * @retval      #DPM_ERROR_NONE Successful
464  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
465  * @retval      #DPM_ERROR_TIMED_OUT Time out
466  * @pre         The handle must be created by dpm_manager_create().
467  * @see         dpm_manager_create()
468  */
469 int dpm_password_get_status(device_policy_manager_h handle, dpm_password_status_e *status);
470
471
472 /**
473  * @partner
474  * @brief       Removes all password patterns.
475  * @details     An administrator can remove all password patterns.
476  * @since_tizen 3.0
477  * @privlevel   partner
478  * @privilege   %http://tizen.org/privilege/dpm.password
479  * @param[in]   handle Device policy manager handle
480  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
481  * @retval      #DPM_ERROR_NONE Successful
482  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
483  * @retval      #DPM_ERROR_TIMED_OUT Time out
484  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
485  *              the privilege to call this API
486  * @pre         The handle must be created by dpm_manager_create().
487  * @see         dpm_manager_create()
488  */
489 int dpm_password_delete_pattern(device_policy_manager_h handle);
490
491 /**
492  * @partner
493  * @brief       Gets password pattern.
494  * @details     This API can be used for applying complexity on new password value.
495  * @since_tizen 3.0
496  * @privlevel   partner
497  * @privilege   %http://tizen.org/privilege/dpm.password
498  * @remarks     The @a pattern should be freed using free().
499  * @param[in]   handle Device policy manager handle
500  * @param[out]  pattern Password pattern
501  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
502  * @retval      #DPM_ERROR_NONE Successful
503  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
504  * @retval      #DPM_ERROR_TIMED_OUT Time out
505  * @retval      #DPM_ERROR_OUT_OF_MEMORY Out of memory
506  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
507  *              the privilege to call this API
508  * @pre         The handle must be created by dpm_manager_create().
509  * @see         dpm_manager_create()
510  */
511 int dpm_password_get_pattern(device_policy_manager_h handle, char **pattern);
512
513 /**
514  * @partner
515  * @brief       Sets the maximum number of times a character can occur in
516  *              the device password.
517  * @details     Called by an admin that is managing the device to specify that
518  *              any character in the device password cannot occur more than
519  *              the specified maximum number of times. Characters can be numeric
520  *              or alphabetic or symbolic. "aaabcde" has 'a' which occurs 3 times,
521  *              "1b1c1de" has '1' which occurs 3 times and "a@b@c@" has '@' which
522  *              occurs 3 times. A value of '0' specifies that no restrictions are
523  *              applied.
524  * @since_tizen 3.0
525  * @privlevel   partner
526  * @privilege   %http://tizen.org/privilege/dpm.password
527  * @param[in]   handle Device policy manager handle
528  * @param[in]   value Maximum character occurrences
529  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
530  * @retval      #DPM_ERROR_NONE Successful
531  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
532  * @retval      #DPM_ERROR_TIMED_OUT Time out
533  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
534  *              the privilege to call this API
535  * @pre         The handle must be created by dpm_manager_create().
536  * @see         dpm_manager_create()
537  */
538 int dpm_password_set_maximum_character_occurrences(device_policy_manager_h handle, int value);
539
540 /**
541  * @partner
542  * @brief       Gets the maximum number of times a character can occur in
543  *              the device password.
544  * @details     An administrator can retrieve the maximum number of times
545  *              a character can occur in the device password. If more than
546  *              one admin has set this value then the least value will take
547  *              preference.
548  * @since_tizen 3.0
549  * @privlevel   partner
550  * @privilege   %http://tizen.org/privilege/dpm.password
551  * @param[in]   handle Device policy manager handle
552  * @param[out]   value Pointer of Maximum Character Occurrences
553  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
554  * @retval      #DPM_ERROR_NONE Successful
555  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
556  * @retval      #DPM_ERROR_TIMED_OUT Time out
557  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
558  *              the privilege to call this API
559  * @pre         The handle must be created by dpm_manager_create().
560  * @see         dpm_manager_create()
561  */
562 int dpm_password_get_maximum_character_occurrences(device_policy_manager_h handle, int *value);
563
564 /**
565  * @partner
566  * @brief       Sets the maximum length of the numeric sequence
567  *              which is allowed in the device password.
568  * @details     Called by an administrator that is managing the device to set
569  *              the maximum numeric sequence length. This specifies that
570  *              the device password must not contain numeric sequences greater
571  *              than the given length.
572  *              Numeric sequences can be increasing successively by one like
573  *              "12345", or decreasing successively by one like "98765", or
574  *              repeating like "55555".
575  *              These are all numeric sequences of length '5'.
576  *              If maximum value is set to '5' then "123456" or "987654" or
577  *              "555555" are not allowed.
578  *              A value of '0' specifies that no such numeric sequence
579  *              restrictions are applied.
580  * @since_tizen 3.0
581  * @privlevel   partner
582  * @privilege   %http://tizen.org/privilege/dpm.password
583  * @param[in]   handle Device policy manager handle
584  * @param[in]   value Maximum numeric sequence length
585  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
586  * @retval      #DPM_ERROR_NONE Successful
587  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
588  * @retval      #DPM_ERROR_TIMED_OUT Time out
589  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
590  *              the privilege to call this API
591  * @pre         The handle must be created by dpm_manager_create().
592  * @see         dpm_manager_create()
593  */
594 int dpm_password_set_maximum_numeric_sequence_length(device_policy_manager_h handle, int value);
595
596 /**
597  * @partner
598  * @brief       Gets the maximum numeric sequence length allowed in
599  *              the device password.
600  * @details     An administrator can retrieve the length of numeric sequences
601  *              which are allowed in the device password.
602  *              For instance, if the return value is '3' then "123", "987",
603  *              "555" would all be numeric sequences of length '3' and will be
604  *              allowed in the device password.
605  *              If more than one admin has set this value then the least value
606  *              will take preference.
607  * @since_tizen 3.0
608  * @privlevel   partner
609  * @privilege   %http://tizen.org/privilege/dpm.password
610  * @param[in]   handle Device policy manager handle
611  * @param[out]  value Pointer of maximum numeric sequence length
612  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
613  * @retval      #DPM_ERROR_NONE Successful
614  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
615  * @retval      #DPM_ERROR_TIMED_OUT Time out
616  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
617  *              the privilege to call this API
618  * @pre         The handle must be created by dpm_manager_create().
619  * @see         dpm_manager_create()
620  */
621 int dpm_password_get_maximum_numeric_sequence_length(device_policy_manager_h handle, int *value);
622
623 /**
624  * @brief       The password forbidden string list iterator handle
625  * @since_tizen 3.0
626  * @see         dpm_password_create_iterator()
627  * @see         dpm_password_iterator_next()
628  * @see         dpm_password_destroy_iterator()
629  */
630 typedef void *dpm_password_iterator_h;
631
632 /**
633  * @partner
634  * @brief       Creates a password forbidden string list iterator.
635  * @details     The password forbidden string list iterator can be used to get all forbidden strings.
636  * @since_tizen 3.0
637  * @privlevel   partner
638  * @privilege   %http://tizen.org/privilege/dpm.password
639  * @param[in]   handle Device policy manager handle
640  * @return      A password forbidden string list iterator on success, otherwise
641  *              null value
642  * @remarks     The specific error code can be obtained by using the
643  *              get_last_result() method. Error codes are described in
644  *              exception section.
645  *              The returned iterator should be released using dpm_password_destroy_iterator().
646  * @exception   #DPM_ERROR_NONE No error
647  * @exception   #DPM_ERROR_OUT_OF_MEMORY Out of memory
648  * @exception   #DPM_ERROR_INVALID_PARAMETER Invalid parameter
649  * @exception   #DPM_ERROR_TIMED_OUT Time out
650  * @exception   #DPM_ERROR_PERMISSION_DENIED The application does not have
651  *              the privilege to call this API
652  * @pre         The handle must be created by dpm_manager_create().
653  * @see         dpm_manager_create()
654  * @see         dpm_password_iterator_next()
655  * @see         dpm_password_destroy_iterator()
656  * @see         get_last_result()
657  */
658 dpm_password_iterator_h dpm_password_create_iterator(device_policy_manager_h handle);
659
660 /**
661  * @partner
662  * @brief       Fetches a password forbidden string and forwards the iterator.
663  * @details     This API returns a password forbidden string indicated by the iterator, and then
664  *              the iterator is moved to the next position. If the iterator reaches
665  *              the end of the list, null value will be returned.
666  * @since_tizen 3.0
667  * @param[in]   iter The iterator to be controlled
668  * @param[out]  forbidden_string The forbidden string got from the iterator
669  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
670  * @remarks     The @a forbidden_string should not be freed using free().
671  * @retval      #DPM_ERROR_NONE Successful
672  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
673  * @retval      #DPM_ERROR_TIMED_OUT Time out
674  * @pre         The iter must be created by dpm_password_create_iterator().
675  * @see         dpm_passsword_create_iterator()
676  * @see         dpm_password_destroy_iterator()
677  */
678 int dpm_password_iterator_next(dpm_password_iterator_h iter, const char **forbidden_string);
679
680 /**
681  * @partner
682  * @brief       Frees the password forbidden string iterator.
683  * @details     This API frees the password forbidden string iterator. This API must be called
684  *              if the iterator no longer used.
685  * @since_tizen 3.0
686  * @privlevel   partner
687  * @privilege   %http://tizen.org/privilege/dpm.password
688  * @param[in]   iter The iterator to be removed
689  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
690  * @retval      #DPM_ERROR_NONE Successful
691  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
692  * @retval      #DPM_ERROR_TIMED_OUT Time out
693  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
694  *              the privilege to call this API
695  * @pre         The iter must be created by dpm_password_create_iterator()
696  * @see         dpm_password_create_iterator()
697  * @see         dpm_password_iterator_next()
698  */
699 int dpm_password_destroy_iterator(dpm_password_iterator_h iter);
700
701 /**
702  * @partner
703  * @brief       Sets strings which are forbidden in the device password.
704  * @details     Called by an admin that is managing the device to set strings that are forbidden to be used in the device password.
705  *              This specifies any strings which must not be present in the device password such as personal data (variations on the user's name, email address or X400 address), or any other strings.
706  *              If the parameter list has only one blank string(""), then the stored strings are cleared.
707  * @since_tizen 3.0
708  * @privlevel   partner
709  * @privilege   %http://tizen.org/privilege/dpm.password
710  * @param[in]   handle Device policy manager handle
711  * @param[in]   strings The forbidden strings
712  * @param[in]   length The length of the strings
713  * @return      #DPM_ERROR_NONE on success, otherwise a negative value
714  * @retval      #DPM_ERROR_NONE Successful
715  * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
716  * @retval      #DPM_ERROR_TIMED_OUT Time out
717  * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
718  *              the privilege to call this API
719  * @pre         The handle must be created by dpm_manager_create().
720  * @see         dpm_manager_create()
721  */
722 int dpm_password_set_forbidden_strings(device_policy_manager_h handle, const char *strings[], int length);
723
724 /**
725  * @}
726  */
727
728 #ifdef __cplusplus
729 }
730 #endif
731
732 #endif /*  __CAPI_PASSWORD_POLICY_H__ */