All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.projectfloodlight.openflow.protocol.ver13.OFBsnPktinFlagSerializerVer13 Maven / Gradle / Ivy

Go to download

OpenFlowJ API supporting OpenFlow versions 1.0 through 1.5.1, generated by LoxiGen

The newest version!
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution

// Automatically generated by LOXI from template const_set_serializer.java
// Do not modify

package org.projectfloodlight.openflow.protocol.ver13;

import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.stat.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.oxs.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.projectfloodlight.openflow.protocol.OFBsnPktinFlag;
import java.util.Set;
import io.netty.buffer.ByteBuf;
import com.google.common.hash.PrimitiveSink;
import java.util.EnumSet;
import java.util.Collections;


public class OFBsnPktinFlagSerializerVer13 {

    public final static long BSN_PKTIN_FLAG_PDU_VAL = 0x1L;
    public final static long BSN_PKTIN_FLAG_NEW_HOST_VAL = 0x2L;
    public final static long BSN_PKTIN_FLAG_STATION_MOVE_VAL = 0x4L;
    public final static long BSN_PKTIN_FLAG_ARP_VAL = 0x8L;
    public final static long BSN_PKTIN_FLAG_DHCP_VAL = 0x10L;
    public final static long BSN_PKTIN_FLAG_L2_CPU_VAL = 0x20L;
    public final static long BSN_PKTIN_FLAG_DEBUG_VAL = 0x40L;
    public final static long BSN_PKTIN_FLAG_TTL_EXPIRED_VAL = 0x80L;
    public final static long BSN_PKTIN_FLAG_L3_MISS_VAL = 0x100L;
    public final static long BSN_PKTIN_FLAG_L3_CPU_VAL = 0x200L;
    public final static long BSN_PKTIN_FLAG_INGRESS_ACL_VAL = 0x400L;
    public final static long BSN_PKTIN_FLAG_SFLOW_VAL = 0x800L;
    public final static long BSN_PKTIN_FLAG_ARP_CACHE_VAL = 0x1000L;
    public final static long BSN_PKTIN_FLAG_ARP_TARGET_VAL = 0x2000L;
    public final static long BSN_PKTIN_FLAG_IGMP_VAL = 0x4000L;
    public final static long BSN_PKTIN_FLAG_PIM_VAL = 0x8000L;
    public final static long BSN_PKTIN_FLAG_VXLAN_SIP_MISS_VAL = 0x10000L;
    public final static long BSN_PKTIN_FLAG_MC_RESERVED_VAL = 0x20000L;
    public final static long BSN_PKTIN_FLAG_ANALYTICS_VAL = 0x40000L;
    public final static long BSN_PKTIN_FLAG_ICMPV6_VAL = 0x80000L;
    public final static long BSN_PKTIN_FLAG_INGRESS_ACL_LOCAL_VAL = 0x100000L;
    public final static long BSN_PKTIN_FLAG_IPMC_MISS_VAL = 0x200000L;
    public final static long BSN_PKTIN_FLAG_IPMC_RPF_FAILED_VAL = 0x400000L;
    public final static long BSN_PKTIN_FLAG_BFD_SLOWPATH_VAL = 0x800000L;
    public final static long BSN_PKTIN_FLAG_SFLOW_EGRESS_VAL = 0x1000000L;
    public final static long BSN_PKTIN_FLAG_DHCPV6_VAL = 0x2000000L;
    public final static long BSN_PKTIN_FLAG_IP_HELPER_VAL = 0x4000000L;

    public static Set readFrom(ByteBuf bb) throws OFParseError {
        try {
            return ofWireValue(bb.readLong());
        } catch (IllegalArgumentException e) {
            throw new OFParseError(e);
        }
    }

    public static void writeTo(ByteBuf bb, Set set) {
        bb.writeLong(toWireValue(set));
    }

    public static void putTo(Set set, PrimitiveSink sink) {
        sink.putLong(toWireValue(set));
    }


