コード例 #1
0
ファイル: action.js プロジェクト: flowgrammable/ofpmsg-js
 it('to view', function(){
   var oa = a3.Output(uint.mk(4, 0xffffffff), uint.mk(2, 0xffff));
   expect(oa.bytes().value()).to.equal(16);
   expect(oa.header.length.value()).to.equal(16);
   var buf = new Buffer(oa.bytes().value());
   var v = new view.View(buf);
   oa.toView(v);
 });
コード例 #2
0
ファイル: header.js プロジェクト: flowgrammable/ofpmsg-js
function Header(args) {
  if(args) {
    this.version = _(args.version).isFinite() ? args.version : null;
    this.type    = _(args.type).isFinite() ? args.type : null;
    this.length  = args.length  || bytes();
    this.xid     = args.xid     || uint.mk(4, Math.floor((Math.random() * 0xffffffff) + 1));
  } else {
    this.version = null;
    this.type    = null;
    this.length  = bytes();
    this.xid     = uint.mk(4, Math.floor((Math.random() * 0xffffffff) + 1));
  }
}
コード例 #3
0
ファイル: ipv4.js プロジェクト: flowgrammable/ofpmsg-js
function Address(address) {
  if(address){
  } else {
    this._value = uint.mk(4, 0); //new uint.UInt({ bytes: 4 });
  }
}
コード例 #4
0
ファイル: action.js プロジェクト: flowgrammable/ofpmsg-js
 it('from view', function(){
   var buf2 = new Buffer(8);
   var v2 = new view.View(buf2);
   var o = a.Output({ port: uint.mk(2, 1), max_len: uint.mk(2, 1) });
   o.toView(v2);
 });