cmdriver/src/CMDriver.cxx
//---------------------------------------------------------------------------------------------
// This function will process given Source Integrity command with it's arguments and will 
// send the reply
//---------------------------------------------------------------------------------------------
This function will process given Source Integrity command with it's arguments and will
send the reply
This function will process given Source Integrity command with it ' s arguments and will send the reply
int ProcessSICommand(ClientDescriptor* client, char **args) {
    char	command[1024];
    char*	reply = NULL;
    if(strcmp(args[0],REGISTER_CMD)==0) {
        nClients++;
        sendReply(client->m_ClientSocket,"done");
        _DBG(fprintf(log_fd,"Source Integrity %s :done\n",args[0]));
        return 1;
    }
    if(strcmp(args[0],UNREGISTER_CMD)==0) {
        nClients--;
        if(nClients < 1 && work_forever == 0) {
            do_shutdown = 1;
        }
        sendReply(client->m_ClientSocket,"done");
        _DBG(fprintf(log_fd,"Source Integrity %s :done\n",args[0]));
    }
    if(strcmp(args[0],UNCHECKOUT_CMD)==0) {
        sprintf(command,"si revert -g \"%s\"",args[1]);
        if(runCommand(command,&reply)!=0)
            sendReply(client->m_ClientSocket,"Error");
        sendReply(client->m_ClientSocket,reply);
        delete reply;
        _DBG(fprintf(log_fd,"Source Integrity %s :done\n",UNCHECKOUT_CMD));
        return 1;
    }
    if(strcmp(args[0],CHECKOUT_CMD)==0) {
        sprintf(command,"si co -g \"%s\"",args[1]);
        if(runCommand(command,&reply)!=0)
            sendReply(client->m_ClientSocket,"Error");
        sendReply(client->m_ClientSocket,reply);
        delete reply;
        _DBG(fprintf(log_fd,"Source Integrity %s :done\n",CHECKOUT_CMD));
        return 1;
    }
    if(strcmp(args[0],CHECKIN_CMD)==0) {
        sprintf(command,"si ci -g \"%s\"",args[1]);
        if(runCommand(command,&reply)!=0)
            sendReply(client->m_ClientSocket,"Error");
        sendReply(client->m_ClientSocket,reply);
        delete reply;
        _DBG(fprintf(log_fd,"Source Integrity %s :done\n",CHECKIN_CMD));
        return 1;
    }
    if(strcmp(args[0],RESERVE_CMD)==0) {
        sprintf(command,"si lock -g \"%s\"",args[1]);
        if(runCommand(command,&reply)!=0)
            sendReply(client->m_ClientSocket,"Error");
        sendReply(client->m_ClientSocket,reply);
        delete reply;
        _DBG(fprintf(log_fd,"Source Integrity %s :done\n",RESERVE_CMD));
        return 1;
    }
    if(strcmp(args[0],UNRESERVE_CMD)==0) {
        sprintf(command,"si unlock -g \"%s\"",args[1]);
        if(runCommand(command,&reply)!=0)
            sendReply(client->m_ClientSocket,"Error");
        sendReply(client->m_ClientSocket,reply);
        delete reply;
        _DBG(fprintf(log_fd,"Source Integrity %s :done\n",UNRESERVE_CMD));
        return 1;
    }
    if(strcmp(args[0],RESYNC_CMD)==0) {
        sprintf(command,"si resync -g \"%s\"",args[1]);
        if(runCommand(command,&reply)!=0)
            sendReply(client->m_ClientSocket,"Error");
        sendReply(client->m_ClientSocket,reply);
        delete reply;
        _DBG(fprintf(log_fd,"Source Integrity %s :done\n",LOCALLIST_CMD));
        return 1;
    }
    sendReply(client->m_ClientSocket,"Error");
    sendReply(client->m_ClientSocket,"Unknown command.");
    _DBG(fprintf(log_fd,"Source Integrity Unknown command %s.\n",args[0]));
    return 0;
}
int ProcessSICommand ( ClientDescriptor * client , char * * args ) { char command [ 1024 ] ; char * reply = NULL ; if ( strcmp ( args [ 0 ] , REGISTER_CMD ) == 0 ) { nClients ++ ; sendReply ( client -> m_ClientSocket , " " ) ; _DBG ( fprintf ( log_fd , " \n " , args [ 0 ] ) ) ; return 1 ; } if ( strcmp ( args [ 0 ] , UNREGISTER_CMD ) == 0 ) { nClients -- ; if ( nClients < 1 && work_forever == 0 ) { do_shutdown = 1 ; } sendReply ( client -> m_ClientSocket , " " ) ; _DBG ( fprintf ( log_fd , " \n " , args [ 0 ] ) ) ; } if ( strcmp ( args [ 0 ] , UNCHECKOUT_CMD ) == 0 ) { sprintf ( command , " \" \" " , args [ 1 ] ) ; if ( runCommand ( command , & reply ) != 0 ) sendReply ( client -> m_ClientSocket , " " ) ; sendReply ( client -> m_ClientSocket , reply ) ; delete reply ; _DBG ( fprintf ( log_fd , " \n " , UNCHECKOUT_CMD ) ) ; return 1 ; } if ( strcmp ( args [ 0 ] , CHECKOUT_CMD ) == 0 ) { sprintf ( command , " \" \" " , args [ 1 ] ) ; if ( runCommand ( command , & reply ) != 0 ) sendReply ( client -> m_ClientSocket , " " ) ; sendReply ( client -> m_ClientSocket , reply ) ; delete reply ; _DBG ( fprintf ( log_fd , " \n " , CHECKOUT_CMD ) ) ; return 1 ; } if ( strcmp ( args [ 0 ] , CHECKIN_CMD ) == 0 ) { sprintf ( command , " \" \" " , args [ 1 ] ) ; if ( runCommand ( command , & reply ) != 0 ) sendReply ( client -> m_ClientSocket , " " ) ; sendReply ( client -> m_ClientSocket , reply ) ; delete reply ; _DBG ( fprintf ( log_fd , " \n " , CHECKIN_CMD ) ) ; return 1 ; } if ( strcmp ( args [ 0 ] , RESERVE_CMD ) == 0 ) { sprintf ( command , " \" \" " , args [ 1 ] ) ; if ( runCommand ( command , & reply ) != 0 ) sendReply ( client -> m_ClientSocket , " " ) ; sendReply ( client -> m_ClientSocket , reply ) ; delete reply ; _DBG ( fprintf ( log_fd , " \n " , RESERVE_CMD ) ) ; return 1 ; } if ( strcmp ( args [ 0 ] , UNRESERVE_CMD ) == 0 ) { sprintf ( command , " \" \" " , args [ 1 ] ) ; if ( runCommand ( command , & reply ) != 0 ) sendReply ( client -> m_ClientSocket , " " ) ; sendReply ( client -> m_ClientSocket , reply ) ; delete reply ; _DBG ( fprintf ( log_fd , " \n " , UNRESERVE_CMD ) ) ; return 1 ; } if ( strcmp ( args [ 0 ] , RESYNC_CMD ) == 0 ) { sprintf ( command , " \" \" " , args [ 1 ] ) ; if ( runCommand ( command , & reply ) != 0 ) sendReply ( client -> m_ClientSocket , " " ) ; sendReply ( client -> m_ClientSocket , reply ) ; delete reply ; _DBG ( fprintf ( log_fd , " \n " , LOCALLIST_CMD ) ) ; return 1 ; } sendReply ( client -> m_ClientSocket , " " ) ; sendReply ( client -> m_ClientSocket , " " ) ; _DBG ( fprintf ( log_fd , " \n " , args [ 0 ] ) ) ; return 0 ; }
This function will process given Source Integrity command with it's arguments and will
send the reply
This function will process given Source Integrity command with it ' s arguments and will send the reply
// Un Check Out command // Check Out command // Check In command // Reserv command // Unreserv command // Resync command // We do not know this command 