OSDN Git Service

sync read count of threads.
[ntch/develop.git] / src / inc / cloud / nt_cloud.h
1 /* Copyright 2013 Akira Ohta (akohta001@gmail.com)
2     This file is part of ntch.
3
4     The ntch is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
8
9     The ntch is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with ntch.  If not, see <http://www.gnu.org/licenses/>.
16     
17 */
18
19 #ifndef _NT_CLOUD_H_
20 #define _NT_CLOUD_H_
21
22 #include "usr/usr_db_t.h"
23
24 #ifdef NT_CLOUD
25
26
27 typedef struct tag_nt_cloud_handle *nt_cloud_handle;
28 typedef struct tag_nt_cloud_handle{
29         int chk_sum;
30 }nt_cloud_handle_t;
31
32 extern nt_cloud_handle nt_cloud_init(
33                 const char *auth_url, const char *usr_id, const char *pass);
34 extern BOOL nt_cloud_chk_user(nt_cloud_handle handle);
35 extern BOOL nt_cloud_upload_file(nt_cloud_handle handle,
36                 const char *file_name, nt_link_tp lines);
37 extern nt_link_tp nt_cloud_download_file(nt_cloud_handle handle,
38                 const char *file_name);
39
40 extern BOOL nt_cloud_insert_lines_into_file(nt_cloud_handle handle,
41                 const char *file_name, nt_link_tp lines);
42 extern BOOL nt_cloud_delete_lines_from_file(nt_cloud_handle handle,
43                 const char *file_name, nt_link_tp lines);
44
45 extern void nt_cloud_update_read_count_async(nt_cloud_handle handle, 
46                 const wchar_t *board_name, const wchar_t *dat_name, 
47                 int res_number);
48 extern BOOL nt_cloud_update_read_count(nt_cloud_handle handle, 
49                 const wchar_t *board_name, const wchar_t *dat_name, 
50                 int res_number, int depth);
51 extern BOOL nt_cloud_query_board_attributes(nt_cloud_handle handle, 
52                 const wchar_t *board_name, nt_usr_db_handle db_handle, int depth);
53
54 extern void nt_cloud_delete_read_count_async(nt_cloud_handle handle, 
55                 const wchar_t *board_name, const wchar_t *dat_name);
56 extern BOOL nt_cloud_delete_read_count(nt_cloud_handle handle, 
57                 const wchar_t *board_name, const wchar_t *dat_name,
58                 int depth);
59
60 extern BOOL nt_cloud_query_favorite_attributes_async(nt_cloud_handle handle, 
61                 nt_usr_db_handle db_handle);
62 extern BOOL nt_cloud_query_attributes(nt_cloud_handle handle, 
63                 nt_usr_db_handle db_handle, int depth);
64
65
66
67 extern nt_cloud_handle nt_cloud_get_handle();
68 extern int nt_cloud_add_ref(nt_cloud_handle);
69 extern int nt_cloud_release_ref(nt_cloud_handle);
70
71 #ifdef NT_CLOUD_PRIVATE
72
73 #define NT_CLOUD_CHK_SUM (1478428)
74
75 typedef struct tag_nt_cloud_t *nt_cloud_tp;
76 typedef struct tag_nt_cloud_t {
77         nt_cloud_handle_t handle;
78         int ref_count;
79         char *usr_id;
80         char *passwd;
81         char *auth_url;
82         char *query_url;
83         char *home_url;
84         char *token;
85         int error_no;
86 }nt_cloud_t;
87
88 extern int nt_get_cloud_result(const char *ptr);
89 extern nt_link_tp nt_split_line(char *data);
90
91 extern BOOL nt_wc_sjis_aes_b64_url_encode(
92                 iconv_t icd, nt_crypt_handle h_crypt,
93                 const wchar_t *in_data,
94                 unsigned char *wrk_buf, char *out_data, size_t max_len);
95 extern BOOL nt_url_b64_aes_sjis_wc_decode(
96                 iconv_t icd, nt_crypt_handle h_crypt,
97                 const char *in_data,
98                 unsigned char *wrk_buf, wchar_t *out_data, size_t max_len);
99
100 extern BOOL nt_ascii_aes_b64_url_encode(
101                 iconv_t icd, nt_crypt_handle h_crypt,
102                 const char *in_data,
103                 unsigned char *wrk_buf, char *out_data, size_t max_len);
104 extern BOOL nt_url_b64_aes_ascii_decode(
105                 iconv_t icd, nt_crypt_handle h_crypt,
106                 const char *in_data,
107                 unsigned char *wrk_buf, char *out_data, size_t max_len);
108
109 #define NT_CLOUD_INSERT_LINES_FILE_PHP "nc_insert_lines_file.php"
110 #define NT_CLOUD_DELETE_LINES_FILE_PHP "nc_delete_lines_file.php"
111 #define NT_CLOUD_WRITE_FILE_PHP "nc_write_file.php"
112 #define NT_CLOUD_UPDATE_READ_CNT_PHP "nc_update_readcnt_db.php"
113 #define NT_CLOUD_QUERY_ATTRIBUTES_PHP "nc_query_attributes_db.php"
114 #define NT_CLOUD_QUERY_BOARD_ATTRIBUTES_PHP "nc_query_board_attributes_db.php"
115 #define NT_CLOUD_DELETE_READ_CNT_PHP "nc_delete_readcnt_db.php"
116
117 #endif /*NT_CLOUD_PRIVATE*/
118
119 #endif /*NT_CLOUD*/
120 #endif /*_NT_CLOUD_H_*/