1/* Name:SambaClient
2   Nvram Port : 4
3   Client Port : 3571
4   Inotify Port : 3678
5   Nvram Struct:
6        4>WORKGROUP>smb://192.168.1.9>zxcvbnmmmmmm>mars>123456>0>/tmp/mnt/ANDI/syncFolder
7        |       |             |               |      |_____|   |            |
8        |       |             |               |         |      |            |
9        ID   workgroup        IP         shareFolder   auth   rule     localFolder
10
11*/
12
13#ifndef __DATA_H
14#define __DATA_H
15#include <stdlib.h>
16
17#ifdef NVRAM_
18#ifdef USE_TCAPI
19        #define WANDUCK "Wanduck_Command"
20        #define AICLOUD "AiCloud_Entry"
21        #include "libtcapi.h"
22        #include "tcapi.h"
23#else
24        #include <bcmnvram.h>
25#endif
26        #include <shutils.h>
27#endif
28
29#define MAX_BUFF_SIZE   255
30
31#define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
32#define DIR_MODE  S_IRWXU | S_IRWXG | S_IRWXO
33
34//#define __DEBUG__
35#ifdef __DEBUG__
36#define DEBUG(info, ...) printf(info,##__VA_ARGS__)
37#else
38#define DEBUG(info, ...)
39#endif
40
41#define S_INITIAL		70
42#define S_SYNC			71
43#define S_DOWNUP		72
44#define S_UPLOAD		73
45#define S_DOWNLOAD		74
46#define S_STOP			75
47#define S_ERROR			76
48
49#define NV_PORT 4
50#define MYPORT 3571
51#define INOTIFY_PORT 3678
52
53typedef struct Mult_Rule
54{
55        char workgroup[64];
56        char serverIP[32];
57        char shareFolder[255];
58        char server_root_path[255];
59        char acount[64];
60        char password[64];
61        int  rule;
62        char client_root_path[255];
63        char mount_path[255];
64}MultRule;
65
66typedef struct _Config
67{
68        int id;
69        int dir_num;
70        MultRule **multrule;
71}Config;
72
73typedef struct node{
74    char *href;
75    char *filename;
76    int isfile;
77    long long int size;
78    time_t modtime;
79    int ismodify;
80    struct node *next;
81}CloudFile;
82
83typedef struct BROWSE
84{
85    int foldernumber;
86    int filenumber;
87    CloudFile *folderlist;
88    CloudFile *filelist;
89}Browse;
90
91typedef struct ServerTreeNode
92{
93    char *parenthref;
94    Browse *browse;
95    struct ServerTreeNode *Child;
96    struct ServerTreeNode *NextBrother;
97}Server_TreeNode;
98
99typedef struct _Node
100{
101    char *cmdName;
102    struct _Node *next;
103}Node;
104
105typedef struct Action_Item
106{
107    char *action;
108    char *path;
109    struct Action_Item *next;
110} action_item;
111
112typedef struct SYNC_LIST
113{
114    char up_item_file[256];
115    char temp_path[256];
116    int index;
117    int first_sync;
118    int receve_socket;
119    int have_local_socket;
120    int no_local_root;
121    int init_completed;
122    int sync_disk_exist;
123    int IsNetWorkUnlink; //2014.11.20 by sherry (ip������������������������������)
124    action_item *copy_file_list;
125    action_item *server_action_list;
126    action_item *dragfolder_action_list;
127    action_item *unfinished_list;
128    action_item *download_only_socket_head;
129    action_item *up_space_not_enough_list;
130    Node *SocketActionList;
131    Node *SocketActionList_Rename;
132    Node *SocketActionList_Refresh;
133    Server_TreeNode *ServerRootNode;
134    Server_TreeNode *OldServerRootNode;
135    Server_TreeNode *OrigServerRootNode;
136}sync_list;
137
138typedef struct LOCALFOLDER{
139    char *path;
140    char *name;
141    struct LOCALFOLDER *next;
142}LocalFolder;
143
144typedef struct LOCALFILE{
145    char *path;
146    char *name;
147    time_t modtime;
148    long long int size;
149    struct LOCALFILE *next;
150}LocalFile;
151
152typedef struct LOCAL
153{
154    int foldernumber;
155    int filenumber;
156    LocalFolder *folderlist;
157    LocalFile *filelist;
158}Local;
159
160struct tokenfile_info_tag
161{
162    char *folder;
163    char *url;
164    char *mountpath;
165    struct tokenfile_info_tag *next;
166};
167
168struct mounts_info_tag
169{
170    int num;
171    char **paths;
172};
173
174#endif // DATA_H
175