OSDN Git Service

*** empty log message ***
authorkoinec <>
Wed, 24 Feb 2010 23:42:47 +0000 (23:42 +0000)
committerkoinec <>
Wed, 24 Feb 2010 23:42:47 +0000 (23:42 +0000)
deamon/Makefile
deamon/drd64_debugd_send_cmd_bootinfo.c
deamon/drd64_marshald_cinfo.c
deamon/drd64_marshald_cmd_attach_link.c
deamon/drd64_marshald_cmd_attach_report.c [new file with mode: 0644]
deamon/drd64_marshald_cmd_attach_request.c
deamon/drd64_marshald_dispatch.c
deamon/drd64_server_recvstatus.c
include/drd64_packet.h
libdrd64/drd64_libdrd64_cmd_attach.c

index 35b3289..42b33d2 100644 (file)
@@ -39,7 +39,7 @@ MAKE = make
 CC = gcc
 
 # Section 2 : Setting Compile Flag  ####################################
-FLAGS_DEBUG = -g
+FLAGS_DEBUG = -g -Wall
 LINK_LIBS = brownie
 LINK_LIBDIR = ..
 
@@ -90,6 +90,7 @@ MARSHALD_OBJS = drd64_marshald_main.o \
                                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 \
@@ -160,14 +161,20 @@ drd64_marshald_cmd_connect.o: drd64_marshald_cmd_connect.c $(MARSHALD_HEADER)
 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) \
index aafadfb..0ee1c67 100644 (file)
@@ -41,7 +41,6 @@ int
        Drd64_Debugd_Send_Cmd_BootInfo(
                int             i_request_fd )
 {
-       int                                                     i_err;
        int                                                     i_wlen;
        int                                                     i_socket_temp;
        Drd64_PacketHeader                      *p_phead;
index e7948bd..8d50d67 100644 (file)
@@ -177,7 +177,6 @@ int
        Drd64_Marshald_CInfo_InitConnectInfo(
                void )
 {
-       int             i_cnt;
 
        gp_marshald_cinfo
                = (Drd64_Marshald_ConnectInfo *)malloc(
index 564630c..34a9452 100644 (file)
@@ -136,8 +136,6 @@ int
                Drd64_Marshald_MasterInformation        *p_marshald )
 {
        int             i_result;
-       int             i_cmd_status;
-       Byte    b_packet_status;
 
        DRD64_LOG_VERBOSE("[STAT]CMD: Attach Link Start");
 
diff --git a/deamon/drd64_marshald_cmd_attach_report.c b/deamon/drd64_marshald_cmd_attach_report.c
new file mode 100644 (file)
index 0000000..342babc
--- /dev/null
@@ -0,0 +1,113 @@
+/*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 ----------------------------------- */
index efa726f..9a2b909 100644 (file)
@@ -53,7 +53,7 @@ int
                Drd64_Marshald_MasterInformation        *p_marshald )
 {
        int             i_wlen;
-       int             i_result;
+       //int           i_result;
        int             i_fds;
        Drd64_Marshald_ConnectInfo      *p_cinfo_client;
 
@@ -100,7 +100,7 @@ int
                Drd64_Marshald_MasterInformation        *p_marshald )
 {
        int             i_wlen;
-       int             i_result;
+       //int           i_result;
        int             i_fds;
        Drd64_Marshald_ConnectInfo      *p_cinfo;
 
@@ -229,7 +229,7 @@ int
        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");
 
@@ -348,13 +348,13 @@ int
                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");
 
index dc4eed5..cacdaf0 100644 (file)
@@ -140,7 +140,10 @@ int
                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 )  {
        }
@@ -285,7 +288,7 @@ int
         Drd64_Marshald_MasterInformation *p_marshald )
 {
        fd_set  fds_now;
-       int     i_cnt;
+       //int     i_cnt;
        int             i_socket;
        int             i_result;
        int             i_err;
index 0766b2c..2df9280 100644 (file)
@@ -69,7 +69,7 @@ int
        free( gpp_recvstat );
        gpp_recvstat            = NULL;
 
-       return;
+       return 0x00;
 }
 
 
@@ -174,7 +174,7 @@ int
 {
        Drd64_Server_RecvStatus_FreeRecvStatus_All();
 
-       return;
+       return 0x00;
 }
 
 
index d91061f..1bd42be 100644 (file)
@@ -148,6 +148,21 @@ typedef struct     {
 
 } __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 ----------------------------------- */
index c1ea917..51f0691 100644 (file)
@@ -38,13 +38,56 @@ Comment:
 
 
 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 );
@@ -77,8 +120,9 @@ int
                                                        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(
@@ -194,6 +238,7 @@ int
        Drd64_LibDrd64_Cmd_Attach_Link( p_cinfo );
 
        /* Phase 3: Attach Report */
+       Drd64_LibDrd64_Cmd_Attach_Report( p_cinfo );
 
        return 0x00;
 }