"use strict";
//
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
Object.defineProperty(exports, "__esModule", { value: true });
exports.PortForwardRequestMessage = void 0;
const dev_tunnels_ssh_1 = require("@microsoft/dev-tunnels-ssh");
const portForwardingService_1 = require("../services/portForwardingService");
class PortForwardRequestMessage extends dev_tunnels_ssh_1.SessionRequestMessage {
    constructor() {
        super();
        this.addressToBind = '';
        this.port = 0;
        this.requestType = portForwardingService_1.PortForwardingService.portForwardRequestType;
        this.wantReply = true;
    }
    onRead(reader) {
        super.onRead(reader);
        this.addressToBind = reader.readString('ascii');
        this.port = reader.readUInt32();
    }
    onWrite(writer) {
        super.onWrite(writer);
        writer.writeString(this.validateField(this.addressToBind, 'address'), 'ascii');
        writer.writeUInt32(this.validateField(this.port, 'port'));
    }
    toString() {
        return `${super.toString()} (addressToBind=${this.addressToBind} port=${this.port})`;
    }
}
exports.PortForwardRequestMessage = PortForwardRequestMessage;
//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/6a44c352bd24569c417e530095901b649960f9f8/node_modules/@microsoft/dev-tunnels-ssh-tcp/messages/portForwardRequestMessage.js.map