"use strict";
//
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
Object.defineProperty(exports, "__esModule", { value: true });
exports.PortForwardChannelOpenMessage = void 0;
const dev_tunnels_ssh_1 = require("@microsoft/dev-tunnels-ssh");
class PortForwardChannelOpenMessage extends dev_tunnels_ssh_1.ChannelOpenMessage {
    constructor() {
        super(...arguments);
        this.host = '';
        this.port = 0;
        this.originatorIPAddress = '';
        this.originatorPort = 0;
    }
    onRead(reader) {
        super.onRead(reader);
        this.host = reader.readString('ascii');
        this.port = reader.readUInt32();
        this.originatorIPAddress = reader.readString('ascii');
        this.originatorPort = reader.readUInt32();
    }
    onWrite(writer) {
        super.onWrite(writer);
        writer.writeString(this.validateField(this.host, 'host'), 'ascii');
        writer.writeUInt32(this.validateField(this.port, 'port'));
        writer.writeString(this.originatorIPAddress || '', 'ascii');
        writer.writeUInt32(this.originatorPort || 0);
    }
    toString() {
        return `${super.toString()} (host=${this.host} port=${this.port})`;
    }
}
exports.PortForwardChannelOpenMessage = PortForwardChannelOpenMessage;
//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/6a44c352bd24569c417e530095901b649960f9f8/node_modules/@microsoft/dev-tunnels-ssh-tcp/messages/portForwardChannelOpenMessage.js.map