"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://github.com/VSCodium/sourcemaps/releases/download/stable-4c0b0c6cc561d2d3636d1ec250935431876ce4dc/node_modules-@microsoft-dev-tunnels-ssh-tcp-messages-portForwardChannelOpenMessage.js.map