CC = gcc
# Section 2 : Setting Compile Flag ####################################
-FLAGS_DEBUG = -g
+FLAGS_DEBUG = -g -Wall
LINK_LIBS = brownie
LINK_LIBDIR = ..
drd64_marshald_cmd_disconnect.o \
drd64_marshald_cmd_attach_request.o \
drd64_marshald_cmd_attach_link.o \
+ drd64_marshald_cmd_attach_report.o \
drd64_marshald_msg_bootinfo.o \
drd64_marshald_send_connect.o \
drd64_marshald_connect_debugd.o \
drd64_marshald_cmd_disconnect.o: drd64_marshald_cmd_disconnect.c $(MARSHALD_HEADER)
$(CC) -c -o drd64_marshald_cmd_disconnect.o $(FLAGS_DEBUG) drd64_marshald_cmd_disconnect.c
-drd64_marshald_cmd_attach_request.o: drd64_marshald_cmd_attach_request.c $(MARSHALD_HEADER)
- $(CC) -c -o drd64_marshald_cmd_attach_request.o $(FLAGS_DEBUG) drd64_marshald_cmd_attach_request.c
+drd64_marshald_cmd_attach_request.o: \
+ drd64_marshald_cmd_attach_request.c $(MARSHALD_HEADER)
+ $(CC) -c -o drd64_marshald_cmd_attach_request.o $(FLAGS_DEBUG) \
+ drd64_marshald_cmd_attach_request.c
drd64_marshald_cmd_attach_link.o: \
- drd64_marshald_cmd_attach_link.c \
- $(MARSHALD_HEADER)
- $(CC) -c -o drd64_marshald_cmd_attach_link.o \
- $(FLAGS_DEBUG) drd64_marshald_cmd_attach_link.c
+ drd64_marshald_cmd_attach_link.c $(MARSHALD_HEADER)
+ $(CC) -c -o drd64_marshald_cmd_attach_link.o $(FLAGS_DEBUG) \
+ drd64_marshald_cmd_attach_link.c
+
+drd64_marshald_cmd_attach_report.o: \
+ drd64_marshald_cmd_attach_report.c $(MARSHALD_HEADER)
+ $(CC) -c -o drd64_marshald_cmd_attach_report.o $(FLAGS_DEBUG) \
+ drd64_marshald_cmd_attach_report.c
drd64_marshald_msg_bootinfo.o: drd64_marshald_msg_bootinfo.c $(MARSHALD_HEADER)
$(CC) -c -o drd64_marshald_msg_bootinfo.o $(FLAGS_DEBUG) \
Drd64_Debugd_Send_Cmd_BootInfo(
int i_request_fd )
{
- int i_err;
int i_wlen;
int i_socket_temp;
Drd64_PacketHeader *p_phead;
Drd64_Marshald_CInfo_InitConnectInfo(
void )
{
- int i_cnt;
gp_marshald_cinfo
= (Drd64_Marshald_ConnectInfo *)malloc(
Drd64_Marshald_MasterInformation *p_marshald )
{
int i_result;
- int i_cmd_status;
- Byte b_packet_status;
DRD64_LOG_VERBOSE("[STAT]CMD: Attach Link Start");
--- /dev/null
+/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
+
+ D r . D e a m o n 6 4
+ for INTEL64(R), AMD64(R)
+
+ Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
+
+/* File Info -----------------------------------------------------------
+File: drd64_.c
+Function:
+Comment:
+----------------------------------------------------------------------*/
+
+#include"drd64_marshald.h"
+
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+/*int
+ Drd64_Marshald_Cmd_AttachLink_Request(
+ int i_recv_id,
+ Drd64_PacketHeader *p_phead,
+ Drd64_PacketData_AttachLink *p_alink,
+ Drd64_Marshald_MasterInformation *p_marshald )
+{
+ int i_result;
+ int i_err;
+ Drd64_Marshald_ConnectInfo *p_cinfo_now;
+ Drd64_Marshald_ConnectInfo *p_cinfo_debugd;
+
+ DRD64_LOG_DEBUG(" [DEBUG]CMD: Attach Link (Request) Start");
+
+ i_result = DRD64_MARSHALD_DISPATCH_RESULT_COMPLETE;
+
+ p_cinfo_now = Drd64_Marshald_CInfo_GetConnectInfo( p_phead->i_cid_dest );
+ assert( NULL != p_cinfo_now );
+
+ p_cinfo_debugd = Drd64_Marshald_Connect_Debugd(
+ p_alink->str_debugd_sockname,
+ p_cinfo_now->i_prog_pid,
+ p_cinfo_now->i_debugd_pid );
+
+ p_cinfo_now->i_debugd_socket = p_cinfo_debugd->i_dest_socket;
+ p_cinfo_now->i_client_socket
+ = Drd64_Server_RecvStatus_GetSocketID( i_recv_id );
+ assert( -1 != p_cinfo_now->i_client_socket );
+
+ p_phead->w_packettype |= DRD64_PACKETTYPE_FLAG_RELAY;
+ p_phead->i_cid_client = p_phead->i_cid_dest;
+ p_phead->i_cid_dest = DRD64_CONNECTID_NONE;
+ p_phead->i_cid_src = p_cinfo_debugd->i_cinfo_id;
+
+ i_err = send( p_cinfo_debugd->i_dest_socket, (void *)p_phead,
+ DRD64_PacketSize(p_phead), 0x00 );
+ DRD64_DEBUG_PRINT("send",i_err,"FD",p_cinfo_debugd->i_dest_socket,"errno",errno);
+ if( i_err != DRD64_PacketSize(p_phead) ) { return 0x02; }
+
+
+ DRD64_LOG_DEBUG(" [DEBUG]CMD: Attach Link (Request) Ended");
+
+ return i_result;
+}*/
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+int
+ Drd64_Marshald_Cmd_AttachReport(
+ int i_recv_id,
+ Drd64_PacketHeader *p_phead,
+ Drd64_PacketData_AttachReport *p_areport,
+ Drd64_Marshald_MasterInformation *p_marshald )
+{
+ int i_result;
+ //int i_cmd_status;
+ //Byte b_packet_status;
+
+ DRD64_LOG_VERBOSE("[STAT]CMD: Attach Report Start");
+
+ i_result = DRD64_MARSHALD_DISPATCH_RESULT_COMPLETE;
+
+
+ DRD64_LOG_VERBOSE("[STAT]CMD: Attach Report Ended");
+
+ return i_result;
+}
+
+
+/* EOF of drd64_.c ----------------------------------- */
Drd64_Marshald_MasterInformation *p_marshald )
{
int i_wlen;
- int i_result;
+ //int i_result;
int i_fds;
Drd64_Marshald_ConnectInfo *p_cinfo_client;
Drd64_Marshald_MasterInformation *p_marshald )
{
int i_wlen;
- int i_result;
+ //int i_result;
int i_fds;
Drd64_Marshald_ConnectInfo *p_cinfo;
char str_request_fd[10];
char str_debugd_connect_id[10];
int i_pid_debugd;
- int i_wlen;
+ //int i_wlen;
DRD64_LOG_DEBUG(" [DEBUG]CMD: Attach Req. (Scn1:BootDebugd) Start");
Drd64_PacketData_AttachRequest *p_attachreq,
Drd64_Marshald_MasterInformation *p_marshald )
{
- int i_wlen;
- int i_err;
+ //int i_wlen;
+ //int i_err;
int i_result;
int i_cmd_status;
int i_inet_flag;
Byte b_packet_status;
- Drd64_Marshald_ConnectInfo *p_cinfo;
+ //Drd64_Marshald_ConnectInfo *p_cinfo;
DRD64_LOG_VERBOSE("[STAT]CMD: Attach Request Start");
i_result = Drd64_Marshald_Cmd_AttachLink(
i_recv_id, p_phead, pv_data, p_marshald );
}
- else if( DRD64_COMMAND_DEBUG_REQUEST == p_phead->dw_command ) {
+ /* CMD: Attach Report -----------------------------*/
+ else if( DRD64_COMMAND_ATTACH_REPORT == p_phead->dw_command ) {
+ i_result = Drd64_Marshald_Cmd_AttachReport(
+ i_recv_id, p_phead, pv_data, p_marshald );
}
else if( DRD64_COMMAND_DETACH == p_phead->dw_command ) {
}
Drd64_Marshald_MasterInformation *p_marshald )
{
fd_set fds_now;
- int i_cnt;
+ //int i_cnt;
int i_socket;
int i_result;
int i_err;
free( gpp_recvstat );
gpp_recvstat = NULL;
- return;
+ return 0x00;
}
{
Drd64_Server_RecvStatus_FreeRecvStatus_All();
- return;
+ return 0x00;
}
} __attribute((packed)) Drd64_PacketData_AttachLink;
+
+
+/* CMD: Attach Report ===================================*/
+
+typedef struct {
+ /* Request Data */
+ char str_debugd_sockname[DRD64_MAX_PATH+1];
+
+ /* Answer Data */
+
+} __attribute((packed)) Drd64_PacketData_AttachReport;
+
+
+
+
#endif /* DRD64_HEADER_XXX */
/* EOF of drd64_.h ----------------------------------- */
int
- Drd64_LibDrd64_Cmd_Attach_Link(
+ Drd64_LibDrd64_Cmd_Attach_Report(
Drd64_LibDrd64_ConnectInfo *p_cinfo )
{
int i_err;
int i_socket;
int i_socket_marshald;
Drd64_PacketHeader *p_phead;
+ Drd64_PacketData_AttachReport *p_areport;
+
+ assert( NULL != p_cinfo );
+
+ /* Phase 1 : Set Packet Data --- */
+ p_phead = (Drd64_PacketHeader *)gp_buffer;
+ p_areport
+ = (Drd64_PacketData_AttachReport *)DRD64_PacketData( gp_buffer );
+
+ /*strncpy( p_alink->str_debugd_sockname,
+ p_cinfo->str_debugd_addr_local,
+ DRD64_MAX_PATH );*/
+
+ Drd64_LibDrd64_Packet_SetPacketHeader(
+ p_phead,
+ p_cinfo->i_marshald_cid,
+ DRD64_PACKETTYPE_CONTROL,
+ DRD64_COMMAND_ATTACH_REPORT,
+ sizeof( Drd64_PacketData_AttachReport ) );
+
+ /* Phase 2 : Send & Recv. Attach-Link Cmd */
+ i_err = Drd64_LibDrd64_Packet_SendPacket(
+ p_cinfo->i_marshald_socket, gp_buffer,
+ sizeof( Drd64_PacketData_AttachReport ),
+ sizeof( Drd64_PacketData_AttachReport ),
+ 0x00 );
+ printf("attach report: %d\n", i_err );
+ if( 0 > i_err ) {
+ return -2;
+ }
+
+ return 0x00;
+}
+
+
+int
+ Drd64_LibDrd64_Cmd_Attach_Link(
+ Drd64_LibDrd64_ConnectInfo *p_cinfo )
+{
+ int i_err;
+ int i_socket;
+ //int i_socket_marshald;
+ Drd64_PacketHeader *p_phead;
Drd64_PacketData_AttachLink *p_alink;
assert( NULL != p_cinfo );
DRD64_COMMAND_ATTACH_LINK,
sizeof( Drd64_PacketData_AttachLink ) );
- p_alink
+ /*p_alink
= (Drd64_PacketData_AttachLink *)DRD64_PacketData( gp_buffer );
+ */
/* Phase 3 : Send & Recv. Attach-Link Cmd */
i_err = Drd64_LibDrd64_Packet_SendPacket(
Drd64_LibDrd64_Cmd_Attach_Link( p_cinfo );
/* Phase 3: Attach Report */
+ Drd64_LibDrd64_Cmd_Attach_Report( p_cinfo );
return 0x00;
}