Added openflow-codec and openflowj_netty from openflowplugin
[openflowjava.git] / third-party / openflowj_netty / src / main / java / org / openflow / vendor / openflow / OFOpenFlowVendorExtensions.java
1 /**
2 *    Copyright 2012, Andrew Ferguson, Brown University
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.vendor.openflow;
18
19 import org.openflow.protocol.vendor.OFBasicVendorDataType;
20 import org.openflow.protocol.vendor.OFBasicVendorId;
21 import org.openflow.protocol.vendor.OFVendorId;
22
23 public class OFOpenFlowVendorExtensions {
24     private static boolean initialized = false;
25
26     public static synchronized void initialize() {
27         if (initialized)
28             return;
29
30         // Configure openflowj to be able to parse the OpenFlow extensions.
31         OFBasicVendorId openflowVendorId =
32                 new OFBasicVendorId(OFOpenFlowVendorData.OF_VENDOR_ID, 4);
33         OFVendorId.registerVendorId(openflowVendorId);
34
35         OFBasicVendorDataType queueModifyVendorData =
36                 new OFBasicVendorDataType(OFQueueModifyVendorData.OFP_EXT_QUEUE_MODIFY,
37                         OFQueueModifyVendorData.getInstantiable());
38         openflowVendorId.registerVendorDataType(queueModifyVendorData);
39
40         OFBasicVendorDataType queueDeleteVendorData =
41                 new OFBasicVendorDataType(OFQueueDeleteVendorData.OFP_EXT_QUEUE_DELETE,
42                         OFQueueModifyVendorData.getInstantiable());
43         openflowVendorId.registerVendorDataType(queueDeleteVendorData);
44
45         initialized = true;
46     }
47 }