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

void PTelnetSocket::OnWill ( BYTE  option  )  [protected, virtual]

This callback function is called by the system when it receives a WILL request from the remote system.

The default action is to send a DO for options that are understood by the standard TELNET class and a DONT for all others.

Parameters:
option  Option to WILL

Definition at line 802 of file telnet.cxx.

References DO, DONT, and SendCommand().

Referenced by Read().

{
  PTelnetError << "OnWill " << GetTELNETOptionName(code) << ' ';

  OptionInfo & opt = option[code];

  switch (opt.theirState) {
    case OptionInfo::IsNo :
      if (opt.theyShould) {
        PDebugError << "DO.";
        SendCommand(DO, code);
        opt.theirState = OptionInfo::IsYes;
      }
      else {
        PDebugError << "DONT.";
        SendCommand(DONT, code);
      }
      break;

    case OptionInfo::IsYes :
      PDebugError << "ignored.";
      break;

    case OptionInfo::WantNo :
      PDebugError << "is answer to DONT.";
      opt.theirState = OptionInfo::IsNo;
      break;

    case OptionInfo::WantNoQueued :
      PDebugError << "impossible answer.";
      opt.theirState = OptionInfo::IsYes;
      break;

    case OptionInfo::WantYes :
      PDebugError << "accepted.";
      opt.theirState = OptionInfo::IsYes;
      break;

    case OptionInfo::WantYesQueued :
      PDebugError << "refused.";
      opt.theirState = OptionInfo::WantNo;
      SendCommand(DONT, code);
      break;
  }

  PDebugError << endl;
}


Generated by  Doxygen 1.6.0   Back to index