src/stored/fd_cmds.c
static bool read_open_session(JCR *jcr)
{
   BSOCK *fd = jcr->file_bsock;

   Dmsg1(120, "%s", fd->msg);
   if (jcr->session_opened) {
      pm_strcpy(jcr->errmsg, _("Attempt to open an already open session.\n"));
      fd->fsend(NO_open);
      return false;
   }

   if (sscanf(fd->msg, read_open, jcr->read_dcr->VolumeName, &jcr->read_VolSessionId,
         &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
         &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
      Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n",
         jcr->JobId, jcr->read_dcr->VolumeName, jcr->read_VolSessionId,
         jcr->read_VolSessionTime);
      Dmsg4(100, "  StartF=%ld EndF=%ld StartB=%ld EndB=%ld\n",
         jcr->read_StartFile, jcr->read_EndFile, jcr->read_StartBlock,
         jcr->read_EndBlock);

   } else {
      pm_strcpy(jcr->errmsg, _("Cannot open session, received bad parameters.\n"));
      fd->fsend(ERROR_open);
      return false;
   }

   jcr->session_opened = true;
   jcr->setJobType(JT_RESTORE);

   /* Send "Ticket" to File Daemon */
   fd->fsend(OK_open, jcr->VolSessionId);
   Dmsg1(110, ">filed: %s", fd->msg);

   return true;
}
/*
 * Read Open session command
 *
 *  We need to scan for the parameters of the job
 *    to be restored.
 */
Read Open session command
We need to scan for the parameters of the job
to be restored.
Read Open session command We need to scan for the parameters of the job to be restored .
static bool read_open_session(JCR *jcr)
{
   BSOCK *fd = jcr->file_bsock;
   Dmsg1(120, "%s", fd->msg);
   if (jcr->session_opened) {
      pm_strcpy(jcr->errmsg, _("Attempt to open an already open session.\n"));
      fd->fsend(NO_open);
      return false;
   }
   if (sscanf(fd->msg, read_open, jcr->read_dcr->VolumeName, &jcr->read_VolSessionId,
         &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
         &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
      Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n",
         jcr->JobId, jcr->read_dcr->VolumeName, jcr->read_VolSessionId,
         jcr->read_VolSessionTime);
      Dmsg4(100, "  StartF=%ld EndF=%ld StartB=%ld EndB=%ld\n",
         jcr->read_StartFile, jcr->read_EndFile, jcr->read_StartBlock,
         jcr->read_EndBlock);
   } else {
      pm_strcpy(jcr->errmsg, _("Cannot open session, received bad parameters.\n"));
      fd->fsend(ERROR_open);
      return false;
   }
   jcr->session_opened = true;
   jcr->setJobType(JT_RESTORE);
   fd->fsend(OK_open, jcr->VolSessionId);
   Dmsg1(110, ">filed: %s", fd->msg);
   return true;
}
static bool read_open_session ( JCR * jcr ) { BSOCK * fd = jcr -> file_bsock ; Dmsg1 ( 120 , " " , fd -> msg ) ; if ( jcr -> session_opened ) { pm_strcpy ( jcr -> errmsg , _ ( " \n " ) ) ; fd -> fsend ( NO_open ) ; return false ; } if ( sscanf ( fd -> msg , read_open , jcr -> read_dcr -> VolumeName , & jcr -> read_VolSessionId , & jcr -> read_VolSessionTime , & jcr -> read_StartFile , & jcr -> read_EndFile , & jcr -> read_StartBlock , & jcr -> read_EndBlock ) == 7 ) { Dmsg4 ( 100 , " \n " , jcr -> JobId , jcr -> read_dcr -> VolumeName , jcr -> read_VolSessionId , jcr -> read_VolSessionTime ) ; Dmsg4 ( 100 , " \n " , jcr -> read_StartFile , jcr -> read_EndFile , jcr -> read_StartBlock , jcr -> read_EndBlock ) ; } else { pm_strcpy ( jcr -> errmsg , _ ( " \n " ) ) ; fd -> fsend ( ERROR_open ) ; return false ; } jcr -> session_opened = true ; jcr -> setJobType ( JT_RESTORE ) ; fd -> fsend ( OK_open , jcr -> VolSessionId ) ; Dmsg1 ( 110 , " " , fd -> msg ) ; return true ; }
Read Open session command
  We need to scan for the parameters of the job
    to be restored.
Read Open session command We need to scan for the parameters of the job to be restored .
/* Send "Ticket" to File Daemon */