Files
interactive/application/sp-console(down)/ConsoleTransfer(DN)/NoticeStruct.h
T
2026-08-07 17:38:18 +09:00

194 lines
6.1 KiB
C++

#define OP_SEQ_REQ 0x1000
#define OP_SEQ_RSP 0x1001
#define MAX_SIZE_OF_URI 1024
#define MAX_SIZE_OF_TARGET 128
#define RSP_CODE_DIST_SUCCESS 1000
#define RSP_CODE_AUTH_SUCCESS 1001
#define RSP_CODE_SVR_BUSY 4200
#define RSP_CODE_INTERNAL_ERROR 4001
#define RSP_CODE_UNKNOWN_ERROR 4002
#define RSP_CODE_OP_FAILED 4003
#define RSP_CODE_AUTH_FAILED 4004
#define RSP_CODE_INVALID_PROTO 4051
#define RSP_CODE_INVALID_OP_CODE 4052
#define RSP_CODE_INVALID_ATTR_VALUE 4053
#define MAX_SIZE_OF_UA 128
#define MAX_SIZE_OF_UP 256
#define MAX_SIZE_OF_SP_ID 64
#define MAX_SIZE_OF_SP_PASSWD 256
#define MAX_SIZE_OF_OP_DESC 128
#define MAX_SIZE_OF_SP_ID 64
#define MAX_SIZE_OF_SP_PASSWD 256
#define OP_NUM_AUTH 10
#define OP_NUM_DN 201
#define OP_NUM_DDI 202
#define OP_NUM_DNC 203
#define OP_NUM_DA 204
#define OP_DN_MODE_REQ 0x00a0
#define RCTS_NOTICE_PORT 13110
#define MAX_SIZE_OF_TID 64
#define MAX_SIZE_OF_SP_TID 33
#define MAX_SIZE_OF_PHONE 16
#define MAX_SIZE_OF_MAIL 64
#define MAX_SIZE_OF_NAME 64
#define MAX_SIZE_FILE_NAME 1024
typedef struct _s_rc_auth_md5_req_body {
char sp_id_str[MAX_SIZE_OF_SP_ID];
char sp_passwd_str[MAX_SIZE_OF_SP_PASSWD];
} rc_auth_md5_req_body_t;
//Request Header
typedef struct _s_tsvc_req_header {
unsigned short op_num_w;
unsigned short op_seq_w;
} tsvc_req_header_t;
//Request auth Body
typedef struct _s_tsvc_auth_info {
char ua_str[MAX_SIZE_OF_SP_ID];
char up_str[MAX_SIZE_OF_SP_PASSWD];
} tsvc_auth_info_t;
//Request Directory Dist Info body
typedef struct _s_tsvc_ddi_req_body {
// unsigned short op_mode_w;
char uri_str[MAX_SIZE_OF_URI];
} tsvc_ddi_req_body_t;
typedef struct _s_tsvc_dn_req_body {
unsigned short op_mode_w;
char tid_str[MAX_SIZE_OF_TID];
char sp_tid_str[MAX_SIZE_OF_SP_TID];
char uri_str[MAX_SIZE_OF_URI];
char source_url[MAX_SIZE_OF_TARGET];
char target_url[MAX_SIZE_OF_TARGET];
char target_str[MAX_SIZE_OF_TARGET];
long long file_size;
long long offset;
} tsvc_dn_req_body_t;
//Response Header
typedef struct _s_tsvc_rsp_header {
unsigned short op_num_w;
unsigned short op_seq_w;
unsigned short rsp_cnt_w;
unsigned int op_result_code_w;
char op_result_desc_str[MAX_SIZE_OF_OP_DESC];
} tsvc_rsp_header_t;
//Response Directory Dist Info Body
typedef struct _s_tsvc_ddi_rsp_body {
int file_cnt;
int dist_complete;
int dist_now;
int dist_fail;
} tsvc_ddi_rsp_body_t;
//Trans Complete
typedef struct _s_tsvc_ddc_req_body {
char sp_tid_str[MAX_SIZE_OF_SP_TID];
char name_01[MAX_SIZE_OF_NAME];
char phone_01[MAX_SIZE_OF_PHONE];
char mail_01[MAX_SIZE_OF_MAIL];
char name_02[MAX_SIZE_OF_NAME];
char phone_02[MAX_SIZE_OF_PHONE];
char mail_02[MAX_SIZE_OF_MAIL];
char name_03[MAX_SIZE_OF_NAME];
char phone_03[MAX_SIZE_OF_PHONE];
char mail_03[MAX_SIZE_OF_MAIL];
} tsvc_ddc_req_body_t;
//dist req again
typedef struct _s_tsvc_da_req {
char sp_tid_str[MAX_SIZE_OF_SP_TID];
unsigned int file_cnt;
} tsvc_da_req_t;
typedef struct _s_tsvc_da_contents {
char file_name[MAX_SIZE_FILE_NAME];
bool bFolder;
} tsvc_da_contents_t;
/*
Sample
int main(int argc, char **argv)
{
Socket socket_obj;
tsvc_req_header_t tsvc_req_header;
rc_auth_md5_req_body_t auth_req_body;
tsvc_dn_req_body_t dn_req_body;
tsvc_rsp_header_t *tsvc_rsp_header_ptr;
char recv_buffer[8196];
if(argc < 3) {
::fprintf(stderr, "%s ip_addr port\n", argv[0]);
::exit(1);
}
fprintf(stderr, "argv[1] = %s, argv[2] = %s\n", argv[1], argv[2]);
Address serv_addr(argv[1], ::atoi(argv[2]));
try {
tsvc_req_header.op_num_w = ::htons(10);
tsvc_req_header.op_seq_w = ::htons(OP_SEQ_REQ);
::snprintf(auth_req_body.sp_id_str, MAX_SIZE_OF_SP_ID, "pooltest@test");
::snprintf(auth_req_body.sp_passwd_str, MAX_SIZE_OF_SP_PASSWD, "alfkzmf");
socket_obj.open(Socket::TCP);
socket_obj.connect(serv_addr);
socket_obj.send((char *)&tsvc_req_header, sizeof(tsvc_req_header));
socket_obj.send((char *)&auth_req_body, sizeof(auth_req_body));
socket_obj.recv(recv_buffer, sizeof(recv_buffer));
tsvc_rsp_header_ptr = reinterpret_cast<tsvc_rsp_header_t *>(&recv_buffer);
fprintf(stderr, "============================= LOGIN ==================================\n");
fprintf(stderr, "op_num_w = %d\n", ::ntohs(tsvc_rsp_header_ptr->op_num_w));
fprintf(stderr, "op_seq_w = %d\n", ::ntohs(tsvc_rsp_header_ptr->op_seq_w));
fprintf(stderr, "rsp_cnt_w = %d\n", ::ntohs(tsvc_rsp_header_ptr->rsp_cnt_w));
fprintf(stderr, "op_result_code_w = %d\n", ::ntohs(tsvc_rsp_header_ptr->op_result_code_w));
fprintf(stderr, "op_result_desc_str = %s\n", tsvc_rsp_header_ptr->op_result_desc_str);
tsvc_req_header.op_num_w = ::htons(OP_NUM_DN);
tsvc_req_header.op_seq_w = ::htons(OP_SEQ_REQ);
socket_obj.send((char *)&tsvc_req_header, sizeof(tsvc_req_header));
//dn_req_body.op_mode_w = htons(0x1100);
dn_req_body.op_mode_w = htons(OP_DN_MODE_REQ);
//::snprintf(dn_req_body.uri_str, PATH_MAX, "%s", "/freezonetest72.cert");
::snprintf(dn_req_body.uri_str, PATH_MAX, "%s", "/TEST_5G_BY_SDK");
socket_obj.send((char *)&dn_req_body, sizeof(tsvc_dn_req_body_t));
socket_obj.recv(recv_buffer, sizeof(recv_buffer));
fprintf(stderr, "======================= COPY REQ ==================================\n");
fprintf(stderr, "op_num_w = %d\n", ::ntohs(tsvc_rsp_header_ptr->op_num_w));
fprintf(stderr, "op_seq_w = %d\n", ::ntohs(tsvc_rsp_header_ptr->op_seq_w));
fprintf(stderr, "rsp_cnt_w = %d\n", ::ntohs(tsvc_rsp_header_ptr->rsp_cnt_w));
fprintf(stderr, "op_result_code_w = %d\n", ::ntohs(tsvc_rsp_header_ptr->op_result_code_w));
fprintf(stderr, "op_result_desc_str = %s\n", tsvc_rsp_header_ptr->op_result_desc_str);
socket_obj.close();
} catch (Exception e) {
fprintf(stderr, "ERROR: %s, %s, %d\n", e.getMethod().c_str(), e.getMessage().c_str(), e.getCode());
}
return 1;
}
*/