From af69cf2cc4770a0b21f6addff2cca66002f37784 Mon Sep 17 00:00:00 2001 From: Jeff Kunkle Date: Thu, 5 Jan 2012 14:57:22 -0500 Subject: [PATCH] Change includedLength to capturedLength --- README.md | 4 ++-- lib/pcap-parser.js | 8 ++++---- package.json | 2 +- test/pcap-parser.js | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ef042bb..696c26b 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ event listener would look something like { timestampSeconds: 1254722767, timestampMicroseconds: 492060, - includedLength: 76, + capturedLength: 76, originalLength: 76 } @@ -69,7 +69,7 @@ the header fields and packet data. header: { timestampSeconds: 1254722767, timestampMicroseconds: 492060, - includedLength: 76, + capturedLength: 76, originalLength: 76 }, diff --git a/lib/pcap-parser.js b/lib/pcap-parser.js index a1a2a96..6c9c31e 100644 --- a/lib/pcap-parser.js +++ b/lib/pcap-parser.js @@ -62,7 +62,7 @@ function parsePacketHeader() { var header = { timestampSeconds: buffer.readUInt32LE(0, true), timestampMicroseconds: buffer.readUInt32LE(4, true), - includedLength: buffer.readUInt32LE(8, true), + capturedLength: buffer.readUInt32LE(8, true), originalLength: buffer.readUInt32LE(12, true) }; @@ -79,8 +79,8 @@ function parsePacketHeader() { function parsePacketBody() { var buffer = this.buffer; - if (buffer.length >= this.currentPacketHeader.includedLength) { - var data = buffer.slice(0, this.currentPacketHeader.includedLength); + if (buffer.length >= this.currentPacketHeader.capturedLength) { + var data = buffer.slice(0, this.currentPacketHeader.capturedLength); this.emit('packetData', data); this.emit('packet', { @@ -88,7 +88,7 @@ function parsePacketBody() { data: data }); - this.buffer = buffer.slice(this.currentPacketHeader.includedLength); + this.buffer = buffer.slice(this.currentPacketHeader.capturedLength); this.state = parsePacketHeader; return true; } diff --git a/package.json b/package.json index c99e5e2..9a28ecc 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Packet capture (PCAP) parser for node", "keywords": ["pcap", "parser"], "homepage": "https://github.com/nearinfinity/node-pcap-parser", - "version": "0.0.1", + "version": "0.0.2", "engines": { "node" : ">=0.6.0" }, "maintainers": [ { "name": "Jeff Kunkle", "email": "jeff.kunkle@nearinfinity.com" }, diff --git a/test/pcap-parser.js b/test/pcap-parser.js index aded885..dc5457e 100644 --- a/test/pcap-parser.js +++ b/test/pcap-parser.js @@ -36,7 +36,7 @@ vows.describe('pcap-parser').addBatch({ assert.isNotNull(packetHeader); assert.equal(packetHeader.timestampSeconds, 1254722767); assert.equal(packetHeader.timestampMicroseconds, 492060); - assert.equal(packetHeader.includedLength, 76); + assert.equal(packetHeader.capturedLength, 76); assert.equal(packetHeader.originalLength, 76); } }, @@ -66,7 +66,7 @@ vows.describe('pcap-parser').addBatch({ assert.equal(packet.data.length, 76); assert.equal(packet.header.timestampSeconds, 1254722767); assert.equal(packet.header.timestampMicroseconds, 492060); - assert.equal(packet.header.includedLength, 76); + assert.equal(packet.header.capturedLength, 76); assert.equal(packet.header.originalLength, 76); } },