summaryrefslogtreecommitdiff
path: root/include/common/common_define_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/common/common_define_internal.h')
-rwxr-xr-xinclude/common/common_define_internal.h307
1 files changed, 307 insertions, 0 deletions
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_ */