#define INDEV stdin #define OUTDEV stdout #define DEFAULT_BUF_SIZE 1024 #define RESERVED 5 #include #include #include #include #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; }