UNPKG

mediasoup

Version:

Cutting Edge WebRTC Video Conferencing

72 lines (71 loc) 2.31 kB
"use strict"; // automatically generated by the FlatBuffers compiler, do not modify Object.defineProperty(exports, "__esModule", { value: true }); exports.IpPortT = exports.IpPort = void 0; /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ const flatbuffers = require("flatbuffers"); class IpPort { bb = null; bb_pos = 0; __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsIpPort(bb, obj) { return (obj || new IpPort()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsIpPort(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new IpPort()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } ip(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } port() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readUint16(this.bb_pos + offset) : 0; } static startIpPort(builder) { builder.startObject(2); } static addIp(builder, ipOffset) { builder.addFieldOffset(0, ipOffset, 0); } static addPort(builder, port) { builder.addFieldInt16(1, port, 0); } static endIpPort(builder) { const offset = builder.endObject(); builder.requiredField(offset, 4); // ip return offset; } static createIpPort(builder, ipOffset, port) { IpPort.startIpPort(builder); IpPort.addIp(builder, ipOffset); IpPort.addPort(builder, port); return IpPort.endIpPort(builder); } unpack() { return new IpPortT(this.ip(), this.port()); } unpackTo(_o) { _o.ip = this.ip(); _o.port = this.port(); } } exports.IpPort = IpPort; class IpPortT { ip; port; constructor(ip = null, port = 0) { this.ip = ip; this.port = port; } pack(builder) { const ip = (this.ip !== null ? builder.createString(this.ip) : 0); return IpPort.createIpPort(builder, ip, this.port); } } exports.IpPortT = IpPortT;