base
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
CFLAGS=-g -Wall
|
||||
CC=g++
|
||||
AR=ar
|
||||
RANLIB=ranlib
|
||||
LIBS=-L./ -L/usr/local/lib -lc -lz -lexpat
|
||||
|
||||
ALL=shlisting shcopy shmove
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
shlisting: shlisting.o libshsdk.a
|
||||
g++ shlisting.o -o shlisting ${LIBS} -lshsdk
|
||||
|
||||
shcopy: shcopy.o libshsdk.a
|
||||
g++ shcopy.o -o shcopy ${LIBS} -lshsdk
|
||||
|
||||
shmove: shmove.o libshsdk.a
|
||||
g++ shmove.o -o shmove ${LIBS} -lshsdk
|
||||
|
||||
clean:
|
||||
rm -f *.o $(ALL)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
Makefile
|
||||
빌드하는데 사용되는 Makefile 입니다.
|
||||
libshsdk.a
|
||||
system hosting server+client side sdk 라이브러리입니다.
|
||||
포함된 라이브러리는 2007년 1월 19일자입니다.
|
||||
SHSSDK.h
|
||||
system hosting server side sdk 라이브러리 헤더입니다.
|
||||
SHCSDK.h
|
||||
system hosting client side sdk 라이브러리 헤더입니다.
|
||||
shlisting.c
|
||||
파일 리스트를 가져오는 예제입니다.
|
||||
shcopy.c
|
||||
파일 복사 예제입니다.
|
||||
shmove.c
|
||||
파일 이동 예제입니다.
|
||||
@@ -0,0 +1,211 @@
|
||||
#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
|
||||
@@ -0,0 +1,111 @@
|
||||
#ifndef _SHSDK_H
|
||||
#define _SHSDK_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifdef WIN32
|
||||
typedef __int64 INT64;
|
||||
typedef __int64* PINT64;
|
||||
typedef int BOOL;
|
||||
#else
|
||||
typedef long long INT64;
|
||||
typedef long long* PINT64;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// SSDK 커스텀 에러번호
|
||||
enum SHSSDK_ERRNO {
|
||||
SHERRNO_UNDEFINED = 30000,
|
||||
SHERRNO_AUTHORIZATION = 31000,
|
||||
SHERRNO_INTERNAL = 31001,
|
||||
SHERRNO_NOSERVICE = 32000,
|
||||
SHERRNO_NOCACHEFILE = 33000,
|
||||
SHERRNO_INVALIDCACHEFILE = 33001,
|
||||
};
|
||||
|
||||
enum SASSDK_ERRNO {
|
||||
ERR_RCTRAN_NOT_EXSIT_URI = 0x3a27, // 존재하지 않는 URI
|
||||
ERR_RCTRAN_USERID_NOT_FOUND = 0x3a24, // 존재하지 않는 ID
|
||||
ERR_RCTRAN_PASSWORD_NOT_MATCH = 0x3a25, // 패스워드 에러
|
||||
ERR_RCTRAN_NOT_DEFINED = 0x00, // 알수 없는 에러
|
||||
};
|
||||
|
||||
typedef struct tranlog_data{
|
||||
char *sessionid; // 세션 ID char*
|
||||
char *filename; // 파일명 char*
|
||||
unsigned long long length; // 사이즈 long long
|
||||
int ndirection; // 업다운여부
|
||||
time_t startdate; // 시작시간 time_t
|
||||
time_t enddate; // 종료시간 time_t
|
||||
struct tranlog_data *pnext; // 다음 로그데이타 포인터
|
||||
}TRANSFER_LOG_DATA,*LPTRANSFER_LOG_DATA;
|
||||
|
||||
const char *sh_get_service_host(
|
||||
const char *userId, // 사용자 ID
|
||||
const char *password, // 사용자 비밀번호
|
||||
const char *serviceId // 서비스 ID
|
||||
);
|
||||
|
||||
const int sh_get_service_info(
|
||||
const char *userId, // 사용자 ID
|
||||
const char *password, // 사용자 비밀번호
|
||||
const char *serviceId, // 서비스 ID
|
||||
PINT64 totalSpace, // 전체 용량
|
||||
PINT64 freeSpace // 남은 용량
|
||||
);
|
||||
|
||||
const char *sh_get_auth_string(
|
||||
const char *userId, // 사용자 ID
|
||||
const char *password, // 사용자 비밀번호
|
||||
const char *serviceId, // 서비스 ID
|
||||
const char *authKey, // 인증 키
|
||||
const char *authFile, // 인증서 파일 경로
|
||||
time_t expire // 만기시간 (BASE 1970-01-01 00:00:00)
|
||||
);
|
||||
|
||||
const char *sh_decrypt(
|
||||
const char *encrypted, // 암호화된 문자열
|
||||
int acceptGap // 허용 시간 차
|
||||
);
|
||||
|
||||
void sh_set_timeout(
|
||||
int second // 접속대기시간(초)
|
||||
);
|
||||
|
||||
void sh_set_cache_file(
|
||||
const char *file_path // 캐쉬파일 저장 경로
|
||||
);
|
||||
|
||||
const char* sh_get_uri_by_filename(
|
||||
const char* szHost, // 서버 주소
|
||||
const char *userId, // 사용자 ID
|
||||
const char *password, // 사용자 비밀 번호
|
||||
const char* uri, // 패스 URI
|
||||
int ncount, // 다운로드 횟수
|
||||
int nexpire); // 다운로드 만료 시한
|
||||
|
||||
LPTRANSFER_LOG_DATA sh_get_transfer_log_list(
|
||||
const char *userId, // 사용자 ID
|
||||
const char *password, // 사용자 비밀번호
|
||||
const char *serviceId, // 서비스 ID
|
||||
const char* szSessionID, // 세션 ID
|
||||
time_t sTime, // 시작시간
|
||||
time_t eTime, // 종료시간
|
||||
int nDelete, // 삭제 여부
|
||||
int nDirection // Up/Down 여부
|
||||
);
|
||||
|
||||
void sh_free_transfer_log(
|
||||
LPTRANSFER_LOG_DATA ploglist // 로그리스트 포인터
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
Binary file not shown.
@@ -0,0 +1,95 @@
|
||||
#define SERVER_NAME cgiServerName
|
||||
#define SAVED_ENVIRONMENT "/tmp/cgicsave.env"
|
||||
#define INDEV stdin
|
||||
#define OUTDEV stdout
|
||||
|
||||
#define DEFAULT_BUF_SIZE 1024
|
||||
#define RESERVED 5
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "SHSSDK.h"
|
||||
#include "SHCSDK.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char service[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char service_host[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char auth_string[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char *auth_key, *auth_file;
|
||||
char *__service_host = NULL;
|
||||
char *__auth_string = NULL;
|
||||
HSHSDK hsdk;
|
||||
char source[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char target[DEFAULT_BUF_SIZE + RESERVED];
|
||||
|
||||
/* get service id */
|
||||
strcpy(service, "demoweb");
|
||||
if (service && !strcmp(service, "demoweb")) {
|
||||
auth_key = "demoweb";
|
||||
auth_file = "/tmp/demo40.cert";
|
||||
} else {
|
||||
fprintf(OUTDEV, "서비스 ID가 존재하지 않습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* SSDK : get service host */
|
||||
__service_host = (char *)sh_get_service_host("demo", "ktidc", service);
|
||||
if (!__service_host) {
|
||||
fprintf(OUTDEV, "서비스 호스트를 받아오지 못했습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* SSDK : get auth string */
|
||||
__auth_string = (char *)sh_get_auth_string("demo", "ktidc", service, auth_key, auth_file, time(0)+100000);
|
||||
if (!__auth_string) {
|
||||
fprintf(OUTDEV, "인증 스트링을 받아오지 못했습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
snprintf(service_host, DEFAULT_BUF_SIZE, "%s",
|
||||
__service_host);
|
||||
|
||||
snprintf(auth_string, DEFAULT_BUF_SIZE, "%s",
|
||||
__auth_string);
|
||||
|
||||
/* CSDK : init */
|
||||
fprintf(stderr, "service_host %s\n", service_host);
|
||||
hsdk = sh_init(service_host, auth_string, NULL, NULL);
|
||||
if (hsdk == NULL) {
|
||||
fprintf(OUTDEV, "클라이언트 SDK 초기화를 실패하였습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* specify source and target */
|
||||
strcpy(source, "/source_to_copy");
|
||||
strcpy(target, "/target_to_copy");
|
||||
|
||||
/* check variable */
|
||||
if (!source[0]) {
|
||||
fprintf(OUTDEV, "원본 경로가 존재하지 않습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
if (!target[0]) {
|
||||
fprintf(OUTDEV, "대상 경로가 존재하지 않습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
if (source[0] != '/') {
|
||||
fprintf(OUTDEV, "원본이 경로가 아닙니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* CSDK : get list */
|
||||
if (!sh_copy(hsdk, source, target, 1)) {
|
||||
fprintf(OUTDEV, "복사를 실패하였습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
fprintf(OUTDEV, "복사가 성공하였습니다.\n");
|
||||
exit_prg:
|
||||
if (__service_host) free(__service_host);
|
||||
if (__auth_string) free(__auth_string);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
#define INDEV stdin
|
||||
#define OUTDEV stdout
|
||||
|
||||
#define DEFAULT_BUF_SIZE 1024
|
||||
#define RESERVED 5
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "SHSSDK.h"
|
||||
#include "SHCSDK.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char service[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char path[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char service_host[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char auth_string[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char *auth_key, *auth_file;
|
||||
char *__service_host = NULL;
|
||||
char *__auth_string = NULL;
|
||||
HSHSDK hsdk;
|
||||
HSHFILELIST hsdf;
|
||||
int i;
|
||||
PSHFILE_STRUCT pshf;
|
||||
|
||||
/* get service id */
|
||||
strcpy(service, "solboxtest");
|
||||
if (service && !strcmp(service, "solboxtest")) {
|
||||
auth_key = "solboxtest";
|
||||
auth_file = "./solboxtest186.cert";
|
||||
} else {
|
||||
fprintf(OUTDEV, "서비스 ID가 존재하지 않습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* SSDK : get service host */
|
||||
__service_host = (char *)sh_get_service_host("solboxtest", "solboxtest", service);
|
||||
if (!__service_host) {
|
||||
fprintf(OUTDEV, "서비스 호스트를 받아오지 못했습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* SSDK : get auth string */
|
||||
__auth_string = (char *)sh_get_auth_string("solboxtest", "solboxtest", service, auth_key, auth_file, time(0)+100000);
|
||||
if (!__auth_string) {
|
||||
fprintf(OUTDEV, "인증 스트링을 받아오지 못했습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
snprintf(service_host, DEFAULT_BUF_SIZE, "%s",
|
||||
__service_host);
|
||||
|
||||
snprintf(auth_string, DEFAULT_BUF_SIZE, "%s",
|
||||
__auth_string);
|
||||
|
||||
/* CSDK : init */
|
||||
fprintf(stderr, "service_host %s\n", service_host);
|
||||
hsdk = sh_init(service_host, auth_string, NULL, NULL);
|
||||
if (hsdk == NULL) {
|
||||
fprintf(OUTDEV, "클라이언트 SDK 초기화를 실패하였습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
path[0] = '\0';
|
||||
/* TODO : listing base uri copy to path */
|
||||
strcpy(path, "/");
|
||||
|
||||
/* CSDK : get list */
|
||||
hsdf = sh_get_filelist(hsdk, path, 1);
|
||||
if (hsdf == NULL) {
|
||||
fprintf(OUTDEV, "파일 리스트 수신을 실패하였습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
for (i = 0; i < sh_get_filelist_count(hsdk, hsdf); i++) {
|
||||
pshf = sh_get_file(hsdk, hsdf, i);
|
||||
if (pshf->attr == SHFILEATTR_FOLDER) {
|
||||
fprintf(OUTDEV, "폴더명 : %s\n", pshf->path);
|
||||
} else {
|
||||
fprintf(OUTDEV, "파일명 : %s (%lld byte)\n",
|
||||
pshf->path, pshf->size);
|
||||
}
|
||||
}
|
||||
|
||||
exit_prg:
|
||||
if (__service_host) free(__service_host);
|
||||
if (__auth_string) free(__auth_string);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
#define INDEV stdin
|
||||
#define OUTDEV stdout
|
||||
|
||||
#define DEFAULT_BUF_SIZE 1024
|
||||
#define RESERVED 5
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "SHSSDK.h"
|
||||
#include "SHCSDK.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char service[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char service_host[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char auth_string[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char *auth_key, *auth_file;
|
||||
char *__service_host = NULL;
|
||||
char *__auth_string = NULL;
|
||||
HSHSDK hsdk;
|
||||
char source[DEFAULT_BUF_SIZE + RESERVED];
|
||||
char target[DEFAULT_BUF_SIZE + RESERVED];
|
||||
|
||||
/* get service id */
|
||||
strcpy(service, "demoweb");
|
||||
if (service && !strcmp(service, "demoweb")) {
|
||||
auth_key = "demoweb";
|
||||
auth_file = "/tmp/demo40.cert";
|
||||
} else {
|
||||
fprintf(OUTDEV, "서비스 ID가 존재하지 않습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* SSDK : get service host */
|
||||
__service_host = (char *)sh_get_service_host("demo", "ktidc", service);
|
||||
if (!__service_host) {
|
||||
fprintf(OUTDEV, "서비스 호스트를 받아오지 못했습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* SSDK : get auth string */
|
||||
__auth_string = (char *)sh_get_auth_string("demo", "ktidc", service, auth_key, auth_file, time(0)+100000);
|
||||
if (!__auth_string) {
|
||||
fprintf(OUTDEV, "인증 스트링을 받아오지 못했습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
snprintf(service_host, DEFAULT_BUF_SIZE, "%s",
|
||||
__service_host);
|
||||
|
||||
snprintf(auth_string, DEFAULT_BUF_SIZE, "%s",
|
||||
__auth_string);
|
||||
|
||||
/* CSDK : init */
|
||||
fprintf(stderr, "service_host %s\n", service_host);
|
||||
hsdk = sh_init(service_host, auth_string, NULL, NULL);
|
||||
if (hsdk == NULL) {
|
||||
fprintf(OUTDEV, "클라이언트 SDK 초기화를 실패하였습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* specify source and target */
|
||||
strcpy(source, "/source_to_move");
|
||||
strcpy(target, "/target_to_move");
|
||||
|
||||
/* check variable */
|
||||
if (!source[0]) {
|
||||
fprintf(OUTDEV, "원본 경로가 존재하지 않습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
if (!target[0]) {
|
||||
fprintf(OUTDEV, "대상 경로가 존재하지 않습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
if (source[0] != '/') {
|
||||
fprintf(OUTDEV, "원본이 경로가 아닙니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
/* CSDK : get list */
|
||||
if (!sh_move(hsdk, source, target, 1)) {
|
||||
fprintf(OUTDEV, "이등이 실패하였습니다.\n");
|
||||
goto exit_prg;
|
||||
}
|
||||
|
||||
fprintf(OUTDEV, "이동이 완료되었습니다.\n");
|
||||
|
||||
exit_prg:
|
||||
|
||||
if (__service_host) free(__service_host);
|
||||
if (__auth_string) free(__auth_string);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user