3855c2bb7b8e38c1ff3d6469003ce89f2a80c14e
[openflowjava.git] / third-party / openflow-codec / src / main / java / org / openflow / codec / protocol / factory / OFPMessageFactory.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.OFPMessage;
7 import org.openflow.codec.protocol.OFPType;
8
9 /**
10  * The interface to factories used for retrieving OFPMessage instances. All
11  * methods are expected to be thread-safe.
12  *
13  * @author David Erickson (daviderickson@cs.stanford.edu)
14  */
15 public interface OFPMessageFactory {
16     /**
17      * Retrieves an OFPMessage instance corresponding to the specified OFPType
18      *
19      * @param t
20      *            the type of the OFPMessage to be retrieved
21      * @return an OFPMessage instance
22      */
23     public OFPMessage getMessage(OFPType t);
24
25     /**
26      * Attempts to parse and return all OFMessages contained in the given
27      * DataBuffer, beginning at the DataBuffer's position, and ending at the
28      * DataBuffer's limit.
29      *
30      * @param data
31      *            the DataBuffer to parse for an OpenFlow message
32      * @return a list of OFPMessage instances
33      */
34     public List<OFPMessage> parseMessages(IDataBuffer data);
35
36     /**
37      * Attempts to parse and return all OFMessages contained in the given
38      * DataBuffer, beginning at the DataBuffer's position, and ending at the
39      * DataBuffer's limit.
40      *
41      * @param data
42      *            the DataBuffer to parse for an OpenFlow message
43      * @param limit
44      *            the maximum number of messages to return, 0 means no limit
45      * @return a list of OFPMessage instances
46      */
47     public List<OFPMessage> parseMessages(IDataBuffer data, int limit);
48
49     /**
50      * Retrieves an OFPActionFactory
51      *
52      * @return an OFPActionFactory
53      */
54     public OFPActionFactory getActionFactory();
55 }