blob: e094760958c3630de371e9380959a7d9b9e97172 [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2// Copyright (c) 2011, 2012 Open Networking Foundation
3// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4// This library was generated by the LoxiGen Compiler.
5// See the file LICENSE.txt which should have been included in the source distribution
6
7// Automatically generated by LOXI from template const_serializer.java
8// Do not modify
9
10package org.projectfloodlight.openflow.protocol.ver10;
11
12import org.projectfloodlight.openflow.protocol.*;
13import org.projectfloodlight.openflow.protocol.action.*;
14import org.projectfloodlight.openflow.protocol.actionid.*;
15import org.projectfloodlight.openflow.protocol.bsntlv.*;
16import org.projectfloodlight.openflow.protocol.errormsg.*;
17import org.projectfloodlight.openflow.protocol.meterband.*;
18import org.projectfloodlight.openflow.protocol.instruction.*;
19import org.projectfloodlight.openflow.protocol.instructionid.*;
20import org.projectfloodlight.openflow.protocol.match.*;
21import org.projectfloodlight.openflow.protocol.oxm.*;
22import org.projectfloodlight.openflow.protocol.queueprop.*;
23import org.projectfloodlight.openflow.types.*;
24import org.projectfloodlight.openflow.util.*;
25import org.projectfloodlight.openflow.exceptions.*;
26import org.projectfloodlight.openflow.protocol.OFActionType;
27import org.jboss.netty.buffer.ChannelBuffer;
28import com.google.common.hash.PrimitiveSink;
29
30public class OFActionTypeSerializerVer10 {
31
32 public final static short OUTPUT_VAL = (short) 0x0;
33 public final static short SET_VLAN_VID_VAL = (short) 0x1;
34 public final static short SET_VLAN_PCP_VAL = (short) 0x2;
35 public final static short STRIP_VLAN_VAL = (short) 0x3;
36 public final static short SET_DL_SRC_VAL = (short) 0x4;
37 public final static short SET_DL_DST_VAL = (short) 0x5;
38 public final static short SET_NW_SRC_VAL = (short) 0x6;
39 public final static short SET_NW_DST_VAL = (short) 0x7;
40 public final static short SET_NW_TOS_VAL = (short) 0x8;
41 public final static short SET_TP_SRC_VAL = (short) 0x9;
42 public final static short SET_TP_DST_VAL = (short) 0xa;
43 public final static short ENQUEUE_VAL = (short) 0xb;
44 public final static short EXPERIMENTER_VAL = (short) 0xffff;
45
46 public static OFActionType readFrom(ChannelBuffer bb) throws OFParseError {
47 try {
48 return ofWireValue(bb.readShort());
49 } catch (IllegalArgumentException e) {
50 throw new OFParseError(e);
51 }
52 }
53
54 public static void writeTo(ChannelBuffer bb, OFActionType e) {
55 bb.writeShort(toWireValue(e));
56 }
57
58 public static void putTo(OFActionType e, PrimitiveSink sink) {
59 sink.putShort(toWireValue(e));
60 }
61
62 public static OFActionType ofWireValue(short val) {
63 switch(val) {
64 case OUTPUT_VAL:
65 return OFActionType.OUTPUT;
66 case SET_VLAN_VID_VAL:
67 return OFActionType.SET_VLAN_VID;
68 case SET_VLAN_PCP_VAL:
69 return OFActionType.SET_VLAN_PCP;
70 case STRIP_VLAN_VAL:
71 return OFActionType.STRIP_VLAN;
72 case SET_DL_SRC_VAL:
73 return OFActionType.SET_DL_SRC;
74 case SET_DL_DST_VAL:
75 return OFActionType.SET_DL_DST;
76 case SET_NW_SRC_VAL:
77 return OFActionType.SET_NW_SRC;
78 case SET_NW_DST_VAL:
79 return OFActionType.SET_NW_DST;
80 case SET_NW_TOS_VAL:
81 return OFActionType.SET_NW_TOS;
82 case SET_TP_SRC_VAL:
83 return OFActionType.SET_TP_SRC;
84 case SET_TP_DST_VAL:
85 return OFActionType.SET_TP_DST;
86 case ENQUEUE_VAL:
87 return OFActionType.ENQUEUE;
88 case EXPERIMENTER_VAL:
89 return OFActionType.EXPERIMENTER;
90 default:
91 throw new IllegalArgumentException("Illegal wire value for type OFActionType in version 1.0: " + val);
92 }
93 }
94
95
96 public static short toWireValue(OFActionType e) {
97 switch(e) {
98 case OUTPUT:
99 return OUTPUT_VAL;
100 case SET_VLAN_VID:
101 return SET_VLAN_VID_VAL;
102 case SET_VLAN_PCP:
103 return SET_VLAN_PCP_VAL;
104 case STRIP_VLAN:
105 return STRIP_VLAN_VAL;
106 case SET_DL_SRC:
107 return SET_DL_SRC_VAL;
108 case SET_DL_DST:
109 return SET_DL_DST_VAL;
110 case SET_NW_SRC:
111 return SET_NW_SRC_VAL;
112 case SET_NW_DST:
113 return SET_NW_DST_VAL;
114 case SET_NW_TOS:
115 return SET_NW_TOS_VAL;
116 case SET_TP_SRC:
117 return SET_TP_SRC_VAL;
118 case SET_TP_DST:
119 return SET_TP_DST_VAL;
120 case ENQUEUE:
121 return ENQUEUE_VAL;
122 case EXPERIMENTER:
123 return EXPERIMENTER_VAL;
124 default:
125 throw new IllegalArgumentException("Illegal enum value for type OFActionType in version 1.0: " + e);
126 }
127 }
128
129}