#include"../include/drd64_defines.h"
#include"../include/drd64_conf.h"
#include"../include/drd64_packet.h"
+#include"../include/drd64_error.h"
#include"drd64_server_log.h"
#include"drd64_server_debuglog.h"
#include"drd64_server_recvstatus.h"
p_phead->w_packettype = DRD64_PACKETTYPE_REPORT;
p_phead->i_datalen = 0;
p_phead->i_rid_resume = i_request_fd;
- p_phead->i_result = 0x00;
- p_phead->i_error = 0x00;
+ p_phead->dw_errcode = DRD64_ERROR_CODE_CLEAR;
+ p_phead->dw_errlocation = DRD64_ERROR_LOCATION_CLEAR;
+
/* Phase 2 : Create Local-Marshald Socket ------*/
i_socket_temp =
#include"../include/drd64_defines.h"
#include"../include/drd64_conf.h"
#include"../include/drd64_packet.h"
+#include"../include/drd64_error.h"
#include"drd64_server_recvstatus.h"
#include"drd64_server_log.h"
#include"drd64_server_debuglog.h"
{
int i_wlen;
int i_fds;
+ int i_result;
+ DWord dw_errcode;
+ DWord dw_errlocation;
Drd64_Marshald_ConnectInfo *p_cinfo;
Drd64_Server_RecvStatus *p_recv;
DRD64_LOG_DEBUG(" [DEBUG] CMD: Connect(Server) Start");
+ i_result = DRD64_MARSHALD_DISPATCH_RESULT_COMPLETE;
+ dw_errcode = DRD64_ERROR_CODE_CLEAR;
+ dw_errlocation = DRD64_ERROR_LOCATION_CLEAR;
+
p_recv = Drd64_Server_RecvStatus_GetRecvStatus( i_recv_id );
assert( NULL != p_recv );
i_fds = p_recv->i_fds_id;
/* Alloc ConnectInfo. */
p_cinfo = Drd64_Marshald_CInfo_AllocConnectInfo();
- if( NULL == p_cinfo )
- { return DRD64_MARSHALD_DISPATCH_RESULT_CLOSE; } // XXX > error
+ if( NULL == p_cinfo ) {
+ dw_errcode = DRD64_ERROR_SET_CODE(
+ DRD64_ERROR_TYPE_ERROR,
+ DRD64_ERROR_PTN_NOMEMORY,
+ 0x00, 0x01 );
+ dw_errlocation = DRD64_ERROR_SET_LOCATION(
+ DRD64_ERROR_MODULE_MARSHALD,
+ DRD64_ERROR_ARCH_NODEPEND,
+ 0x0000, 0x0000 );
+ Drd64_LibBrownie_Error_SetErrorInfo(
+ dw_errcode, dw_errlocation, errno );
+
+ i_result = DRD64_MARSHALD_DISPATCH_RESULT_CLOSE;
+
+ goto goto_Marshald_Cmd_Connect_Server_Answer;
+ }
/* Set Cinfo Common Info. ---*/
p_cinfo->b_cinfo_type = DRD64_MARSHALD_CINFOTYPE_SERVER;
Drd64_Server_RecvStatus_SetConnectionInfoPointer(
p_recv, (void *)p_cinfo );
- /* Set Answer Data ---------*/
- p_phead->w_packettype |= DRD64_PACKETTYPE_FLAG_ANSWER;
p_connect->i_connect_id = p_cinfo->i_cinfo_id;
p_connect->i_marshald_pid = getpid();
+ /* Set Answer Data ---------*/
+goto_Marshald_Cmd_Connect_Server_Answer:
+ p_phead->dw_errcode = dw_errcode;
+ p_phead->dw_errlocation = dw_errlocation;
+ p_phead->w_packettype |= DRD64_PACKETTYPE_FLAG_ANSWER;
+
i_wlen = send( i_fds, (void *)p_phead, DRD64_PacketSize(p_phead), 0x00 );
- DRD64_DEBUG_PRINT("send",i_wlen,"FD",i_fds,"errno",errno);
- if( i_wlen != DRD64_PacketSize(p_phead) )
- { return DRD64_MARSHALD_DISPATCH_RESULT_CLOSE; } // XXX > error
+ DRD64_DEBUG_PRINT("send",i_wlen,"Socket",i_fds,"errno",errno);
+ if( i_wlen != DRD64_PacketSize(p_phead) ) {
+ dw_errcode = DRD64_ERROR_SET_CODE(
+ DRD64_ERROR_TYPE_ERROR,
+ DRD64_ERROR_PTN_SOCKET,
+ 0x00, 0x02 );
+ dw_errlocation = DRD64_ERROR_SET_LOCATION(
+ DRD64_ERROR_MODULE_MARSHALD,
+ DRD64_ERROR_ARCH_NODEPEND,
+ 0x0000, 0x0000 );
+ Drd64_LibBrownie_Error_SetErrorInfo(
+ dw_errcode, dw_errlocation, errno );
+
+ i_result = DRD64_MARSHALD_DISPATCH_RESULT_CLOSE;
+ }
DRD64_LOG_DEBUG(" [DEBUG] CMD: Connect(Server) Complete ");
- return DRD64_MARSHALD_DISPATCH_RESULT_COMPLETE;
+ return i_result;
}
+/*----------------------------------------------------------------------
+Drd64_Marshald_Cmd_Connect(
+----------------------------------------------------------------------*/
int
Drd64_Marshald_Cmd_Connect(
int i_recv_id,
{
int i_result;
- DRD64_LOG_VERBOSE("[STAT]CMD: Connect");
+ DRD64_LOG_VERBOSE("[STAT]CMD: Connect Start");
if( DRD64_IsPacketType_Answer( p_phead ) ) {
i_result = Drd64_Marshald_Cmd_Connect_Client(
i_recv_id, p_phead, p_connect );
}
+ DRD64_LOG_VERBOSE("[STAT]CMD: Connect Ended");
+
return i_result;
}
close( drd64_marshald_info.i_socket_inet );
close( drd64_marshald_info.i_socket_local );
+ Drd64_LibBrownie_Error_TermErrorSystem();
+
DRD64_LOG_INFO("[INFO] Terminate drmarshald. Good-Bye.");
Drd64_Server_Log_TermLogSystem();
exit( 0x00 );
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
int
Drd64_Marshald_Init(
Drd64_Marshald_MasterInformation *p_marshald )
DRD64_LOG_INFO("[INFO] Booting drmarshald ...");
/* */
+ i_err = Drd64_LibBrownie_Error_InitErrorSystem(
+ DRD64_ERRORINFO_HISTORY_MARSHALD );
+ if( 0x00 != i_err ) { return 0x04; }
+
+ /* */
Drd64_Server_Common_Signal( SIGINT, Drd64_Marshald_SigTerm );
Drd64_Server_Common_Signal( SIGTERM, Drd64_Marshald_SigTerm );
Drd64_Server_Common_Signal( SIGHUP, Drd64_Marshald_SigHup );
gp_sendbuffer = (Byte *)malloc( DRD64_MAX_PACKET_LENGTH );
if( NULL == gp_sendbuffer ) { return 0x03; }
+
return 0x00;
}
p_phead->w_packettype = DRD64_PACKETTYPE_LINK;
p_phead->i_datalen = sizeof( Drd64_PacketData_Connect );
p_phead->i_rid_resume = i_recv_id;
- p_phead->i_result = 0x00;
- p_phead->i_error = 0x00;
+ p_phead->dw_errcode = DRD64_ERROR_CODE_CLEAR;
+ p_phead->dw_errlocation = DRD64_ERROR_LOCATION_CLEAR;
+
p_connect
= (Drd64_PacketData_Connect *)DRD64_PacketData( gp_sendbuffer );
p_phead->w_packettype = DRD64_PACKETTYPE_LINK;
p_phead->i_datalen = sizeof( Drd64_PacketData_ConnectCount );
p_phead->i_rid_resume = i_rid_resume;
- p_phead->i_result = 0x00;
- p_phead->i_error = 0x00;
+ p_phead->dw_errcode = DRD64_ERROR_CODE_CLEAR;
+ p_phead->dw_errlocation = DRD64_ERROR_LOCATION_CLEAR;
+
p_ccount
= (Drd64_PacketData_ConnectCount *)DRD64_PacketData( gp_sendbuffer );
#define DRD64_LOG_FACILITY_DEBUGD LOG_LOCAL4
#define DRD64_LOG_LEVEL_DEBUGD DRD64_LOG_LEVEL_DEBUG
+#define DRD64_ERRORINFO_HISTORY_MARSHALD 5
+#define DRD64_ERRORINFO_HISTORY_DEBUGD 5
+
#define DRD64_PACKET_MAX_MULTIPLE 2
#endif /* DRD64_HEADER_CONF */
#include"drd64_types.h"
#include"drd64_defines.h"
+#define DRD64_ERROR_SET_CODE(c,p,m,n) (((DWord)(c))|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
+#define DRD64_ERROR_SET_LOCATION(m,a,s,f) (((DWord)(m))|((DWord)(a))|(((DWord)(s))<<8)|((DWord)(f)))
+
/*DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
[Error] : Error Code
RRRR => Reserved.
PPPP => Error Pattern
1111 => Error Code Level-1 ( defined by Each-Module )
- 2222 => Error Code Level-1 ( defined by Each-Module )
+ 2222 => Error Code Level-2 ( defined by Each-Module )
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD*/
+#define DRD64_ERROR_CODE_CLEAR 0x00000000
+#define DRD64_ERROR_LOCATION_CLEAR 0x00000000
+
/* [Error] Type Code ================== __*_______ */
-#define DRD64_ERROR_TYPE_FATAL 0x40000000
-#define DRD64_ERROR_TYPE_ERROR 0x20000000
-#define DRD64_ERROR_TYPE_WARNING 0x10000000
-#define DRD64_ERROR_TYPE_INFO 0x00000000
+#define DRD64_ERROR_TYPE_FATAL 0x80000000
+#define DRD64_ERROR_TYPE_ERROR 0x40000000
+#define DRD64_ERROR_TYPE_WARNING 0x20000000
+#define DRD64_ERROR_TYPE_INFO 0x10000000
+#define DRD64_ERROR_TYPE_NONE 0x00000000
/* [Error] Pattern Code =============== ____**____ */
#define DRD64_ERROR_PTN_NOERROR 0x00000000
-#define DRD64_ERROR_PTN_PACKET 0x00000000
-#define DRD64_ERROR_PTN_COMMAND 0x00000000
-#define DRD64_ERROR_PTN_LOG 0x00000000
-#define DRD64_ERROR_PTN_SYSCALL 0x00000000
-#define DRD64_ERROR_PTN_TIMEOUT 0x00000000
-#define DRD64_ERROR_PTN_NOEXIST 0x00000000
+#define DRD64_ERROR_PTN_PACKET 0x00010000
+#define DRD64_ERROR_PTN_COMMAND 0x00020000
+#define DRD64_ERROR_PTN_LOG 0x00030000
+#define DRD64_ERROR_PTN_SYSCALL 0x00040000
+#define DRD64_ERROR_PTN_TIMEOUT 0x00050000
+#define DRD64_ERROR_PTN_NOEXIST 0x00060000
+#define DRD64_ERROR_PTN_NOMEMORY 0x00070000
+#define DRD64_ERROR_PTN_SOCKET 0x00080000
/* [Location] Module Level-1 Code ===== __*+______ */
#define DRD64_ERROR_MODULE_UI 0x71000000
/* [Location] Archtechture Code ======= ___**_____ */
+#define DRD64_ERROR_ARCH_NODEPEND 0x00000000
#define DRD64_ERROR_ARCH_INTEL64 0x01100000
#define DRD64_ERROR_ARCH_INTEL32 0x01200000
#define DRD64_ERROR_ARCH_INTEL16 0x01300000
INT i_rid_resume; /* resume_recvstatus_id */
/* Answer */
- INT i_result;
- INT i_error;
+ //INT i_result;
+ //INT i_error;
+ DWord dw_errcode;
+ DWord dw_errlocation;
} __attribute((packed)) Drd64_PacketHeader;
p_phead->i_datalen = i_datalen;
p_phead->i_rid_resume = -1;
- p_phead->i_result = 0x00;
- p_phead->i_error = 0x00;
+ p_phead->dw_errcode = DRD64_ERROR_CODE_CLEAR;
+ p_phead->dw_errlocation = DRD64_ERROR_LOCATION_CLEAR;
return;
}