UNPKG

mediasoup

Version:

Cutting Edge WebRTC Video Conferencing

107 lines (106 loc) 4.17 kB
"use strict"; // automatically generated by the FlatBuffers compiler, do not modify Object.defineProperty(exports, "__esModule", { value: true }); exports.TupleT = exports.Tuple = void 0; /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ const flatbuffers = require("flatbuffers"); const protocol_1 = require("../../fbs/transport/protocol"); class Tuple { bb = null; bb_pos = 0; __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsTuple(bb, obj) { return (obj || new Tuple()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsTuple(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new Tuple()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } localAddress(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } localPort() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readUint16(this.bb_pos + offset) : 0; } remoteIp(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } remotePort() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.readUint16(this.bb_pos + offset) : 0; } protocol() { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? this.bb.readUint8(this.bb_pos + offset) : protocol_1.Protocol.UDP; } static startTuple(builder) { builder.startObject(5); } static addLocalAddress(builder, localAddressOffset) { builder.addFieldOffset(0, localAddressOffset, 0); } static addLocalPort(builder, localPort) { builder.addFieldInt16(1, localPort, 0); } static addRemoteIp(builder, remoteIpOffset) { builder.addFieldOffset(2, remoteIpOffset, 0); } static addRemotePort(builder, remotePort) { builder.addFieldInt16(3, remotePort, 0); } static addProtocol(builder, protocol) { builder.addFieldInt8(4, protocol, protocol_1.Protocol.UDP); } static endTuple(builder) { const offset = builder.endObject(); builder.requiredField(offset, 4); // local_address return offset; } static createTuple(builder, localAddressOffset, localPort, remoteIpOffset, remotePort, protocol) { Tuple.startTuple(builder); Tuple.addLocalAddress(builder, localAddressOffset); Tuple.addLocalPort(builder, localPort); Tuple.addRemoteIp(builder, remoteIpOffset); Tuple.addRemotePort(builder, remotePort); Tuple.addProtocol(builder, protocol); return Tuple.endTuple(builder); } unpack() { return new TupleT(this.localAddress(), this.localPort(), this.remoteIp(), this.remotePort(), this.protocol()); } unpackTo(_o) { _o.localAddress = this.localAddress(); _o.localPort = this.localPort(); _o.remoteIp = this.remoteIp(); _o.remotePort = this.remotePort(); _o.protocol = this.protocol(); } } exports.Tuple = Tuple; class TupleT { localAddress; localPort; remoteIp; remotePort; protocol; constructor(localAddress = null, localPort = 0, remoteIp = null, remotePort = 0, protocol = protocol_1.Protocol.UDP) { this.localAddress = localAddress; this.localPort = localPort; this.remoteIp = remoteIp; this.remotePort = remotePort; this.protocol = protocol; } pack(builder) { const localAddress = (this.localAddress !== null ? builder.createString(this.localAddress) : 0); const remoteIp = (this.remoteIp !== null ? builder.createString(this.remoteIp) : 0); return Tuple.createTuple(builder, localAddress, this.localPort, remoteIp, this.remotePort, this.protocol); } } exports.TupleT = TupleT;