32eb3cbffa5fb1765439108c4691279981743240
[controller.git] / third-party / openflowj_netty / src / main / java / org / openflow / protocol / factory / OFStatisticsFactory.java
1 /**
2 *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
3 *    University
4
5 *    Licensed under the Apache License, Version 2.0 (the "License"); you may
6 *    not use this file except in compliance with the License. You may obtain
7 *    a copy of the License at
8 *
9 *         http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *    Unless required by applicable law or agreed to in writing, software
12 *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 *    License for the specific language governing permissions and limitations
15 *    under the License.
16 **/
17
18 package org.openflow.protocol.factory;
19
20 import java.util.List;
21
22 import org.jboss.netty.buffer.ChannelBuffer;
23 import org.openflow.protocol.OFType;
24 import org.openflow.protocol.statistics.OFStatistics;
25 import org.openflow.protocol.statistics.OFStatisticsType;
26
27
28 /**
29  * The interface to factories used for retrieving OFStatistics instances. All
30  * methods are expected to be thread-safe.
31  * @author David Erickson (daviderickson@cs.stanford.edu)
32  */
33 public interface OFStatisticsFactory {
34     /**
35      * Retrieves an OFStatistics instance corresponding to the specified
36      * OFStatisticsType
37      * @param t the type of the containing OFMessage, only accepts statistics
38      *           request or reply
39      * @param st the type of the OFStatistics to be retrieved
40      * @return an OFStatistics instance
41      */
42     public OFStatistics getStatistics(OFType t, OFStatisticsType st);
43
44     /**
45      * Attempts to parse and return all OFStatistics contained in the given
46      * ByteBuffer, beginning at the ByteBuffer's position, and ending at
47      * position+length.
48      * @param t the type of the containing OFMessage, only accepts statistics
49      *           request or reply
50      * @param st the type of the OFStatistics to be retrieved
51      * @param data the ChannelBuffer to parse for OpenFlow Statistics
52      * @param length the number of Bytes to examine for OpenFlow Statistics
53      * @return a list of OFStatistics instances
54      */
55     public List<OFStatistics> parseStatistics(OFType t,
56             OFStatisticsType st, ChannelBuffer data, int length);
57
58     /**
59      * Attempts to parse and return all OFStatistics contained in the given
60      * ByteBuffer, beginning at the ByteBuffer's position, and ending at
61      * position+length.
62      * @param t the type of the containing OFMessage, only accepts statistics
63      *           request or reply
64      * @param st the type of the OFStatistics to be retrieved
65      * @param data the ChannelBuffer to parse for OpenFlow Statistics
66      * @param length the number of Bytes to examine for OpenFlow Statistics
67      * @param limit the maximum number of messages to return, 0 means no limit
68      * @return a list of OFStatistics instances
69      */
70     public List<OFStatistics> parseStatistics(OFType t,
71             OFStatisticsType st, ChannelBuffer data, int length, int limit);
72 }