blob: 1f0e14b2dd4b6dac9f5dadc5d5c9e6a0b4a1a4a5 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
2* Copyright 2011, Big Switch Networks, Inc.
3* Originally created by David Erickson & Rob Sherwood, Stanford 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
18package org.openflow.protocol.vendor;
19
20import org.openflow.protocol.Instantiable;
21
22/**
23 * Subclass of OFVendorDataType that works with any vendor data format that
24 * begins with a integral value to indicate the format of the remaining data.
25 * It maps from the per-vendor-id integral data type code to the object
26 * used to instantiate the class associated with that vendor data type.
27 *
28 * @author Rob Vaterlaus (rob.vaterlaus@bigswitch.com)
29 */
30public class OFBasicVendorDataType extends OFVendorDataType {
31
32 /**
33 * The data type value at the beginning of the vendor data.
34 */
35 protected long type;
36
37 /**
38 * Construct an empty (i.e. no specified data type value) vendor data type.
39 */
40 public OFBasicVendorDataType() {
41 super();
42 this.type = 0;
43 }
44
45 /**
46 * Store some information about the vendor data type, including wire protocol
47 * type number, derived class and instantiator.
48 *
49 * @param type Wire protocol number associated with this vendor data type
50 * @param instantiator An Instantiator<OFVendorData> implementation that
51 * creates an instance of an appropriate subclass of OFVendorData.
52 */
53 public OFBasicVendorDataType(long type, Instantiable<OFVendorData> instantiator) {
54 super(instantiator);
55 this.type = type;
56 }
57
58 /**
59 * @return Returns the wire protocol value corresponding to this OFVendorDataType
60 */
61 public long getTypeValue() {
62 return this.type;
63 }
64
65 /**
66 * @param type the wire protocol value for this data type
67 */
68 public void setTypeValue(long type) {
69 this.type = type;
70 }
71}