This commit is contained in:
biosvos
2026-08-07 17:38:18 +09:00
commit 873193a243
9613 changed files with 2755992 additions and 0 deletions
@@ -0,0 +1,55 @@
# Makefile for sample file
CC = g++
CFLAGS = -g -Wall
SDK_INCLUDE = ./SDK/include
SDK_LIB = ./SDK/lib
PATH_INC = -I$(SDK_INCLUDE)
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
PATH_LIBS = -lc -lz -lexpat -lgssapi_krb5 -L$(SDK_LIB)
else
PATH_LIBS = -lc -lexpat -L$(SDK_LIB)
endif
APP= sample sample_csdk_static sample_csdk_dynamic sample_ssdk_static sample_ssdk_dynamic auth_token
all: $(APP)
sync
sample: sample.o
$(CC) $(CFLAGS) -o $@ $^ $(PATH_LIBS) $(SDK_LIB)/libshcsdk.a $(SDK_LIB)/libshssdk.a
sample.o: sample.cpp
$(CC) $(CFLAGS) -c $^ $(PATH_INC)
sample_csdk_static: sample_csdk.o
$(CC) $(CFLAGS) -o $@ $^ $(PATH_LIBS) $(SDK_LIB)/libshcsdk.a
sample_csdk_dynamic: sample_csdk.o
$(CC) $(CFLAGS) -o $@ $^ $(PATH_LIBS) -Wl,-rpath,'$(SDK_LIB)' -lshcsdk
sample_csdk.o: sample_csdk.cpp
$(CC) $(CFLAGS) -c $^ $(PATH_INC)
sample_ssdk_static: sample_ssdk.o
$(CC) $(CFLAGS) -o $@ $^ $(PATH_LIBS) $(SDK_LIB)/libshssdk.a
sample_ssdk_dynamic: sample_ssdk.o
$(CC) $(CFLAGS) -o $@ $^ $(PATH_LIBS) -Wl,-rpath,'$(SDK_LIB)' -lshssdk
sample_ssdk.o: sample_ssdk.cpp
$(CC) $(CFLAGS) -c $^ $(PATH_INC)
auth_token.o: auth_token.cpp
$(CC) $(CFLAGS) -c $^ $(PATH_INC)
auth_token: auth_token.o
$(CC) $(CFLAGS) -o $@ $^ $(PATH_LIBS) $(SDK_LIB)/libshssdk.a
clean:
rm -f *.o $(APP)
@@ -0,0 +1,29 @@
1. make SDK include
/smpale dir/SDK/include
2. make SDK lib
/smpale dir/SDK/lib
3. copy include, library files
tar.SDK/include/* => /smpale dir/SDK/include
tar.SDK/_shared/csdk/* => /smpale dir/SDK/lib
tar.SDK/_shared/ssdk/* => /smpale dir/SDK/lib
tar.SDK/_shared/sdk/* => /smpale dir/SDK/lib
tar.SDK/_static/csdk/* => /smpale dir/SDK/lib
tar.SDK/_static/ssdk/* => /smpale dir/SDK/lib
tar.SDK/_static/sdk/* => /smpale dir/SDK/lib
ex)
[sample_linux]# tar zxvf Solbox_SDK.tar.gz
[sample_linux]# tar zxvf Sample.tar.gz
[sample_linux]# cd sample_linux
[sample_linux]# mkdir -p SDK/include
[sample_linux]# mkdir -p SDK/lib
[sample_linux]# cp ../64/SOLBOX/include/* SDK/include
[sample_linux]# cp -P ../64/SOLBOX/_shared/csdk/* SDK/lib/
[sample_linux]# cp -P ../64/SOLBOX/_shared/ssdk/* SDK/lib/
[sample_linux]# cp -P ../64/SOLBOX/_shared/sdk/* SDK/lib/
[sample_linux]# cp -P ../64/SOLBOX/_static/csdk/* SDK/lib/
[sample_linux]# cp -P ../64/SOLBOX/_static/ssdk/* SDK/lib/
[sample_linux]# cp -P ../64/SOLBOX/_static/sdk/* SDK/lib/
@@ -0,0 +1,73 @@
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctime>
#include "SHSSDK.h"
// 사용방법 표시
void PrintUsage(const char* prg)
{
fprintf( stderr, "\n" );
fprintf( stderr, "Usage: %s [id] [passwd] [service] [auth key] [cert file] [expire time]\n", prg );
fprintf( stderr, "Inputs: \n" );
fprintf( stderr, " id : ID \n" );
fprintf( stderr, " passwd : Password\n" );
fprintf( stderr, " service : Service Name \n" );
fprintf( stderr, " auth key : Service authentication key \n" );
fprintf( stderr, " cert file : authentication file(full path) \n" );
fprintf( stderr, " expire time: auth token expiration time(sec) \n" );
fprintf( stderr, "\n" );
fprintf( stderr, " ex) %s test pass test1 authkey /user/service/cert/test123.cert 3600", prg );
fprintf( stderr, "\n" );
fprintf( stderr, "\n" );
fprintf( stderr, " %s is Solbox Cloud Storage auth token tool.\n", prg );
fprintf( stderr, "\n" );
fprintf( stderr, "[Note] This program doesn't check for the input argument.\n");
fprintf( stderr, "\n" );
return;
}
int main(int argc, char * argv[])
{
if( argc != 7 ) {
PrintUsage(argv[0]);
return 1;
}
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
// !!! 중요 !!!
// SSDK 가 End User에게 배포가되면 안됩니다.
// 그 이유는 보안상 취약점이 발생 하기때문입니다.
// 해당 소스는 샘플용일 뿐이며, SSDK는 인증서버를 마련하여 해당 서버에서
// 생성해 전달 될 수 있도록 제작되어야 합니다.
char *__auth_string = NULL;
time_t expire = time(0)+atoll(argv[6]);
/* SSDK : get auth string */
__auth_string = (char *)sh_get_auth_string(argv[1], argv[2], argv[3], argv[4], argv[5], expire);
if (!__auth_string) {
fprintf(stderr, "Cannot get the auth string.\n");
return 1;
}
tm * ptm = localtime(&expire);
char buffer[64] = {0};
strftime(buffer, 64, "%F %T", ptm);
fprintf(stdout, "\n");
fprintf(stdout, "* auth token : \n");
fprintf(stdout, "%s\n\n",__auth_string);
fprintf(stdout, "* expire date : \n");
fprintf(stdout, "%s \n",buffer);
fprintf(stdout, "\n");
if(__auth_string)
sh_mem_free(__auth_string);
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
return 0;
}
@@ -0,0 +1,194 @@
#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"
// 아래는 개통정보 전달시 전달된 내용입니다.
// 단, cert 파일은 샘플소스와 함께 전달됩니다.
#define ID "wjthinkbig"
#define PWD "wjthinkbig1@"
#define FILE_PATH "./wjthinkbig295.cert"
#define AUTHSTR "wjthinkbig"
#define SERVICE "wjthinkbig"
/* Callback Funtion */
int CallbackProc(void *param, long long int result)
{
// progress
printf("File Transfer : %lld\n", result);
// 1 : Stop
// 0 : Continue
return 1;
}
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;
strcpy(service, SERVICE);
if (service && !strcmp(service, SERVICE)) {
auth_key = AUTHSTR;
auth_file = FILE_PATH;
} else {
fprintf(OUTDEV, "There isn't the service ID\n");
return -1;
}
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
// !!! 중요 !!!
// SSDK 가 End User에게 배포가되면 안됩니다.
// 그 이유는 보안상 취약점이 발생 하기때문입니다.
// 해당 소스는 샘플용일 뿐이며, SSDK는 인증서버를 마련하여 해당 서버에서
// 생성해 전달 될 수 있도록 제작되어야 합니다.
/* SSDK : get service host */
__service_host = (char *)sh_get_service_host(ID, PWD, service);
if (!__service_host) {
fprintf(OUTDEV, "Cannot get the service host.\n");
goto ERR_EXIT;
}
/* SSDK : get auth string */
__auth_string = (char *)sh_get_auth_string(ID, PWD, service, auth_key, auth_file, time(0)+100000);
if (!__auth_string) {
fprintf(OUTDEV, "Cannot get the auth string.\n");
goto ERR_EXIT;
}
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
sprintf(service_host, "%s", __service_host);
sprintf(auth_string, "%s", __auth_string);
/* CSDK : init */
fprintf(stderr, "service_host!!! %s\n", service_host);
hsdk = sh_init(service_host, auth_string, CallbackProc, NULL);
if (hsdk == NULL) {
fprintf(OUTDEV, "Failed to initiate the SDK.\n");
goto ERR_EXIT;
}
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, "Failed to retrieve the file list.\n");
goto ERR_EXIT;
}
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, "Folder Name : %s\n", pshf->path);
} else {
fprintf(OUTDEV, "file Name : %s(%lld byte)\n",
pshf->path, pshf->size);
}
}
sh_free_filelist(hsdk, hsdf);
/* Upload Test */
if (!sh_upload(hsdk, "./test.txt", "/test.txt", SHWRITEPOLICY_OVERWRITE, -1, NULL))
{
printf("sh_upload ERROR 1: %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
} else {
printf("sh_upload SUCCESS\n");
}
/* Dowload Test */
if (!sh_download(hsdk, "/test.txt", "./test.txt", SHWRITEPOLICY_OVERWRITE, -1, NULL))
{
printf("sh_download ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
} else {
printf("sh_download SUCCESS\n");
}
/* CSDK : get list */
hsdf = sh_get_filelist(hsdk, path, 1);
if (hsdf == NULL) {
fprintf(OUTDEV, "Failed to retrieve the file list.\n");
goto ERR_EXIT;
}
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, "Folder Name : %s\n", pshf->path);
} else {
fprintf(OUTDEV, "file Name : %s(%lld byte)\n",
pshf->path, pshf->size);
}
}
sh_free_filelist(hsdk, hsdf);
/* File delete test */
if (sh_delete(hsdk, "/test.txt") == 0)
{
printf("sh_delete ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("sh_delete SUCCESS\n");
}
/* CSDK : get list */
hsdf = sh_get_filelist(hsdk, path, 1);
if (hsdf == NULL) {
fprintf(OUTDEV, "Failed to retrieve the file list.\n");
goto ERR_EXIT;
}
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, "Folder Name : %s\n", pshf->path);
} else {
fprintf(OUTDEV, "file Name : %s(%lld byte)\n",
pshf->path, pshf->size);
}
}
sh_free_filelist(hsdk, hsdf);
sh_free(hsdk);
ERR_EXIT:
if(__service_host)
sh_mem_free(__service_host);
if(__auth_string)
sh_mem_free(__auth_string);
return 0;
}
@@ -0,0 +1,210 @@
#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 "SHCSDK.h"
/* Callback Funtion */
int CallbackProc(void *param, long long int result)
{
// progress
printf("File Transfer : %lld\n", result);
// 1 : Stop
// 0 : Continue
return 1;
}
static int __totalsend = 0;
ssize_t Upload_Func(void *userval, char *buf, size_t len)
{
int nbyte =*((int *)userval);
// Check buffer (MUST BE)
if(buf == 0x00)
return 0;
// Check the capacity of transmission (MUST BE)
if(__totalsend >= nbyte)
return 0; //
int nsend = 0;
char data[11] = "1234567890";
// copy data
nsend = strlen(data);
if ( nsend > (int)len )
{
nsend = len;
}
if( nbyte - __totalsend < nsend )
{
nsend = nbyte - __totalsend;
}
strncpy(buf, data, nsend);
__totalsend += nsend;
printf("uploading : %d\n", __totalsend);
// Return capacity of transmission
return nsend;
}
int main(void)
{
// Service Information : Again provided
char *__service_host = "http://nctest.ktsh.co.kr/dav";
char *__auth_string = "bmN0ZXN0QG5jdGVzdDpJci0ocTJeCl8XQ+7BR5mjQu+lIZB/YryG0skrskPC+NmftbbpDiB4C+iTuEErTRQQ+I3oOv5yDDg=";
char path[DEFAULT_BUF_SIZE + RESERVED];
char service_host[DEFAULT_BUF_SIZE + RESERVED];
char auth_string[DEFAULT_BUF_SIZE + RESERVED];
HSHSDK hsdk = NULL;
int nBytes = 0;
sprintf(service_host, "%s", __service_host);
sprintf(auth_string, "%s", __auth_string);
/* CSDK : init */
fprintf(stderr, "service_host!!! %s\n", service_host);
hsdk = sh_init(service_host, auth_string, CallbackProc, NULL);
if (hsdk == NULL) {
fprintf(OUTDEV, "Failed to initiate the SDK.\n");
goto ERR_EXIT;
}
path[0] = '\0';
/* TODO : listing base uri copy to path */
strcpy(path, "/test");
/* CSDK : Creating a directory */
if (sh_make_directory(hsdk, path) == 0)
{
if (sh_get_error_number(hsdk) != SHCERRNO_ALREADYEXIST )
{
printf("sh_make_directory ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("sh_make_directory always EXIST\n");
}
}
else
{
printf("sh_make_directory SUCCESS\n");
}
/* CSDK : Upload Test */
/* sh_upload_buffer_r Test : Add at the end of the file */
nBytes = 1024;
for(int n = 0; n < 3; ++n)
{
__totalsend = 0;
if (!sh_upload_buffer_r(hsdk, "/test.txt", SHWRITEPOLICY_APPEND, Upload_Func, -1, nBytes, &nBytes))
{
printf("upload_buffer_r : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("upload_buffer_r SUCCESS\n");
}
}
/* sh_upload_buffer_r Test : Replace the middle part of the file */
__totalsend = 0;
if (!sh_upload_buffer_r(hsdk, "/test.txt", SHWRITEPOLICY_APPEND, Upload_Func, 10, nBytes, &nBytes))
{
printf("upload_buffer_r : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("upload_buffer_r SUCCESS\n");
}
/* CSDK : delete Test */
/* File delete test */
if (sh_delete(hsdk, "/test.txt") == 0)
{
printf("sh_delete ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("sh_delete SUCCESS\n");
}
/* Directory delete test */
if (sh_delete(hsdk, "/test") == 0)
{
printf("sh_delete ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("sh_delete SUCCESS\n");
}
// sh_open : Create the parent directory of the file
strcpy(path, "/SVC1_TEST/test_send.txt");
if(!sh_open(hsdk, path) )
{
printf("sh_open ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("sh_open SUCCESS.\n");
nBytes = 1024;
for(int u = 0; u < 3; ++u)
{
__totalsend = 0;
// sh_send_append : Add data to the end of the file.
if(!sh_send_append(hsdk, path, Upload_Func, nBytes, &nBytes))
{
printf("sh_send_append ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("sh_send_append SUCCESS.\n");
}
}
// sh_send_block : Changes in the contents of the specified location.
nBytes = 10;
__totalsend = 0;
if( !sh_send_block(hsdk,path, Upload_Func, 3, nBytes, &nBytes) )
{
printf("sh_send_block ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("sh_send_block SUCCESS.\n");
}
}
ERR_EXIT:
if(hsdk) sh_free(hsdk);
return 0;
}
@@ -0,0 +1,39 @@
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "SHSSDK.h"
// 아래는 개통정보 전달시 전달된 내용입니다.
#define ID "nctest"
#define PWD "nctest123"
#define SERVICE "nctest"
int main(void)
{
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
// !!! 중요 !!!
// SSDK 가 End User에게 배포가되면 안됩니다.
// 그 이유는 보안상 취약점이 발생 하기때문입니다.
// 해당 소스는 샘플용일 뿐이며, SSDK는 인증서버를 마련하여 해당 서버에서
// 생성해 전달 될 수 있도록 제작되어야 합니다.
/* SSDK : get service space (Bytes) */
long long t = 0, f = 0;
if (sh_get_service_info(ID, PWD, SERVICE, &t, &f))
{
printf("Service [%s] => Total space : %lld, Free space %lld\n", SERVICE, t, f);
}
else
{
char errmsg[254] = {0};
sh_get_error_msg(sh_get_lasterror(), errmsg);
printf("sh_get_service_info ERROR : %d, %s\n", sh_get_lasterror(), errmsg);
}
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
return 0;
}
@@ -0,0 +1,49 @@
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
test file.
@@ -0,0 +1,24 @@
1. make SDK include
/smpale dir/SDK/include
2. make SDK lib
/smpale dir/SDK/lib
3. copy include, library, dll files
zip.SDK/include/* => /smpale dir/SDK/include
zip.SDK/_bin/csdk/* => /smpale dir/SDK/lib
zip.SDK/_bin/ssdk/* => /smpale dir/SDK/lib
zip.SDK/_lib/ssdk/* => /smpale dir/SDK/lib
ex)
c:\> unzip Solbox_SDK.zip
c:\> unzip Sample.zip
c:\> cd sample_win
c:\sample_win> mkdir SDK\include
c:\sample_win> mkdir SDK\lib
c:\sample_win> xcopy /S ..\32\SOLBOX\include\* SDK\include
c:\sample_win> xcopy /S ..\32\SOLBOX\_bin\csdk\* SDK\lib
c:\sample_win> xcopy /S ..\32\SOLBOX\_bin\ssdk\* SDK\lib
c:\sample_win> xcopy /S ..\32\SOLBOX\_lib\ssdk\* SDK\lib
+206
View File
@@ -0,0 +1,206 @@
/***************************************************************************
Sample.cpp
-----------------------------------------
copyright : (C) 2005 SolutionBox Inc.
author : Service 1 Team
email : svc1@solbox.com
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of SolutionBox Inc.
***************************************************************************/
#include "stdafx.h"
#define INDEV stdin
#define OUTDEV stdout
#define DEFAULT_BUF_SIZE 1024
#define RESERVED 5
#include <windows.h>
#include <atlstr.h>
#include "SHSSDK.h"
#include "SHCSDK.h"
// 아래는 개통정보 전달시 전달된 내용입니다.
// 단, cert 파일은 샘플소스와 함께 전달됩니다.
#define ID "xeron"
#define PWD "xeron@#$"
#define FILE_PATH "./xeron345.cert"
#define SERVICE "comtopsy"
#define AUTHSTR "didqkdgid"
/* Callback Funtion */
int __stdcall CallbackProc(void *param, long long int result)
{
// progress
printf("File Transfer : %lld\n", result);
// 1 : Stop
// 0 : Continue
return 1;
}
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;
strcpy(service, SERVICE);
if (service && !strcmp(service, SERVICE)) {
auth_key = AUTHSTR;
auth_file = FILE_PATH;
} else {
fprintf(OUTDEV, "There isn't the service ID\n");
return -1;
}
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
// !!! 중요 !!!
// SSDK 가 End User에게 배포가되면 안됩니다.
// 그 이유는 보안상 취약점이 발생 하기때문입니다.
// 해당 소스는 샘플용일 뿐이며, SSDK는 인증서버를 마련하여 해당 서버에서
// 생성해 전달 될 수 있도록 제작되어야 합니다.
/* SSDK : get service host */
__service_host = (char *)sh_get_service_host(ID, PWD, service);
if (!__service_host) {
fprintf(OUTDEV, "Cannot get the service host.\n");
goto ERR_EXIT;
}
/* SSDK : get auth string */
__auth_string = (char *)sh_get_auth_string(ID, PWD, service, auth_key, auth_file, time(0)+100000);
if (!__auth_string) {
fprintf(OUTDEV, "Cannot get the auth string.\n");
goto ERR_EXIT;
}
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
sprintf(service_host, "%s", __service_host);
sprintf(auth_string, "%s", __auth_string);
/* CSDK : init */
fprintf(stderr, "service_host!!! %s\n", service_host);
hsdk = sh_init(service_host, auth_string, CallbackProc, NULL);
if (hsdk == NULL) {
fprintf(OUTDEV, "Failed to initiate the SDK.\n");
goto ERR_EXIT;
}
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, "Failed to retrieve the file list.\n");
goto ERR_EXIT;
}
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, "Folder Name : %s\n", pshf->path);
} else {
fprintf(OUTDEV, "file Name : %s(%lld byte)\n",
pshf->path, pshf->size);
}
}
sh_free_filelist(hsdk, hsdf);
/* Upload Test */
if (!sh_upload(hsdk, "./test.txt", "/test.txt", SHWRITEPOLICY_OVERWRITE, -1, NULL))
{
printf("sh_upload ERROR 1: %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
} else {
printf("sh_upload SUCCESS\n");
}
/* Dowload Test */
if (!sh_download(hsdk, "/test.txt", "./test.txt", SHWRITEPOLICY_OVERWRITE, -1, NULL))
{
printf("sh_download ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
} else {
printf("sh_download SUCCESS\n");
}
/* CSDK : get list */
hsdf = sh_get_filelist(hsdk, path, 1);
if (hsdf == NULL) {
fprintf(OUTDEV, "Failed to retrieve the file list.\n");
goto ERR_EXIT;
}
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, "Folder Name : %s\n", pshf->path);
} else {
fprintf(OUTDEV, "file Name : %s(%lld byte)\n",
pshf->path, pshf->size);
}
}
sh_free_filelist(hsdk, hsdf);
/* File delete test */
if (sh_delete(hsdk, "/test.txt") == 0)
{
printf("sh_delete ERROR : %d, %s\n", sh_get_error_number(hsdk), sh_get_error_message(hsdk));
goto ERR_EXIT;
}
else
{
printf("sh_delete SUCCESS\n");
}
/* CSDK : get list */
hsdf = sh_get_filelist(hsdk, path, 1);
if (hsdf == NULL) {
fprintf(OUTDEV, "Failed to retrieve the file list.\n");
goto ERR_EXIT;
}
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, "Folder Name : %s\n", pshf->path);
} else {
fprintf(OUTDEV, "file Name : %s(%lld byte)\n",
pshf->path, pshf->size);
}
}
sh_free_filelist(hsdk, hsdf);
sh_free(hsdk);
ERR_EXIT:
if(__service_host)
sh_mem_free(__service_host);
if(__auth_string)
sh_mem_free(__auth_string);
return 0;
}
@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sample", "Sample.vcproj", "{2E831581-9371-4024-88F7-F2AA94775755}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2E831581-9371-4024-88F7-F2AA94775755}.Debug|Win32.ActiveCfg = Debug|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Debug|Win32.Build.0 = Debug|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Release|Win32.ActiveCfg = Release|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="ks_c_5601-1987"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="Sample"
ProjectGUID="{2E831581-9371-4024-88F7-F2AA94775755}"
RootNamespace="Sample"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="./SDK/include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_32BIT_TIME_T"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="./SDK/lib/debug/SHCSDK.lib ./SDK/lib/debug/SHSSDK.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="./SDK/include/"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="./SDK/lib/release/SHCSDK.lib ./SDK/lib/release/SHSSDK.lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="소스 파일"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\Sample.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="헤더 파일"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="리소스 파일"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,42 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sample", "Sample_vs100.vcxproj", "{2E831581-9371-4024-88F7-F2AA94775755}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "auth_token", "auth_token_vs100.vcxproj", "{9C358813-59AD-4EDD-8CBC-4F230A28FC79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2E831581-9371-4024-88F7-F2AA94775755}.Debug|Any CPU.ActiveCfg = Debug|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Debug|Win32.ActiveCfg = Debug|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Debug|Win32.Build.0 = Debug|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Release|Any CPU.ActiveCfg = Release|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Release|Mixed Platforms.Build.0 = Release|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Release|Win32.ActiveCfg = Release|Win32
{2E831581-9371-4024-88F7-F2AA94775755}.Release|Win32.Build.0 = Release|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Debug|Any CPU.ActiveCfg = Debug|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Debug|Win32.ActiveCfg = Debug|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Debug|Win32.Build.0 = Debug|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Release|Any CPU.ActiveCfg = Release|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Release|Mixed Platforms.Build.0 = Release|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Release|Win32.ActiveCfg = Release|Win32
{9C358813-59AD-4EDD-8CBC-4F230A28FC79}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>Sample</ProjectName>
<ProjectGuid>{2E831581-9371-4024-88F7-F2AA94775755}</ProjectGuid>
<RootNamespace>Sample</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>./SDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>./SDK/lib/debug/SHCSDK.lib;./SDK/lib/debug/SHSSDK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>./SDK/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>./SDK/lib/release/SHCSDK.lib;./SDK/lib/release/SHSSDK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Sample.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="소스 파일">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="헤더 파일">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="리소스 파일">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Sample.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>헤더 파일</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
</Project>
@@ -0,0 +1,73 @@
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctime>
#include "SHSSDK.h"
// 사용방법 표시
void PrintUsage(const char* prg)
{
fprintf( stderr, "\n" );
fprintf( stderr, "Usage: %s [id] [passwd] [service] [auth key] [cert file] [expire time]\n", prg );
fprintf( stderr, "Inputs: \n" );
fprintf( stderr, " id : ID \n" );
fprintf( stderr, " passwd : Password\n" );
fprintf( stderr, " service : Service Name \n" );
fprintf( stderr, " auth key : Service authentication key \n" );
fprintf( stderr, " cert file : authentication file(full path) \n" );
fprintf( stderr, " expire time: auth token expiration time(sec) \n" );
fprintf( stderr, "\n" );
fprintf( stderr, " ex) %s test pass test1 authkey /user/service/cert/test123.cert 3600", prg );
fprintf( stderr, "\n" );
fprintf( stderr, "\n" );
fprintf( stderr, " %s is Solbox Cloud Storage auth token tool.\n", prg );
fprintf( stderr, "\n" );
fprintf( stderr, "[Note] This program doesn't check for the input argument.\n");
fprintf( stderr, "\n" );
return;
}
int main(int argc, char * argv[])
{
if( argc != 7 ) {
PrintUsage(argv[0]);
return 1;
}
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
// !!! 중요 !!!
// SSDK 가 End User에게 배포가되면 안됩니다.
// 그 이유는 보안상 취약점이 발생 하기때문입니다.
// 해당 소스는 샘플용일 뿐이며, SSDK는 인증서버를 마련하여 해당 서버에서
// 생성해 전달 될 수 있도록 제작되어야 합니다.
char *__auth_string = NULL;
time_t expire = time(0)+_atoi64(argv[6]);
/* SSDK : get auth string */
__auth_string = (char *)sh_get_auth_string(argv[1], argv[2], argv[3], argv[4], argv[5], expire);
if (!__auth_string) {
fprintf(stderr, "Cannot get the auth string.\n");
return 1;
}
tm * ptm = localtime(&expire);
char buffer[64] = {0};
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm);
fprintf(stdout, "\n");
fprintf(stdout, "* auth token : \n");
fprintf(stdout, "%s\n\n",__auth_string);
fprintf(stdout, "* expire date : \n");
fprintf(stdout, "%s \n",buffer);
fprintf(stdout, "\n");
if(__auth_string)
sh_mem_free(__auth_string);
///////////////////////// SSDK ////////////////////////////////////////////////////////////////////
return 0;
}
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>auth_token</ProjectName>
<ProjectGuid>{9C358813-59AD-4EDD-8CBC-4F230A28FC79}</ProjectGuid>
<RootNamespace>auth_token</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>./SDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;__SSDK_LIB__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>./SDK/lib/debug/libSHSSDK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>./SDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;__SSDK_LIB__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>./SDK/lib/release/libSHSSDK.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="auth_token.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="소스 파일">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="헤더 파일">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="리소스 파일">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="auth_token.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -0,0 +1,8 @@
// stdafx.cpp : 표준 포함 파일만 들어 있는 소스 파일입니다.
// Sample.pch는 미리 컴파일된 헤더가 됩니다.
// stdafx.obj에는 미리 컴파일된 형식 정보가 포함됩니다.
#include "stdafx.h"
// TODO: 필요한 추가 헤더는
// 이 파일이 아닌 STDAFX.H에서 참조합니다.
+15
View File
@@ -0,0 +1,15 @@
// stdafx.h : 자주 사용하지만 자주 변경되지는 않는
// 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이
// 들어 있는 포함 파일입니다.
//
#pragma once
#define WIN32_LEAN_AND_MEAN // 거의 사용되지 않는 내용은 Windows 헤더에서 제외합니다.
#include <stdio.h>
#include <tchar.h>
// TODO: 프로그램에 필요한 추가 헤더는 여기에서 참조합니다.
+32
View File
@@ -0,0 +1,32 @@
========================================================================
콘솔 응용 프로그램 : Sample 프로젝트 개요
========================================================================
응용 프로그램 마법사에서 이 Sample 응용 프로그램을 만들었습니다.
이 파일에는 Sample 응용 프로그램을 구성하는 각 파일에 대한
요약 설명이 포함되어 있습니다.
Sample.vcproj
응용 프로그램 마법사를 사용하여 생성한 VC++ 프로젝트의 기본 프로젝트 파일입니다.
파일을 생성한 Visual C++ 버전에 대한 정보와 응용 프로그램 마법사를 사용하여 선택한
플랫폼, 구성 및 프로젝트 기능에 대한 정보가 포함되어 있습니다.
Sample.cpp
기본 응용 프로그램 소스 파일입니다.
/////////////////////////////////////////////////////////////////////////////
기타 표준 파일:
StdAfx.h, StdAfx.cpp
이 파일은 미리 컴파일된 헤더(PCH) 파일인 Sample.pch와
미리 컴파일된 형식(PCT) 파일인 StdAfx.obj를 빌드하는 데 사용됩니다.
/////////////////////////////////////////////////////////////////////////////
기타 참고:
응용 프로그램 마법사에서 사용하는 "TODO:" 주석은 사용자가 추가하거나 사용자 지정해야 하는
소스 코드 부분을 나타냅니다.
/////////////////////////////////////////////////////////////////////////////