00001 /******************************************************************** 00002 00003 Copyright © 2006, ACCESS Systems Americas, Inc. All rights reserved. 00004 00005 The contents of this file are subject to the Mozilla Public License Version 00006 1.1 (the "License"); you may not use this file except in compliance with 00007 the License. You may obtain a copy of the License at 00008 http://www.mozilla.org/MPL/ 00009 00010 Software distributed under the License is distributed on an "AS IS" basis, 00011 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 00012 for the specific language governing rights and limitations under the 00013 License. 00014 00015 The Original Code is the entire contents of this file. 00016 00017 The Initial Developer of the Original Code is ACCESS Systems Americas, Inc. 00018 00019 Portions created by ACCESS Systems Americas, Inc. are Copyright © 2006. All 00020 Rights Reserved. 00021 00022 Contributor(s): none. 00023 00024 ********************************************************************/ 00032 #ifndef ALP_GLOBAL_SETTINGS_SERVER_H_ 00033 #define ALP_GLOBAL_SETTINGS_SERVER_H_ 1 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 #include <glib.h> 00040 #include <sys/types.h> 00041 #include <sys/stat.h> 00042 #include <unistd.h> 00043 #include <time.h> 00044 00045 #include <hiker/config.h> 00046 #include <hiker/sysclass.h> 00047 #include <hiker/types.h> 00048 #include <hiker/ipc.h> 00049 #include "hiker/global_settings.h" 00050 00051 #include "sqlfs/sqlfs.h" 00052 00053 00054 #define TRANSACTION_CHECK_INTERVAL 10 /*seconds */ 00055 00056 typedef struct gs_svr_context 00057 { 00058 sqlfs_t *sqlfs; 00059 int notification_on; /* to broadcast change notification or not */ 00060 GList *node_stack; 00061 char *cwd; 00062 /*GHashTable *callback_table; 00063 GHashTable *any_callback_table;*/ 00064 int transaction_level; 00065 time_t last_op_time; 00066 pid_t pid; 00067 int thread_id; 00068 int to_close; 00069 char *default_uid_in_import; 00070 char *default_gid_in_import; 00071 mode_t default_mode_in_import; 00072 00073 } gs_svr_context; 00074 00075 int AlpGlobalSettingsServerMain(int argc, char *argv[]); 00076 00077 alp_status_t alp_global_settings_server_wait_started(void); 00078 00079 alp_status_t alp_global_settings_server_running(void); 00080 00081 alp_status_t alp_global_settings_server_stop(void); 00082 00083 alp_status_t Alp_global_settings_server_clean_data(void); 00084 00085 extern alp_status_t 00086 gs_svr_init(const char *db_file); 00087 00088 extern alp_status_t 00089 gs_svr_open(const char *db_file, gs_svr_context **context); 00090 00091 extern alp_status_t 00092 gs_svr_close(gs_svr_context *context); 00093 00094 extern alp_status_t 00095 gs_svr_proc_import_from_file(gs_svr_context *context, 00096 const char *file); 00097 00098 extern alp_status_t 00099 gs_svr_proc_delete_tree(gs_svr_context *context, const gchar *key); 00100 00101 00102 extern alp_status_t 00103 gs_svr_proc_begin_transaction(gs_svr_context *context); 00104 00105 00106 extern alp_status_t 00107 gs_svr_proc_complete_transaction(gs_svr_context *context); 00108 00109 extern alp_status_t 00110 gs_svr_proc_cancel_transaction(gs_svr_context *context); 00111 00112 00117 #ifdef __cplusplus 00118 } // extern "C" 00119 #endif 00120 00121 #endif // #ifndef ALP_GLOBAL_SETTINGS_SERVER_H_