diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-13 01:51:48 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-13 01:51:48 +0900 |
commit | d6aa47559c38d7e20d6d6a7a3671fa48ed58b9eb (patch) | |
tree | 5fbc758662a7866e32ec1adcfd9149c71987549e /include | |
parent | 8fe192a924f295972402d46141e39b86241a1441 (diff) | |
download | oma-ds-agent-d6aa47559c38d7e20d6d6a7a3671fa48ed58b9eb.tar.gz oma-ds-agent-d6aa47559c38d7e20d6d6a7a3671fa48ed58b9eb.tar.bz2 oma-ds-agent-d6aa47559c38d7e20d6d6a7a3671fa48ed58b9eb.zip |
Tizen 2.1 base
Diffstat (limited to 'include')
30 files changed, 8581 insertions, 0 deletions
diff --git a/include/common/common_define.h b/include/common/common_define.h new file mode 100755 index 0000000..4612b39 --- /dev/null +++ b/include/common/common_define.h @@ -0,0 +1,1191 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @Common_Define.h + * @version 0.1 + * @brief This file is the header file of interface for common structure + */ + +#ifndef COMMON_DEFINE_H_ +#define COMMON_DEFINE_H_ + +#include "common_define_internal.h" + +/** + * @par Description: API to create datastore_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, target uri + * @param[in] string type, source uri + * @param[out] Status structure + * + * @return datastore_info_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +datastore_info_s *create_datastore_info(char *target, char *source); + +/** + * @par Description: API to free list of datastore_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of datastore_info_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_datastore_infos(GList * datastore_infos); + +/** + * @par Description: API to free datastore_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_info_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_datastore_info(datastore_info_s * datastore_info); + +/** + * @par Description: API to set sync type in datastore_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_info_s structure + * @param[in] enum type, sync type + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_info_sync_type(datastore_info_s * datastore_info, alert_type_e sync_type); + +/** + * @par Description: API to set last anchor in datastore_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_info_s structure + * @param[in] string type, last anchor + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_info_last_anchor(datastore_info_s * datastore_info, char *last_anchor); + +/** + * @par Description: API to set next anchor in datastore_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_info_s structure + * @param[in] string type, next anchor + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_info_next_anchor(datastore_info_s * datastore_info, char *next_anchor); + +/** + * @par Description: API to set max_obj_size in datastore_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_info_s structure + * @param[in] unsigned int, max_obj_size + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_info_max_obj_size(datastore_info_s * datastore_info, unsigned int max_obj_size); + +/** + * @par Description: API to create changed_item_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, change type of item + * @param[in] string type, luid of item + * @param[out] + * + * @return changed_item_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +changed_item_s *create_changed_item(change_type_e type, char *luid); + +/** + * @par Description: API to free changed_item_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] changed_item_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_changed_item(changed_item_s * changed_item); + +/** + * @par Description: API to set content type in changed_item_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] changed_item_s structure + * @param[in] string type, content type + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_changed_item_content_type(changed_item_s * changed_item, char *content_type); + +/** + * @par Description: API to set data in changed_item_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] changed_item_s structure + * @param[in] string type, data + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_changed_item_data(changed_item_s * changed_item, char *data); + +/** + * @par Description: API to set in changed_item_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] changed_item_s structure + * @param[in] datastore index(0=contacts, 1=calendar, 2= memo) + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_changed_item_index_of_datastore(changed_item_s * changed_item, unsigned int indexOfDatastore); + +/** + * @par Description: API to create changed_datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, source uri + * @param[in] string type, target uri + * @param[in] int type, has numberOfChanges or not + * @param[in] unsigned int type, if numberOfChanges is true set count else set zero + * @param[out] + * + * @return changed_datastore_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +changed_datastore_s *create_changed_datastore(char *source, char *target, int has_number_of_changes, unsigned int number_of_changes); + +/** + * @par Description: API to free list of changed_datastore_s + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of changed_datastore_s + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_changed_datastores(GList * changed_datastores); + +/** + * @par Description: API to free changed_datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] changed_datastore_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_changed_datastore(changed_datastore_s * changed_datastore); + +/** + * @par Description: API to set changed_item in changed_datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] changed_datastore_s structure + * @param[in] list of changed_item_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_changed_datastore_changed_item(changed_datastore_s * changed_datastore, GList * changed_item); + +/** + * @par Description: API to add changed_item in changed_datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] changed_datastore_s structure + * @param[in] changed_item_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void add_changed_datastore_changed_item(changed_datastore_s * changed_datastore, changed_item_s * changed_item); + +/** + * @par Description: API to create applied_status_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, luid of item + * @param[in] enum type, change type( CHANGE_ADD , CHANGE_REPLACE , CHANGE_DELETE) + * @param[in] int type, status code(200....) + * @param[out] + * + * @return applied_status_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +applied_status_s *create_applied_status(char *luid, change_type_e change_type, int status); + +/** + * @par Description: API to free list of applied_status_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of applied_status_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_applied_statuses(GList * applied_statuses); + +/** + * @par Description: API to free applied_status_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] applied_status_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_applied_status(applied_status_s * applied_status); + +/** + * @par Description: API to create sending_status_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] source uri + * @param[in] target uri + * @param[out] + * + * @return sending_status_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sending_status_s *create_sending_status(char *source, char *target); + +/** + * @par Description: API to free list of sending_status_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of sending_status_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_sending_statuses(GList * sending_statuses); + +/** + * @par Description: API to free sending_status_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sending_status_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_sending_status(sending_status_s * sending_status); + +/** + * @par Description: API to add applied_status_s in sending_status_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sending_status_s structure + * @param[in] applied_status_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void add_sending_status_applied_status(sending_status_s * sending_status, applied_status_s * applied_status); + +/** + * @par Description: API to create datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, target uri + * @param[in] string type, source uri + * @param[out] + * + * @return datastore_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +datastore_s *create_datastore(char *target, char *source); + +/** + * @par Description: API to set content type infomation in datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_s structure + * @param[in] int type, datastore_id(TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO) + * @param[in] int type, folder_type_id(9, 8, 10) + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_content_type_info(datastore_s * datastore, int datastore_id, int folder_type_id); + +/** + * @par Description: API to set account information in datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_s structure + * @param[in] string type, account_id + * @param[in] string type, account_pw + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_account_info(datastore_s * datastore, char *account_id, char *account_pw); + +/** + * @par Description: API to set client sync type in datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_s structure + * @param[in] enum type, sync type + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_client_sync_type(datastore_s * datastore, alert_type_e sync_type); + +/** + * @par Description: API to set server sync type in datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_s structure + * @param[in] enum type, sync type + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_server_sync_type(datastore_s * datastore, alert_type_e sync_type); + +/** + * @par Description: API to set client anchor in datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_s structure + * @param[in] string type, last anchor + * @param[in] string type, next anchor + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_client_anchor(datastore_s * datastore, char *last_anchor, char *next_anchor); + +/** + * @par Description: API to set client anchor in datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_s structure + * @param[in] string type, last anchor + * @param[in] string type, next anchor + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_datastore_server_anchor(datastore_s * datastore, char *last_anchor, char *next_anchor); + +/** + * @par Description: API to create sync_result_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_s structure + * @param[in] string type, last anchor + * @param[in] string type, next anchor + * @param[out] + * + * @return sync_result_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_result_s *create_sync_result(); + +/** + * @par Description: API to duplicate sync_result_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_result_s structure + * @param[out] + * + * @return sync_result_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_result_s *dup_sync_result(sync_result_s * org_sync_result); + +/** + * @par Description: API to set number of total item in sync_result_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_result_s structure + * @param[in] number of total item + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_number_of_change(sync_result_s * sync_result, unsigned int number_of_change); + +/** + * @par Description: API to set number of received item in sync_result_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_result_s structure + * @param[in] number of received item + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void add_receive_count(sync_result_s * sync_result, unsigned int received_count); + +/** + * @par Description: API to set number of add item in sync_result_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_result_s structure + * @param[in] number of add item + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void add_add_count(sync_result_s * sync_result, unsigned int add_cnt); + +/** + * @par Description: API to set number of replace item in sync_result_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_result_s structure + * @param[in] number of replace item + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void add_replace_count(sync_result_s * sync_result, unsigned int replace_cnt); + +/** + * @par Description: API to set number of delete item in sync_result_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_result_s structure + * @param[in] number of delete item + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void add_delete_count(sync_result_s * sync_result, unsigned int delete_cnt); + +/** + * @par Description: API to free PreSyncReturnObj structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] pre_sync_return_obj_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_pre_sync_return_obj(pre_sync_return_obj_s * pre_sync_return_obj); + +/** + * @par Description: API to free sync_obj_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_obj_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_sync_obj(sync_obj_s * sync_obj); + +/** + * @par Description: API to free sync_return_obj_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_return_obj_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_sync_return_obj(sync_return_obj_s * sync_return_obj); + +/** + * @par Description: API to free datastore_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] datastore_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_datastore(datastore_s * datastore); + +/** + * @par Description: API to free sync_category structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_service_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_sync_service(sync_service_s * category); + +#endif /* COMMON_DEFINE_H_ */ diff --git a/include/common/common_define_internal.h b/include/common/common_define_internal.h new file mode 100755 index 0000000..c3078de --- /dev/null +++ b/include/common/common_define_internal.h @@ -0,0 +1,307 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @Common_Define_Internal.h + * @version 0.1 + * @brief This file is the header file of defined common structure for using between SE and SA + */ + +#ifndef COMMON_DEFINE_INTERNAL_H_ +#define COMMON_DEFINE_INTERNAL_H_ + +#include <malloc.h> +#include <stdio.h> +#include <glib.h> +#include <string.h> + +/* #define COMMUNICATION_TYPE SYNC_AGENT_PB_ENCODING_XML */ +#define COMMUNICATION_TYPE SYNC_AGENT_PB_ENCODING_WBXML_12 + +#define TRANSPORT_TYPE 1 /*http */ + /*#define TRANSPORT_TYPE "FW_MOBEX" *//*mobex -> does not support in OMA */ + +#define NETWORK_TIMEOUT 60 + +#define MAXIMUM_ACCOUNT_COUNT 5 + +#define PKG_NAME "oma-ds-agent" +#define DEFINE_PLATFORM 1 +#define LOW_BATTERY_LEVEL 10 + +#define OMA_DS_MSG_PATH "/opt/usr/data/oma-ds/debug_msg" +#define OMA_DS_CSC_CHECK_PATH "/opt/usr/data/oma-ds/csc_check" + +#define ELEMENT_TEXT_VCARD "text/x-vcard" +#define ELEMENT_TEXT_VCARD_30 "text/vcard" +#define ELEMENT_TEXT_VCAL "text/x-vcalendar" +#define ELEMENT_TEXT_ICAL "text/calendar" +#define ELEMENT_TEXT_PLAIN "text/plain" +#define ELEMENT_TEXT_XCALLLOG "text/x-calllog" +#define ELEMENT_TEXT_MESSAGE "text/x-vMessage" + +#define DEFINE_ALERT_UNKNOWN_STR "Unknown" +#define DEFINE_ALERT_SLOW_SYNC_STR "Full" +#define DEFINE_ALERT_TWO_WAY_STR "Update both" +#define DEFINE_ALERT_ONE_WAY_FROM_CLIENT_STR "Update to server" +#define DEFINE_ALERT_ONE_WAY_FROM_SERVER_STR "Update to phone" +#define DEFINE_ALERT_REFRESH_FROM_SERVER_STR "Refresh from server" +#define DEFINE_ALERT_REFRESH_FROM_CLIENT_STR "Refresh from phone" + +#define DEFINE_ALERT_SLOW_SYNC_VALUE "201" +#define DEFINE_ALERT_TWO_WAY_VALUE "200" +#define DEFINE_ALERT_ONE_WAY_FROM_CLIENT_VALUE "202" +#define DEFINE_ALERT_ONE_WAY_FROM_SERVER_VALUE "204" +#define DEFINE_ALERT_REFRESH_FROM_SERVER_VALUE "205" +#define DEFINE_ALERT_REFRESH_FROM_CLIENT_VALUE "203" + +#define DEFINE_CONFIG_KEY_PROFILE_SERVER_ID "Server_id" +#define DEFINE_CONFIG_KEY_PROFILE_SYNC_MODE "Sync_mode" +#define DEFINE_CONFIG_KEY_PROFILE_SERVER_IP "Server_ip" +#define DEFINE_CONFIG_KEY_PROFILE_NEXT_NONCE "Next_nonce" +#define DEFINE_CONFIG_KEY_PROFILE_DIR_NAME "Dir_name" +#define DEFINE_CONFIG_KEY_PROFILE_SYNCHRONISING "Synchronising" +#define DEFINE_CONFIG_KEY_PROFILE_RESUME "Resume" +#define DEFINE_CONFIG_KEY_PROFILE_NAME "Name" +#define DEFINE_CONFIG_KEY_PROFILE_CLIENT_SYNC_TYPE "Client_Sync_type" +#define DEFINE_CONFIG_KEY_PROFILE_SERVER_SYNC_TYPE "Server_Sync_type" +#define DEFINE_CONFIG_KEY_PROFILE_SYNC_INTERVAL "Sync_interval" +#define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_CONTACTS "Contacts" +#define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_CALENDAR "Organizer" +#define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_MEMO "Memo" +#define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_CALLLOG "CallLog" +#define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_SOURCE "source" +#define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_TARGET "target" +#define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_ID "id" +#define DEFINE_CONFIG_KEY_PROFILE_CATEGORY_PASSWORD "password" +#define DEFINE_CONFIG_KEY_PROFILE_LAST_SESSION_STATUS "Last_session_status" +#define DEFINE_CONFIG_KEY_PROFILE_LAST_SESSION_TIME "Last_session_time" +#define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_DBSYNCED "dbSynced" +#define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_LAST_TIME "last_session_time" +#define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_TOTAL "numberOfChanges" +#define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_NROFADD "add_count" +#define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_NROFDELETE "delete_count" +#define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_NROFREPLACE "replace_count" +#define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_SERVER "server" +#define DEFINE_CONFIG_KEY_PROFILE_STATISTICS_CLIENT "client" +#define DEFINE_CONFIG_KEY_PROFILE_ALARM_ID "Alarm_id" + +#define DEFINE_SYNC_MODE_MANUAL "Manual" +#define DEFINE_SYNC_MODE_PUSH "Push" +#define DEFINE_SYNC_MODE_PERIODIC "Periodic" + +#define DEFINE_SOURCE_CONTACT_URI "Contacts" +#define DEFINE_SOURCE_CALENDAR_URI "Organizer" +#define DEFINE_SOURCE_MEMO_URI "Memo" +#define DEFINE_SOURCE_CALLLOG_URI "CallLog" + +#define DEFINE_DIVE_SERVER_URL_HTTPS "https://syn.samsungdive.com/sync" +#define DEFINE_DIVE_SERVER_URL_HTTP "http://syn.samsungdive.com/sync" +#define DEFINE_DIVE_SERVER_ID "syn.samsungdive.com" +#define DEFINE_DIVE_DEFAULT_NEXT_NONCE "pcwds" + +typedef enum { + SYNC_SESSION_NOT_SYNCED_YET = -1, + SYNC_SESSION_FAILED = 0, + SYNC_SESSION_SUCCEEDED = 1, + SYNC_SESSION_STOPPED = 2, + SYNC_SESSION_SYNCHRONIZING = 3 +} sync_session_result_e; + +typedef enum { + ALERT_UNKNOWN = 0, + ALERT_DISPLAY = 100, + ALERT_TWO_WAY = 200, + ALERT_SLOW_SYNC = 201, + ALERT_ONE_WAY_FROM_CLIENT = 202, + ALERT_REFRESH_FROM_CLIENT = 203, + ALERT_ONE_WAY_FROM_SERVER = 204, + ALERT_REFRESH_FROM_SERVER = 205, + ALERT_TWO_WAY_BY_SERVER = 206, + ALERT_ONE_WAY_FROM_CLIENT_BY_SERVER = 207, + ALERT_REFRESH_FROM_CLIENT_BY_SERVER = 208, + ALERT_ONE_WAY_FROM_SERVER_BY_SERVER = 209, + ALERT_REFRESH_FROM_SERVER_BY_SERVER = 210, + ALERT_RESULT = 221, + ALERT_NEXT_MESSAGE = 222, + ALERT_NO_END_OF_DATA = 223, + ALERT_SUSPEND = 224, + ALERT_RESUME = 225, +} alert_type_e; + +typedef enum { + CHANGE_UNKNOWN = 0, + CHANGE_ADD = 1, + CHANGE_REPLACE = 2, + CHANGE_DELETE = 3 +} change_type_e; + +typedef enum { + TYPE_CONTACT = 0, + TYPE_CALENDAR, + TYPE_MEMO, + TYPE_CALLLOG, + + TYPE_SERVICE_COUNT +} service_type_e; + +typedef enum { + COMMON_INIT = 0, + COMMON_OK = 100, + COMMON_MISCONFIGURATION = 200, + COMMON_AUTHENTICATION_ERROR = 201, + COMMON_NOT_FOUND = 202, + COMMON_NO_MEMORY = 203, + COMMON_INTERNAL_ERROR = 204, + COMMON_SERVER_ERROR = 205, + COMMON_CONNECTION_ERROR = 206, + COMMON_AUTOCONFIG_NOT_SUPPORT_BY_SERVER = 207, + COMMON_BUSY_SIGNALING = 208, + COMMON_SUSPEND_FAIL = 209, + COMMON_CANCEL = 300, +} common_error_type_e; + +typedef struct { + sync_session_result_e session_result; + unsigned int number_of_change; + unsigned int received_count; + unsigned int add_count; + unsigned int replace_count; + unsigned int delete_count; +} sync_result_s; + +/** + * @brief Data Store information + * relevant information about Data Store\n + * + */ +typedef struct { + int datastore_id; /**< plugin_type : TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO, TYPE_CALL_LOG */ + int folder_type_id; /**< folder type id 0 */ + char *target; /**< target(server) URI */ + char *source; /**< source(client) URI */ + char *id; /**< account id */ + char *pw; /**< account pw */ + alert_type_e client_sync_type; /**< Sync Type(two-way, one-way ...) */ + alert_type_e server_sync_type; /**< Sync Type(two-way, one-way ...) */ + char *last_anchor_client; /**< Last Anchor of datastore for client side */ + char *next_anchor_client; /**< Next Anchor of datastore for client side */ + char *last_anchor_server; /**< Next Anchor of datastore for server side */ + char *next_anchor_server; /**< Next Anchor of datastore for server side */ + sync_result_s *client_sync_result; + sync_result_s *server_sync_result; +} datastore_s; + +typedef struct { + char *target; /**< target(server) URI */ + char *source; /**< source(client) URI */ + alert_type_e sync_type; /**< Sync Type(two-way, one-way ...) */ + char *last_anchor; /**< Last Anchor of datastore for client side */ + char *next_anchor; /**< Next Anchor of datastore for client side */ + unsigned int max_obj_size; +} datastore_info_s; + +/** + @brief Third parameter of pre_sync function + + Output data from pre_sync function\n + Data that need to be passed to Service Engine from Service Adapter result of pkg2 + + */ +typedef struct { + GList *datastore_info; /**< containing datastore_info structure*/ + char *dev_id; +} pre_sync_return_obj_s; + +/** + @brief a changed item(changelog) + + */ +typedef struct { + change_type_e change_type; /**< type of changes (add, replace, delete, copy, move ..) */ + char *luid; /**< luid of item */ + char *content_type; /**< content type of data */ + unsigned int index_of_datastore; + char *data; /**< data */ +} changed_item_s; + +/** + @brief item that are grouped by each Data Store + + */ +typedef struct { + char *source; /**< source(client) URI */ + char *target; /**< target(server) URI */ + int need_sync_command; + unsigned int number_of_changes; + int has_number_of_changes; + + GList *change_item; /**< containing changed_item all type */ + GList *sent_item; /**< containing changed_item */ +} changed_datastore_s; + +/** + @brief result of applied command that from service engine or server + + */ +typedef struct { + change_type_e change_type; /**< change type (add, replace, delete...) */ + char *luid; /**< luid of item */ + int status; /**< status of applied item */ +} applied_status_s; + +typedef struct { + char *source; /**< source(client) URI */ + char *target; /**< target(server) URI */ + GList *items; /**< containing appllied_status struct */ +} sending_status_s; + +/** + @brief second and third parameter of sync function + + */ +typedef struct { + GList *changed_datastore; /**< containing changed_datastore structure when it's in SyncObj it will be command that client send to server */ + GList *sending_status; /**< containing sending_status structure when it's in SyncObj status of add, replace, delete command from server */ +} sync_obj_s; + +typedef struct { + GList *changed_datastore; /**< containing changed_datastore structure when it's in SyncReturnObj command(add, relpace, delete) from server */ + GList *status; /**< containing applied_status structure when it's in SyncReturnObj return to engine(status of add, replace, delete command that client sent to server)*/ +} sync_return_obj_s; + +typedef struct { + service_type_e service_type; + int enabled; + char *src_uri; + char *tgt_uri; + char *id; + char *password; +} sync_service_s; + +typedef struct { + char *name; + char *accept; + char *id; + char *password; + char *auth_type; + char *auth_data; +} resource_cp_s; + +extern datastore_s *datastoreinfo_per_content_type[4]; + +#endif /* COMMON_DEFINE_INTERNAL_H_ */ diff --git a/include/common/common_util.h b/include/common/common_util.h new file mode 100755 index 0000000..ce10a90 --- /dev/null +++ b/include/common/common_util.h @@ -0,0 +1,187 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @Common_Util.h + * @version 0.1 + * @brief This file is the header file of interface for utility function + */ + +#ifndef COMMON_UTIL_H_ +#define COMMON_UTIL_H_ + +#include <stdbool.h> + +/** + * @par Description: API to create sync_agent_da_config_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] string type, key + * @param[in] string type, value(char *) + * @param[in] string type, type of value(string, int) + * @param[in] string type, name of access(SE, SA...) + * @param[out] sync_agent_da_config_s + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool create_config_str(int account_id, char *key, char *value, char *type, char *access_name, sync_agent_da_config_s ** config); + +/** + * @par Description: API to set value into config_tbl(key, value) + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] string type, key + * @param[in] string type, value(char *) + * @param[in] string type, type of value(string, int) + * @param[in] string type, name of access(SE, SA...) + * @param[out] + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool set_config_str(int account_id, char *key, char *value, char *type, char *access_name); + +/** + * @par Description: API to set value into config_tbl(key, value) + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] string type, key + * @param[in] int type, value(int) + * @param[in] string type, type of value(string, int) + * @param[in] string type, name of access(SE, SA...) + * @param[out] + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool set_config_int(int account_id, char *key, int value, char *type, char *access_name); + +/** + * @par Description: API to get value from config_tbl(key, value) + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] string type, key + * @param[out] string type, value + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_config(int account_id, char *key, char **value); + +/** + * @par Description: API to get account ID from profileDirName(Sync1...) + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, profileDirName(Sync1, Sync2...) + * @param[in] boolean type, already open agent db or not + * @param[out] + * + * @return account ID (more than 1) on success + * -1 on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int get_account_id(char *profile, bool open); + +/** + * @brief convert sync type(UI-> Engine) + * @param[in] sync type(Full, Update both, Update to server, Update to phone, Refresh from server, Refresh from phone) + * @return char * + * @retval value of sync type Success + * NULL Error + */ +/*int convert_synctype_value(char *syncType_str);*/ +/*char *convert_synctype_str(char *syncType_value);*/ +#endif /* COMMON_UTIL_H_ */ diff --git a/include/common/common_vconf.h b/include/common/common_vconf.h new file mode 100755 index 0000000..19cbcd7 --- /dev/null +++ b/include/common/common_vconf.h @@ -0,0 +1,249 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @Common_Vconf.h + * @version 0.1 + * @brief This file is the header file of defined vconf value + */ + +#ifndef COMMON_VCONF_H_ +#define COMMON_VCONF_H_ + +#include <stdbool.h> + +/** + * @par Description: API to get value(char*) from vconf + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, base key + * @param[in] string type, key + * @param[out] + * + * @return value on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +char *get_vconf_str(char *base_key, char *key); + +/** + * @par Description: API to get value(char*) from vconf + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, key + * @param[out] + * + * @return value on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +char *get_vconf_str_key(char *key); + +/** + * @par Description: API to get value(int) from vconf + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, base key + * @param[in] string type, key + * @param[out] int type, value + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_vconf_int(char *base_key, char *key, int *value); + +/** + * @par Description: API to get value(int) from vconf + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, key + * @param[out] int type, value + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_vconf_int_key(char *key, int *value); + +/** + * @par Description: API to set value(char*) into vconf + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, basekey + * @param[in] string type, key + * @param[in] string type, value + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool set_vconf_str(char *base_key, char *key, char *value); + +/** + * @par Description: API to set value(char*) into vconf + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, key + * @param[in] string type, value + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool set_vconf_str_key(char *key, char *value); + +/** + * @par Description: API to set value(int) into vconf + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, basekey + * @param[in] string type, key + * @param[in] int type, value + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool set_vconf_int(char *base_key, char *key, int value); + +/** + * @par Description: API to set value(int) into vconf + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, key + * @param[in] int type, value + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool set_vconf_int_key(char *key, int value); + +#endif /* COMMON_VCONF_H_ */ diff --git a/include/common/csc_keys.h b/include/common/csc_keys.h new file mode 100755 index 0000000..d34c3a3 --- /dev/null +++ b/include/common/csc_keys.h @@ -0,0 +1,50 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @CscKeys.h + * @version 0.1 + * @brief This file is the header file of define for CSC keys + */ + +#ifndef CSCKEYS_H_ +#define CSCKEYS_H_ + +/* SyncML DS */ +#define CSC_VCONF_KEY_SYNCMLDS_NBDATASYNC "db/SyncML/oma-ds-agent/DS/Accounts/NbDataSync" +#define CSC_VCONF_KEY_SYNCMLDS_NETWORK "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/NetworkName" +#define CSC_VCONF_KEY_SYNCMLDS_VERSION "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/DSVersion" +#define CSC_VCONF_KEY_SYNCMLDS_NAME "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Name" +#define CSC_VCONF_KEY_SYNCMLDS_ADDR "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/AppAddr/Addr" +#define CSC_VCONF_KEY_SYNCMLDS_AUTHNAME "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/AuthInfo/Client/AuthName" +#define CSC_VCONF_KEY_SYNCMLDS_AUTHPWD "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/AuthInfo/Client/AuthPWD" +#define CSC_VCONF_KEY_SYNCMLDS_SYNCTYPE "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/GUI/SyncType" +#define CSC_VCONF_KEY_SYNCMLDS_SYNCMODE "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/GUI/SyncMode" +#define CSC_VCONF_KEY_SYNCMLDS_CONTACTS_ENABLED "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Contacts/Enabled" +#define CSC_VCONF_KEY_SYNCMLDS_CONTACTS_TGTURI "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Contacts/TgtURI" +#define CSC_VCONF_KEY_SYNCMLDS_CONTACTS_AUTHNAME "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Contacts/AuthInfo/Server/AuthName" +#define CSC_VCONF_KEY_SYNCMLDS_CONTACTS_AUTHPWD "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Contacts/AuthInfo/Server/AuthPWD" +#define CSC_VCONF_KEY_SYNCMLDS_CALENDAR_ENABLED "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Calendar/Enabled" +#define CSC_VCONF_KEY_SYNCMLDS_CALENDAR_TGTURI "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Calendar/TgtURI" +#define CSC_VCONF_KEY_SYNCMLDS_CALENDAR_AUTHNAME "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Calendar/AuthInfo/Server/AuthName" +#define CSC_VCONF_KEY_SYNCMLDS_CALENDAR_AUTHPWD "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Calendar/AuthInfo/Server/AuthPWD" +#define CSC_VCONF_KEY_SYNCMLDS_MEMO_ENABLED "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Memo/Enabled" +#define CSC_VCONF_KEY_SYNCMLDS_MEMO_TGTURI "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Memo/TgtURI" +#define CSC_VCONF_KEY_SYNCMLDS_MEMO_AUTHNAME "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Memo/AuthInfo/Server/AuthName" +#define CSC_VCONF_KEY_SYNCMLDS_MEMO_AUTHPWD "db/SyncML/oma-ds-agent/DS/Accounts/Sync%d/Resource/Memo/AuthInfo/Server/AuthPWD" + +#endif /* CSCKEYS_H_ */ diff --git a/include/framework/event/oma_ds_event_handler.h b/include/framework/event/oma_ds_event_handler.h new file mode 100755 index 0000000..27bf66b --- /dev/null +++ b/include/framework/event/oma_ds_event_handler.h @@ -0,0 +1,354 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @OMA_DS_Event_Handler.h + * @version 0.1 + * @brief This file is the header file of interface for event callback function(from UI) + */ + +#ifndef OMA_DS_EVENT_HANDLER_H_ +#define OMA_DS_EVENT_HANDLER_H_ + +#include <stdio.h> +#include <sync_agent.h> + +/** + * @par Description: This API is event callback function for add profile + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_add_profile_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for edit profile + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_edit_profile_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for delete profile + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_delete_profile_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for request sync + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_request_sync_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for cancel sync + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_cancel_sync_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for get profile data + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_get_profile_data_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for getting profile sync category + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_get_profile_sync_category_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for last statistics + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_get_profile_last_statistics_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for add profile for CP + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_add_profile_cp_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for request callog sync + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_request_calllog_sync_async(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for request reset all data + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_request_reset_all_data_sync(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +/** + * @par Description: This API is event callback function for request reset all data + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] buffer for incomming parameter + * @param[in] buffer for outgoing parameter + * @param[out] + * + * @return 0 on success + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int event_callback_request_get_all_profiles_data(sync_agent_event_data_s * request, sync_agent_event_data_s * response); + +#endif /* OMA_DS_EVENT_HANDLER_H_ */ diff --git a/include/framework/event/oma_ds_platform_event_handler.h b/include/framework/event/oma_ds_platform_event_handler.h new file mode 100755 index 0000000..4305e43 --- /dev/null +++ b/include/framework/event/oma_ds_platform_event_handler.h @@ -0,0 +1,114 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @OMA_DS_Platform_Event_Handler.h + * @version 0.1 + * @brief This file is the header file of interface for event callback function(platform monitor) + */ + +#ifndef OMA_DS_PLATFORM_EVENT_HANDLER_H_ +#define OMA_DS_PLATFORM_EVENT_HANDLER_H_ + +#include <glib.h> +#include <stdio.h> +#include <stdbool.h> + +/** + * @par Description: API to parse callback function for SAN + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, msg body + * @param[in] unsigned int type, size of msg + * @param[in] int type, version + * @param[out] + * + * @return 1 on success + * 0 on fail + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int san_callback_parse(int item_id, void *user_data); + +/** + * @par Description: This API is callback function for scheduler + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] scheduler Id + * @param[in] user data + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void send_periodic_sync_msg(int scheduler_id, void *data); + +/** + * @par Description: This API is for receive ip push msg from event + * + * Parse ip push msg and request sync + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] data(ip push message) + * + * @return 1 on success + * 0 on fail + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int send_ip_push_sync_msg(char *data); + +#endif /* OMA_DS_PLATFORM_EVENT_HANDLER_H_ */ diff --git a/include/framework/san-parser/pm_sanparser.h b/include/framework/san-parser/pm_sanparser.h new file mode 100755 index 0000000..47b5bf5 --- /dev/null +++ b/include/framework/san-parser/pm_sanparser.h @@ -0,0 +1,224 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @PM_SanParser.h + * @version 0.1 + * @brief This file is the header file of interface and defined structure for San Parser + */ + +#ifndef PM_SANPARSER_H_ +#define PM_SANPARSER_H_ + +/* FIXME : When initialize, set "Server_id" at config_tbl.. +#define SMLDS_MOBILEDIT_SERVER (char *)"mobiledit" +#define SMLDS_FUNAMBOL_SERVER (char *)"funambol" +#define SMLDS_O3SIS_SERVER_SAN_IDENTIFIER (char *)"O3SIS SyncML Server" +*/ + +typedef enum { + SAN_UIMODE_UNSPECIFIED = 0, + SAN_UIMODE_BACKGROUND = 1, + SAN_UIMODE_INFORMATIVE = 2, + SAN_UIMODE_USER = 3 +} san_ui_mode_e; + +typedef enum { + SAN_INITIATOR_USER = 0, + SAN_INITIATOR_SERVER = 1 +} san_initiator_e; + +typedef enum { + SAN_SYNC_TYPE_TWO_WAY_BY_SERVER = 206, + SAN_SYNC_TYPE_ONE_WAY_FROM_CLIENT_BY_SERVER = 207, + SAN_SYNC_TYPE_REFRESH_FROM_CLIENT_BY_SERVER = 208, + SAN_SYNC_TYPE_ONE_WAY_FROM_SERVER_BY_SERVER = 209, + SAN_SYNC_TYPE_REFRESH_FROM_SERVER_BY_SERVER = 210, +} san_sync_type_e; + +typedef struct san_cred san_cred_s; +struct san_cred { + char *cred_format; + char *cred_auth; + char *cred_data; +}; + +typedef struct san_content_type san_content_type_s; +struct san_content_type { + unsigned int type; + char *strType; +}; + +typedef struct san_sync_alert san_sync_alert_s; +struct san_sync_alert { + san_sync_type_e sync_type; + char *content_type; + char *server_uri; +}; + +typedef struct san_package san_package_s; +struct san_package { + char *msg_body_without_digest; + unsigned int msg_body_without_digest_length; + char *digest; + unsigned int version; + san_ui_mode_e ui_mode; + san_initiator_e initiator; + unsigned int session_id; + san_cred_s *cred; + char *server_id; + unsigned int cnt_sync_alerts; + san_sync_alert_s *sync_alerts; +}; + +/** + * @par Description: API to parse for SAN version 1.2 + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, msg body + * @param[in] unsigned int type, size of msg + * @param[out] + * + * @return san_package_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +san_package_s *san_package_12_parser(const char *msg_body, unsigned int msg_size); + +/** + * @par Description: API to parse for SAN version 1.1 + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, msg body + * @param[in] unsigned int type, size of msg + * @param[out] + * + * @return san_package_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +san_package_s *san_package_11_parser(const char *msg_body, unsigned int msg_size); + +/** + * @par Description: API to free san_package_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] san_package_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void sanPackageParserFree(void *point); + +/** + * @par Description: API to print SAN msg for debugging + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] san_package_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void sanPrintMsg(san_package_s * san); + +/** + * @par Description: API to parse ip push message + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] data(ip push message) + * @param[out] san_package_s structure + * @param[out] id + * + * @return 1 on success + * 0 on fail + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int parse_ip_push_msg(char *data, san_package_s ** sanpackage, char **id); + +#endif /* PM_SANPARSER_H_ */ diff --git a/include/framework/task/oma_ds_engine_controller_task.h b/include/framework/task/oma_ds_engine_controller_task.h new file mode 100755 index 0000000..f4b3ccc --- /dev/null +++ b/include/framework/task/oma_ds_engine_controller_task.h @@ -0,0 +1,975 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @OMA_DS_Engine_Controller_Task.h + * @version 0.1 + * @brief This file is the header file of registration function for using Engine Controller + */ + +#ifndef ENGINE_CONTROLLER_TASK_H_ +#define ENGINE_CONTROLLER_TASK_H_ + +#include <stdio.h> +#include <sync_agent.h> + +#define SYNC_MODE_MANUAL 0 +#define SYNC_MODE_PERIODIC 1 +#define SYNC_MODE_SAN 2 +#define SYNC_MODE_AUTOCONFIG 3 + +typedef struct request_msg_info_s request_msg_info_t; +struct request_msg_info_s { + int sync_type; + unsigned int request_id; +}; + +#define EC_MSG_TYPE_SYNC_TASK_REQUEST 1 +#define EC_MSG_TYPE_NAME_SYNC_TASK_REQUEST "sync_request" +#define EC_MSG_TYPE_SYNC_TASK_ADD_PROFILE 2 +#define EC_MSG_TYPE_NAME_SYNC_TASK_ADD_PROFILE "add_profile" +#define EC_MSG_TYPE_SYNC_TASK_EDIT_PROFILE 3 +#define EC_MSG_TYPE_NAME_SYNC_TASK_EDIT_PROFILE "edit_profile" +#define EC_MSG_TYPE_SYNC_TASK_DELETE_PROFILE 4 +#define EC_MSG_TYPE_NAME_SYNC_TASK_DELETE_PROFILE "delete_profile" +#define EC_MSG_TYPE_SAN_TASK_REQUEST 5 +#define EC_MSG_TYPE_NAME_SAN_TASK_REQUEST "SAN_request" +#define EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_DATA 6 +#define EC_MSG_TYPE_NAME_SYNC_TASK_GET_PROFILE_DATA "get_profile_data" +#define EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_SYNC_CATEGORY 7 +#define EC_MSG_TYPE_NAME_SYNC_TASK_GET_PROFILE_SYNC_CATEGORY "get_profile_sync_category" +#define EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_STATISTICS 8 +#define EC_MSG_TYPE_NAME_SYNC_TASK_GET_PROFILE_STATISTICS "get_profile_statistics" +#define EC_MSG_TYPE_SYNC_TASK_RESET_SYNCHRONIZING_PROFILES 9 +#define EC_MSG_TYPE_NAME_SYNC_TASK_RESET_SYNCHRONIZING_PROFILES "reset_synchronizing_profiles" +#define EC_MSG_TYPE_SYNC_TASK_CANCEL_SYNC_REQUEST 10 +#define EC_MSG_TYPE_NAME_SYNC_TASK_CANCEL_SYNC_REQUEST "cancel_sync_request" +#define EC_MSG_TYPE_SYNC_TASK_ADD_PROFILE_CP 11 +#define EC_MSG_TYPE_NAME_SYNC_TASK_ADD_PROFILE_CP "add_profile_cp" +#define EC_MSG_TYPE_SYNC_TASK_REFRESH_FROM_SERVICE 12 +#define EC_MSG_TYPE_NAME_SYNC_TASK_REFRESH_FROM_SERVICE "refresh_from_service" +#define EC_MSG_TYPE_SYNC_TASK_RESET_ALL_DATA 13 +#define EC_MSG_TYPE_NAME_SYNC_TASK_RESET_ALL_DATA "reset_all_data" +#define EC_MSG_TYPE_SYNC_TASK_GET_ALL_PROFILES_DATA 14 +#define EC_MSG_TYPE_NAME_SYNC_TASK_GET_ALL_PROFILES_DATA "get_all_profiles_data" + +/** + * @par Description: API to create synchronize task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_synchronize_task(); + +/** + * @par Description: API to create synchronize task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_add_profile_task(); + +/** + * @par Description: API to create edit profile task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_edit_profile_task(); + +/** + * @par Description: API to create delete profiles task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_delete_profile_task(); + +/** + * @par Description: API to create get profile data task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_get_profile_data_task(); + +/** + * @par Description: API to create get profile sync category task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_get_profile_sync_category_task(); + +/** + * @par Description: API to create get profile last statistics task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_get_profile_statistics_task(); + +/** + * @par Description: API to create reset synchronizing profiles task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_reset_synchronizing_profiles_task(); + +/** + * @par Description: API to create reset synchronizing profiles task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_add_profile_cp_task(); + +/** + * @par Description: API to create reset refresh_from_service task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_refresh_from_service_task(); + +/** + * @par Description: API to create cancel network session task + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_cancel_request_task(); + +/** + * @par Description: API to reset all data + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_reset_all_data_task(); + +/** + * @par Description: API to get all profiles data + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return sync_agent_ec_task_spec_s structure on success + * NYLL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_spec_s *make_get_all_profiles_data_task(); +/** + * @par Description: This API is callback function which runs when synchronize task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e synchronize_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when add profile task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e add_profile_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when edit profile task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e edit_profile_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when delete profiles task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e delete_profile_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when get profile name task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e get_profile_data_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when get profile sync category task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e get_profile_sync_category_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when get profile last statistics task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e get_profile_statistics_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when reset synchronizing profiles task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e reset_synchronizing_profiles_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when cancel is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e cancel_sync_request_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when reset function is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e reset_all_data_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when reset function is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e get_all_profiles_data_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when add profile for cp task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e add_profile_cp_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: This API is callback function which runs when refresh_from_service task is requested + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, parameter count + * @param[in] array of parameters + * @param[out] + * + * @return SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS on success + * SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_ec_task_error_e refresh_from_service_task_process(unsigned int param_cnt, sync_agent_ec_param_param_s ** param_array); + +/** + * @par Description: API to insert request_msg_info_t structure into list + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_type(SYNC_MODE_MANUAL, SYNC_MODE_PERIODIC, SYNC_MODE_SAN, SYNC_MODE_AUTOCONFIG) + * @param[in] request id + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void insert_request_msg_info(int sync_type, unsigned int request_id); + +/** + * @par Description: API to delete request_msg_info_t structure from list + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] request id + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void delete_request_msg_info(unsigned int request_id); + +/** + * @par Description: API to get synchronizing request id and delete request_msg_info_t structure from list + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] request id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_synchronizing_request_id(unsigned int *request_id); + +/** + * @par Description: API to get manual sync request id and delete request_msg_info_t structure from list + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] request id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_manual_sync_request_id(unsigned int *request_id); + +/** + * @par Description: API to get periodic sync request id and delete request_msg_info_t structure from list + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] request id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_periodic_sync_request_id(unsigned int *request_id); + +/** + * @par Description: API to get SAN sync request id and delete request_msg_info_t structure from list + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] request id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_san_sync_request_id(unsigned int *request_id); + +/** + * @par Description: API to get auto configure sync request id and delete request_msg_info_t structure from list + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] request id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_auto_configure_request_id(unsigned int *request_id); + +/** + * @par Description: cancel current sync task(auto configure task or sync task) + * + * if auto configure task is processing, cancel auto configure task + * if sync task is processing, cancel sync task + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool cancel_current_sync_task(); + +#endif /* ENGINE_CONTROLLER_TASK_H_ */ diff --git a/include/service-adapter/network-binder/na_binder.h b/include/service-adapter/network-binder/na_binder.h new file mode 100755 index 0000000..a229bd2 --- /dev/null +++ b/include/service-adapter/network-binder/na_binder.h @@ -0,0 +1,85 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @NA_Binder.h + * @version 0.1 + * @brief This file is the header file of interface of NA Binder + */ + +#ifndef NA_BINDER_H_ +#define NA_BINDER_H_ + +#include <sync_agent.h> +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to header binding for HTTP protocol + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, access type(http, obex...) + * @param[in] string type, target uri + * @param[in] boolean type, xml or wbxml + * @param[out] GList type, list of header info + * + * @return 1 on success + * 0 on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int na_http_header_binder(char *acc_type, char *loc_uri, bool is_xml, char *jsession_id, GList ** list); + +/** + * @par Description: API to free sync_agent_na_common_header_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_na_common_header_info_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_header_info(sync_agent_na_common_header_info_s * common_header_info); + +#endif /* NA_BINDER_H_ */ diff --git a/include/service-adapter/protocol-binder/oma_ds_protocol_binder.h b/include/service-adapter/protocol-binder/oma_ds_protocol_binder.h new file mode 100755 index 0000000..ab25ad2 --- /dev/null +++ b/include/service-adapter/protocol-binder/oma_ds_protocol_binder.h @@ -0,0 +1,314 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @oma_ds_protocol_binder.h + * @version 0.1 + * @brief This file is the header file of interface of protocol binder + */ + +#ifndef OMA_DS_PROTOCOL_BINDER_H_ +#define OMA_DS_PROTOCOL_BINDER_H_ + +#include <sync_agent.h> +#include "service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h" + +/** + * @par Description: API to Initialize protocol binder function set + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return sync_agent_pb_error_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e init_oma_ds_1_2_binder_function_set(sync_agent_pb_protocol_binder_function_set_s ** binder_function_set); + +/** + * @par Description: API to free sync_agent_pb_protocol_binder_function_set_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_oma_ds_1_2_binder_function_set(sync_agent_pb_protocol_binder_function_set_s * binder_function_set); + +/** + * @par Description: API to Initialize protocol binder + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[in] enum type, sync_agent_pb_encoding_e(SYNC_AGENT_PB_ENCODING_XML, SYNC_AGENT_PB_ENCODING_WBXML_10, SYNC_AGENT_PB_ENCODING_WBXML_11, SYNC_AGENT_PB_ENCODING_WBXML_12, SYNC_AGENT_PB_ENCODING_WBXML_13) + * @param[in] boolean type, whether encode xml header or not + * @param[in] boolean type, whether use string table or not + * @param[in] boolean type, whether protocol is anonymous or not + * @param[in] boolean type, whether use flow mode or not + * @param[in] boolean type, whether use textual public id or not + * @param[in] sync_agent_pb_protocol_binder_function_set_s structure + * @param[out] + * + * @return sync_agent_pb_protocol_binder_info_s on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_protocol_binder_info_s *oma_ds_1_2_binder_init(sync_agent_pb_protocol_binder_info_s * binder, sync_agent_pb_encoding_e enc, bool encode_xml_header, + bool use_strtbl, bool produce_anonymous, bool use_flow_mode, bool text_public_id, sync_agent_pb_protocol_binder_function_set_s * binder_function_set); + +/** + * @par Description: API to append specific element to WBXML tree + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[in] enum type, protocol element + * @param[in] content(structure to append) + * @param[out] + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e oma_ds_1_2_binder_append(sync_agent_pb_protocol_binder_info_s * binder, oma_ds_protocol_element_e protocol_element, Content_Ptr content); + +/** + * @par Description: API to terminate sync_agent_pb_protocol_binder_info_s structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void oma_ds_1_2_binder_terminate(sync_agent_pb_protocol_binder_info_s * binder); + +/** + * @par Description: API to get stream + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] string type, stream from WBXML tree + * @param[out] unsigned int type, size of stream + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e oma_ds_1_2_binder_get_stream(sync_agent_pb_protocol_binder_info_s * binder, char **byte_stream, unsigned int *byte_stream_size); + +/** + * @par Description: API to get stream size + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] unsigned int type, size of stream + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e oma_ds_1_2_binder_get_stream_size(sync_agent_pb_protocol_binder_info_s * binder, unsigned int *byte_stream_size); + +/** + * @par Description: API to get encoding type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_info_s structure + * @param[out] enum type, sync_agent_pb_encoding_e(SYNC_AGENT_PB_ENCODING_XML, SYNC_AGENT_PB_ENCODING_WBXML_10, SYNC_AGENT_PB_ENCODING_WBXML_11, SYNC_AGENT_PB_ENCODING_WBXML_12, SYNC_AGENT_PB_ENCODING_WBXML_13) + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e oma_ds_1_2_binder_get_encoding(sync_agent_pb_protocol_binder_info_s * binder, sync_agent_pb_encoding_e * enc); + +/** + * @par Description: API to Initialize reverse protocol binder + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, WBXML stream to parse + * @param[in] unsigned int type, size of stream + * @param[in] enum type, decoding(SYNC_AGENT_PB_DECODING_XML, SYNC_AGENT_PB_DECODING_WBXML) + * @param[in] user data + * @param[out] sync_agent_pb_protocol_binder_reverse_info_s structure + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e reverse_oma_ds_1_2_binder_init(char *byte_stream, + unsigned int byte_stream_len, sync_agent_pb_decoding_e dec, sync_agent_pb_protocol_binder_function_set_s * binder_function_set, void *user_data, sync_agent_pb_protocol_binder_reverse_info_s ** binder); + +/** + * @par Description: API to parse and get next contents + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_agent_pb_protocol_binder_reverse_info_s structure + * @param[out] protocol element + * @param[out] string type, protocol element + * @param[out] parsed contents(defined structure) + * + * @return SYNC_AGENT_PB_RETURN_OK on success + * others on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sync_agent_pb_error_e reverse_oma_ds_1_2_binder_next(sync_agent_pb_protocol_binder_reverse_info_s * binder, Protocol_Element * protocol_element, char **protocol_element_name, Content_Ptr * content); + +#endif /* OMA_DS_PROTOCOL_BINDER_H_ */ diff --git a/include/service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h b/include/service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h new file mode 100755 index 0000000..a74bde5 --- /dev/null +++ b/include/service-adapter/protocol-binder/oma_ds_protocol_binder_definition.h @@ -0,0 +1,188 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @oma_ds_protocol_binder_definition.h + * @version 0.1 + * @brief This file is the header file for protocol binder definition + */ + +#ifndef OMA_DS_PROTOCOL_BINDER_DEFINITION_H_ +#define OMA_DS_PROTOCOL_BINDER_DEFINITION_H_ + +#define SYNC_AGENT_INIT_ESTIMATE_DOC_SIZE 20 + +/* SyncML */ +#define ELEMENT_SYNCML "SyncML" + +/* SyncHdr */ +#define ELEMENT_SYNCHDR "SyncHdr" +#define ELEMENT_VERDTD "VerDTD" +#define ELEMENT_VERDRD_10 "1.0" +#define ELEMENT_VERDRD_11 "1.1" +#define ELEMENT_VERDRD_12 "1.2" +#define ELEMENT_VERPROTO "VerProto" +#define ELEMENT_VERPROTO_10 "SyncML/1.0" +#define ELEMENT_VERPROTO_11 "SyncML/1.1" +#define ELEMENT_VERPROTO_12 "SyncML/1.2" +#define ELEMENT_SESSIONID "SessionID" +#define ELEMENT_MSGID "MsgID" +#define ELEMENT_RESPURI "RespURI" +#define ELEMENT_NORESP "NoResp" +#define ELEMENT_CRED "Cred" + +/* SyncBody */ +#define ELEMENT_SYNCBODY "SyncBody" +#define ELEMENT_CMD "Cmd" +#define ELEMENT_ADD "Add" +#define ELEMENT_REPLACE "Replace" +#define ELEMENT_ALERT "Alert" +#define ELEMENT_SYNC "Sync" +#define ELEMENT_PUT "Put" +#define ELEMENT_REPLACE "Replace" +#define ELEMENT_DELETE "Delete" +#define ELEMENT_MAP "Map" +#define ELEMENT_GET "Get" +#define ELEMENT_RESULTS "Results" +#define ELEMENT_STATUS "Status" +#define ELEMENT_CMDID "CmdID" +#define ELEMENT_ITEM "Item" +#define ELEMENT_NUMBEROFCHANGES "NumberOfChanges" +#define ELEMENT_MSGREF "MsgRef" +#define ELEMENT_CMDREF "CmdRef" +#define ELEMENT_TARGETREF "TargetRef" +#define ELEMENT_SOURCEREF "SourceRef" +#define ELEMENT_MAPITEM "MapItem" +#define ELEMENT_MOREDATA "MoreData" +#define ELEMENT_TARGET "Target" +#define ELEMENT_SOURCE "Source" +#define ELEMENT_LOCURI "LocURI" +#define ELEMENT_LOCNAME "LocName" +#define ELEMENT_CHAL "Chal" +#define ELEMENT_B64 "b64" +#define ELEMENT_DATA "Data" + +/* DevInf */ +#define ELEMENT_DEVINF "DevInf" +#define ELEMENT_MAN "Man" +#define ELEMENT_MOD "Mod" +#define ELEMENT_OEM "OEM" +#define ELEMENT_FWV "FwV" +#define ELEMENT_SWV "SwV" +#define ELEMENT_HWV "HwV" +#define ELEMENT_DEVID "DevID" +#define ELEMENT_DEVTYP "DevTyp" +#define ELEMENT_PAGER "Pager" +#define ELEMENT_HANDHELD "handheld" +#define ELEMENT_PDA "pda" +#define ELEMENT_PHONE "phone" +#define ELEMENT_SMARTPHONE "smartphone" +#define ELEMENT_SERVER "server" +#define ELEMENT_WORKSTATION "workstation" +#define ELEMENT_UTC "UTC" +#define ELEMENT_SUPPORTLARGEOBJS "SupportLargeObjs" +#define ELEMENT_SUPPORTNUMBEROFCHANGES "SupportNumberOfChanges" +#define ELEMENT_DATASTORE "DataStore" +#define ELEMENT_DISPLAYNAME "DisplayName" +#define ELEMENT_MAXGUIDSIZE "MaxGUIDSize" +#define ELEMENT_RX_PREF "Rx-Pref" +#define ELEMENT_RX "Rx" +#define ELEMENT_TX_PREF "Tx-Pref" +#define ELEMENT_TX "Tx" +#define ELEMENT_CTCAP "CTCap" +#define ELEMENT_CTTYPE "CTType" +#define ELEMENT_VERCT "VerCT" +#define ELEMENT_FIELDLEVEL "FieldLevel" +#define ELEMENT_PROPERTY "Property" +#define ELEMENT_PROPNAME "PropName" +#define ELEMENT_DATATYPE "DataType" +#define ELEMENT_MAXOCCUR "MaxOccur" +#define ELEMENT_MAXSIZE "MaxSize" +#define ELEMENT_NOTRUNCATE "NoTruncate" +#define ELEMENT_VALENUM "ValEnum" +#define ELEMENT_DISPLAYNAME "DisplayName" +#define ELEMENT_PROPPARAM "PropParam" +#define ELEMENT_PARAMNAME "ParamName" +#define ELEMENT_DSMEM "DSMem" +#define ELEMENT_SHAREDMEM "SharedMem" +#define ELEMENT_MAXMEM "MaxMem" +#define ELEMENT_MAXID "MaxID" +#define ELEMENT_SUPPORTHIERARCHICALSYNC "SupportHierarchicalSync" +#define ELEMENT_SYNCCAP "SyncCap" +#define ELEMENT_SYNCTYPE "SyncType" +#define ELEMENT_SYNCTYPE_1 "1" +#define ELEMENT_SYNCTYPE_2 "2" +#define ELEMENT_SYNCTYPE_3 "3" +#define ELEMENT_SYNCTYPE_4 "4" +#define ELEMENT_SYNCTYPE_5 "5" +#define ELEMENT_SYNCTYPE_6 "6" +#define ELEMENT_SYNCTYPE_7 "7" +#define ELEMENT_FILTER_RX "Filter-Rx" +#define ELEMENT_FILTERCAP "FilterCap" + +/* MetInf */ +#define ELEMENT_META "Meta" +#define ELEMENT_FORMAT "Format" +#define ELEMENT_NEXTNONCE "NextNonce" +#define ELEMENT_TYPE "Type" +#define ELEMENT_SIZE "Size" +#define ELEMENT_MAXMSGSIZE "MaxMsgSize" +#define ELEMENT_MAXOBJSIZE "MaxObjSize" +#define ELEMENT_ANCHOR "Anchor" +#define ELEMENT_LAST "Last" +#define ELEMENT_NEXT "Next" +#define ELEMENT_MEM "Mem" +#define ELEMENT_SHAREDMEM "SharedMem" +#define ELEMENT_FREEMEM "FreeMem" +#define ELEMENT_FREEID "FreeID" + +typedef enum { + PE_UNDEF = 0, + PE_ERROR, + PE_ADD, + PE_ALERT, + PE_ATOMIC_START, + PE_ATOMIC_END, + PE_COPY, + PE_DELETE, + PE_EXEC, + PE_GET, + PE_MAP, + PE_PUT_START, + PE_PUT_END, + PE_RESULTS_START, + PE_RESULTS_END, + PE_SEARCH, + PE_SEQUENCE_START, + PE_SEQUENCE_END, + PE_STATUS, + PE_SYNC_START, + PE_SYNC_END, + PE_REPLACE, + PE_HEADER, + PE_PUT_GET, + PE_CMD_GROUP, + PE_GENERIC, + PE_FINAL, + PE_DEVINF, + PE_SYNCML_START, + PE_SYNCML_END, + PE_BODY_START, + PE_BODY_END +} oma_ds_protocol_element_e; + +#endif /* OMA_DS_PROTOCOL_BINDER_DEFINITION_H_ */ diff --git a/include/service-adapter/sa_command.h b/include/service-adapter/sa_command.h new file mode 100755 index 0000000..7ded49f --- /dev/null +++ b/include/service-adapter/sa_command.h @@ -0,0 +1,866 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Commandl.h + * @version 0.1 + * @brief This file is the header file of interface of Command structure + */ + +#ifndef SA_COMMAND_H_ +#define SA_COMMAND_H_ + +#include "service-adapter/sa_define.h" +#include "common/common_define.h" + +/** + * @par Description: API to create alert command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, sync type + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] string type, last anchor + * @param[in] string type, next anchor + * @param[in] Cred structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_alert_command(session_s * session, alert_type_e sync_type, location_s * source, location_s * target, char *last_anchor, char *next_anchor, cred_s * cred, command_s ** command); + +/** + * @par Description: API to create get command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about target info) + * @param[in] string type, content type + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_get_command(session_s * session, location_s * target, const char *content_type, command_s ** command); + +/** + * @par Description: API to create put command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] string type, content type + * @param[in] DevInf structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_put_command(session_s * session, location_s * source, const char *content_type, devinf_s * devinf, command_s ** command); + +/** + * @par Description: API to create results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] string type, content type + * @param[in] DevInf structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_results_command(session_s * session, location_s * source, const char *content_type, devinf_s * devinf, command_s ** command); + +/** + * @par Description: API to create sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_sync_start_command(session_s * session, location_s * source, location_s * target, command_s ** command); + +/** + * @par Description: API to create sync end command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_sync_end_command(command_s ** command); + +/** + * @par Description: API to create add command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[in] string type, data(vobject) + * @param[in] unsigned int type, size of data + * @param[in] int type, moreData(LargeObj) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_add_command(session_s * session, change_type_e type, char *luid, const char *content_type, char *data, unsigned int size, int more_data, command_s ** command); + +/** + * @par Description: API to create replace command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[in] string type, data(vobject) + * @param[in] unsigned int type, size of data + * @param[in] int type, more_data(LargeObj) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_replace_command(session_s * session, change_type_e type, char *luid, const char *content_type, const char *data, unsigned int size, int more_data, command_s ** command); + +/** + * @par Description: API to create delete command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_delete_command(session_s * session, change_type_e type, char *luid, const char *content_type, command_s ** command); + +/** + * @par Description: API to create map command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_map_command(session_s * session, location_s * source, location_s * target, command_s ** command); + +/** + * @par Description: API to free list of command structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of command structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_commands(GList * commands); + +/** + * @par Description: API to free command structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_command(command_s * command); + +/** + * @par Description: API to increase reference count of command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e increase_command_ref_count(command_s * command); + +/** + * @par Description: API to decrease reference count of command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e decrease_command_ref_count(command_s * command); + +/** + * @par Description: API to set msgRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Commnad structure + * @param[in] unsigned int type, msg reference + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_msg_ref(command_s * command, unsigned int msg_ref); + +/** + * @par Description: API to set cmdRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Commnad structure + * @param[in] unsigned int, cmd reference + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_cmd_ref(command_s * command, unsigned int cmd_ref); + +/** + * @par Description: API to set targetRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] location_s structure(target info) + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_target_ref(command_s * command, location_s * location); + +/** + * @par Description: API to set number_of_changes in sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] unsigned int type, number of changes + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_sync_start_command_number_of_changes(command_s * command, unsigned int number_of_changes); + +/** + * @par Description: API to set Mem structure in sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] mem_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_sync_start_command_mem(command_s * command, mem_s * mem); + +/** + * @par Description: API to set item in map command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] item_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_map_command_item(command_s * mapCommand, item_s * temp); + +/** + * @par Description: API to create status command with locatiion structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] data (status code) + * @param[in] command_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_new_status_location(session_s * session, oma_status_type_e data, command_s * command, location_s * source_ref, location_s * target_ref, command_type_e type, status_s ** status); + +/** + * @par Description: API to create create status command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, data (status code) + * @param[in] command_s structure + * @param[in] enum type, command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_new_status(session_s * session, oma_status_type_e data, command_s * command, command_type_e type, status_s ** status); + +/** + * @par Description: API to create status command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, data (status code) + * @param[in] unsigned int type, cmd ID + * @param[in] unsigned int type, cmd reference + * @param[in] unsigned int type, msg reference + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] enum type, command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_status(oma_status_type_e data, unsigned int cmd_id, unsigned int cmd_ref, unsigned int msg_ref, location_s * source_ref, location_s * target_ref, command_type_e type, status_s ** status); + +/** + * @par Description: API to free list of Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of Status structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_statuses(GList * status); + +/** + * @par Description: API to free Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Status structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_status(status_s * status); + +/** + * @par Description: API to get status code from Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Status structure + * @param[out] + * + * @return OMA_StatusType type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +oma_status_type_e get_status_code(status_s * status); + +/** + * @par Description: API to convert to command type from char* + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] char* (Alert, Sync, Put, SyncHdr, Add, Replace, Map, Delete, Results, Get) + * @param[out] + * + * @return command_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +command_type_e convert_command_type(char *type); + +/** + * @par Description: API to convert to change type from command type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, command_type_e + * @param[out] + * + * @return change_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +change_type_e convert_change_type_command_type(command_type_e type); + +/** + * @par Description: API to convert to command type from change type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, change_type_e + * @param[out] + * + * @return command_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +command_type_e convert_command_type_change_type(change_type_e type); + +/* unused function + * keep for in case + */ +/* +ChangeType convertToChangeType(unsigned int type); +char *convertFromCommandType(CommandType type); +*/ + +#endif /* SA_COMMAND_H_ */ diff --git a/include/service-adapter/sa_command_internal.h b/include/service-adapter/sa_command_internal.h new file mode 100755 index 0000000..707d2e9 --- /dev/null +++ b/include/service-adapter/sa_command_internal.h @@ -0,0 +1,102 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Command_Internal.h + * @version 0.1 + * @brief This file is the header file that structure which is available in SA is defined + * Command (Alert, Results, Sync, Put, Get, Map, Add, Replace, Delete) + * Status + */ + +#ifndef SA_COMMAND_INTERNAL_H_ +#define SA_COMMAND_INTERNAL_H_ + +#include "service-adapter/sa_define.h" +#include "common/common_define.h" + +typedef struct { + alert_type_e type; + anchor_s *anchor; + char *content_type; + unsigned int max_obj_size; +} command_alert_private_s; + +typedef struct { + unsigned int num_changed; + int max_obj_size; + int has_num_changed; + mem_s *mem; +} command_sync_private_s; + +typedef struct { + char *type; + item_s *item; +} command_access_private_s; + +typedef struct { + GList *items; + change_type_e type; +} command_change_private_s; + +typedef struct { + GList *items; +} command_map_private_s; + +typedef struct { + unsigned int msg_ref; + unsigned int cmd_ref; + location_s *target_ref; + char *type; + item_s *item; +} command_results_private_s; + +typedef union { + command_alert_private_s alert; + command_sync_private_s sync; + command_access_private_s access; /*put or get */ + command_change_private_s change; + command_map_private_s map; + command_results_private_s results; +} command_private_u; + +struct command { + int ref_count; + command_type_e type; + unsigned int cmd_id; + unsigned int msg_id; + command_private_u private; + location_s *source; + location_s *target; + cred_s *cred; + int no_resp; +}; + +struct status { + unsigned int cmd_id; + unsigned int msg_ref; + unsigned int cmd_ref; + command_type_e type; + char *data; + location_s *source_ref; + location_s *target_ref; + cred_s *cred; + chal_s *chal; + item_s *item; +}; + +#endif /* SA_COMMAND_INTERNAL_H_ */ diff --git a/include/service-adapter/sa_common_interface.h b/include/service-adapter/sa_common_interface.h new file mode 100755 index 0000000..56d95aa --- /dev/null +++ b/include/service-adapter/sa_common_interface.h @@ -0,0 +1,285 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Common_Interface.h + * @version 0.1 + * @brief This file is the header file of interface of SA + * called by SE + */ + +#ifndef SA_COMMON_INTERFACE_H_ +#define SA_COMMON_INTERFACE_H_ + +/** + * @par Description: API to process pre-action that has to be befor sync service + * + * Exchage Pkg1 and Pkg2 with server + * Get Device Information + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, transport Type(obex, FW_HTTP ...) + * @param[in] int type, account id + * @param[in] string type, session id + * @param[in] int type, whether server is fmm server for calllog or not + * @param[out] pre_sync_return_obj_s structure(result from pkg2) + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int pre_sync(int transport_type, int account_id, char *session_id, int server_flag, void **pre_sync_return_obj); + +/** + * @par Description: API to generate protocol specific msg + * + * Generate MSg which be considered maxMsgSize and maxObjSize + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_obj_s structure + * @param[in] int type, whether server is fmm server for calllog or not + * @param[out] msg + * @param[out] msg size + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int generate_msg(void **sync_obj, int server_flag, char **msg, unsigned int *msg_size); + +/** + * @par Description: API to exchange protocol specific msg with server + * + * Exchange protocol specific msg(request and response) using header binding information with server + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, transport protocol type(http, obex etc) + * @param[in] string type, msg to send + * @param[in] unsigned int type, msg size + * @param[out] string type, receive msg + * @param[out] unsigned int type, receive msg size + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int exchange_msg(int transport_type, char *send_msg, unsigned int send_msg_length, char **recv_msg, unsigned int *recv_msg_length); + +/** + * @par Description: API to process response msg from server + * + * Process response msg from server and convert to obj that return to Service Engine + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, recive msg from server + * @param[in] unsigned int type, receive msg size + * @param[in] int type, whether or not to end in pkg4 + * @param[out] sync_return_obj_s structure + * @param[out] int type, flag for finsih sync session + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int process_recv_msg(char *recv_msg, unsigned int recv_msg_length, int only_from_client, void **sync_return_obj, int *is_finish); + +/** + * @par Description: API to free session_s structure and close connection + * + * This API for case that error or cancel occur in ServiceEngine so need to clean up resource which using in ServiceAdapter + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void clean_up_sa(); + +/** + * @par Description: API to process auto configure function + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, server ip + * @param[in] string type, id + * @param[in] string type, password + * @param[out] GList type, list of auto configure results + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int auto_configure(char *addr, char *id, char *password, GList ** congifure); + +/** + * @par Description: API to check cancel status + * + * Cancel flag is set and if engine is going to process pkg 5 & 6 + * keep going until finish sync session + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return 1 means Do cancel + * 0 means Do not cancel + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int check_cancel_status(); + +/** + * @par Description: API to suspend current sync session + * + * Send alert 224 to server and status if there are + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, transport Type(obex, FW_HTTP ...) + * @param[in] int type, account id + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int suspend_sync(int transport_type, int account_id, int server_flag); + +/** + * @par Description: API to cancel connection during sync session + * + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, transport Type(obex, FW_HTTP ...) + * + * @return common_error_type_e enum value + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int cancel_connection_sync_request(int transport_type); + +#endif /* SA_COMMON_INTERFACE_H_ */ diff --git a/include/service-adapter/sa_define.h b/include/service-adapter/sa_define.h new file mode 100755 index 0000000..254e6ce --- /dev/null +++ b/include/service-adapter/sa_define.h @@ -0,0 +1,159 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Define.h + * @version 0.1 + * @brief This file is the header file of defined structure and enumeration used in SA + */ + +#ifndef SA_DEFINE_H_ +#define SA_DEFINE_H_ + +#include <malloc.h> +#include <glib.h> +#include <assert.h> +#include <string.h> +#include <stdbool.h> + +#include "service-adapter/sa_error.h" + +#define DEFINE_PROTOCOL_TYPE "OMA_DS" + +#define ELEMENT_DEVINF_10 "./devinf10" +#define ELEMENT_DEVINF_11 "./devinf11" +#define ELEMENT_DEVINF_12 "./devinf12" + +#define ELEMENT_DEVINF_XML "application/vnd.syncml-devinf+xml" +#define ELEMENT_DEVINF_WBXML "application/vnd.syncml-devinf+wbxml" +#define ELEMENT_WBXML "application/vnd.syncml+wbxml" +#define ELEMENT_XML "application/vnd.syncml+xml" + +#define ELEMENT_AUTH_BASIC "syncml:auth-basic" +#define ELEMENT_AUTH_MD5 "syncml:auth-md5" +#define ELEMENT_FORMAT_BASE64 "b64" + +#define OMA_DS_HTTP_DEFAULT_CLIENT_MAX_MSG_SIZE 1024*12 +#define OMA_DS_HTTP_DEFAULT_CLIENT_MAX_OBJ_SIZE 1024*1024 + +/*#define OMA_DS_HTTP_DEFAULT_SERVER_MAX_MSG_SIZE 61440*/ +#define OMA_DS_HTTP_DEFAULT_SERVER_MAX_MSG_SIZE 1024*5 + +typedef struct item item_s; +typedef struct status status_s; +typedef struct command command_s; +typedef struct anchor anchor_s; +typedef struct location location_s; +typedef struct cred cred_s; +typedef struct syncml syncml_s; +typedef struct sync_hdr sync_hdr_s; +typedef struct chal chal_s; +typedef struct devinf devinf_s; +typedef struct devinf_datastore devinf_datastore_s; +typedef struct devinf_content_type devinf_content_type_s; +typedef struct devinf_ct_cap devinf_ct_cap_s; +typedef struct devinf_property devinf_property_s; +typedef struct devinf_prop_param devinf_prop_param_s; +typedef struct filter_cap filter_cap_s; +typedef struct session session_s; +typedef struct command_status command_status_s; +typedef struct mem mem_s; + +typedef enum { + VERSION_UNKNOWN = 0, + VERSION_10 = 1, + VERSION_11 = 2, + VERSION_12 = 3 +} protocol_version_e; + +typedef enum { + PROTOCOL_TYPE_UNKNOWN = 0, + PROTOCOL_TYPE_DS = 1, +} protocol_type_e; + +typedef enum { + COMMAND_TYPE_UNKNOWN = 0, + COMMAND_TYPE_ALERT = 1, + COMMAND_TYPE_SYNC_START = 2, + COMMAND_TYPE_SYNC_END = 3, + COMMAND_TYPE_PUT = 4, + COMMAND_TYPE_HEADER = 5, + COMMAND_TYPE_ADD = 6, + COMMAND_TYPE_REPLACE = 7, + COMMAND_TYPE_DELETE = 8, + COMMAND_TYPE_MAP = 9, + COMMAND_TYPE_GET = 10, + COMMAND_TYPE_RESULTS = 11 +} command_type_e; + +typedef enum { + AUTH_TYPE_UNKNOWN = 0, + AUTH_TYPE_BASIC = 1, + AUTH_TYPE_MD5 = 2 +} auth_type_e; + +typedef enum { + FORMAT_TYPE_UNKNOWN = 0, + FORMAT_TYPE_BASE64 = 1 +} format_type_e; + +typedef enum { + DEVINF_VERSION_UNKNOWN = 0, + DEVINF_VERSION_10 = 1, + DEVINF_VERSION_11 = 2, + DEVINF_VERSION_12 = 3 +} devinf_version_e; + +typedef enum { + DEVINF_DEVTYPE_UNKNOWN, + DEVINF_DEVTYPE_PAGER, + DEVINF_DEVTYPE_HANDHELD, + DEVINF_DEVTYPE_PDA, + DEVINF_DEVTYPE_PHONE, + DEVINF_DEVTYPE_SMARTPHONE, + DEVINF_DEVTYPE_SERVER, + DEVINF_DEVTYPE_WORKSTATION +} devinf_devtyp_e; + +typedef enum { + DEVINF_SYNCTYPE_UNKNOWN = 0, + DEVINF_SYNCTYPE_TWO_WAY = 1, + DEVINF_SYNCTYPE_SLOW_SYNC = 1 << 1, + DEVINF_SYNCTYPE_ONE_WAY_FROM_CLIENT = 1 << 2, + DEVINF_SYNCTYPE_REFRESH_FROM_CLIENT = 1 << 3, + DEVINF_SYNCTYPE_ONE_WAY_FROM_SERVER = 1 << 4, + DEVINF_SYNCTYPE_REFRESH_FROM_SERVER = 1 << 5, + DEVINF_SYNCTYPE_SERVER_ALERTED_SYNC = 1 << 6 +} devinf_sync_cap_e; + +typedef enum { + SYNCML_PKG_1 = 1, + SYNCML_PKG_2 = 2, + SYNCML_PKG_3 = 3, + SYNCML_PKG_4 = 4, + SYNCML_PKG_5 = 5, + SYNCML_PKG_6 = 6, + SYNCML_SUSPEND = 7 +} pkg_status_e; + +typedef enum { + ITEM_UNKNOWN = 0, + ITEM_DATA = 1, + ITEM_DEVINF = 2, +} item_data_type_e; + +#endif /* SA_DEFINE_H_ */ diff --git a/include/service-adapter/sa_devinf.h b/include/service-adapter/sa_devinf.h new file mode 100755 index 0000000..95efc87 --- /dev/null +++ b/include/service-adapter/sa_devinf.h @@ -0,0 +1,134 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_DevInf.h + * @version 0.1 + * @brief This file is the header file of interface of DevInf structure + */ + +#ifndef SA_DEVINF_H_ +#define SA_DEVINF_H_ + +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to create devinf_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[out] devinf_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_ERROR, ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_devinf(session_s * session, devinf_s ** devinf); + +/** + * @par Description: API to free devinf_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] devinf_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_devinf(devinf_s * devinf); + +/** + * @par Description: API to set sync cap in devinf_datastore_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] devinf_datastore_s structure + * @param[in] devinf_sync_cap_e sync type + * @param[in] whether support or not + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_devinf_datastore_sync_cap(devinf_datastore_s * devinf_datastore, devinf_sync_cap_e cap, int supported); + +/** + * @par Description: API to get sync cap from devinf_datastore_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] devinf_datastore_s structure + * @param[in] devinf_sync_cap_e sync type + * + * @return True on success + * False on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int get_devinf_datastore_sync_cap(const devinf_datastore_s * devinf_datastore, devinf_sync_cap_e cap); + +/* +DevInfSyncCap convert_devinf_synccap(unsigned int id); +*/ +#endif /* SA_DEVINF_H_ */ diff --git a/include/service-adapter/sa_devinf_internal.h b/include/service-adapter/sa_devinf_internal.h new file mode 100755 index 0000000..f60fd56 --- /dev/null +++ b/include/service-adapter/sa_devinf_internal.h @@ -0,0 +1,118 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_DevInf_Internal.h + * @version 0.1 + * @brief This file is the header file that structure which is available in SA is defined + * about device information(DevInf) + */ + +#ifndef SA_DEVINF_INTERNAL_H_ +#define SA_DEVINF_INTERNAL_H_ + +#include "service-adapter/sa_define.h" + +#define DEFINE_DEVICE_TYPE_PAGER "pager" +#define DEFINE_DEVICE_TYPE_HANDHELD "handheld" +#define DEFINE_DEVICE_TYPE_PDA "pda" +#define DEFINE_DEVICE_TYPE_PHONE "phone" +#define DEFINE_DEVICE_TYPE_SMARTPHONE "smartphone" +#define DEFINE_DEVICE_TYPE_SERVER "server" +#define DEFINE_DEVICE_TYPE_WORKSTATION "workstation" + +struct devinf { + devinf_version_e version; + + devinf_devtyp_e devtyp; + char *manufacturer; + char *model; + char *oem; + char *software_version; + char *hardware_version; + char *firmware_version; + char *dev_id; + + int supports_utc; + int supports_large_objs; + int supports_number_of_changes; + + GList *datastores; /*containing DevInfDataStore structure */ +}; + +struct devinf_datastore { + int supports_hierarchical_sync; + + char *source_ref; + char *display_name; + unsigned int max_guid_size; + + devinf_content_type_s *rx_pref; + devinf_content_type_s *tx_pref; + + GList *filter_rx; /*need to be considered filter_rx,filterCap */ + GList *filter_cap; + + GList *rx; + GList *tx; + + int shared_mem; + unsigned int max_mem; + unsigned int max_id; + + unsigned int sync_cap; + + GList *ct_caps; /*containing DevInfCTCap structure */ +}; + +struct devinf_content_type { + char *ct_type; + char *verct; +}; + +struct devinf_ct_cap { + devinf_content_type_s *ct; + GList *properties; /*containing DevInfProperty structure */ +}; + +struct devinf_property { + char *prop_name; + char *data_type; + unsigned int max_occur; + unsigned int max_size; +/* unsigned int propSize;*/ + int no_truncate; + char *display_name; + GList *val_enums; /*containing char* */ + GList *prop_params; /*containing DevInfPropParam structure */ +}; + +struct devinf_prop_param { + char *param_name; + char *data_type; + char *display_name; + GList *val_enums; +}; + +struct filter_cap { + char *ct_type; + char *verct; + GList *filter_keyword; + GList *prop_name; +}; + +#endif /* SA_DEVINF_INTERNAL_H_ */ diff --git a/include/service-adapter/sa_elements.h b/include/service-adapter/sa_elements.h new file mode 100755 index 0000000..32b4e41 --- /dev/null +++ b/include/service-adapter/sa_elements.h @@ -0,0 +1,893 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Elements.h + * @version 0.1 + * @brief This file is the header file of interface of elements structure + */ + +#ifndef SA_ELEMENTS_H_ +#define SA_ELEMENTS_H_ + +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to create anchor_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, last anchor + * @param[in] string type, next anchor + * @param[out] anchor_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_anchor(char *last, char *next, anchor_s ** anchor); + +/** + * @par Description: API to set anchor in item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] item_s structure + * @param[in] anchor_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_item_anchor(item_s * item, anchor_s * anchor); + +/** + * @par Description: API to set last anchor in anchor_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] anchor_s structure + * @param[in] string type, last anchor + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_last_anchor(anchor_s * anchor, char *lastAnchor); + +/** + * @par Description: API to set next anchor in anchor_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] anchor_s structure + * @param[in] string type, next anchor + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_next_anchor(anchor_s * anchor, char *nextAnchor); + +/** + * @par Description: API to free anchor_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] anchor_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_anchor(anchor_s * anchor); + +/** + * @par Description: API to create location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, location uri + * @param[in] string type, location name + * @param[out] location_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_location(char *loc_uri, char *loc_name, location_s ** location); + +/** + * @par Description: API to duplicate location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] location_s structure + * + * @return location_s structure on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +location_s *dup_location(location_s * location); + +/** + * @par Description: API to get location name from location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] location_s structure + * + * @return location name on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +char *get_location_loc_name(location_s * location); + +/** + * @par Description: API to get location uri from location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] location_s structure + * + * @return location uri on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +char *get_location_loc_uri(location_s * location); + +/** + * @par Description: API to free location_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] location_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_location(location_s * location); + +/** + * @par Description: API to create cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, ID + * @param[in] string type, password + * @param[in] enum type, authentication type(basic, md5..) + * @param[in] enum type, format type(base64..) + * @param[in] string type, credential + * @param[out] cred_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_cred(char *user_name, char *pwd, auth_type_e auth_type, format_type_e format_type, char *data, cred_s ** cred); + +/** + * @par Description: API to create cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, authentication type(basic, md5..) + * @param[in] credential + * + * @return cred_s structure on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +cred_s *create_cred_with_data(auth_type_e auth_type, char *data); + +/** + * @par Description: API to duplicate cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] cred_s structure + * + * @return cred_s structure on success + * NULL on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +cred_s *dup_cred(cred_s * cred); + +/** + * @par Description: API to set format type in cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] cred_s structure + * @param[in] format type(base64..) + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_cred_format_type(cred_s * cred, format_type_e format_type); + +/** + * @par Description: API to free cred_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] cred_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_cred(cred_s * cred); + +/** + * @par Description: API to create syncml_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] sync_hdr_s structure + * @param[in] GList type, list of status_s structure + * @param[in] GList type, list of command_s structure + * @param[in] int type, final flag + * @param[out] syncml_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_syncml(sync_hdr_s * sync_hdr, GList * status, GList * commands, int is_final, syncml_s ** syncml); + +/** + * @par Description: API to free syncml_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] syncml_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_syncml(syncml_s * syncml); + +/** + * @par Description: API to create sync_hdr_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[out] sync_hdr_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_sync_hdr(session_s * session, sync_hdr_s ** sync_hdr); + +/** + * @par Description: API to free SyncHdr structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] SyncHdr structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_sync_hdr(sync_hdr_s * sync_hdr); + +/** + * @par Description: API to create item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return item_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +item_s *create_item(); + +/** + * @par Description: API to create item_s structure using data + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] data + * @param[in] size of data + * @param[out] + * + * @return item_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +item_s *create_item_for_data(const char *data, unsigned int size); + +/** + * @par Description: API to create item_s structure using DevInf + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] devinf_s structure + * @param[out] + * + * @return item_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +item_s *create_item_for_devinf(devinf_s * devinf); + +/** + * @par Description: API to set location_s(target) structure in item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] item_s structure + * @param[in] location_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_item_target(item_s * item, location_s * target); + +/** + * @par Description: API to set location_s(source) structure in item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] item_s structure + * @param[in] location_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_item_source(item_s * item, location_s * source); + +/** + * @par Description: API to free item_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] item_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_item(item_s * item); + +/** + * @par Description: API to duplicate chal_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] chal_s structure + * @param[out] + * + * @return chal_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +chal_s *dup_chal(chal_s * chal); + +/** + * @par Description: API to free chal_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] chal_s structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_chal(chal_s * chal); + +/** + * @par Description: API to compare server credential with local credential + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] cred_s structure + * @param[in] cred_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_AUTH_REJECTED, ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e compare_cred(cred_s * hdr_cred, cred_s * session_cred); + +/** + * @par Description: API to convert auth_type_e + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, auth type + * @param[out] + * + * @return AUTH_TYPE_MD5, AUTH_TYPE_BASIC on success + * AUTH_TYPE_UNKNOWN on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +auth_type_e convert_auth_type(char *auth_type); + +/** + * @par Description: API to convert format_type_e + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, format type + * @param[out] + * + * @return FORMAT_TYPE_BASE64 on success + * FORMAT_TYPE_UNKNOWN on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +format_type_e convert_format_type(char *format_type); + +/** + * @par Description: API to create mem_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] + * + * @return mem_s structure on success + * NULL on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +mem_s *create_mem(); + +/** + * @par Description: API to set shared_mem + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] mem + * @param[in] shared_mem + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_mem_shared_mem(mem_s * mem, int shared_mem); + +/** + * @par Description: API to set free_mem + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] mem + * @param[in] free_mem + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_mem_free_mem(mem_s * mem, unsigned int free_mem); + +/** + * @par Description: API to set free_id + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] mem + * @param[in] free_id + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_mem_free_id(mem_s * mem, unsigned int free_id); + +#endif /* SA_ELEMENTS_H_ */ diff --git a/include/service-adapter/sa_elements_internal.h b/include/service-adapter/sa_elements_internal.h new file mode 100755 index 0000000..842ca1d --- /dev/null +++ b/include/service-adapter/sa_elements_internal.h @@ -0,0 +1,102 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Elements_Internal.h + * @version 0.1 + * @brief This file is the header file that structure which is available in SA is defined + * SyncHdr, SyncML, Cred, Chal, Item, Anchor, Location + */ + +#ifndef SA_ELEMENTS_INTERNAL_H_ +#define SA_ELEMENTS_INTERNAL_H_ + +#include "service-adapter/sa_define.h" + +typedef union { + char *data; + devinf_s *devinf; +} item_data_u; + +struct mem { + int sharedmem; + unsigned int free_mem; + unsigned int free_id; +}; + +struct chal { + format_type_e format; + auth_type_e type; + char *nonce_plain; + unsigned int nonce_length; + char *nonce_b64; +}; + +struct item { + item_data_type_e data_type; + item_data_u private; + location_s *source; + location_s *target; + anchor_s *anchor; + + unsigned int size; /* for data */ + char *content_type; /* for data */ + int more_data; /* for moredata */ +}; + +struct anchor { + char *last_anchor; /**< Last Anchor*/ + char *next_anchor; /**< Next Anchor*/ +}; + +struct location { + char *loc_uri; + char *loc_name; +}; + +struct cred { + format_type_e format; + auth_type_e type; + char *data; + char *user_name; + char *password; +}; + +struct sync_hdr { + char *session_id; + protocol_version_e version; + protocol_type_e protocol; + location_s *source; + location_s *target; + cred_s *cred; + char *response_uri; + int no_response; + unsigned int message_id; + + /*in meta element */ + unsigned int max_msg_size; + unsigned int max_obj_size; +}; + +struct syncml { + sync_hdr_s *hdr; + GList *status; /**< containing Status struct */ + GList *commands; /**< containing Command struct */ + int final; +}; + +#endif /* SA_ELEMENTS_INTERNAL_H_ */ diff --git a/include/service-adapter/sa_error.h b/include/service-adapter/sa_error.h new file mode 100755 index 0000000..fd9d641 --- /dev/null +++ b/include/service-adapter/sa_error.h @@ -0,0 +1,124 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Error.h + * @version 0.1 + * @brief This file is the header file of Error is defined + */ + +#ifndef SA_ERROR_H_ +#define SA_ERROR_H_ + +typedef enum { + ERROR_UNKNOWN = 0, + + /* Informational */ + IN_PROGRESS = 101, + + /* OK code */ + /** No error */ + NO_ERROR = 200, + /** Requested item was added */ + ITEM_ADDED = 201, + /** Accepted for processing */ + PROCESSING_ACCEPTED = 202, + /** Non-authoritative response */ + NON_AUTHORITATIVE = 203, + /** No content */ + NO_CONTENT = 204, + /** Reset content */ + RESET_CONTENT = 205, + /** Partial content */ + PARTIAL_CONTENT = 206, + /** Conflict resolved with merge */ + CONFLICT_MERGE = 207, + /** Conflict resolved with client win */ + CONFLICT_CLIENT_WIN = 208, + /** Conflict resolved with duplicate */ + CONFLICT_DUPLICATE = 209, + /** Deleted without archiving */ + DELETE_NO_ARCHIVE = 210, + /** Item not deleted (not found) */ + DELETE_NOT_FOUND = 211, + /** Authentication accepted */ + AUTH_ACCEPTED = 212, + /** Chunked item accepted */ + CHUNK_ACCEPTED = 213, + /** Operation cancelled */ + OPERATION_CANCELLED = 214, + /** Not executed */ + NOT_EXECUTED = 215, + /** Atomic rollback ok */ + ATOMIC_ROLLBACK_OK = 216, + + /* Retry error */ + ERROR_MULTIPLE_CHOICES = 300, + ERROR_MOVED_PERMANENTLY = 301, + ERROR_FOUND_RETRY = 302, + ERROR_SEE_OTHER_RETRY = 303, + ERROR_NOT_MODIFIED = 304, + ERROR_USE_PROXY = 305, + + /* Errors */ + ERROR_BAD_REQUEST = 400, /* Bad Request */ + ERROR_AUTH_REJECTED = 401, /* Unauthorized, Invalid Credentials */ + ERROR_PAYMENT_NEEDED = 402, /* Payment need */ + ERROR_FORBIDDEN = 403, /* Forbidden */ + ERROR_NOT_FOUND = 404, /* Not found */ + ERROR_COMMAND_NOT_ALLOWED = 405, /* Command not allowed */ + ERROR_UNSUPPORTED_FEATURE = 406, /* Optional feature unsupported */ + ERROR_AUTH_REQUIRED = 407, /* Authentication required, Missing Credentials */ + ERROR_SIZE_REQUIRED = 411, + ERROR_REQUESTED_SIZE_TOO_BIG = 416, + ERROR_RETRY_LATER = 417, /* Retry later */ + ERROR_ALREADY_EXISTS = 418, /* Put or Add failed because item already exists */ + ERROR_SIZE_MISMATCH = 424, /* Size mismatch */ + + /* Standard errors */ + ERROR_GENERIC = 500, + ERROR_NOT_IMPLEMENTED = 501, + ERROR_SERVICE_UNAVAILABLE = 503, + ERROR_REQUIRE_REFRESH = 508, + ERROR_SERVER_FAILURE = 511, + +} oma_status_type_e; + +typedef enum { + + /* Internal errors - never ever send this via SyncML */ + SA_ERROR_UNKNOWN = 0, + SA_INTERNAL_OK = 1, + SA_INTERNAL_ERROR, + SA_INTERNAL_BINDER_ERROR, + SA_INTERNAL_TIMEOUT, + SA_INTERNAL_NOT_FOUND, + SA_INTERNAL_MISCONFIGURATION, + SA_INTERNAL_NO_MEMORY, + SA_INTERNAL_NOT_DEFINED, + SA_INTERNAL_CONNECTION_ERROR, + SA_INTERNAL_DA_ERROR, + SA_INTERNAL_CANCEL, + SA_INTERNAL_AUTOCONFIG_NOT_SUPPORT_BY_SERVER, + SA_INTERNAL_BUSY_SIGNALING, + SA_INTERNAL_SERVER_FAILURE, + SA_INTERNAL_SERVER_ERROR, + SA_INTERNAL_AUTHENTICATION_ERROR, + SA_INTERNAL_SUSPEND_FAIL, +} sa_error_type_e; + +#endif /* SA_ERROR_H_ */ diff --git a/include/service-adapter/sa_session.h b/include/service-adapter/sa_session.h new file mode 100755 index 0000000..89efe2b --- /dev/null +++ b/include/service-adapter/sa_session.h @@ -0,0 +1,277 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Session.h + * @version 0.1 + * @brief This file is the header file of interface of Session structure + */ + +#ifndef SA_SESSION_H_ +#define SA_SESSION_H_ + +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to create session_s structure + * This API can be used to create session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, protocol version(VERSION_UNKNOWN, VERSION_10, VERSION_11, VERSION_12); + * @param[in] enum type, protocol type(PROTOCOL_TYPE_UNKNOWN , PROTOCOL_TYPE_DS) + * @param[in] int type, account id + * @param[in] int type, session id + * @param[in] string type, source uri(server ip) + * @param[in] string type, target uri(client identifer) + * @param[out] session_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_session(protocol_version_e protocol_version, protocol_type_e protocol_type, int account_id, char *sess_id, location_s * source_location, location_s * target_location, session_s ** session); + +/** + * @par Description: API to free session_s structure + * This API can be used to free session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_session(session_s * session); + +/** + * @par Description: API to set cred_s structure in session_s structure + * This API can be used to set cred_s structure in session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] cred_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_session_cred(session_s * session, cred_s * cred); + +/** + * @par Description: API to set devinf_s structure in session_s structure + * This API can be used to set devinf_s structure in session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] devinf_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void set_session_devinf(session_s * session, devinf_s * devInf); + +/** + * @par Description: API to create command_status_s structure + * This API can be used to set devinf_s structure in session_s structure + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] unsigned int type, msg id + * @param[in] unsigned int type, cmd id + * @param[out] command_status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_command_status(unsigned int msg_id, unsigned int cmdID, command_status_s ** command_status); + +/** + * @par Description: API to process sync_hdr_s structure from server + * This API manage responseURI + * set server info in session_s structure + * check header credential + * create Status structure for header + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] sync_hdr_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e receive_header(session_s * session, sync_hdr_s * header); + +/** + * @par Description: API to process list of status_s structure from server + * This API check credential status + * process Status structure for each type + * create AppliedStatus structure for passing to ServiceEngine + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] GList type, list of status_s structure + * @param[out] GList type, list of applied_status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_ERROR, ERROR_SERVER_FAILURE, ERROR_INTERNAL_BUSY_SIGNALING on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e receive_statuses(session_s * session, GList * receive_status, GList ** return_status); + +/** + * @par Description: API to process list of command_s structure from server + * This API check credential status + * process command_ structure for each type + * create changed_datastore_s structure for passing to ServiceEngine + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session structure + * @param[in] GList type, list of command_s structure + * @param[in] whether auto configure or not + * @param[out] GList type, list of changed_datastore_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_ERROR, ERROR_INTERNAL_NO_MEMORY, ERROR_INTERNAL_NOT_DEFINED on error + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e receive_commands(session_s * session, GList * receive_command, bool auto_config, GList ** return_datastore); + +/** + * @par Description: API to reset cmd id(1) in session + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void reset_cmd_id_session(session_s * session); + +#endif /* SE_SESSION_H_ */ diff --git a/include/service-adapter/sa_session_internal.h b/include/service-adapter/sa_session_internal.h new file mode 100755 index 0000000..56ff46c --- /dev/null +++ b/include/service-adapter/sa_session_internal.h @@ -0,0 +1,83 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Session_Internal.h + * @version 0.1 + * @brief This file is the header file of session structure is defined + * Session, PendingStatus + */ + +#ifndef SA_SESSION_INTERNAL_H_ +#define SA_SESSION_INTERNAL_H_ + +#include "service-adapter/sa_define.h" + +struct session { + protocol_version_e protocol_version; + protocol_type_e protocol_type; + + char *session_id; + unsigned int msg_id; + unsigned int last_recieved_msg_id; + unsigned int cmd_id; + int is_sending_final; + int is_receiving_final; + + GList *status; /*status to return to server */ + GList *temp_status; /*temp status for sync add, replace, delete command(it doesnot have data element value) */ + GList *suspend_status; /* for suspend */ + location_s *target; + location_s *source; + location_s *org_target; + + unsigned int source_max_msg_size; + unsigned int source_max_obj_size; + + unsigned int target_max_msg_size; + unsigned int target_max_obj_size; + + cred_s *cred; /*account info */ + chal_s *chal; /*chal from server */ + + devinf_s *devinf; /*client devinf */ + devinf_s *remote_devinf; /*server devinf */ + + pkg_status_e pkg_status; /*for status */ + + command_s *large_obj_cmd; /*for incomming large Command */ + + GList *map_command; /*containing map command that has sent to server(this is used to for delete map item from mapping table) */ + + GList *alert_command; /*containing alert command that have to send to server */ + + GList *results_command; /*containing results command */ + + command_status_s *large_obj; /*for outgoing large command */ + + int has_opend; + unsigned int naci_session_id; + + int account_id; + char *jsession_id; +}; + +struct command_status { + unsigned int cmd_id; + unsigned int msg_id; +}; +#endif /* SA_SESSION_INTERNAL_H_ */ diff --git a/include/service-adapter/sa_util.h b/include/service-adapter/sa_util.h new file mode 100755 index 0000000..8b07eb7 --- /dev/null +++ b/include/service-adapter/sa_util.h @@ -0,0 +1,94 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SA_Util.h + * @version 0.1 + * @brief This file is the header file of interface for utility function in SA + */ + +#ifndef SA_UTIL_H_ +#define SA_UTIL_H_ + +#include "service-adapter/sa_define.h" + +/** + * @par Description: API to put command into GList + * This API can be used to put structure into GList + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] GList type, first index of list + * @param[in] GList type, last index of list + * @param[in] void pointer type, structure to put in the list + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void put_into_list(GList ** commands, GList ** commands_last, void *command); + +/** + * @par Description: API to create credential string + * This API can be used to create credential string + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, type of authentication(AUTH_TYPE_BASIC , AUTH_TYPE_MD5...) + * @param[in] string type, id + * @param[in] string type, password + * @param[in] string type, nonce + * @param[in] unsigned int type, size of nonce + * @param[out] string type, credential + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_cred_string(auth_type_e type, const char *user_name, const char *password, const char *nonce, unsigned int nonce_size, char **cred); + +/** + * @brief write xml to file(for debugging) + * @param[in] string to write + * @param[in] path + */ +void set_xml_to_file(char *xml, const char *path); + +#endif /* SA_UTIL_H_ */ diff --git a/include/service-engine/se_account.h b/include/service-engine/se_account.h new file mode 100755 index 0000000..fc6563e --- /dev/null +++ b/include/service-engine/se_account.h @@ -0,0 +1,342 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SE_Account.h + * @version 0.1 + * @brief This file is the header file of interface of account + */ + +#ifndef SE_ACCOUNT_H_ +#define SE_ACCOUNT_H_ + +#include <glib.h> +#include <stdbool.h> +#include "common/common_define.h" + +/** + * @par Description: API to add profile API + * This API can be used to add profile + * This API is part of API for UI + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, profile_dir_name(identify profile in UI) + * @param[in] string type, profile name + * @param[in] string type, server ip + * @param[in] string type, id + * @param[in] string type, password + * @param[in] string type, sync mode + * @param[in] string type, sync type + * @param[in] string type, interval(for periodic) + * @param[in] GList type, list of sync_service_s structure + * @param[out] int type, account id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool add_profile(char *profile_dir_name, char *profile_name, char *addr, char *id, char *password, char *sync_mode, char *sync_type, char *interval, GList * categories, int *account_id); + +/** + * @par Description: API to add profile from csc + * This API can be used to add profile from csc(vconf) + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, index of profile + * + * @return 1 on success + * 0 on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool add_profile_csc(int index); + +/** + * @par Description: API to add profile API + * This API can be used to add profile + * This API is part of API for UI + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, profile name + * @param[in] string type, server ip + * @param[in] string type, id + * @param[in] string type, password + * @param[in] GList type, list of resource_cp structure + * @param[out] int type, account id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool add_profile_cp(char *profile_name, char *addr, char *id, char *password, GList * categories, int *account_id); + +/** + * @par Description: API to add profile for call log sync + * This API can be used to add profile + * This API is part of API for call log sync + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[out] int type, account_id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool add_profile_dive(int *account_id); + +/** + * @par Description: API to edit profile API + * This API can be used to edit profile + * This API is part of API for UI + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] string type, profile name + * @param[in] string type, server ip + * @param[in] string type, id + * @param[in] string type, password + * @param[in] string type, sync mode + * @param[in] string type, sync type + * @param[in] string type, interval(for periodic) + * @param[in] GList type, list of sync_service_s structure + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool edit_profile(int account_id, char *profile_name, char *addr, char *id, char *password, char *sync_mode, char *sync_type, char *interval, GList * categories); + +/** + * @par Description: API to delete profile API + * This API can be used to delete profile + * This API is part of API for UI + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] GList type, list of account id + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool delete_profiles(GList * profiles); + +/** + * @par Description: API to delete profile for call log sync + * This API can be used to delete profile + * This API is part of API for call log sync + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool delete_profile_dive(); + +/** + * @par Description: API to delete profile + * This API can be used to delete profile + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool delete_profile(char *access_name); + +/** + * @par Description: API to delete all profiles + * This API can be used to delete all profiles + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool delete_all_profiles(); + +/** + * @par Description: API to get profile directory name of synchronizing account + * This API can be used to get profile directory name + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[out] string type, profile_dir_name(identify profile in UI) + * @param[out] string type, sync_type(determined by server) + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_synchronising_profile(char **profile_dir_name, char **sync_type); + +/** + * @par Description: API to delete all agent default table(except id_provider_tbl, id_page_tbl) + * This API can be used to delete all agent default table + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool delete_all_agent_default_table(); + +#endif /* SE_ACCOUNT_H_ */ diff --git a/include/service-engine/se_common.h b/include/service-engine/se_common.h new file mode 100755 index 0000000..108acef --- /dev/null +++ b/include/service-engine/se_common.h @@ -0,0 +1,128 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SE_Common.h + * @version 0.1 + * @brief This file is the header file of enumeration and define used in SE + */ + +#ifndef SE_COMMON_H_ +#define SE_COMMON_H_ + +#define DEFINE_SYNC_PROGRESS_NONE "PROGRESS_NONE" +#define DEFINE_SYNC_INIT "INIT" +#define DEFINE_SYNC_CONNECTING "CONNECTING" +#define DEFINE_SYNC_AUTHENTICATED "AUTHENTICATED" +#define DEFINE_SYNC_DONE "DONE" +#define DEFINE_SYNC_ERROR "ERROR" + +#define DEFINE_ERROR_NONE "ERROR_NONE" +#define DEFINE_ERROR_CONNECTION "CONNECTION" +#define DEFINE_ERROR_SYNCHDR "SYNCHDR" +#define DEFINE_ERROR_INTERNAL "INTERNAL" +#define DEFINE_ERROR_SUSPENDED "SUSPENDED" +#define DEFINE_ERROR_DB "DB" +#define DEFINE_ERROR_ABORT "ABORT" +#define DEFINE_ERROR_SERVER "SERVER" +#define DEFINE_ERROR_MEMORY_FULL "MEMORY_FULL" +#define DEFINE_ERROR_AUTHENTICATE "AUTHENTICATE" +#define DEFINE_ERROR_AUTOCONFIG_NOT_SUPPORT_BY_SERVER "AUTOCONFIG_NOT_SUPPORT_BY_SERVER" +#define DEFINE_ERROR_LOW_BATTERY "LOW_BATTERY" + +#define DEFINE_PROGRESS_NONE "PROGRESS_NONE" +#define DEFINE_PROGRESS_SUCCESS "PROGRESS_SUCCESS" +#define DEFINE_FAILED_DB "FAILED_DB" +#define DEFINE_FAILED_DB_FORBIDDEN "FAILED_DB_FORBIDDEN" +#define DEFINE_FAILED_DB_ITEM "FAILED_DB_ITEM" +#define DEFINE_FAILED_DB_CONFIG "FAILED_DB_CONFIG" +#define DEFINE_FAILED_DB_DEVICEFULL "FAILED_DB_DEVICEFULL" + +#define DEFINE_NOOP "NOOP" +#define DEFINE_ADD "ADD" +#define DEFINE_DELETE "DELETE" +#define DEFINE_MOVE "MOVE" +#define DEFINE_COPY "COPY" +#define DEFINE_REPLACE "REPLACE" + +#define DEFINE_DBSYNC_SUCCESS "success" +#define DEFINE_DBSYNC_STOP "stop" +#define DEFINE_DBSYNC_FAIL "fail" +#define DEFINE_DBSYNC_NO "No" + +typedef enum { + PROGRESS_NONE = 0, + PROGRESS_INIT = 1, + PROGRESS_CONNECTING = 2, + PROGRESS_AUTHENTICATED = 3, + PROGRESS_DONE = 4, + PROGRESS_ERROR = 5 +} sync_progress_e; + +typedef enum { + ERROR_NONE = 0, + ERROR_CONNECTION = 1, + ERROR_SYNCHDR = 2, + ERROR_INTERNAL = 3, + ERROR_SUSPENDED = 4, + ERROR_DB = 5, + ERROR_ABORT = 6, + ERROR_SERVER = 7, + ERROR_MEMORY_FULL = 8, + ERROR_AUTHENTICATE = 9, + ERROR_AUTOCONFIG_NOT_SUPPORT_BY_SERVER = 10, + ERROR_LOW_BATTERY = 11 +} sync_error_e; + +typedef enum { + SYNC_PROGRESS_NONE = 0, + SYNC_PROGRESS_SUCCESS, + SYNC_FAILED_DB, + SYNC_FAILED_DB_FORBIDDEN, + SYNC_FAILED_DB_ITEM, + SYNC_FAILED_DB_CONFIG, + SYNC_FAILED_DB_DEVICEFULL +} sync_progress_status_e; + +typedef enum { + OPERATION_NOOP = 0, + OPERATION_ADD, + OPERATION_DELETE, + OPERATION_MOVE, + OPERATION_COPY, + OPERATION_REPLACE +} operation_type_e; + +typedef enum { + COMMAND_RESULT_INIT = 0, + COMMAND_RESULT_OK = 200, /*[R] OK exception */ + COMMAND_RESULT_ADDED = 201, /*[AR] Item added exception */ + COMMAND_RESULT_DELETE_PARTIAL = 206, /*[D] Partial content exception condition */ + COMMAND_RESULT_DELETE_WITHOUT_ARCHIVE = 210, /*[D] Delete without archive exception */ + COMMAND_RESULT_NOT_EXIST = 211, /*[D] Item not deleted exception */ + COMMAND_RESULT_UNAUTHRIZED = 401, /*[ARD] Unauthorized exception */ + COMMAND_RESULT_AUTHENTICATION_REQUIRED = 407, /*[ARD] Authentication required exception */ + COMMAND_RESULT_INCOMPLETE = 412, /*[D] Incomplete command exception */ + COMMAND_RESULT_UNSUPPORTED_TYPE = 415, /*[A] Unsupported media type or format exception */ + COMMAND_RESULT_ALREADY_EXIST = 418, /*[A] Already exists exception */ + COMMAND_RESULT_DEVICE_FULL = 420, /*[AR] Device full exception */ + COMMAND_RESULT_PARTIAL_REPLACE_NOT_ACCEPTED = 426, /*[R] Partial item not accepted */ + COMMAND_RESULT_NOT_EMPTY = 427, /*[D] Item not empty */ + COMMAND_RESULT_COMMAND_FAIL = 500 /*[ARD] Command failed exception */ +} command_result_e; + +#endif /* SE_COMMON_H_ */ diff --git a/include/service-engine/se_error.h b/include/service-engine/se_error.h new file mode 100755 index 0000000..6a22139 --- /dev/null +++ b/include/service-engine/se_error.h @@ -0,0 +1,45 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SE_Error.h + * @version 0.1 + * @brief This file is the header file of Error is defined + */ + +#ifndef SE_ERROR_H_ +#define SE_ERROR_H_ + +typedef enum { + ERROR_UNKNOWN = 0, + SE_INTERNAL_OK = 1, + SE_INTERNAL_ERROR = 2, + SE_INTERNAL_NO_MEMORY = 3, + SE_INTERNAL_NOT_DEFINED = 4, + SE_INTERNAL_DA_ERROR = 5, + SE_INTERNAL_EVENT_ERROR = 6, + SE_INTERNAL_ENGINE_CONTROLER_ERROR = 7, + SE_INTERNAL_SCHEDULER_ERROR = 8, + SE_INTERNAL_SA_ERROR = 9, + SE_INTERNAL_MISCONFIGURATION = 10, + SE_INTERNAL_CANCEL = 11, + SE_INTERNAL_LOW_BATTERY = 12, + SE_INTERNAL_SUSPEND = 13, + +} se_error_type_e; + +#endif /* SE_ERROR_H_ */ diff --git a/include/service-engine/se_notification.h b/include/service-engine/se_notification.h new file mode 100755 index 0000000..4789ba5 --- /dev/null +++ b/include/service-engine/se_notification.h @@ -0,0 +1,99 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SE_Notification.h + * @version 0.1 + * @brief This file is the header file of interface of notification to UI + */ + +#ifndef SE_NOTIFICATION_H_ +#define SE_NOTIFICATION_H_ + +#include <glib.h> +#include "service-engine/se_error.h" + +/** + * @par Description: API to notify session process to UI + * This API can be used to notify session process + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, profile dir name(identify profile in UI) + * @param[in] string type, progress(DEFINE_SYNC_PROGRESS_NONE, + * DEFINE_SYNC_INIT, DEFINE_SYNC_CONNECTING, DEFINE_SYNC_AUTHENTICATED, + * DEFINE_SYNC_DONE, DEFINE_SYNC_ERROR) + * @param[in] string type, error(DEFINE_ERROR_NONE, DEFINE_ERROR_CONNECTION, DEFINE_ERROR_SYNCHDR, + * DEFINE_ERROR_INTERNAL, DEFINE_ERROR_SUSPENDED, DEFINE_ERROR_DB, DEFINE_ERROR_ABORT, + * DEFINE_ERROR_SERVER, DEFINE_ERROR_MEMORY_FULL, DEFINE_ERROR_AUTHENTICATE, + * DEFINE_ERROR_AUTOCONFIG_NOT_SUPPORT_BY_SERVER) + * + * @return SE_INTERNAL_OK on success + * SE_INTERNAL_NOT_DEFINED, SE_INTERNAL_NO_MEMORY, SE_INTERNAL_EVENT_ERROR on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +se_error_type_e send_noti_session_process(char *profile, char *progress, char *error, char *sync_type); + +/** + * @par Description: API to notify process update to UI + * This API can be used to notify process update + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, profile dir name(identify profile in UI) + * @param[in] string type, server sync type + * @param[in] string type, datastore name + * @param[in] string type, progressStatus(DEFINE_PROGRESS_NONE, DEFINE_PROGRESS_SUCCESS, DEFINE_FAILED_DB, + * DEFINE_FAILED_DB_FORBIDDEN, DEFINE_FAILED_DB_ITEM, DEFINE_FAILED_DB_CONFIG, DEFINE_FAILED_DB_DEVICEFULL) + * @param[in] string type, operationType(DEFINE_NOOP, DEFINE_ADD, DEFINE_DELETE, DEFINE_MOVE, DEFINE_COPY, DEFINE_REPLACE) + * @param[in] int type, whether from server or from client + * @param[in] int type, total number per operation + * @param[in] int type, synced item number per operation + * @param[in] int type, total number per db + * @param[in] int type, synced item number per db + * + * @return SE_INTERNAL_OK on success + * SE_INTERNAL_NOT_DEFINED, SE_INTERNAL_NO_MEMORY, SE_INTERNAL_EVENT_ERROR on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +se_error_type_e send_noti_process_update(char *profile_dir_name, char *sync_type, char *uri, char *progress_status, char *operation_type, int is_from_server, int total_per_operation, int synced_per_operation, int total_per_db, int synced_per_db); + +#endif /* SE_NOTIFICATION_H_ */ diff --git a/include/service-engine/se_storage.h b/include/service-engine/se_storage.h new file mode 100755 index 0000000..ecf45d6 --- /dev/null +++ b/include/service-engine/se_storage.h @@ -0,0 +1,258 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SE_Storage.h + * @version 0.1 + * @brief This file is the header file of interface which saves and gets sync results + */ + +#ifndef SE_STORAGE_H_ +#define SE_STORAGE_H_ + +#include "common/common_define.h" +#include "service-engine/se_error.h" + +/** + * @par Description: API to save sync type, sync result , last sync time(each datastore) + * This API can be used to save sync type, sync result , last sync time at the end of synchronization process + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] enum type, AlertType + * @param[in] enum type, sync_session_result_e + * @param[in] int type, last sync time + * @param[in] int type, whether or not tn end in pkg4 + * + * @return SE_INTERNAL_OK on success + * SE_INTERNAL_DA_ERROR on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +se_error_type_e write_profile_data(int account_id, alert_type_e alert_type, sync_session_result_e sync_session_result, int last_session_time, int only_from_client); + +/** + * @par Description: API to save sync statistics(each datastore) + * This API can be used to save statistics at the end of synchronization process + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] int type, content type(TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO) + * @param[in] bool type whether from server or from client + * @param[in] sync_result_s structure + * + * @return SE_INTERNAL_OK on success + * SE_INTERNAL_DA_ERROR on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +se_error_type_e write_sync_statistics(int account_id, int content_type, bool is_from_server, sync_result_s * sync_result); + +/** + * @par Description: API to save sync result(each datastore) + * This API can be used to save sync result at the end of synchronization process + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] int type, content type(TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO) + * @param[in] int type, last sync time + * @param[in] int type, whether or not to end in pkg4 + * @param[in] sync_result_s structure, client + * @param[in] sync_result_s structure, server + * + * @return SE_INTERNAL_OK on success + * SE_INTERNAL_DA_ERROR on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +se_error_type_e write_sync_resource_info(int account_id, int content_type, int last_session_time, int only_from_client, sync_result_s * client_sync_result, sync_result_s * server_sync_result); + +/** + * @par Description: API to get profile data from config_tbl + * This API can be used to get profile data + * This API is part of API for UI + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[out] string type, profile name + * @param[out] string type, server ip + * @param[out] string type, id + * @param[out] string type, password + * @param[out] string type, sync mode + * @param[out] string type, sync type + * @param[out] string type, interval + * @param[out] int type, last_session_status + * @param[out] int type, last_session_time + * + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_profile_data(int account_id, char **profile_name, char **addr, char **id, char **password, char **sync_mode, char **sync_type, char **interval, int *last_session_status, int *last_session_time); + +/** + * @par Description: API to get profile datastore information(enable, source uri, target uri, id, password) from config_tbl + * This API can be used to get enable, source uri, target uri, id, password + * This API is part of API for UI + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] int type, content type(TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO) + * @param[out] string type, enabled + * @param[out] string type, source uri + * @param[out] string type, target uri + * @param[out] string type, id + * @param[out] string type, password + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_profile_sync_category(int account_id, int content_type, int *enabled, char **src_uri, char **tgt_uri, char **id, char **password); + +/** + * @par Description: API to get profile sync statistics for each content type from config_tbl + * This API can be used to get profile sync statistics for each content type + * This API is part of API for UI + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] int type, content type(TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO) + * @param[out] string type, sync result(success, fail, stop) + * @param[out] int type, sync time + * @param[out] int type, total items(server to client) + * @param[out] int type, add items(server to client) + * @param[out] int type, delete items(server to client) + * @param[out] int type, replace items(server to client) + * @param[out] int type, total items(client to server) + * @param[out] int type, add items(client to server) + * @param[out] int type, delete items(client to server) + * @param[out] int type, replace items(client to server) + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_profile_statistics(int account_id, int content_type, char **dbSynced, int *last_session_time, + int *server2client_total, int *server2client_nrofadd, int *server2client_nrofdelete, int *server2client_nrofreplace, + int *client2server_total, int *client2server_nrofadd, int *client2server_nrofdelete, int *client2server_nrofreplace); + +/** + * @par Description: API to get all profiles data from config_tbl + * This API can be used to get all profiles data + * This API is part of API for UI + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[out] GList, all profiles data + * + * + * @return true on success + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool get_all_profiles_data(GList ** list); + +#endif /* SE_STORAGE_H_ */ diff --git a/include/service-engine/se_sync.h b/include/service-engine/se_sync.h new file mode 100755 index 0000000..7f63c5c --- /dev/null +++ b/include/service-engine/se_sync.h @@ -0,0 +1,234 @@ +/* + * oma-ds-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @SE_Sync.h + * @version 0.1 + * @brief This file is the header file of interface of Service Engine + */ + +#ifndef SYNCENGINE_H_ +#define SYNCENGINE_H_ + +#include <stdbool.h> +#include "common/common_define_internal.h" +#include "service-engine/se_common.h" +#include "framework/san-parser/pm_sanparser.h" +#include "service-engine/se_error.h" + +/** + * @par Description: API to process synchronization request + * This API can be used to process synchronization by predefined profile information + * This API uses Notification and Storage API which for notifying synchronization status to UI and saving sync results to Agent DB + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * @param[in] string type, sync mode(manual, push(SAN), periodic) + * @param[in] SanPackage structure, only for SAN sync mode + + * @return true on success, false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code +int main() +{ + bool ret = 0; + ret = synchronize(accountId, syncMode, pSanPackage); + if (ret == true) + { + //synchronization success + } + else + { + //synchronization fail + } + + return 0; +} + * @endcode + */ +bool synchronize(int account_id, char *sync_mode, san_package_s * sanpackage); + +/** + * @par Description: API to convert SyncProgress and SyncError from common error code + * This API can be used to convert string to be used to notify to UI for sync results + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, common_error_type_e + * @param[out] enum type, sync_progress_e + * @param[out] enum type, sync_error_e + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void convert_common_errorcode(common_error_type_e error_code, sync_progress_e * process, sync_error_e * error); + +/** + * @par Description: API to convert SyncProgress and SyncError from engine error code + * This API can be used to convert string to be used to notify to UI for sync results + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, se_error_type_e + * @param[out] enum type, sync_progress_e + * @param[out] enum type, sync_error_e + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void convert_engine_errorcode(se_error_type_e err, sync_progress_e * process, sync_error_e * error); + +/** + * @par Description: API to notify sync results for specific profile to UI + * This API can be used to notify sync results(SyncProgress, SyncError) to UI + * This API uses Notification which for notification module to send data using IPC + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] string type, profile_dir_name(identify profile in UI) + * @param[in] enum type, sync_progress_e + * @param[in] enum type, sync_error_e + * @param[in] enum type, se_error_type_e sync type + * + * @return SE_INTERNAL_OK on success + * SE_INTERNAL_NOT_DEFINED, SE_INTERNAL_NO_MEMORY, SE_INTERNAL_EVENT_ERROR on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +se_error_type_e session_process(char *profile_dir_name, alert_type_e server_sync_type, sync_progress_e process, sync_error_e error); + +/** + * @par Description: API to reset all synchronizing profiles(off) & construct item_tbl from service for in case + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return SE_INTERNAL_OK on success + * SE_INTERNAL_DA_ERROR on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +se_error_type_e reset_synchronizing_profiles(); + +/** + * @par Description: API to refresh from service for all contents type + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] int type, account id + * + * @return true on success, + * false on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +bool refresh_from_service_all(int account_id); + +/** + * @par Description: API to cancel connection during sync session + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return SE_INTERNAL_OK on success + * SE_INTERNAL_DA_ERROR on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +se_error_type_e cancel_sync_request(); + +#endif /* SYNCENGINE_H_ */ |