List of usage examples for io.netty.buffer ByteBuf writeLong
public abstract ByteBuf writeLong(long value);
From source file:org.opendaylight.openflowjava.nx.codec.action.LearnCodecUtil.java
License:Open Source License
static void serializeLearnHeader(final ByteBuf outBuffer, ActionLearn action) { outBuffer.writeShort(action.getNxActionLearn().getIdleTimeout().shortValue()); outBuffer.writeShort(action.getNxActionLearn().getHardTimeout().shortValue()); outBuffer.writeShort(action.getNxActionLearn().getPriority().shortValue()); outBuffer.writeLong(action.getNxActionLearn().getCookie().longValue()); outBuffer.writeShort(action.getNxActionLearn().getFlags().shortValue()); outBuffer.writeByte(action.getNxActionLearn().getTableId().byteValue()); outBuffer.writeZero(1);/*w ww .j a va2 s . com*/ outBuffer.writeShort(action.getNxActionLearn().getFinIdleTimeout().shortValue()); outBuffer.writeShort(action.getNxActionLearn().getFinHardTimeout().shortValue()); }
From source file:org.opendaylight.openflowjava.nx.codec.action.RegLoadCodec.java
License:Open Source License
@Override public void serialize(final Action input, final ByteBuf outBuffer) { ActionRegLoad actionRegLoad = ((ActionRegLoad) input.getActionChoice()); serializeHeader(LENGTH, SUBTYPE, outBuffer); outBuffer.writeShort(actionRegLoad.getNxActionRegLoad().getOfsNbits()); outBuffer.writeInt(actionRegLoad.getNxActionRegLoad().getDst().intValue()); outBuffer.writeLong(actionRegLoad.getNxActionRegLoad().getValue().longValue()); }
From source file:org.opendaylight.openflowjava.nx.codec.action.RegLoadCodecTest.java
License:Open Source License
private void createBuffer(ByteBuf message) { message.writeShort(EncodeConstants.EXPERIMENTER_VALUE); message.writeShort(LENGTH);// w w w .j ava2s. c om message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue()); message.writeShort(SUBTYPE); message.writeShort(1); message.writeInt(2); message.writeLong(3); }
From source file:org.opendaylight.openflowjava.nx.codec.match.TunIdCodec.java
License:Open Source License
@Override public void serialize(MatchEntry input, ByteBuf outBuffer) { serializeHeader(input, outBuffer);//www. java2 s . c o m BigInteger value = ((TunIdCaseValue) input.getMatchEntryValue()).getTunIdValues().getValue(); outBuffer.writeLong(value.longValue()); }
From source file:org.opendaylight.openflowjava.nx.codec.match.TunIdCodecTest.java
License:Open Source License
private void createBuffer(ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = (NXM_FIELD_CODE << 1); message.writeByte(fieldMask);/*ww w .jav a2 s . c o m*/ message.writeByte(VALUE_LENGTH); byte[] value = new byte[VALUE_LENGTH]; message.writeLong(new BigInteger(value).longValue()); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.factories.FlowModInputMessageFactory.java
License:Open Source License
@Override public void messageToBuffer(short version, ByteBuf out, FlowModInput message) { ByteBufUtils.writeOFHeader(instance, message, out); out.writeLong(message.getCookie().longValue()); out.writeLong(message.getCookieMask().longValue()); out.writeByte(message.getTableId().getValue().byteValue()); out.writeByte(message.getCommand().getIntValue()); out.writeShort(message.getIdleTimeout().intValue()); out.writeShort(message.getHardTimeout().intValue()); out.writeShort(message.getPriority()); out.writeInt(message.getBufferId().intValue()); out.writeInt(message.getOutPort().getValue().intValue()); out.writeInt(message.getOutGroup().intValue()); out.writeShort(createFlowModFlagsBitmask(message.getFlags())); ByteBufUtils.padBuffer(PADDING_IN_FLOW_MOD_MESSAGE, out); MatchSerializer.encodeMatch(message.getMatch(), out); InstructionsSerializer.encodeInstructions(message.getInstruction(), out); }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactory.java
License:Open Source License
private void serializeMeterBody(final MultipartReplyBody body, final ByteBuf outBuffer) { MultipartReplyMeterCase meterCase = (MultipartReplyMeterCase) body; MultipartReplyMeter meter = meterCase.getMultipartReplyMeter(); for (MeterStats meterStats : meter.getMeterStats()) { ByteBuf meterStatsBuff = UnpooledByteBufAllocator.DEFAULT.buffer(); meterStatsBuff.writeInt(meterStats.getMeterId().getValue().intValue()); meterStatsBuff.writeInt(EncodeConstants.EMPTY_LENGTH); meterStatsBuff.writeZero(METER_PADDING); meterStatsBuff.writeInt(meterStats.getFlowCount().intValue()); meterStatsBuff.writeLong(meterStats.getPacketInCount().longValue()); meterStatsBuff.writeLong(meterStats.getByteInCount().longValue()); meterStatsBuff.writeInt(meterStats.getDurationSec().intValue()); meterStatsBuff.writeInt(meterStats.getDurationNsec().intValue()); for (MeterBandStats meterBandStats : meterStats.getMeterBandStats()) { meterStatsBuff.writeLong(meterBandStats.getPacketBandCount().longValue()); meterStatsBuff.writeLong(meterBandStats.getByteBandCount().longValue()); }//from w ww. j a va 2 s. c o m meterStatsBuff.setInt(METER_LENGTH_INDEX, meterStatsBuff.readableBytes()); outBuffer.writeBytes(meterStatsBuff); } }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactory.java
License:Open Source License
private void serializeGroupBody(final MultipartReplyBody body, final ByteBuf outBuffer) { MultipartReplyGroupCase groupCase = (MultipartReplyGroupCase) body; MultipartReplyGroup group = groupCase.getMultipartReplyGroup(); for (GroupStats groupStats : group.getGroupStats()) { ByteBuf groupStatsBuff = UnpooledByteBufAllocator.DEFAULT.buffer(); groupStatsBuff.writeShort(EncodeConstants.EMPTY_LENGTH); groupStatsBuff.writeZero(GROUP_STATS_PADDING_1); groupStatsBuff.writeInt(groupStats.getGroupId().getValue().intValue()); groupStatsBuff.writeInt(groupStats.getRefCount().intValue()); groupStatsBuff.writeZero(GROUP_STATS_PADDING_2); groupStatsBuff.writeLong(groupStats.getPacketCount().longValue()); groupStatsBuff.writeLong(groupStats.getByteCount().longValue()); groupStatsBuff.writeInt(groupStats.getDurationSec().intValue()); groupStatsBuff.writeInt(groupStats.getDurationNsec().intValue()); for (BucketStats bucketStats : groupStats.getBucketStats()) { groupStatsBuff.writeLong(bucketStats.getPacketCount().longValue()); groupStatsBuff.writeLong(bucketStats.getByteCount().longValue()); }//from w w w .j a v a 2s .c o m groupStatsBuff.setShort(GROUP_STATS_LENGTH_INDEX, groupStatsBuff.readableBytes()); outBuffer.writeBytes(groupStatsBuff); } }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactory.java
License:Open Source License
private void serializeQueueBody(final MultipartReplyBody body, final ByteBuf outBuffer) { MultipartReplyQueueCase queueCase = (MultipartReplyQueueCase) body; MultipartReplyQueue queue = queueCase.getMultipartReplyQueue(); for (QueueStats queueStats : queue.getQueueStats()) { outBuffer.writeInt(queueStats.getPortNo().intValue()); outBuffer.writeInt(queueStats.getQueueId().intValue()); outBuffer.writeLong(queueStats.getTxBytes().longValue()); outBuffer.writeLong(queueStats.getTxPackets().longValue()); outBuffer.writeLong(queueStats.getTxErrors().longValue()); outBuffer.writeInt(queueStats.getDurationSec().intValue()); outBuffer.writeInt(queueStats.getDurationNsec().intValue()); }/*from w w w.j ava 2s. co m*/ }
From source file:org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactory.java
License:Open Source License
private void serializePortStatsBody(final MultipartReplyBody body, final ByteBuf outBuffer) { MultipartReplyPortStatsCase portStatsCase = (MultipartReplyPortStatsCase) body; MultipartReplyPortStats portStats = portStatsCase.getMultipartReplyPortStats(); for (PortStats portStat : portStats.getPortStats()) { outBuffer.writeInt(portStat.getPortNo().intValue()); outBuffer.writeZero(PORT_STATS_PADDING); outBuffer.writeLong(portStat.getRxPackets().longValue()); outBuffer.writeLong(portStat.getTxPackets().longValue()); outBuffer.writeLong(portStat.getRxBytes().longValue()); outBuffer.writeLong(portStat.getTxBytes().longValue()); outBuffer.writeLong(portStat.getRxDropped().longValue()); outBuffer.writeLong(portStat.getTxDropped().longValue()); outBuffer.writeLong(portStat.getRxErrors().longValue()); outBuffer.writeLong(portStat.getTxErrors().longValue()); outBuffer.writeLong(portStat.getRxFrameErr().longValue()); outBuffer.writeLong(portStat.getRxOverErr().longValue()); outBuffer.writeLong(portStat.getRxCrcErr().longValue()); outBuffer.writeLong(portStat.getCollisions().longValue()); outBuffer.writeInt(portStat.getDurationSec().intValue()); outBuffer.writeInt(portStat.getDurationNsec().intValue()); }//from w w w. ja v a2 s .c o m }