blob: 20dfee03b18f87be8e1d654f6d9e491b5f9b5bc9 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
Thomas Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska781d18b2014-10-27 10:31:25 -070015 */
tomf110fff2014-09-26 00:38:18 -070016package org.onlab.onos.foo;
17
18import org.onlab.nio.AbstractMessage;
19
tom0e0863f2014-09-26 09:02:33 -070020import static com.google.common.base.Preconditions.checkNotNull;
21
tomf110fff2014-09-26 00:38:18 -070022/**
tom0e0863f2014-09-26 09:02:33 -070023 * Test message for measuring rate and round-trip latency.
tomf110fff2014-09-26 00:38:18 -070024 */
25public class TestMessage extends AbstractMessage {
26
tom0e0863f2014-09-26 09:02:33 -070027 private final byte[] padding;
tomf110fff2014-09-26 00:38:18 -070028
tom0e0863f2014-09-26 09:02:33 -070029 private final long requestorTime;
30 private final long responderTime;
tomf110fff2014-09-26 00:38:18 -070031
32 /**
33 * Creates a new message with the specified data.
34 *
tom0e0863f2014-09-26 09:02:33 -070035 * @param requestorTime requester time
36 * @param responderTime responder time
37 * @param padding message padding
tomf110fff2014-09-26 00:38:18 -070038 */
tom0e0863f2014-09-26 09:02:33 -070039 TestMessage(int length, long requestorTime, long responderTime, byte[] padding) {
40 this.length = length;
41 this.requestorTime = requestorTime;
42 this.responderTime = responderTime;
43 this.padding = checkNotNull(padding, "Padding cannot be null");
tomf110fff2014-09-26 00:38:18 -070044 }
45
tom0e0863f2014-09-26 09:02:33 -070046 public long requestorTime() {
47 return requestorTime;
48 }
49
50 public long responderTime() {
51 return responderTime;
52 }
53
54 public byte[] padding() {
55 return padding;
tomf110fff2014-09-26 00:38:18 -070056 }
57
58}