217 lines
5.1 KiB
Plaintext
217 lines
5.1 KiB
Plaintext
#ifndef _COMMLIB_H
|
|
#define _COMMLIB_H
|
|
|
|
#if defined(COMMLIB_EXPORTS)
|
|
# define WIN32DLL __declspec(dllexport)
|
|
#else
|
|
# define WIN32DLL __declspec(dllimport)
|
|
#endif
|
|
|
|
|
|
typedef void *HCOMMLIB;
|
|
|
|
|
|
#pragma pack(1)
|
|
typedef struct {
|
|
char id[32];
|
|
char domain[128];
|
|
#ifdef _OLD
|
|
#else
|
|
char domain2[128];
|
|
#endif
|
|
} CLSERVICE_STRUCT, *PCLSERVICE_STRUCT;
|
|
#pragma pack()
|
|
|
|
#pragma pack(1)
|
|
typedef struct {
|
|
char value;
|
|
char path[2048];
|
|
} CLPATHINFO_STRUCT, *PCLPATHINFO_STRUCT;
|
|
#pragma pack()
|
|
|
|
typedef struct {
|
|
char path[2048];
|
|
__int64 size;
|
|
char lastModified[32];
|
|
unsigned int attr;
|
|
// char* mimeType;
|
|
char source[128];
|
|
} CLFILE_STRUCT, *PCLFILE_STRUCT;
|
|
|
|
|
|
// For SHFILE_STRUCT.attr
|
|
enum CL_FILEATTR {
|
|
CLFILEATTR_FOLDER = 0x00000001,
|
|
};
|
|
|
|
// For write policy
|
|
enum CL_WRITEPOLICY {
|
|
CLWRITEPOLICY_NONE = 0,
|
|
CLWRITEPOLICY_OVERWRITE,
|
|
CLWRITEPOLICY_APPEND
|
|
};
|
|
|
|
// For error number
|
|
enum CL_ERRNO {
|
|
CLERRNO_UNDEFINED = 30000,
|
|
CLERRNO_INVALID_HANDLE = 30001,
|
|
CLERRNO_ABNORMAL_RESPONSE = 30002,
|
|
CLERRNO_SERVICE = 30003,
|
|
CLERRNO_AUTHORIZATION = 30004,
|
|
CLERRNO_FORBIDDEN = 30005,
|
|
CLERRNO_PARSE_FILE_LIST = 30006,
|
|
CLERRNO_EXISTSFILE = 30007,
|
|
CLERRNO_NOEXISTSFILE = 30008,
|
|
CLERRNO_BUSY = 30009,
|
|
CLERRNO_NOAVAILQUOTA = 30010,
|
|
CLERRNO_NOSERVICE_LIST = 30011,
|
|
CLERRNO_NOAVAILPATH_LIST = 30012,
|
|
CLERRNO_INVALID_CMD_RESULT = 30013,
|
|
CLERRNO_MAX = CLERRNO_NOAVAILPATH_LIST + 1,
|
|
};
|
|
|
|
// Callback function format
|
|
typedef void (*cl_callback)(
|
|
void *param, // Callback function's param
|
|
__int64 result // 0 : Complete,
|
|
// -1 : Error,
|
|
// .. : Processing
|
|
);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifdef _OLD
|
|
// Initialization
|
|
WIN32DLL HCOMMLIB cl_init(
|
|
const char *url, // Url, CENTER == NULL
|
|
const char *userId, // User id
|
|
const char *password, // Password
|
|
const char *proxyHost, // Proxy server addr
|
|
unsigned int proxyPort); // Proxy server port
|
|
#else
|
|
WIN32DLL HCOMMLIB cl_init(
|
|
const char *url, // Url, CENTER == NULL
|
|
const char *d2, // second domain
|
|
const char *userId, // User id
|
|
const char *password, // Password
|
|
const char *proxyHost, // Proxy server addr
|
|
unsigned int proxyPort); // Proxy server port
|
|
#endif
|
|
|
|
// Termination
|
|
WIN32DLL void cl_free(
|
|
HCOMMLIB hcl);
|
|
|
|
|
|
WIN32DLL int cl_get_error_number(
|
|
HCOMMLIB hcl);
|
|
WIN32DLL const char* cl_get_error_message(
|
|
HCOMMLIB hcl);
|
|
|
|
|
|
WIN32DLL PCLSERVICE_STRUCT cl_get_service_list(
|
|
HCOMMLIB hcl,
|
|
unsigned int *count); // Island count
|
|
|
|
WIN32DLL void cl_free_service_list(
|
|
HCOMMLIB hcl,
|
|
PCLSERVICE_STRUCT pclsl); // Volume list pointer
|
|
|
|
WIN32DLL BOOL cl_get_service_info(
|
|
HCOMMLIB hcl,
|
|
const char *serviceId,
|
|
__int64 *totalBytes,
|
|
__int64 *usedBytes);
|
|
|
|
|
|
WIN32DLL PCLFILE_STRUCT cl_get_file_list(
|
|
HCOMMLIB hcl,
|
|
const char *path, // Path
|
|
unsigned int depth, // 0 : itself
|
|
// 1 : 1 depth children
|
|
// 2 : all children
|
|
unsigned int *count); // File count
|
|
|
|
WIN32DLL void cl_free_file_list(
|
|
HCOMMLIB hcl,
|
|
PCLFILE_STRUCT pclfl); // File list pointer
|
|
|
|
|
|
WIN32DLL PCLPATHINFO_STRUCT cl_get_path_auth(
|
|
HCOMMLIB hcl,
|
|
const char *serviceId,
|
|
unsigned int *count);
|
|
|
|
WIN32DLL void cl_free_path_auth(
|
|
HCOMMLIB hcl,
|
|
PCLPATHINFO_STRUCT pclpi);
|
|
|
|
WIN32DLL BOOL cl_set_anonyauth(
|
|
HCOMMLIB hcl,
|
|
const char *serviceId,
|
|
BOOL set,
|
|
const char *path);
|
|
|
|
WIN32DLL BOOL cl_set_bandwidth(
|
|
HCOMMLIB hcl,
|
|
const char *serviceId,
|
|
const char *levelnpath);
|
|
|
|
|
|
WIN32DLL BOOL cl_make_directory(
|
|
HCOMMLIB hcl,
|
|
const char *drectory); // Directory Path
|
|
|
|
WIN32DLL BOOL cl_copy(
|
|
HCOMMLIB hcl,
|
|
const char *srcPath, // Source directory | file Path
|
|
const char *dstPath, // Destination directory | file Path
|
|
BOOL overwrite); // Overwrite
|
|
|
|
WIN32DLL BOOL cl_move(
|
|
HCOMMLIB hcl,
|
|
const char *srcPath, // Source directory | file Path
|
|
const char *dstPath, // Destination directory | file Path
|
|
BOOL overwrite); // Overwrite
|
|
|
|
WIN32DLL BOOL cl_delete(
|
|
HCOMMLIB hcl,
|
|
const char *path); // Directory | file Path
|
|
|
|
|
|
WIN32DLL BOOL cl_upload(
|
|
HCOMMLIB hcl,
|
|
const char *srcPath, // Source file
|
|
const char *dstPath, // Destination file
|
|
int writePolicy, // Write policy flag
|
|
__int64 availQuota,
|
|
cl_callback callbackProc,
|
|
void *pParam);
|
|
|
|
WIN32DLL BOOL cl_download(
|
|
HCOMMLIB hcl,
|
|
const char *srcPath, // Source file
|
|
const char *dstPath, // Destination file
|
|
int writePolicy, // Write policy flag
|
|
__int64 availQuota,
|
|
cl_callback callbackProc,
|
|
void *pParam);
|
|
|
|
WIN32DLL void cl_stop_transfer(
|
|
HCOMMLIB hcl);
|
|
|
|
WIN32DLL void cl_set_write_log_dir(bool bLog);
|
|
WIN32DLL void cl_set_write_log_upload(bool bLog);
|
|
WIN32DLL bool cl_create_log_file();
|
|
WIN32DLL void cl_destroy_log_file();
|
|
WIN32DLL void cl_write_log(char* pszLog, DWORD dwSize, bool bWriteTime);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|