6lowpan 中文文档教程

发布于 9年前 浏览 25 项目主页 更新于 3年前

6lowpan

用于解析、创建和测试 6lowpan 帧的 nodejs 模块。 版本 0.0.4 alpha

Installation

通过 npm:

npm install 6lowpan

Features

  • Initial iphc parse, iphc header and inline header

Examples

Example 1

var frameBuffer = new Buffer('60ffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'hex');

var sixlo = require('6lowpan');


    sixlo.parse(frameBuffer, function(data, error){
        console.log(data.pattern); // LOWPAN_IPHC
        console.log(data.iphc); // the iphc header 
        console.log(data.inline); // inline Header
        console.log(data.payload); // the payload remaining
    });

Example 2

var frameBuffer = new Buffer('60ffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'hex');

var sixlo = require('6lowpan');

var parse = new sixlo.iphc(frameBuffer);
var type = parse.type();
console.log('Pattern: ' + type);
console.log(type === 'LOWPAN_IPHC'); //true
console.log(type === 'IPv6' ); // false
console.log(type === 'LOWPAN_HC1' ); // false
console.log(type === 'LOWPAN_BC0' ); // false
console.log(type === 'ESC' ); // false
console.log(type === 'MESH' ); // false
console.log(type === 'FRAG1' ); // false
console.log(type === 'FRAGN' ); // false
console.log(parse.iphc());
console.log(parse.inlineHeader());
console.log(parse.payload());

TODOs

  • Add Extension Headers
  • Add more documentation
  • Add IPv6 - Uncompressed IPv6 Addresses
  • Add LOWPANHC1 - LOWPANHC1 compressed IPv6
  • Add LOWPANBC0 - LOWPANBC0 broadcast
  • Add MESH - Mesh Header
  • Add FRAG1 - Fragmentation Header (first)
  • Add FRAGN - Fragmentation Header (subsequent)
  • Add descriptions for each field of the iphc header.
  • Validator of 6lowpan frame.
  • Desfragmentation
  • Functionality to create a 6lowpan frame from user data (json config)

History

0.0.4 Initial Commit

  • Initial Commit
  • nitial iphc parse, iphc header and inline header.

0.0.5 Updates

  • Object functionality.
  • Update example 2.

6lowpan

A nodejs module to parse, create and test 6lowpan frames. Version 0.0.4 alpha

Installation

Via npm:

npm install 6lowpan

Features

  • Initial iphc parse, iphc header and inline header

Examples

Example 1

var frameBuffer = new Buffer('60ffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'hex');

var sixlo = require('6lowpan');


    sixlo.parse(frameBuffer, function(data, error){
        console.log(data.pattern); // LOWPAN_IPHC
        console.log(data.iphc); // the iphc header 
        console.log(data.inline); // inline Header
        console.log(data.payload); // the payload remaining
    });

Example 2

var frameBuffer = new Buffer('60ffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'hex');

var sixlo = require('6lowpan');

var parse = new sixlo.iphc(frameBuffer);
var type = parse.type();
console.log('Pattern: ' + type);
console.log(type === 'LOWPAN_IPHC'); //true
console.log(type === 'IPv6' ); // false
console.log(type === 'LOWPAN_HC1' ); // false
console.log(type === 'LOWPAN_BC0' ); // false
console.log(type === 'ESC' ); // false
console.log(type === 'MESH' ); // false
console.log(type === 'FRAG1' ); // false
console.log(type === 'FRAGN' ); // false
console.log(parse.iphc());
console.log(parse.inlineHeader());
console.log(parse.payload());

TODOs

  • Add Extension Headers
  • Add more documentation
  • Add IPv6 - Uncompressed IPv6 Addresses
  • Add LOWPANHC1 - LOWPANHC1 compressed IPv6
  • Add LOWPANBC0 - LOWPANBC0 broadcast
  • Add MESH - Mesh Header
  • Add FRAG1 - Fragmentation Header (first)
  • Add FRAGN - Fragmentation Header (subsequent)
  • Add descriptions for each field of the iphc header.
  • Validator of 6lowpan frame.
  • Desfragmentation
  • Functionality to create a 6lowpan frame from user data (json config)

History

0.0.4 Initial Commit

  • Initial Commit
  • nitial iphc parse, iphc header and inline header.

0.0.5 Updates

  • Object functionality.
  • Update example 2.
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文