Logo Search packages:      
Sourcecode: qtsmbstatus version File versions  Download package

void ClientSocket::core ( const Q3CString &  rcv_txt  )  [private, slot]

Protocol interpreter. analyze the server's answers.

Parameters:
rcv_txt data sent by server
See also:
ClientSSL core_syntax
Protocol interpreter. analyze the client's answers.
Parameters:
rcv_txt data sent by client
See also:
core_syntax

Definition at line 196 of file clientsocket.cpp.

References AnalysisSmbstatus(), ClientSSL::closeConnection(), infoserver(), core_syntax::returnArg(), sendToServer(), core_syntax::setValue(), SignalErrorAuth(), slot_timer(), and TimoutTimerEcho.

Referenced by connectionToServer(), and readClient().

{
      debugQt ("ClientSocket::core()");
      QString texte;
      int reponse;
      bool ok;
      core_syntax stx;

      // reset echo timer because server has sent data
      echo=0;
      echo_timer->stop();
      echo_timer->start( TimoutTimerEcho, FALSE );

      QTextStream ts( rcv_txt, QIODevice::ReadOnly );
      while (!ts.atEnd () )
      {
            texte=ts.readLine();
            texte=QString::fromUtf8( texte );
            stx.setValue(texte);
            if (stx.returnArg(0) != "")
            {
                  reponse=(stx.returnArg(0)).toInt(&ok);
                  if (ok) // if txt to int conversion is ok
                  {
                        switch (reponse)
                        {
                              case auth_ack: // authentication ok
                                          debugQt("["+QString::number(reponse)+"] auth_ack");
                                          slot_timer(); // first time
                                          break;
                              case end: // end socket by server
                                          debugQt("["+QString::number(reponse)+"] end");
                                          socketclient->closeConnection(); //on ferme la connection
                                          break;
                              case smb_data: // smbstatus datas
                                          debugQt("["+QString::number(reponse)+"] smb_data");
                                          ListSmbstatus.append(stx.returnArg(1));
                                          break;
                              case end_smb_rq: // smbstatus command is finished
                                          debugQt("["+QString::number(reponse)+"] end_smb_rq");
                                          AnalysisSmbstatus(); // interpret smbstatus reply
                                          break;
                              case error_auth: // authentication error
                                          debugQt("["+QString::number(reponse)+"] error_auth");
                                          // socketclient->closeConnection(); (don't close here, server will do it)
                                          emit (SignalErrorAuth());
                                          break;
                              case error_command: // Command error ( the last command is not recognized)
                                          debugQt("["+QString::number(reponse)+"] error_command");
                                          break;
                              case echo_request: // echo request from server
                                          debugQt("["+QString::number(reponse)+"] echo_request");
                                          sendToServer(echo_reply);
                                          break;
                              case echo_reply: // echo reply from server, reset echo timer
                                          debugQt("["+QString::number(reponse)+"] echo_reply");
                                          echo=0;
                                          break;
                              case error_obj: // Server wants to open a dialogbox to visualize an error
                                          debugQt("["+QString::number(reponse)+"] error_obj");
                                          // QMessageBox::warning ( 0, "QtSmbstatus",stx.returnArg(1));
                                          msgError->showMessage ( stx.returnArg(1) ) ;
                                          break;
                              case server_info: // informations from server
                                          debugQt("["+QString::number(reponse)+"] server_info");
                                          infoserver(texte);
                                          break;
                              default: // not implemented
                                          debugQt("["+QString::number(reponse)+"] not implemented");
                                          sendToServer(error_command,"["+QString::number(reponse)+"] not implemented");
                                          break;
                        }
                  }
                  else
                  { //conversion error string->int
                        debugQt("Command error !");
                  }
            }
            else
            { // core_syntax sends an error
                  debugQt("Command error !");
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index