Copyright update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / OF10PacketOutInputMessageFactory.java
index d397f8a97621e08463f6631a7d9fd0d3523ad543..cf35ffff682e02126eb9e50489b97bbb0f8a5774 100644 (file)
@@ -1,65 +1,72 @@
-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.impl.util.OF10ActionsSerializer;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;\r
-\r
-/**\r
- * Translates PacketOut messages\r
- * @author michal.polkorab\r
- */\r
-public class OF10PacketOutInputMessageFactory implements OFSerializer<PacketOutInput> {\r
-\r
-    private static final byte MESSAGE_TYPE = 13;\r
-    private static final int MESSAGE_LENGTH = 16;\r
-    \r
-    private static OF10PacketOutInputMessageFactory instance;\r
-    \r
-    private OF10PacketOutInputMessageFactory() {\r
-        // do nothing, just singleton\r
-    }\r
-    \r
-    /**\r
-     * @return singleton factory\r
-     */\r
-    public static synchronized OF10PacketOutInputMessageFactory getInstance() {\r
-        if (instance == null) {\r
-            instance = new OF10PacketOutInputMessageFactory();\r
-        }\r
-        return instance;\r
-    }\r
-    \r
-    @Override\r
-    public void messageToBuffer(short version, ByteBuf out,\r
-            PacketOutInput message) {\r
-        ByteBufUtils.writeOFHeader(instance, message, out);\r
-        out.writeInt(message.getBufferId().intValue());\r
-        out.writeShort(message.getInPort().getValue().intValue());\r
-        out.writeShort(OF10ActionsSerializer.computeActionsLength(message.getActionsList()));\r
-        OF10ActionsSerializer.encodeActionsV10(out, message.getActionsList());\r
-        byte[] data = message.getData();\r
-        if (data != null) {\r
-            out.writeBytes(data);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public int computeLength(PacketOutInput message) {\r
-        int length = MESSAGE_LENGTH + OF10ActionsSerializer.computeActionsLength(message.getActionsList());\r
-        byte[] data = message.getData();\r
-        if (data != null) {\r
-            length += data.length;\r
-        }\r
-        return length;\r
-    }\r
-\r
-    @Override\r
-    public byte getMessageType() {\r
-        return MESSAGE_TYPE;\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;
+import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.impl.util.OF10ActionsSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
+
+/**
+ * Translates PacketOut messages
+ * @author michal.polkorab
+ */
+public class OF10PacketOutInputMessageFactory implements OFSerializer<PacketOutInput> {
+
+    private static final byte MESSAGE_TYPE = 13;
+    private static final int MESSAGE_LENGTH = 16;
+    
+    private static OF10PacketOutInputMessageFactory instance;
+    
+    private OF10PacketOutInputMessageFactory() {
+        // do nothing, just singleton
+    }
+    
+    /**
+     * @return singleton factory
+     */
+    public static synchronized OF10PacketOutInputMessageFactory getInstance() {
+        if (instance == null) {
+            instance = new OF10PacketOutInputMessageFactory();
+        }
+        return instance;
+    }
+    
+    @Override
+    public void messageToBuffer(short version, ByteBuf out,
+            PacketOutInput message) {
+        ByteBufUtils.writeOFHeader(instance, message, out);
+        out.writeInt(message.getBufferId().intValue());
+        out.writeShort(message.getInPort().getValue().intValue());
+        out.writeShort(OF10ActionsSerializer.computeActionsLength(message.getActionsList()));
+        OF10ActionsSerializer.encodeActionsV10(out, message.getActionsList());
+        byte[] data = message.getData();
+        if (data != null) {
+            out.writeBytes(data);
+        }
+    }
+
+    @Override
+    public int computeLength(PacketOutInput message) {
+        int length = MESSAGE_LENGTH + OF10ActionsSerializer.computeActionsLength(message.getActionsList());
+        byte[] data = message.getData();
+        if (data != null) {
+            length += data.length;
+        }
+        return length;
+    }
+
+    @Override
+    public byte getMessageType() {
+        return MESSAGE_TYPE;
+    }
+
+}