#ifndef _SHCSDK_H #define _SHCSDK_H #ifdef WIN32 # if defined(SHCSDK_EXPORTS) # define WIN32DLL __declspec(dllexport) # else # define WIN32DLL __declspec(dllimport) # endif #ifndef ssize_t #define ssize_t SSIZE_T #endif #else #define WIN32DLL typedef long long INT64; #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_NOERROR = 0, 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_RESP_TIMEOUT = 30010, // added by sangkeun.ha 20090727 /*NE_TIMEOUT*/ SHCERRNO_NE_LOOKUP = 30011, // added by webting 20100119 /* NE_LOOKUP */ SHCERRNO_NE_CONNECT = 30012, // added by webting 20100119 /* NE_CONNECT */ //////////////////////////////////////////////////////////////////// SHCERRNO_TRAGETBIGGER = 30013, SHCERRNO_DNS_TIMEOUT = 30014, SHCERRNO_EXT_OVERFLOW = 30015, SHCERRNO_MAX = 30016, }; // Callback function format #ifdef WIN32 // À©µµ¿ì¿¡¼­ ´Ù¸¥ ¾ð¾î(C#) Áö¿øÇϱâ À§Çؼ­ ÇÔ¼öcall ¹æ½ÄÀ» __stdcall ÇØ¾ßÇÔ typedef int (__stdcall *sh_callback)( #else // WIN32 typedef int (*sh_callback)( #endif //WIN32 void *param, // Callback function's param INT64 progress // Progress ); typedef int (*down_stream)( void* userval, const char* buf, size_t len ); typedef ssize_t (*up_stream)( void* userval, char* buf, size_t len ); #ifdef __cplusplus extern "C" { #endif // SDK »ç¿ëÇÒ ÀνºÅϽº »ý¼º WIN32DLL HSHSDK sh_init( const char *url, // Url const char *authString, // Authentication string sh_callback proc, // Callback function void *param); // Callback function's Param // SDK »ç¿ëÇÑ ÀνºÅϽº ÇØÁ¦ WIN32DLL void sh_free( HSHSDK hshsdk); // SDK HANDLE // SDK¿¡¼­ ¹ß»ýÇÑ ¿À·ù ¹øÈ£ WIN32DLL int sh_get_error_number( HSHSDK hshsdk); // SDK handle // ¹ß»ýÇÑ ¿À·ù¿¡ ´ëÇÑ »ó¼¼ÇÑ ¸Þ¼¼Áö WIN32DLL const char* sh_get_error_message( HSHSDK hshsdk); // SDK 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, const char *extSession); // 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 const char *extSession); // Extention query // ¼­¹öÀÇ ÆÄÀÏ ¸ñ·Ï 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 // sh_get_filelist·Î ¾ò¾î¿Â ÆÄÀÏ ¸ñ·ÏÀÇ °³¼ö 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 // sh_get_filelist ¾òÀº ÆÄÀÏ ÇÚµé ÇØÁ¦ WIN32DLL void sh_free_filelist( HSHSDK hshsdk, // SDK handle HSHFILELIST hshfl); // File list handle // µ¥ÀÌÅÍ ¾Ïȣȭ 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 bool sh_file_exist( HSHSDK hshsdk, // SDK Handle const char *path); // file/folder Path // ÆÄÀÏÀ» ¹öÆÛ·Î ´Ù¿î·Îµå WIN32DLL int sh_download_buffer( HSHSDK hshsdk, // SDK handle const char *srcPath, // Source file down_stream proc, // user defined function INT64 beingpos, // point to read void* userval // User-supplied value for callback ); // Avail quota // ÁöÁ¤Å©±â ¸¸Å­ ¹öÆÛ·Î ´Ù¿î·Îµå // sh_download_buffer range version for GAMPLE WIN32DLL int sh_download_buffer_r( HSHSDK hshsdk, // SDK handle const char *srcPath, // Source file down_stream proc, // user defined function INT64 beingpos, // point to read INT64 nbytes, // amount to read void* userval // User-supplied value for callback ); // ¹öÆÛ·ÎºÎÅÍ ÆÄÀÏ ¾÷·Îµå ÇÑ´Ù WIN32DLL int sh_upload_buffer( HSHSDK hshsdk, // SDK handle const char *dstPath, // Destination file int writePolicy, // Write policy flag up_stream proc, // user defined function INT64 nbytes, // write size void* userval // User-supplied value for callback ); // ÁöÁ¤µÈ À§Ä¡¿¡¼­ ¹öÆÛ·ÎºÎÅÍ ÆÄÀÏ ¾÷·Îµå ÇÑ´Ù. WIN32DLL int sh_upload_buffer_r( HSHSDK hshsdk, // SDK handle const char *dstPath, // Destination file int writePolicy, // Write policy flag up_stream proc, // user defined function INT64 beginpos, // write start position INT64 nbytes, // write size void* userval // User-supplied value for callback ); // ÇöÀç ÆÄÀÏ ³» À§Ä¡ WIN32DLL INT64 sh_get_filepos( HSHSDK hshsdk // SDK handle ); // ŸÀÓ ¼­¹ö¿¡ ¿äû ŸÀÓ ¾Æ¿ô ¼³Á¤ WIN32DLL void sh_set_sntp_timeout( int second // Time out (Second) ); // ŸÀÓ ¼­¹ö¿¡ ¿äû ŸÀÓ ¾Æ¿ô ¼³Á¤ WIN32DLL void sh_set_sntp_timeout( int second // Time out (Second) ); // ÇöÀç ¼¼¼ÇÀÇ ¼¼¼Ç ID ¼³Á¤ WIN32DLL int sh_set_sessionID( HSHSDK hshsdk, // SDK Handle const char *pszID); // ÇöÀç ¼¼¼ÇÀÇ ¼¼¼Ç ID Á¤º¸ 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 ); // DNS ¼º°ø ÈÄ request ¼­¹ö·Î ¿¬°á¿¡ ´ëÇÑ Å¸ÀÓ ¾Æ¿ô ¼³Á¤ WIN32DLL void sh_set_connect_timeout( int second // Second ); // DNS, request ¼º°ø ÈÄ ¹ß»ýÇÏ´Â ÀÀ´ä¿¡ ´ëÇÑ Å¸ÀÓ ¾Æ¿ô ¼³Á¤ WIN32DLL void sh_set_response_timeout( int second // Second ); // NEW 2010-03-29 // ƯÁ¤ ½Ã°£(tStart) ÀÌÈÄ¿¡ ¾÷·ÎµåµÈ ¸®½ºÆ®¸¦ ¾ò¾î¿Â´Ù. // °í°´ÀÇ ¿äû¿¡ ÀÇÇØ ÇØ´ç ÀÎÅÍÆäÀ̽º Ãß°¡. WIN32DLL HSHFILELIST sh_get_filelist_certain_time( HSHSDK hshsdk, // SDK handle const char *path, // Path time_t tStart, // start time unsigned int depth); // 0 : itself // 1 : 1 depth children // 2 : all children // ¼ÒÄÏ ¿¬°á ŸÀÓ ¾Æ¿ô ¼³Á¤ WIN32DLL void sh_set_C_timeout ( int second // Second ); // Àü¼Û °ü·Ã callback ÇÔ¼ö µî·Ï WIN32DLL int sh_set_transfer_callback ( HSHSDK hshsdk, // SDK handle sh_callback proc, // Callback function void *param // Callback function's Param ); // ÁöÁ¤µÈ ÆÄÀÏÀÇ ºÎ¸ð µð·ºÅ丮 »ý¼º WIN32DLL int sh_open ( HSHSDK hshsdk, // SDK handle const char *path // Path ); // ¹öÆÛ·ÎºÎÅÍ ÆÄÀÏ ¾÷·Îµå(Á¸Àç ½Ã ÆÄÀÏ ³¡¿¡ Ãß°¡µÊ) WIN32DLL int sh_send_append ( HSHSDK hshsdk, // SDK handle const char *dstPath, // Destination file up_stream proc, // user defined function INT64 nbytes, // write size void* userval // User-supplied value for callback ); // ÁöÁ¤µÈ À§Ä¡¿¡¼­ ¹öÆÛ·Î ÆÄÀÏ ¾÷·Îµå WIN32DLL int sh_send_block ( HSHSDK hshsdk, // SDK handle const char *dstPath, // Destination file up_stream proc, // user defined function INT64 beingpos, // write start position INT64 nbytes, // write size void* userval // User-supplied value for callback ); #ifdef __cplusplus } #endif #endif