AuthSwitchRequestPacket.js 707 B

1234567891011121314151617181920
  1. module.exports = AuthSwitchRequestPacket;
  2. function AuthSwitchRequestPacket(options) {
  3. options = options || {};
  4. this.status = 0xfe;
  5. this.authMethodName = options.authMethodName;
  6. this.authMethodData = options.authMethodData;
  7. }
  8. AuthSwitchRequestPacket.prototype.parse = function parse(parser) {
  9. this.status = parser.parseUnsignedNumber(1);
  10. this.authMethodName = parser.parseNullTerminatedString();
  11. this.authMethodData = parser.parsePacketTerminatedBuffer();
  12. };
  13. AuthSwitchRequestPacket.prototype.write = function write(writer) {
  14. writer.writeUnsignedNumber(1, this.status);
  15. writer.writeNullTerminatedString(this.authMethodName);
  16. writer.writeBuffer(this.authMethodData);
  17. };