2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowjava.protocol.impl.serialization.match;
10 import io.netty.buffer.ByteBuf;
12 import org.opendaylight.openflowjava.util.ByteBufUtils;
13 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
14 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
20 * @author michal.polkorab
23 public class OxmIpv6ExtHdrSerializer extends AbstractOxmMatchEntrySerializer {
26 public void serialize(final MatchEntries entry, final ByteBuf outBuffer) {
27 super.serialize(entry, outBuffer);
28 Ipv6ExthdrFlags pseudoField = entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField();
29 int bitmap = ByteBufUtils.fillBitMask(0,
30 pseudoField.isNonext(),
35 pseudoField.isRouter(),
37 pseudoField.isUnrep(),
38 pseudoField.isUnseq());
39 outBuffer.writeShort(bitmap);
40 writeMask(entry, outBuffer, getValueLength());
44 protected int getOxmClassCode() {
45 return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
49 protected int getOxmFieldCode() {
50 return OxmMatchConstants.IPV6_EXTHDR;
54 protected int getValueLength() {
55 return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;