4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __ACCOUNT_PRIVATE_TYPES_H__
23 #define __ACCOUNT_PRIVATE_TYPES_H__
38 #define LOG_TAG "ACCOUNT"
40 #define ACCOUNT_VERBOSE(fmt, arg...) \
41 LOGD(": " fmt "\n", ##arg);
42 #define ACCOUNT_DEBUG(fmt, arg...) \
43 LOGD(": " fmt "\n", ##arg);
44 #define ACCOUNT_ERROR(fmt, arg...) \
45 LOGE(": " fmt "\n", ##arg);
46 #define ACCOUNT_FATAL(fmt, arg...) \
47 LOGF(": " fmt "\n", ##arg);
48 #define ACCOUNT_SLOGD(fmt, arg...) \
49 SECURE_LOGD(": " fmt "\n", ##arg);
50 #define ACCOUNT_SLOGI(fmt, arg...) \
51 SECURE_LOGI(": " fmt "\n", ##arg);
52 #define ACCOUNT_SLOGE(fmt, arg...) \
53 SECURE_LOGE(": " fmt "\n", ##arg);
55 #define ACCOUNT_RETURN_VAL(eval, expr, ret_val, X)\
62 #define ACCOUNT_SNPRINTF(dest,size,format,arg...) \
64 snprintf(dest,size-1,format,##arg); \
66 /* If the same pointer is passed to free twice, known as a double free. To avoid this, set pointers to
67 NULL after passing them to free: free(NULL) is safe (it does nothing).
70 #define ACCOUNT_MEMSET(dest,value,size) \
72 memset(dest,value,size); \
75 #define ACCOUNT_CATCH_ERROR(eval, expr, error_val, X) \
79 error_code = (error_val);\
83 #define _ACCOUNT_FREE(ptr) \
90 #define _ACCOUNT_GFREE(ptr) \
96 #define ACCOUNT_DB_NAME "/opt/usr/dbspace/.account.db"
97 #define ACCOUNT_TABLE "account"
98 #define CAPABILITY_TABLE "capability"
99 #define ACCOUNT_CUSTOM_TABLE "account_custom"
100 #define ACCOUNT_TYPE_TABLE "account_type"
101 #define LABEL_TABLE "label"
102 #define PROVIDER_FEATURE_TABLE "provider_feature"
103 #define ACCOUNT_SQLITE_SEQ "sqlite_sequence"
104 #define ACCOUNT_SQL_LEN_MAX 1024
105 #define ACCOUNT_TABLE_TOTAL_COUNT 6
107 #define FACEBOOK_PKG_NAME "com.samsung.facebook"
108 #define EMAIL_PKG_NAME "email-setting-efl"
109 #define EXCHANGE_PKG_NAME "activesync-ui"
110 #define IMS_SERVICE_PKG_NAME "ims-service"
111 #define SAMSUNGACCOUNTFRONT_PKG_NAME "com.samsung.samsung-account-front"
112 //#define SAMSUNGACCOUNT_PKG_NAME "gr47by21a5.SamsungAccount"
113 #define SAMSUNGACCOUNT_PKG_NAME "com.samsung.samsungaccount"
114 #define CHATON_PKG_NAME "xnq5eh9vop.ChatON"
115 #define DROPBOX_PKG_NAME "com.samsung.dropbox"
116 #define SYNCHRONISE_PKG_NAME "setting-synchronise-efl"
118 #define USER_TXT_CNT 5
119 #define USER_INT_CNT 5
122 /* account uri list */
123 #define ACCOUNT_DATA_SERVICE_PROVIDER "http://tizen.org/account/data/service_provider"
124 #define ACCOUNT_OPERATION_SIGNIN_OLD "http://tizen.org/account/operation/signin"
126 // private account operation type
127 #define ACCOUNT_OPERATION_FMM "http://tizen.org/account/operation/fmm"
128 #define ACCOUNT_OPERATION_MYACCOUNT "http://tizen.org/account/operation/signin_from_myaccount"
129 // End of private account operation type
131 #define ACCOUNT_SUPPORTS_CAPABILITY_POST "http://tizen.org/account/capability/post"
132 #define ACCOUNT_SUPPORTS_CAPABILITY_VOIP "http://tizen.org/account/capability/voip"
133 #define ACCOUNT_SUPPORTS_CAPABILITY_SAMSUNG_APPS "http://tizen.org/account/capability/samsungapps"
134 #define ACCOUNT_SUPPORTS_CAPABILITY_TASK "http://tizen.org/account/capability/task"
135 #define ACCOUNT_SUPPORTS_CAPABILITY_MOBILE_TRACKER "http://tizen.org/account/capability/mobiletracker"
136 #define ACCOUNT_SUPPORTS_CAPABILITY_S_NOTE "http://tizen.org/account/capability/snote"
137 #define ACCOUNT_SUPPORTS_CAPABILITY_GALLERY "http://tizen.org/account/capability/gallery"
138 #define ACCOUNT_SUPPORTS_CAPABILITY_MEMO "http://tizen.org/account/capability/memo"
139 #define ACCOUNT_SUPPORTS_CAPABILITY_CHAT "http://tizen.org/account/capability/chat"
140 #define ACCOUNT_SUPPORTS_CAPABILITY_BOOKMARK "http://tizen.org/account/capability/bookmark"
141 #define ACCOUNT_SUPPORTS_CAPABILITY_SYNCHRONISE "http://tizen.org/account/capability/synchronise"
142 #define ACCOUNT_SUPPORTS_CAPABILITY_TIZEN_EMAIL "http://tizen.org/account/capability/tizen_email"
143 #define ACCOUNT_SUPPORTS_CAPABILITY_INTERNET "http://tizen.org/account/capability/internet"
144 #define ACCOUNT_SUPPORTS_CAPABILITY_DOCOMO_SCHEDULE_MEMO "http://tizen.org/account/capability/docomo"
145 /* end of account uri list */
147 typedef struct _account_s
157 char* domain_name; /*< domain name [Ex: google, facebook, twitter, samsung, ...] */
161 int user_data_int[USER_INT_CNT];
162 char* user_data_txt[USER_TXT_CNT];
163 GSList* capablity_list;
168 typedef struct _capability_s
176 }account_capability_s;
179 typedef struct _account_custom_s
187 typedef struct _account_type_s
191 char* service_provider_id;
193 char* small_icon_path;
194 bool multiple_account_support;
196 GList* account_type_list;
197 GSList* provider_feature_list;
201 typedef struct _label_s
208 typedef struct _provider_feature_s
214 typedef struct _account_subscribe_s
216 account_event_cb account_subscription_callback;
218 }account_subscribe_s;
221 * @brief Enumarations for account handle fields.
225 ACCOUNT_FIELD_NONE = -1,
227 ACCOUNT_FIELD_USER_NAME,
228 ACCOUNT_FIELD_EMAIL_ADDRESS,
229 ACCOUNT_FIELD_DISPLAY_NAME,
230 ACCOUNT_FIELD_ICON_PATH,
231 ACCOUNT_FIELD_SOURCE,
232 ACCOUNT_FIELD_PACKAGE_NAME,
233 ACCOUNT_FIELD_ACCESS_TOKEN,
234 ACCOUNT_FIELD_DOMAIN_NAME,
235 ACCOUNT_FIELD_AUTH_TYPE,
236 ACCOUNT_FIELD_SECRET,
237 ACCOUNT_FIELD_SYNC_SUPPORT,
238 ACCOUNT_FIELD_USER_TEXT_0,
239 ACCOUNT_FIELD_USER_TEXT_1,
240 ACCOUNT_FIELD_USER_TEXT_2,
241 ACCOUNT_FIELD_USER_TEXT_3,
242 ACCOUNT_FIELD_USER_TEXT_4,
243 ACCOUNT_FIELD_USER_INT_0,
244 ACCOUNT_FIELD_USER_INT_1,
245 ACCOUNT_FIELD_USER_INT_2,
246 ACCOUNT_FIELD_USER_INT_3,
247 ACCOUNT_FIELD_USER_INT_4,
248 ACCOUNT_DB_FIELD_END,
252 * @brief Enumarations for capability fields.
256 CAPABILITY_FIELD_NONE = -1,
258 CAPABILITY_FIELD_KEY,
259 CAPABILITY_FIELD_VALUE,
260 CAPABILITY_FIELD_PACKAGE_NAME,
261 CAPABILITY_FIELD_USER_NAME,
262 CAPABILITY_FIELD_ACCOUNT_ID,
263 CAPABILITY_FIELD_END,
268 ACCOUNT_CUSTOM_FIELD_NONE = -1,
269 ACCOUNT_CUSTOM_FIELD_ACCOUNT_ID,
270 ACCOUNT_CUSTOM_FIELD_APP_ID,
271 ACCOUNT_CUSTOM_FIELD_KEY,
272 ACCOUNT_CUSTOM_FIELD_VALUE,
273 ACCOUNT_CUSTOM_FIELD_END,
274 }ACCOUNT_CUSTOM_DB_IDX;
277 ACCOUNT_TYPE_FIELD_NONE = -1,
278 ACCOUNT_TYPE_FIELD_ID,
279 ACCOUNT_TYPE_FIELD_APP_ID,
280 ACCOUNT_TYPE_FIELD_SERVICE_PROVIDER_ID,
281 ACCOUNT_TYPE_FIELD_ICON_PATH,
282 ACCOUNT_TYPE_FIELD_SMALL_ICON_PATH,
283 ACCOUNT_TYPE_FIELD_MULTIPLE_ACCOUNT_SUPPORT,
284 ACCOUNT_TYPE_FIELD_END,
285 }ACCOUNT_TYPE_DB_IDX;
288 LABEL_FIELD_NONE = -1,
296 PROVIDER_FEATURE_FIELD_NONE = -1,
297 PROVIDER_FEATURE_FIELD_APP_ID,
298 PROVIDER_FEATURE_FIELD_KEY,
299 PROVIDER_FEATURE_FIELD_END,
300 }PROVIDER_FEATURE_DB_IDX;
302 typedef sqlite3_stmt* account_stmt;
305 #define ACCOUNT_SCHEMA "create table account \n"\
307 "_id INTEGER PRIMARY KEY AUTOINCREMENT, "\
309 "email_address TEXT, "\
310 "display_name TEXT, "\
313 "package_name TEXT, "\
314 "access_token TEXT, "\
315 "domain_name TEXT, "\
316 "auth_type INTEGER, "\
318 "sync_support INTEGER, "\
319 "txt_custom0 TEXT, "\
320 "txt_custom1 TEXT, "\
321 "txt_custom2 TEXT, "\
322 "txt_custom3 TEXT, "\
323 "txt_custom4 TEXT, "\
324 "int_custom0 INTEGER, "\
325 "int_custom1 INTEGER, "\
326 "int_custom2 INTEGER, "\
327 "int_custom3 INTEGER, "\
328 "int_custom4 INTEGER "\
332 #define CAPABILITY_SCHEMA "create table capability \n"\
334 "_id INTEGER PRIMARY KEY AUTOINCREMENT, "\
337 "package_name TEXT, "\
339 "account_id INTEGER "\
342 //ACCOUNT_CUSTOM_TABLE
343 #define ACCOUNT_CUSTOM_SCHEMA "create table account_custom \n"\
345 "AccountId INTEGER, "\
352 #define ACCOUNT_TYPE_SCHEMA "create table account_type \n"\
354 "_id INTEGER PRIMARY KEY AUTOINCREMENT, "\
356 "ServiceProviderId TEXT, "\
358 "SmallIconPath TEXT, "\
359 "MultipleAccountSupport INTEGER "\
363 #define LABEL_SCHEMA "create table label \n"\
370 //PROVIDER_FEATURE_TABLE
371 #define PROVIDER_FEATURE_SCHEMA "create table provider_feature \n"\
377 typedef struct GSList account_iterator_s;
383 #endif /* __SLP_ACCOUNT_PRIVATE_TYPES_H__*/