eb89810b78b9709b89b651731cd20d5615f6b80e
[controller.git] / third-party / openflowj_netty / src / main / java / org / openflow / protocol / factory / OFVendorActionFactory.java
1 /**
2  *    Copyright 2013, Big Switch Networks, Inc.
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License"); you may
5  *    not use this file except in compliance with the License. You may obtain
6  *    a copy of the License at
7  *
8  *         http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  *    License for the specific language governing permissions and limitations
14  *    under the License.
15  **/
16
17 package org.openflow.protocol.factory;
18
19 import org.jboss.netty.buffer.ChannelBuffer;
20 import org.openflow.protocol.action.OFActionVendor;
21
22 /** Interface contract for an actionfactory that creates vendor-specific actions.
23  *  VendorActionFactories are registered with the BasicFactory for a specific
24  *  vendor id.
25  *  <p>
26  *  <b>Note:</b> Implementations are expected to be thread-safe.
27  *
28  * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
29  */
30 public interface OFVendorActionFactory {
31
32     /** parse the data from the wire, create and return a vendor-specific action.
33      *
34      * @param data contains a serialized vendor action at the current readerPosition.
35      *    The full message is guaranteed to be available in the buffer.
36      *
37      * @return upon success returns a newly allocated vendor-specific
38      *   action instance, and advances the readerPosition in data for the
39      *   entire length. Upon failure, returns null and leaves the readerPosition
40      *   in data unmodified.
41      */
42     OFActionVendor readFrom(ChannelBuffer data);
43 }