#ifndef _SHCSDK_H #define _SHCSDK_H #ifdef WIN32 # if defined(SHCSDK_EXPORTS) # define WIN32DLL __declspec(dllexport) # else # define WIN32DLL __declspec(dllimport) # endif #else # define WIN32DLL typedef long long INT64; //typedef int bool; #endif typedef void *HSHSDK; typedef void *HSHFILELIST; typedef struct { char *path; INT64 size; char *lastModified; char *lastModified_gmt; unsigned int attr; char *source; } SHFILE_STRUCT, *PSHFILE_STRUCT; // For SHFILE.attr enum SHCSDK_FILEATTR { SHFILEATTR_FOLDER = 0x00000001, }; // For write policy enum SHCSDK_WRITEPOLICY { SHWRITEPOLICY_NONE = 0, SHWRITEPOLICY_OVERWRITE, SHWRITEPOLICY_APPEND, }; // For error number enum SHCSDK_ERRNO { SHCERRNO_UNDEFINED = 30000, SHCERRNO_INVALIDHDL = 30001, SHCERRNO_INVALIDFLHDL = 30002, SHCERRNO_SERVICE = 30003, SHCERRNO_AUTHORIZATION = 30004, SHCERRNO_ISBUSY = 30005, SHCERRNO_EXISTSFILE = 30006, SHCERRNO_NOEXISTSFILE = 30007, SHCERRNO_NOAVAILQUOTA = 30008, SHCERRNO_ALREADYEXIST = 30009, SHCERRNO_MAX = SHCERRNO_ALREADYEXIST + 1, }; // Callback function format typedef int (*sh_callback)( void *param, // Callback function's param INT64 progress // Progress ); typedef int (*down_stream)( void* userval, const char* buf, size_t len ); #ifdef __cplusplus extern "C" { #endif // Initialization WIN32DLL HSHSDK sh_init( const char *url, // Url const char *authString, // Authentication string sh_callback proc, // Callback function void *param); // Callback function's Param // Termination WIN32DLL void sh_free( HSHSDK hshsdk); // SDK HANDLE WIN32DLL int sh_get_error_number( HSHSDK hshsdk); // SDK handle WIN32DLL const char* sh_get_error_message( HSHSDK hshsdk); // SDK handle WIN32DLL HSHFILELIST sh_get_filelist( HSHSDK hshsdk, // SDK handle const char *path, // Path unsigned int depth); // 0 : itself // 1 : 1 depth children // 2 : all children WIN32DLL long sh_get_filelist_count( HSHSDK hshsdk, // SDK handle HSHFILELIST hshfl); // File list handle WIN32DLL PSHFILE_STRUCT sh_get_file( HSHSDK hshsdk, // SDK handle HSHFILELIST hshfl, // File list handle long index); // File index WIN32DLL void sh_free_filelist( HSHSDK hshsdk, // SDK handle HSHFILELIST hshfl); // File list handle WIN32DLL int sh_make_directory( HSHSDK hshsdk, // SDK handle const char *drectory); // Directory Path WIN32DLL int sh_copy( HSHSDK hshsdk, // SDK handle const char *srcPath, // Source file | directory const char *dstPath, // Destination file | directory int overwrite); // 0 : Don't overwrite // 1 : Overwrite WIN32DLL int sh_move( HSHSDK hshsdk, // SDK handle const char *srcPath, // Source file | directory const char *dstPath, // Destination file | directory int overwrite); // 0 : Don't overwrite // 1 : Overwrite WIN32DLL int sh_delete( HSHSDK hshsdk, // SDK handle const char *path); // File | directory WIN32DLL int sh_upload( HSHSDK hshsdk, // SDK handle const char *srcPath, // Source file const char *dstPath, // Destination file int writePolicy, // Write policy flag INT64 availQuota); // Avail quota WIN32DLL int sh_download( HSHSDK hshsdk, // SDK handle const char *srcPath, // Source file const char *dstPath, // Destination file int writePolicy, // Write policy flag INT64 availQuota); // Avail quota WIN32DLL int sh_upload_buffer( HSHSDK hshsdk, // SDK handle down_stream proc, void* userval, // User-supplied value for callback const char *dstPath, // Destination file INT64 availQuota); // Avail quota WIN32DLL int sh_download_buffer( HSHSDK hshsdk, // SDK handle const char *srcPath, // Source file down_stream proc, void* userval // User-supplied value for callback ); // Avail quota WIN32DLL int sh_encrypt( const char *text, // String (< 1000 bytes) char *encrypted); // Encrypted String (1000 bytes) WIN32DLL int sh_set_limit( HSHSDK hshsdk, // SDK handle int nLimit); // Limit value WIN32DLL int sh_get_limit( HSHSDK hshsdk // SDK handle ); // Limit value WIN32DLL INT64 sh_get_filepos( HSHSDK hshsdk // SDK handle ); WIN32DLL bool sh_file_exist( HSHSDK hshsdk, // SDK Handle const char *path); // file/folder Path WIN32DLL void sh_set_C_timeout( int second // Time out (Second) ); WIN32DLL int sh_set_sessionID( HSHSDK hshsdk, // SDK Handle const char *pszID); WIN32DLL const char* sh_get_sessionID( HSHSDK hshsdk // SDK Handle ); WIN32DLL int sh_set_auth_expire( HSHSDK hshsdk, // SDK Handle int ntime // Expire time ); WIN32DLL int sh_get_auth_expire( HSHSDK hshsdk // SDK Handle ); #ifdef __cplusplus } #endif #endif