    public static Set ofWireValue(long val) {
        EnumSet set = EnumSet.noneOf(OFBsnPktinFlag.class);

        if((val & BSN_PKTIN_FLAG_PDU_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_PDU);
        if((val & BSN_PKTIN_FLAG_NEW_HOST_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_NEW_HOST);
        if((val & BSN_PKTIN_FLAG_STATION_MOVE_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_STATION_MOVE);
        if((val & BSN_PKTIN_FLAG_ARP_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_ARP);
        if((val & BSN_PKTIN_FLAG_DHCP_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_DHCP);
        if((val & BSN_PKTIN_FLAG_L2_CPU_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_L2_CPU);
        if((val & BSN_PKTIN_FLAG_DEBUG_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_DEBUG);
        if((val & BSN_PKTIN_FLAG_TTL_EXPIRED_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_TTL_EXPIRED);
        if((val & BSN_PKTIN_FLAG_L3_MISS_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_L3_MISS);
        if((val & BSN_PKTIN_FLAG_L3_CPU_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_L3_CPU);
        if((val & BSN_PKTIN_FLAG_INGRESS_ACL_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_INGRESS_ACL);
        if((val & BSN_PKTIN_FLAG_SFLOW_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_SFLOW);
        if((val & BSN_PKTIN_FLAG_ARP_CACHE_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_ARP_CACHE);
        if((val & BSN_PKTIN_FLAG_ARP_TARGET_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_ARP_TARGET);
        if((val & BSN_PKTIN_FLAG_IGMP_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_IGMP);
        if((val & BSN_PKTIN_FLAG_PIM_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_PIM);
        if((val & BSN_PKTIN_FLAG_VXLAN_SIP_MISS_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_VXLAN_SIP_MISS);
        if((val & BSN_PKTIN_FLAG_MC_RESERVED_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_MC_RESERVED);
        if((val & BSN_PKTIN_FLAG_ANALYTICS_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_ANALYTICS);
        if((val & BSN_PKTIN_FLAG_ICMPV6_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_ICMPV6);
        if((val & BSN_PKTIN_FLAG_INGRESS_ACL_LOCAL_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_INGRESS_ACL_LOCAL);
        if((val & BSN_PKTIN_FLAG_IPMC_MISS_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_IPMC_MISS);
        if((val & BSN_PKTIN_FLAG_IPMC_RPF_FAILED_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_IPMC_RPF_FAILED);
        if((val & BSN_PKTIN_FLAG_BFD_SLOWPATH_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_BFD_SLOWPATH);
        if((val & BSN_PKTIN_FLAG_SFLOW_EGRESS_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_SFLOW_EGRESS);
        if((val & BSN_PKTIN_FLAG_DHCPV6_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_DHCPV6);
        if((val & BSN_PKTIN_FLAG_IP_HELPER_VAL) != 0)
            set.add(OFBsnPktinFlag.BSN_PKTIN_FLAG_IP_HELPER);
        return Collections.unmodifiableSet(set);
    }

    public static long toWireValue(Set set) {
        long wireValue = 0;

        for(OFBsnPktinFlag e: set) {
            switch(e) {
                case BSN_PKTIN_FLAG_PDU:
                    wireValue |= BSN_PKTIN_FLAG_PDU_VAL;
                    break;
                case BSN_PKTIN_FLAG_NEW_HOST:
                    wireValue |= BSN_PKTIN_FLAG_NEW_HOST_VAL;
                    break;
                case BSN_PKTIN_FLAG_STATION_MOVE:
                    wireValue |= BSN_PKTIN_FLAG_STATION_MOVE_VAL;
                    break;
                case BSN_PKTIN_FLAG_ARP:
                    wireValue |= BSN_PKTIN_FLAG_ARP_VAL;
                    break;
                case BSN_PKTIN_FLAG_DHCP:
                    wireValue |= BSN_PKTIN_FLAG_DHCP_VAL;
                    break;
                case BSN_PKTIN_FLAG_L2_CPU:
                    wireValue |= BSN_PKTIN_FLAG_L2_CPU_VAL;
                    break;
                case BSN_PKTIN_FLAG_DEBUG:
                    wireValue |= BSN_PKTIN_FLAG_DEBUG_VAL;
                    break;
                case BSN_PKTIN_FLAG_TTL_EXPIRED:
                    wireValue |= BSN_PKTIN_FLAG_TTL_EXPIRED_VAL;
                    break;
                case BSN_PKTIN_FLAG_L3_MISS:
                    wireValue |= BSN_PKTIN_FLAG_L3_MISS_VAL;
                    break;
                case BSN_PKTIN_FLAG_L3_CPU:
                    wireValue |= BSN_PKTIN_FLAG_L3_CPU_VAL;
                    break;
                case BSN_PKTIN_FLAG_INGRESS_ACL:
                    wireValue |= BSN_PKTIN_FLAG_INGRESS_ACL_VAL;
                    break;
                case BSN_PKTIN_FLAG_SFLOW:
                    wireValue |= BSN_PKTIN_FLAG_SFLOW_VAL;
                    break;
                case BSN_PKTIN_FLAG_ARP_CACHE:
                    wireValue |= BSN_PKTIN_FLAG_ARP_CACHE_VAL;
                    break;
                case BSN_PKTIN_FLAG_ARP_TARGET:
                    wireValue |= BSN_PKTIN_FLAG_ARP_TARGET_VAL;
                    break;
                case BSN_PKTIN_FLAG_IGMP:
                    wireValue |= BSN_PKTIN_FLAG_IGMP_VAL;
                    break;
                case BSN_PKTIN_FLAG_PIM:
                    wireValue |= BSN_PKTIN_FLAG_PIM_VAL;
                    break;
                case BSN_PKTIN_FLAG_VXLAN_SIP_MISS:
                    wireValue |= BSN_PKTIN_FLAG_VXLAN_SIP_MISS_VAL;
                    break;
                case BSN_PKTIN_FLAG_MC_RESERVED:
                    wireValue |= BSN_PKTIN_FLAG_MC_RESERVED_VAL;
                    break;
                case BSN_PKTIN_FLAG_ANALYTICS:
                    wireValue |= BSN_PKTIN_FLAG_ANALYTICS_VAL;
                    break;
                case BSN_PKTIN_FLAG_ICMPV6:
                    wireValue |= BSN_PKTIN_FLAG_ICMPV6_VAL;
                    break;
                case BSN_PKTIN_FLAG_INGRESS_ACL_LOCAL:
                    wireValue |= BSN_PKTIN_FLAG_INGRESS_ACL_LOCAL_VAL;
                    break;
                case BSN_PKTIN_FLAG_IPMC_MISS:
                    wireValue |= BSN_PKTIN_FLAG_IPMC_MISS_VAL;
                    break;
                case BSN_PKTIN_FLAG_IPMC_RPF_FAILED:
                    wireValue |= BSN_PKTIN_FLAG_IPMC_RPF_FAILED_VAL;
                    break;
                case BSN_PKTIN_FLAG_BFD_SLOWPATH:
                    wireValue |= BSN_PKTIN_FLAG_BFD_SLOWPATH_VAL;
                    break;
                case BSN_PKTIN_FLAG_SFLOW_EGRESS:
                    wireValue |= BSN_PKTIN_FLAG_SFLOW_EGRESS_VAL;
                    break;
                case BSN_PKTIN_FLAG_DHCPV6:
                    wireValue |= BSN_PKTIN_FLAG_DHCPV6_VAL;
                    break;
                case BSN_PKTIN_FLAG_IP_HELPER:
                    wireValue |= BSN_PKTIN_FLAG_IP_HELPER_VAL;
                    break;
                default:
                    throw new IllegalArgumentException("Illegal enum value for type OFBsnPktinFlag in version 1.3: " + e);
            }
        }
        return wireValue;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy