Tizen 2.1 base
[platform/core/system/sync-agent.git] / include / data-adapter / luid.h
1 /*
2  * sync-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef LUID_H_
19 #define LUID_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif                          /* __cplusplus */
24
25 /**
26  * @file                luid.h
27  * @brief       Support to generate unique ID
28  */
29
30 /** @addtogroup data_adapter
31  *      @{
32  */
33
34 /**
35  * @brief                       Generate new item LUID to use inside agent, when add new item
36  * @remarks             Generated Sequence ID ( 1, 2, 3, .... ) to max ID value described in F/W initiation config file \<ID-Provider\>\<MaxID\>
37  * @par Usage:
38  * @code
39  
40  char **id_list = NULL;
41  
42  id_list = sync_agent_generate_item_luid(1, count);
43  if (id_list != NULL) {
44         for( int i = 0; i < count; i++) {
45                 do_something(id_list[i]);
46         }
47  }
48  
49  * @endcode
50  * @param[in]   id_provider_code        ID's seed value described in F/W initiation config file \<ID-Provider\>\<Code\>
51  * @param[in]   count   number of id to generate
52  * @return                      operation result
53  * @retval                      generated_item_luid_list                success (new item LUID converted to string)
54  * @retval                      0                                               fail
55  */
56         char **sync_agent_generate_item_luid(int id_provider_code, int count);
57
58 /**
59  * @brief                       Generate new folder LUID to use inside agent, when add new folder
60  * @par Usage:
61  * @code
62  
63  char *folder_id = NULL;
64
65  folder_id = sync_agent_generate_folder_luid();
66  do_something(folder_id);
67  
68  * @endcode
69  * @return                      operation result
70  * @retval                      folder_luid             success (new folder LUID converted to string)
71  * @retval                      0                                       fail
72  */
73         char *sync_agent_generate_folder_luid(void);
74
75 /**
76  *      @}
77  */
78
79 #ifdef __cplusplus
80 }
81 #endif                          /* __cplusplus */
82 #endif                          /* LUID_H_ */