X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fdeserialization%2Fmatch%2FAbstractOxmMatchEntryDeserializer.java;h=1d737b093bfc57e1673d3108d8ba70548b37ac66;hb=519a86d1ddcfb8f0fe264174e62e5424e1efba1f;hp=99c0f8cd0db8eeea840e8b37c091b5e93a885b77;hpb=1af28ce842ef5a96ad1293c8db0a6cb494c1fbdc;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmMatchEntryDeserializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmMatchEntryDeserializer.java index 99c0f8cd..1d737b09 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmMatchEntryDeserializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/AbstractOxmMatchEntryDeserializer.java @@ -1,64 +1,64 @@ -/* - * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.openflowjava.protocol.impl.deserialization.match; - -import io.netty.buffer.ByteBuf; - -import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer; -import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Clazz; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder; - -/** - * @author michal.polkorab - * - */ -public abstract class AbstractOxmMatchEntryDeserializer implements HeaderDeserializer { - - @Override - public MatchEntries deserializeHeader(ByteBuf input) { - MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input); - return builder.build(); - } - - /** - * @return oxm_field class - */ - protected abstract Class getOxmField(); - - /** - * @return oxm_class class - */ - protected abstract Class getOxmClass(); - - /** - * Prepares match entry header - sets oxm_class, oxm_field, hasMask - * + sets the buffer.readerIndex() to the end of match entry - * - where augmentation starts - * @param oxm_class oxm class type - * @param oxm_field oxm field type - * @param input input bytebuf - * @return MatchEntriesBuilder which can be filled with MatchEntry augmentation - */ - protected MatchEntriesBuilder processHeader(Class oxm_class, - Class oxm_field, ByteBuf input) { - MatchEntriesBuilder builder = new MatchEntriesBuilder(); - builder.setOxmClass(oxm_class); - // skip oxm_class (provided) - input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); - builder.setOxmMatchField(oxm_field); - boolean hasMask = (input.readUnsignedByte() & 1) != 0; - builder.setHasMask(hasMask); - // skip match entry length - not needed - input.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); - return builder; - } - -} +/* + * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.openflowjava.protocol.impl.deserialization.match; + +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder; + +/** + * @author michal.polkorab + * + */ +public abstract class AbstractOxmMatchEntryDeserializer implements HeaderDeserializer { + + @Override + public MatchEntries deserializeHeader(ByteBuf input) { + MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input); + return builder.build(); + } + + /** + * @return oxm_field class + */ + protected abstract Class getOxmField(); + + /** + * @return oxm_class class + */ + protected abstract Class getOxmClass(); + + /** + * Prepares match entry header - sets oxm_class, oxm_field, hasMask + * + sets the buffer.readerIndex() to the end of match entry + * - where augmentation starts + * @param oxmClass oxm class type + * @param oxmField oxm field type + * @param input input bytebuf + * @return MatchEntriesBuilder which can be filled with MatchEntry augmentation + */ + protected MatchEntriesBuilder processHeader(Class oxmClass, + Class oxmField, ByteBuf input) { + MatchEntriesBuilder builder = new MatchEntriesBuilder(); + builder.setOxmClass(oxmClass); + // skip oxm_class (provided) + input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); + builder.setOxmMatchField(oxmField); + boolean hasMask = (input.readUnsignedByte() & 1) != 0; + builder.setHasMask(hasMask); + // skip match entry length - not needed + input.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); + return builder; + } + +}