use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags in project bgpcep by opendaylight.
the class FSTcpFlagsHandler method serializeTcpFlags.
private static void serializeTcpFlags(final List<TcpFlags> flags, final ByteBuf nlriByteBuf) {
for (final Iterator<TcpFlags> it = flags.iterator(); it.hasNext(); ) {
final TcpFlags flag = it.next();
final ByteBuf flagsBuf = Unpooled.buffer();
Util.writeShortest(flag.getValue(), flagsBuf);
BitmaskOperandParser.INSTANCE.serialize(flag.getOp(), flagsBuf.readableBytes(), !it.hasNext(), nlriByteBuf);
nlriByteBuf.writeBytes(flagsBuf);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags in project bgpcep by opendaylight.
the class FSTcpFlagsHandler method parseTcpFlags.
private static List<TcpFlags> parseTcpFlags(final ByteBuf nlri) {
final List<TcpFlags> flags = new ArrayList<>();
boolean end = false;
// we can do this as all fields will be rewritten in the cycle
final TcpFlagsBuilder builder = new TcpFlagsBuilder();
while (!end) {
final byte b = nlri.readByte();
final BitmaskOperand op = BitmaskOperandParser.INSTANCE.parse(b);
builder.setOp(op);
final short length = AbstractOperandParser.parseLength(b);
builder.setValue(ByteArray.bytesToInt(ByteArray.readBytes(nlri, length)));
end = op.isEndOfList();
flags.add(builder.build());
}
return flags;
}
Aggregations