blob: 2a06530b06a93a74e4a546344f272c13038b4143 [file] [log] [blame]
Yotam Harchol6fccde62013-08-15 12:04:52 -07001package org.openflow.types;
2
3import org.jboss.netty.buffer.ChannelBuffer;
4
5public class OFMetadata extends U64 implements OFValueType<OFMetadata> {
6
7 private static int LENGTH = 8;
8
Yotam Harcholc2813602013-08-20 12:14:22 -07009 public static final OFMetadata FULL_MASK = OFMetadata.of(0xFFFFFFFFFFFFFFFFl);
10 public static final OFMetadata NO_MASK = OFMetadata.of(0x0);
11
Yotam Harchol6fccde62013-08-15 12:04:52 -070012 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}