Yotam Harchol | 6fccde6 | 2013-08-15 12:04:52 -0700 | [diff] [blame] | 1 | package org.openflow.types; |
| 2 | |
| 3 | import org.jboss.netty.buffer.ChannelBuffer; |
| 4 | |
| 5 | public class OFMetadata extends U64 implements OFValueType<OFMetadata> { |
| 6 | |
| 7 | private static int LENGTH = 8; |
| 8 | |
Yotam Harchol | c281360 | 2013-08-20 12:14:22 -0700 | [diff] [blame^] | 9 | public static final OFMetadata FULL_MASK = OFMetadata.of(0xFFFFFFFFFFFFFFFFl); |
| 10 | public static final OFMetadata NO_MASK = OFMetadata.of(0x0); |
| 11 | |
Yotam Harchol | 6fccde6 | 2013-08-15 12:04:52 -0700 | [diff] [blame] | 12 | protected OFMetadata(long raw) { |
| 13 | super(raw); |
| 14 | } |
| 15 | |
| 16 | public static OFMetadata of(long raw) { |
| 17 | return new OFMetadata(raw); |
| 18 | } |
| 19 | |
| 20 | public static OFMetadata read8Bytes(ChannelBuffer cb) { |
| 21 | return OFMetadata.of(cb.readLong()); |
| 22 | } |
| 23 | |
| 24 | public void write8Bytes(ChannelBuffer cb) { |
| 25 | cb.writeLong(super.getValue()); |
| 26 | } |
| 27 | |
| 28 | @Override |
| 29 | public int getLength() { |
| 30 | return LENGTH; |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public OFMetadata applyMask(OFMetadata mask) { |
| 35 | return OFMetadata.of(this.getValue() & mask.getValue()); |
| 36 | } |
| 37 | } |