1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 #ifndef SEAFILE_CONFIG_H
4 #define SEAFILE_CONFIG_H
5 
6 #include "seafile-session.h"
7 #include "db.h"
8 
9 #define KEY_CLIENT_ID "client_id"
10 #define KEY_CLIENT_NAME "client_name"
11 
12 #define KEY_MONITOR_ID  "monitor_id"
13 #define KEY_CHECK_REPO_PERIOD "check_repo_period"
14 #define KEY_DB_HOST "db_host"
15 #define KEY_DB_USER "db_user"
16 #define KEY_DB_PASSWD "db_passwd"
17 #define KEY_DB_NAME "db_name"
18 #define KEY_UPLOAD_LIMIT "upload_limit"
19 #define KEY_DOWNLOAD_LIMIT "download_limit"
20 #define KEY_CDC_AVERAGE_BLOCK_SIZE "block_size"
21 #define KEY_ALLOW_INVALID_WORKTREE "allow_invalid_worktree"
22 #define KEY_ALLOW_REPO_NOT_FOUND_ON_SERVER "allow_repo_not_found_on_server"
23 #define KEY_SYNC_EXTRA_TEMP_FILE "sync_extra_temp_file"
24 #define KEY_DISABLE_BLOCK_HASH "disable_block_hash"
25 
26 /* Http sync settings. */
27 #define KEY_ENABLE_HTTP_SYNC "enable_http_sync"
28 #define KEY_DISABLE_VERIFY_CERTIFICATE "disable_verify_certificate"
29 
30 /* Http sync proxy settings. */
31 #define KEY_USE_PROXY "use_proxy"
32 #define KEY_PROXY_TYPE "proxy_type"
33 #define KEY_PROXY_ADDR "proxy_addr"
34 #define KEY_PROXY_PORT "proxy_port"
35 #define KEY_PROXY_USERNAME "proxy_username"
36 #define KEY_PROXY_PASSWORD "proxy_password"
37 #define PROXY_TYPE_HTTP "http"
38 #define PROXY_TYPE_SOCKS "socks"
39 
40 gboolean
41 seafile_session_config_exists (SeafileSession *session, const char *key);
42 
43 /*
44  * Returns: config value in string. The string should be freed by caller.
45  */
46 char *
47 seafile_session_config_get_string (SeafileSession *session,
48                                    const char *key);
49 
50 /*
51  * Returns:
52  * If key exists, @exists will be set to TRUE and returns the value;
53  * otherwise, @exists will be set to FALSE and returns -1.
54  */
55 int
56 seafile_session_config_get_int (SeafileSession *session,
57                                 const char *key,
58                                 gboolean *exists);
59 
60 /*
61  * Returns: config value in boolean. Return FALSE if the value is not configured.
62  */
63 gboolean
64 seafile_session_config_get_bool (SeafileSession *session,
65                                  const char *key);
66 
67 
68 int
69 seafile_session_config_set_string (SeafileSession *session,
70                                    const char *key,
71                                    const char *value);
72 
73 int
74 seafile_session_config_set_int (SeafileSession *session,
75                                 const char *key,
76                                 int value);
77 
78 int
79 seafile_session_config_set_allow_invalid_worktree(SeafileSession *session, gboolean val);
80 
81 gboolean
82 seafile_session_config_get_allow_invalid_worktree(SeafileSession *session);
83 
84 gboolean
85 seafile_session_config_get_allow_repo_not_found_on_server(SeafileSession *session);
86 
87 sqlite3 *
88 seafile_session_config_open_db (const char *db_path);
89 
90 
91 #endif
92