mirror of
https://github.com/amigan/aim-oscar-server.git
synced 2024-11-21 12:09:48 -05:00
asserts for FLAP, SNAC headers
This commit is contained in:
parent
f762506bf4
commit
f20f524af0
1 changed files with 3 additions and 1 deletions
|
@ -31,6 +31,7 @@ class TLV {
|
|||
|
||||
class SNAC {
|
||||
static fromBuffer(buf, payloadLength = 0) {
|
||||
assert(buf.length >= 10, 'Expected 10 bytes for SNAC header');
|
||||
const family = buf.slice(0,2).readInt16BE(0);
|
||||
const service = buf.slice(2,4).readInt16BE(0);
|
||||
const flags = buf.slice(4, 6);
|
||||
|
@ -85,7 +86,8 @@ class SNAC {
|
|||
|
||||
class FLAP {
|
||||
static fromBuffer(buf) {
|
||||
assert.equal(buf[0], 0x2a, 'Expected 0x2a FLAP header');
|
||||
assert.equal(buf[0], 0x2a, 'Expected 0x2a at start of FLAP header');
|
||||
assert(buf.length >= 6, 'Expected at least 6 bytes for FLAP header');
|
||||
const channel = buf.readInt8(1);
|
||||
const sequenceNumber = buf.slice(2,4).readInt16BE(0);
|
||||
const payloadLength = buf.slice(4, 6).readInt16BE(0);
|
||||
|
|
Loading…
Reference in a new issue