Update OF header lenght
[openflowjava.git] / openflowjava-util / src / main / java / org / opendaylight / openflowjava / util / ByteBufUtils.java
index 6be2ee39ea80736c287e0b7bba9fa4dec1a81673..5d6869cfb961e072dab713fdd05d7f971f7d12d3 100644 (file)
@@ -136,6 +136,15 @@ public abstract class ByteBufUtils {
         out.setShort(EncodeConstants.OFHEADER_LENGTH_INDEX, out.readableBytes());
     }
 
+    /**
+     * Write length OF header
+     * @param out writing buffer
+     * @param index writing index
+     */
+    public static void updateOFHeaderLength(final ByteBuf out, int index) {
+        out.setShort(index + EncodeConstants.OFHEADER_LENGTH_INDEX, out.writerIndex() - index);
+    }
+
     /**
      * Fills the bitmask from boolean map where key is bit position
      * @param booleanMap bit to boolean mapping