6ce7dd3bd36a105af4ae977a0b7bf45293f9817a
[openflowjava.git] / third-party / openflow-codec / src / main / java / org / openflow / codec / protocol / factory / OFPInstructionFactory.java
1 package org.openflow.codec.protocol.factory;
2
3 import java.util.List;
4
5 import org.openflow.codec.io.IDataBuffer;
6 import org.openflow.codec.protocol.instruction.OFPInstruction;
7 import org.openflow.codec.protocol.instruction.OFPInstructionType;
8
9 /**
10  * The interface to factories used for retrieving OFPInstruction instances. All
11  * methods are expected to be thread-safe.
12  *
13  * @author AnilGujele
14  */
15 public interface OFPInstructionFactory {
16     /**
17      * Retrieves an OFPInstruction instance corresponding to the specified
18      * OFPInstructionType
19      *
20      * @param t
21      *            the type of the OFPInstruction to be retrieved
22      * @return an OFPInstruction instance
23      */
24     public OFPInstruction getInstruction(OFPInstructionType t);
25
26     /**
27      * Attempts to parse and return all OFInstructions contained in the given
28      * DataBuffer, beginning at the DataBuffer's position, and ending at
29      * position+length.
30      *
31      * @param data
32      *            the DataBuffer to parse for OpenFlow Instructions
33      * @param length
34      *            the number of Bytes to examine for OpenFlow Instructions
35      * @return a list of OFPInstruction instances
36      */
37     public List<OFPInstruction> parseInstructions(IDataBuffer data, int length);
38
39     /**
40      * Attempts to parse and return number of specified OFInstructions contained
41      * in the given DataBuffer, beginning at the DataBuffer's position, and
42      * ending at position+length.
43      *
44      * @param data
45      *            the DataBuffer to parse for OpenFlow Instructions
46      * @param length
47      *            the number of Bytes to examine for OpenFlow Instructions
48      * @param limit
49      *            the maximum number of messages to return, 0 means no limit
50      * @return a list of OFPInstruction instances
51      */
52     public List<OFPInstruction> parseInstructions(IDataBuffer data, int length, int limit);
53 }