3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * @brief This file is the header file of interface for common structure
24 #ifndef COMMON_DEFINE_H_
25 #define COMMON_DEFINE_H_
27 #include "common_define_internal.h"
30 * @par Description: API to create datastore_info_s structure
34 * @par Typical use case:
35 * @par Method of function operation:
36 * @par Important notes:
37 * @param[in] string type, target uri
38 * @param[in] string type, source uri
39 * @param[out] Status structure
41 * @return datastore_info_s on success
55 datastore_info_s *create_datastore_info(char *target, char *source);
58 * @par Description: API to free list of datastore_info_s structure
62 * @par Typical use case:
63 * @par Method of function operation:
64 * @par Important notes:
65 * @param[in] list of datastore_info_s structure
81 void free_datastore_infos(GList * datastore_infos);
84 * @par Description: API to free datastore_info_s structure
88 * @par Typical use case:
89 * @par Method of function operation:
90 * @par Important notes:
91 * @param[in] datastore_info_s structure
107 void free_datastore_info(datastore_info_s * datastore_info);
110 * @par Description: API to set sync type in datastore_info_s structure
114 * @par Typical use case:
115 * @par Method of function operation:
116 * @par Important notes:
117 * @param[in] datastore_info_s structure
118 * @param[in] enum type, sync type
134 void set_datastore_info_sync_type(datastore_info_s * datastore_info, alert_type_e sync_type);
137 * @par Description: API to set last anchor in datastore_info_s structure
141 * @par Typical use case:
142 * @par Method of function operation:
143 * @par Important notes:
144 * @param[in] datastore_info_s structure
145 * @param[in] string type, last anchor
161 void set_datastore_info_last_anchor(datastore_info_s * datastore_info, char *last_anchor);
164 * @par Description: API to set next anchor in datastore_info_s structure
168 * @par Typical use case:
169 * @par Method of function operation:
170 * @par Important notes:
171 * @param[in] datastore_info_s structure
172 * @param[in] string type, next anchor
188 void set_datastore_info_next_anchor(datastore_info_s * datastore_info, char *next_anchor);
191 * @par Description: API to set max_obj_size in datastore_info_s structure
195 * @par Typical use case:
196 * @par Method of function operation:
197 * @par Important notes:
198 * @param[in] datastore_info_s structure
199 * @param[in] unsigned int, max_obj_size
215 void set_datastore_info_max_obj_size(datastore_info_s * datastore_info, unsigned int max_obj_size);
218 * @par Description: API to create changed_item_s structure
222 * @par Typical use case:
223 * @par Method of function operation:
224 * @par Important notes:
225 * @param[in] enum type, change type of item
226 * @param[in] string type, luid of item
229 * @return changed_item_s on success
243 changed_item_s *create_changed_item(change_type_e type, char *luid);
246 * @par Description: API to free changed_item_s structure
250 * @par Typical use case:
251 * @par Method of function operation:
252 * @par Important notes:
253 * @param[in] changed_item_s structure
269 void free_changed_item(changed_item_s * changed_item);
272 * @par Description: API to set content type in changed_item_s structure
276 * @par Typical use case:
277 * @par Method of function operation:
278 * @par Important notes:
279 * @param[in] changed_item_s structure
280 * @param[in] string type, content type
296 void set_changed_item_content_type(changed_item_s * changed_item, char *content_type);
299 * @par Description: API to set data in changed_item_s structure
303 * @par Typical use case:
304 * @par Method of function operation:
305 * @par Important notes:
306 * @param[in] changed_item_s structure
307 * @param[in] string type, data
323 void set_changed_item_data(changed_item_s * changed_item, char *data);
326 * @par Description: API to set in changed_item_s structure
330 * @par Typical use case:
331 * @par Method of function operation:
332 * @par Important notes:
333 * @param[in] changed_item_s structure
334 * @param[in] datastore index(0=contacts, 1=calendar, 2= memo)
350 void set_changed_item_index_of_datastore(changed_item_s * changed_item, unsigned int indexOfDatastore);
353 * @par Description: API to create changed_datastore_s structure
357 * @par Typical use case:
358 * @par Method of function operation:
359 * @par Important notes:
360 * @param[in] string type, source uri
361 * @param[in] string type, target uri
362 * @param[in] int type, has numberOfChanges or not
363 * @param[in] unsigned int type, if numberOfChanges is true set count else set zero
366 * @return changed_datastore_s on success
380 changed_datastore_s *create_changed_datastore(char *source, char *target, int has_number_of_changes, unsigned int number_of_changes);
383 * @par Description: API to free list of changed_datastore_s
387 * @par Typical use case:
388 * @par Method of function operation:
389 * @par Important notes:
390 * @param[in] list of changed_datastore_s
406 void free_changed_datastores(GList * changed_datastores);
409 * @par Description: API to free changed_datastore_s structure
413 * @par Typical use case:
414 * @par Method of function operation:
415 * @par Important notes:
416 * @param[in] changed_datastore_s structure
432 void free_changed_datastore(changed_datastore_s * changed_datastore);
435 * @par Description: API to set changed_item in changed_datastore_s structure
439 * @par Typical use case:
440 * @par Method of function operation:
441 * @par Important notes:
442 * @param[in] changed_datastore_s structure
443 * @param[in] list of changed_item_s structure
459 void set_changed_datastore_changed_item(changed_datastore_s * changed_datastore, GList * changed_item);
462 * @par Description: API to add changed_item in changed_datastore_s structure
466 * @par Typical use case:
467 * @par Method of function operation:
468 * @par Important notes:
469 * @param[in] changed_datastore_s structure
470 * @param[in] changed_item_s structure
486 void add_changed_datastore_changed_item(changed_datastore_s * changed_datastore, changed_item_s * changed_item);
489 * @par Description: API to create applied_status_s structure
493 * @par Typical use case:
494 * @par Method of function operation:
495 * @par Important notes:
496 * @param[in] string type, luid of item
497 * @param[in] enum type, change type( CHANGE_ADD , CHANGE_REPLACE , CHANGE_DELETE)
498 * @param[in] int type, status code(200....)
501 * @return applied_status_s on success
515 applied_status_s *create_applied_status(char *luid, change_type_e change_type, int status);
518 * @par Description: API to free list of applied_status_s structure
522 * @par Typical use case:
523 * @par Method of function operation:
524 * @par Important notes:
525 * @param[in] list of applied_status_s structure
541 void free_applied_statuses(GList * applied_statuses);
544 * @par Description: API to free applied_status_s structure
548 * @par Typical use case:
549 * @par Method of function operation:
550 * @par Important notes:
551 * @param[in] applied_status_s structure
567 void free_applied_status(applied_status_s * applied_status);
570 * @par Description: API to create sending_status_s structure
574 * @par Typical use case:
575 * @par Method of function operation:
576 * @par Important notes:
577 * @param[in] source uri
578 * @param[in] target uri
581 * @return sending_status_s on success
595 sending_status_s *create_sending_status(char *source, char *target);
598 * @par Description: API to free list of sending_status_s structure
602 * @par Typical use case:
603 * @par Method of function operation:
604 * @par Important notes:
605 * @param[in] list of sending_status_s structure
621 void free_sending_statuses(GList * sending_statuses);
624 * @par Description: API to free sending_status_s structure
628 * @par Typical use case:
629 * @par Method of function operation:
630 * @par Important notes:
631 * @param[in] sending_status_s structure
647 void free_sending_status(sending_status_s * sending_status);
650 * @par Description: API to add applied_status_s in sending_status_s structure
654 * @par Typical use case:
655 * @par Method of function operation:
656 * @par Important notes:
657 * @param[in] sending_status_s structure
658 * @param[in] applied_status_s structure
674 void add_sending_status_applied_status(sending_status_s * sending_status, applied_status_s * applied_status);
677 * @par Description: API to create datastore_s structure
681 * @par Typical use case:
682 * @par Method of function operation:
683 * @par Important notes:
684 * @param[in] string type, target uri
685 * @param[in] string type, source uri
688 * @return datastore_s on success
702 datastore_s *create_datastore(char *target, char *source);
705 * @par Description: API to set content type infomation in datastore_s structure
709 * @par Typical use case:
710 * @par Method of function operation:
711 * @par Important notes:
712 * @param[in] datastore_s structure
713 * @param[in] int type, datastore_id(TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO)
714 * @param[in] int type, folder_type_id(9, 8, 10)
730 void set_datastore_content_type_info(datastore_s * datastore, int datastore_id, int folder_type_id);
733 * @par Description: API to set account information in datastore_s structure
737 * @par Typical use case:
738 * @par Method of function operation:
739 * @par Important notes:
740 * @param[in] datastore_s structure
741 * @param[in] string type, account_id
742 * @param[in] string type, account_pw
758 void set_datastore_account_info(datastore_s * datastore, char *account_id, char *account_pw);
761 * @par Description: API to set client sync type in datastore_s structure
765 * @par Typical use case:
766 * @par Method of function operation:
767 * @par Important notes:
768 * @param[in] datastore_s structure
769 * @param[in] enum type, sync type
785 void set_datastore_client_sync_type(datastore_s * datastore, alert_type_e sync_type);
788 * @par Description: API to set server sync type in datastore_s structure
792 * @par Typical use case:
793 * @par Method of function operation:
794 * @par Important notes:
795 * @param[in] datastore_s structure
796 * @param[in] enum type, sync type
812 void set_datastore_server_sync_type(datastore_s * datastore, alert_type_e sync_type);
815 * @par Description: API to set client anchor in datastore_s structure
819 * @par Typical use case:
820 * @par Method of function operation:
821 * @par Important notes:
822 * @param[in] datastore_s structure
823 * @param[in] string type, last anchor
824 * @param[in] string type, next anchor
840 void set_datastore_client_anchor(datastore_s * datastore, char *last_anchor, char *next_anchor);
843 * @par Description: API to set client anchor in datastore_s structure
847 * @par Typical use case:
848 * @par Method of function operation:
849 * @par Important notes:
850 * @param[in] datastore_s structure
851 * @param[in] string type, last anchor
852 * @param[in] string type, next anchor
868 void set_datastore_server_anchor(datastore_s * datastore, char *last_anchor, char *next_anchor);
871 * @par Description: API to create sync_result_s structure
875 * @par Typical use case:
876 * @par Method of function operation:
877 * @par Important notes:
878 * @param[in] datastore_s structure
879 * @param[in] string type, last anchor
880 * @param[in] string type, next anchor
883 * @return sync_result_s on success
897 sync_result_s *create_sync_result();
900 * @par Description: API to duplicate sync_result_s structure
904 * @par Typical use case:
905 * @par Method of function operation:
906 * @par Important notes:
907 * @param[in] sync_result_s structure
910 * @return sync_result_s on success
924 sync_result_s *dup_sync_result(sync_result_s * org_sync_result);
927 * @par Description: API to set number of total item in sync_result_s structure
931 * @par Typical use case:
932 * @par Method of function operation:
933 * @par Important notes:
934 * @param[in] sync_result_s structure
935 * @param[in] number of total item
951 void set_number_of_change(sync_result_s * sync_result, unsigned int number_of_change);
954 * @par Description: API to set number of received item in sync_result_s structure
958 * @par Typical use case:
959 * @par Method of function operation:
960 * @par Important notes:
961 * @param[in] sync_result_s structure
962 * @param[in] number of received item
978 void add_receive_count(sync_result_s * sync_result, unsigned int received_count);
981 * @par Description: API to set number of add item in sync_result_s structure
985 * @par Typical use case:
986 * @par Method of function operation:
987 * @par Important notes:
988 * @param[in] sync_result_s structure
989 * @param[in] number of add item
1005 void add_add_count(sync_result_s * sync_result, unsigned int add_cnt);
1008 * @par Description: API to set number of replace item in sync_result_s structure
1012 * @par Typical use case:
1013 * @par Method of function operation:
1014 * @par Important notes:
1015 * @param[in] sync_result_s structure
1016 * @param[in] number of replace item
1032 void add_replace_count(sync_result_s * sync_result, unsigned int replace_cnt);
1035 * @par Description: API to set number of delete item in sync_result_s structure
1039 * @par Typical use case:
1040 * @par Method of function operation:
1041 * @par Important notes:
1042 * @param[in] sync_result_s structure
1043 * @param[in] number of delete item
1059 void add_delete_count(sync_result_s * sync_result, unsigned int delete_cnt);
1062 * @par Description: API to free PreSyncReturnObj structure
1066 * @par Typical use case:
1067 * @par Method of function operation:
1068 * @par Important notes:
1069 * @param[in] pre_sync_return_obj_s structure
1085 void free_pre_sync_return_obj(pre_sync_return_obj_s * pre_sync_return_obj);
1088 * @par Description: API to free sync_obj_s structure
1092 * @par Typical use case:
1093 * @par Method of function operation:
1094 * @par Important notes:
1095 * @param[in] sync_obj_s structure
1111 void free_sync_obj(sync_obj_s * sync_obj);
1114 * @par Description: API to free sync_return_obj_s structure
1118 * @par Typical use case:
1119 * @par Method of function operation:
1120 * @par Important notes:
1121 * @param[in] sync_return_obj_s structure
1137 void free_sync_return_obj(sync_return_obj_s * sync_return_obj);
1140 * @par Description: API to free datastore_s structure
1144 * @par Typical use case:
1145 * @par Method of function operation:
1146 * @par Important notes:
1147 * @param[in] datastore_s structure
1163 void free_datastore(datastore_s * datastore);
1166 * @par Description: API to free sync_category structure
1170 * @par Typical use case:
1171 * @par Method of function operation:
1172 * @par Important notes:
1173 * @param[in] sync_service_s structure
1189 void free_sync_service(sync_service_s * category);
1191 #endif /* COMMON_DEFINE_H_ */