-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrcloud.h
More file actions
100 lines (80 loc) · 2.91 KB
/
frcloud.h
File metadata and controls
100 lines (80 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef _FRCLOUD_H_
#define _FRCLOUD_H_
#include <curl/curl.h>
// Peplace with suitable key file name
#define KEY_FILE "FastReport.Cloud.key"
// FastReport cloud server address
//#define DEFAULT_SERVER "https://fastreport.cloud"
#define DEFAULT_SERVER "https://xn--80ab2acne.xn--e1aflibyb2b0b.xn--p1ai"
#define DEBUG_DIRECTORY_JSON 0
#define ID_SIZE 24
// Undefine this to disable storing history to file
#define HISTORY_FILE ".frcloud.history"
typedef unsigned long uint64_t;
typedef struct {
char remote_fname[4096];
void * curl;
} dnld_params_t;
typedef struct json_chunk_header {
struct json_chunk_header * next_chunk;
int size;
} json_chunk_header_t;
typedef enum { Templates, Reports, Exports} namespace_t;
typedef enum { Unknown, File, Folder } object_type_t;
typedef enum { Fpx, Pdf, Html, Docx} export_type_t;
#define ID_BUFF_SIZE 26 // 24 characters and two bytes pad
typedef struct {
object_type_t type;
char *name;
char uuid[ID_BUFF_SIZE];
char template[ID_BUFF_SIZE];
char parent[ID_BUFF_SIZE];
char subscription[ID_BUFF_SIZE];
uint size;
char status[32];
char reason[32];
char created[32];
char edited[32];
char creator[64];
char editor[64];
} report_info_t;
typedef struct {
CURL * curl;
int verbose;
namespace_t session_namespace;;
report_info_t last_object;
char * command;
char * words[8];
int words_count;
int take_count;
uint received_json_size;
json_chunk_header_t * json_chunks_head;
json_chunk_header_t * json_chunks_tail;
char reports_root_folder[ID_BUFF_SIZE];
char reports_current_folder[ID_BUFF_SIZE];
char templates_root_folder[ID_BUFF_SIZE];
char templates_current_folder[ID_BUFF_SIZE];
char exports_root_folder[ID_BUFF_SIZE];
char exports_current_folder[ID_BUFF_SIZE];
} command_context_t;
typedef void(*cloud_command_t)(command_context_t *);
typedef struct {
char const * const command_name;
cloud_command_t run;
char const * const short_help;
char const * const long_help;
} command_record_t;
int load_token(char * tokenfilename, char * auth);
int draw_json_ListFolderAndFiles(char *js, size_t jslen);
int draw_json_Breadcrumbs(char *js, size_t jslen);
int json_SelectFile(char *js, size_t jslen, command_context_t * context);
int json_FileInfo(char *js, size_t jslen, command_context_t * context);
char *base64_encode(const unsigned char *data,
size_t input_length,
size_t *output_length);
unsigned char *base64_decode(const char *data,
size_t input_length,
size_t *output_length);
void build_decoding_table();
void base64_cleanup();
#endif