blob: dbb1d5345c6c7743814ffa21f01c3b554bb43375 [file] [log] [blame]
Thomas Vachuska58de4162015-09-10 16:15:33 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuska58de4162015-09-10 16:15:33 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
jcc3d4e14a2015-04-21 11:32:05 +080016package org.onosproject.openflow.controller;
17
Jimmy Jine9b7a022016-08-12 16:56:48 -070018import io.netty.buffer.ByteBuf;
jcc3d4e14a2015-04-21 11:32:05 +080019import org.projectfloodlight.openflow.protocol.OFMessage;
20import org.projectfloodlight.openflow.protocol.OFType;
21import org.projectfloodlight.openflow.protocol.OFVersion;
22
23import com.google.common.hash.PrimitiveSink;
Jimmy Jine9b7a022016-08-12 16:56:48 -070024
25import java.util.Arrays;
26
jcc3d4e14a2015-04-21 11:32:05 +080027/**
28 * Used to support for the third party privacy flow rule.
29 * it implements OFMessage interface to use exist adapter API.
30 */
31public class ThirdPartyMessage implements OFMessage {
32
33 private final byte[] payLoad; //privacy flow rule
34
35 public ThirdPartyMessage(byte[] payLoad) {
36 this.payLoad = payLoad;
37 }
38
39 public byte[] payLoad() {
40 return payLoad;
41 }
42
43 @Override
44 public void putTo(PrimitiveSink sink) {
45 // Do nothing here for now.
46 }
47
48 @Override
49 public OFVersion getVersion() {
50 // Do nothing here for now.
51 return null;
52 }
53
54 @Override
55 public OFType getType() {
56 // Do nothing here for now.
57 return null;
58 }
59
60 @Override
61 public long getXid() {
62 // Do nothing here for now.
63 return 0;
64 }
65
66 @Override
Jimmy Jine9b7a022016-08-12 16:56:48 -070067 public void writeTo(ByteBuf byteBuf) {
jcc3d4e14a2015-04-21 11:32:05 +080068 // Do nothing here for now.
69 }
70
71 @Override
Jimmy Jine9b7a022016-08-12 16:56:48 -070072 public boolean equalsIgnoreXid(Object obj) {
73 return Arrays.equals(payLoad, ((ThirdPartyMessage) obj).payLoad());
74 }
75
76 @Override
77 public int hashCodeIgnoreXid() {
Yuta HIGUCHI1edc36b2018-01-24 23:39:06 -080078 return Arrays.hashCode(payLoad);
Jimmy Jine9b7a022016-08-12 16:56:48 -070079 }
80
81 @Override
jcc3d4e14a2015-04-21 11:32:05 +080082 public Builder createBuilder() {
83 // Do nothing here for now.
84 return null;
85 }
86
87}