tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 1 | // 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 | |
| 10 | package org.projectfloodlight.openflow.protocol.ver13; |
| 11 | |
| 12 | import org.projectfloodlight.openflow.protocol.*; |
| 13 | import org.projectfloodlight.openflow.protocol.action.*; |
| 14 | import org.projectfloodlight.openflow.protocol.actionid.*; |
| 15 | import org.projectfloodlight.openflow.protocol.bsntlv.*; |
| 16 | import org.projectfloodlight.openflow.protocol.errormsg.*; |
| 17 | import org.projectfloodlight.openflow.protocol.meterband.*; |
| 18 | import org.projectfloodlight.openflow.protocol.instruction.*; |
| 19 | import org.projectfloodlight.openflow.protocol.instructionid.*; |
| 20 | import org.projectfloodlight.openflow.protocol.match.*; |
| 21 | import org.projectfloodlight.openflow.protocol.oxm.*; |
| 22 | import org.projectfloodlight.openflow.protocol.queueprop.*; |
| 23 | import org.projectfloodlight.openflow.types.*; |
| 24 | import org.projectfloodlight.openflow.util.*; |
| 25 | import org.projectfloodlight.openflow.exceptions.*; |
| 26 | import org.projectfloodlight.openflow.protocol.OFPacketInReason; |
| 27 | import org.jboss.netty.buffer.ChannelBuffer; |
| 28 | import com.google.common.hash.PrimitiveSink; |
| 29 | |
| 30 | public class OFPacketInReasonSerializerVer13 { |
| 31 | |
| 32 | public final static byte NO_MATCH_VAL = (byte) 0x0; |
| 33 | public final static byte ACTION_VAL = (byte) 0x1; |
| 34 | public final static byte INVALID_TTL_VAL = (byte) 0x2; |
| 35 | public final static byte BSN_NEW_HOST_VAL = (byte) 0x80; |
| 36 | public final static byte BSN_STATION_MOVE_VAL = (byte) 0x81; |
| 37 | public final static byte BSN_BAD_VLAN_VAL = (byte) 0x82; |
| 38 | public final static byte BSN_DESTINATION_LOOKUP_FAILURE_VAL = (byte) 0x83; |
| 39 | public final static byte BSN_NO_ROUTE_VAL = (byte) 0x84; |
| 40 | public final static byte BSN_ICMP_ECHO_REQUEST_VAL = (byte) 0x85; |
| 41 | public final static byte BSN_DEST_NETWORK_UNREACHABLE_VAL = (byte) 0x86; |
| 42 | public final static byte BSN_DEST_HOST_UNREACHABLE_VAL = (byte) 0x87; |
| 43 | public final static byte BSN_DEST_PORT_UNREACHABLE_VAL = (byte) 0x88; |
| 44 | public final static byte BSN_FRAGMENTATION_REQUIRED_VAL = (byte) 0x89; |
| 45 | public final static byte BSN_ARP_VAL = (byte) 0x8b; |
| 46 | public final static byte BSN_DHCP_VAL = (byte) 0x8c; |
| 47 | public final static byte BSN_DEBUG_VAL = (byte) 0x8d; |
| 48 | public final static byte BSN_PACKET_OF_DEATH_VAL = (byte) 0x8e; |
| 49 | |
| 50 | public static OFPacketInReason readFrom(ChannelBuffer bb) throws OFParseError { |
| 51 | try { |
| 52 | return ofWireValue(bb.readByte()); |
| 53 | } catch (IllegalArgumentException e) { |
| 54 | throw new OFParseError(e); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | public static void writeTo(ChannelBuffer bb, OFPacketInReason e) { |
| 59 | bb.writeByte(toWireValue(e)); |
| 60 | } |
| 61 | |
| 62 | public static void putTo(OFPacketInReason e, PrimitiveSink sink) { |
| 63 | sink.putByte(toWireValue(e)); |
| 64 | } |
| 65 | |
| 66 | public static OFPacketInReason ofWireValue(byte val) { |
| 67 | switch(val) { |
| 68 | case NO_MATCH_VAL: |
| 69 | return OFPacketInReason.NO_MATCH; |
| 70 | case ACTION_VAL: |
| 71 | return OFPacketInReason.ACTION; |
| 72 | case INVALID_TTL_VAL: |
| 73 | return OFPacketInReason.INVALID_TTL; |
| 74 | case BSN_NEW_HOST_VAL: |
| 75 | return OFPacketInReason.BSN_NEW_HOST; |
| 76 | case BSN_STATION_MOVE_VAL: |
| 77 | return OFPacketInReason.BSN_STATION_MOVE; |
| 78 | case BSN_BAD_VLAN_VAL: |
| 79 | return OFPacketInReason.BSN_BAD_VLAN; |
| 80 | case BSN_DESTINATION_LOOKUP_FAILURE_VAL: |
| 81 | return OFPacketInReason.BSN_DESTINATION_LOOKUP_FAILURE; |
| 82 | case BSN_NO_ROUTE_VAL: |
| 83 | return OFPacketInReason.BSN_NO_ROUTE; |
| 84 | case BSN_ICMP_ECHO_REQUEST_VAL: |
| 85 | return OFPacketInReason.BSN_ICMP_ECHO_REQUEST; |
| 86 | case BSN_DEST_NETWORK_UNREACHABLE_VAL: |
| 87 | return OFPacketInReason.BSN_DEST_NETWORK_UNREACHABLE; |
| 88 | case BSN_DEST_HOST_UNREACHABLE_VAL: |
| 89 | return OFPacketInReason.BSN_DEST_HOST_UNREACHABLE; |
| 90 | case BSN_DEST_PORT_UNREACHABLE_VAL: |
| 91 | return OFPacketInReason.BSN_DEST_PORT_UNREACHABLE; |
| 92 | case BSN_FRAGMENTATION_REQUIRED_VAL: |
| 93 | return OFPacketInReason.BSN_FRAGMENTATION_REQUIRED; |
| 94 | case BSN_ARP_VAL: |
| 95 | return OFPacketInReason.BSN_ARP; |
| 96 | case BSN_DHCP_VAL: |
| 97 | return OFPacketInReason.BSN_DHCP; |
| 98 | case BSN_DEBUG_VAL: |
| 99 | return OFPacketInReason.BSN_DEBUG; |
| 100 | case BSN_PACKET_OF_DEATH_VAL: |
| 101 | return OFPacketInReason.BSN_PACKET_OF_DEATH; |
| 102 | default: |
| 103 | throw new IllegalArgumentException("Illegal wire value for type OFPacketInReason in version 1.3: " + val); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | |
| 108 | public static byte toWireValue(OFPacketInReason e) { |
| 109 | switch(e) { |
| 110 | case NO_MATCH: |
| 111 | return NO_MATCH_VAL; |
| 112 | case ACTION: |
| 113 | return ACTION_VAL; |
| 114 | case INVALID_TTL: |
| 115 | return INVALID_TTL_VAL; |
| 116 | case BSN_NEW_HOST: |
| 117 | return BSN_NEW_HOST_VAL; |
| 118 | case BSN_STATION_MOVE: |
| 119 | return BSN_STATION_MOVE_VAL; |
| 120 | case BSN_BAD_VLAN: |
| 121 | return BSN_BAD_VLAN_VAL; |
| 122 | case BSN_DESTINATION_LOOKUP_FAILURE: |
| 123 | return BSN_DESTINATION_LOOKUP_FAILURE_VAL; |
| 124 | case BSN_NO_ROUTE: |
| 125 | return BSN_NO_ROUTE_VAL; |
| 126 | case BSN_ICMP_ECHO_REQUEST: |
| 127 | return BSN_ICMP_ECHO_REQUEST_VAL; |
| 128 | case BSN_DEST_NETWORK_UNREACHABLE: |
| 129 | return BSN_DEST_NETWORK_UNREACHABLE_VAL; |
| 130 | case BSN_DEST_HOST_UNREACHABLE: |
| 131 | return BSN_DEST_HOST_UNREACHABLE_VAL; |
| 132 | case BSN_DEST_PORT_UNREACHABLE: |
| 133 | return BSN_DEST_PORT_UNREACHABLE_VAL; |
| 134 | case BSN_FRAGMENTATION_REQUIRED: |
| 135 | return BSN_FRAGMENTATION_REQUIRED_VAL; |
| 136 | case BSN_ARP: |
| 137 | return BSN_ARP_VAL; |
| 138 | case BSN_DHCP: |
| 139 | return BSN_DHCP_VAL; |
| 140 | case BSN_DEBUG: |
| 141 | return BSN_DEBUG_VAL; |
| 142 | case BSN_PACKET_OF_DEATH: |
| 143 | return BSN_PACKET_OF_DEATH_VAL; |
| 144 | default: |
| 145 | throw new IllegalArgumentException("Illegal enum value for type OFPacketInReason in version 1.3: " + e); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | } |