Example usage for io.netty.buffer Unpooled buffer

List of usage examples for io.netty.buffer Unpooled buffer

Introduction

In this page you can find the example usage for io.netty.buffer Unpooled buffer.

Prototype

public static ByteBuf buffer() 

Source Link

Document

Creates a new big-endian Java heap buffer with reasonably small initial capacity, which expands its capacity boundlessly on demand.

Usage

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf WtpBoardDataTester() {

    ODLCapwapMessage msg = null;/*from w w  w  .java2  s  . c o m*/
    DiscoveryType discoveryType = null;
    ACDescriptor acDescriptor = null;

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    //create a Board data Dec
    WtpBoardDataMsgElem e = new WtpBoardDataMsgElem();
    e.setVendorId(12);
    BoardDataSubElem se = new BoardDataSubElem(12, 64);
    e.addBoardData(se);

    msg.ctrlMsg.addMessageElement(e);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);
    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf DeleteMacAclEntryTester() {

    ODLCapwapMessage msg = null;//from  www . ja v a  2  s.c om
    DiscoveryType discoveryType = null;
    ACDescriptor acDescriptor = null;

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    DeleteMacAclEntry e = new DeleteMacAclEntry();
    e.setMacAddrLength((short) 6);
    MacAddress mac = new MacAddress((short) 6);
    e.addMacAddress(mac);

    msg.ctrlMsg.addMessageElement(e);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf DeleteStationTester() {

    ODLCapwapMessage msg = null;/*from ww  w. j  av a  2  s.com*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    MacAddress mac = new MacAddress((short) 8);
    mac.address[0] = 12;
    mac.address[1] = 15;
    mac.address[2] = 12;
    mac.address[3] = 17;
    mac.address[4] = 12;
    mac.address[7] = 12;
    DeleteStation e = new DeleteStation((short) 12, mac);

    msg.ctrlMsg.addMessageElement(e);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf DecryptionErrorReportTester() {

    ODLCapwapMessage msg = null;/*from   w  w w.j a v a2s  .com*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    MacAddress mac = new MacAddress((short) 8);
    mac.address[0] = 12;
    mac.address[1] = 15;
    mac.address[2] = 12;
    mac.address[3] = 17;
    mac.address[4] = 12;
    mac.address[7] = 12;
    DecryptionErrorReport e = new DecryptionErrorReport();
    e.setRadioId((short) 1);
    e.addMacAddress(mac);

    msg.ctrlMsg.addMessageElement(e);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf ControlIPV4Tester() {

    ODLCapwapMessage msg = null;/*from   ww w  .  j a  v  a2 s  .c  o  m*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    IPV4Address ipv4 = new IPV4Address();
    byte[] address = new byte[] { 1, 2, 3, 4 };
    ipv4.setAddress(address);

    CapwapControlIPV4Addr ctrl = new CapwapControlIPV4Addr();
    ctrl.setIpv4(ipv4);
    ctrl.setWtpCount(23333);

    msg.ctrlMsg.addMessageElement(ctrl);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf LocalIPV4Tester() {

    ODLCapwapMessage msg = null;/*from ww  w  .  j  a v  a 2 s  .  co m*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    IPV4Address ipv4 = new IPV4Address();
    byte[] address = new byte[] { 1, 2, 3, 4 };
    ipv4.setAddress(address);

    CapwapLocalIPV4Address ctrl = new CapwapLocalIPV4Address();
    ctrl.setAddress(address);

    msg.ctrlMsg.addMessageElement(ctrl);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf LocalIPV6Tester() {

    ODLCapwapMessage msg = null;/* w w w . j av  a2s  . c o m*/

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    IPV6Address ipv6 = new IPV6Address();
    byte[] address = new byte[] { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
    ipv6.setAddress(address);

    CapwapLocalIPV6Address ctrl = new CapwapLocalIPV6Address();
    ctrl.setAddress(address);

    msg.ctrlMsg.addMessageElement(ctrl);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf CapwapTimerTester() {

    ODLCapwapMessage msg = null;//from w w  w  . j ava 2  s .com

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    CapwapTimers timers = new CapwapTimers();
    timers.setDiscovery((short) 255).setEchoReq((short) 0);
    msg.ctrlMsg.addMessageElement(timers);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf DataTransferDataTester() {

    ODLCapwapMessage msg = null;//from   ww  w .  j a  va  2s  . c  o m

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    DataTransferData data = new DataTransferData();
    data.setDataMode((short) 2).setDataType((short) 5);
    byte[] dummy = new byte[128];
    data.setData(dummy);
    msg.ctrlMsg.addMessageElement(data);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}

From source file:DescriptorTester.java

License:Open Source License

public ByteBuf DataTransferModeTester() {

    ODLCapwapMessage msg = null;//from w  w  w  . j a v a2  s  .  c  o m

    ByteBuf buf = Unpooled.buffer();
    msg = new ODLCapwapMessage();

    DataTransferMode mode = new DataTransferMode();
    mode.setMode((byte) 2);
    msg.ctrlMsg.addMessageElement(mode);

    msg.ctrlMsg.setMsgType(ODLCapwapConsts.ODL_CAPWAP_DISCOVERY_REQUEST);
    msg.ctrlMsg.setSeqNo((short) 1);

    msg.header.encodeHeader(buf);
    msg.ctrlMsg.encode(buf);
    return buf;
}