blob: 87a8bb66145a10297ac3d243014d33ea0ff56fc4 [file] [log] [blame]
Madan Jampaniab6d3112014-10-02 16:30:14 -07001package org.onlab.netty;
2
3import java.io.IOException;
4
5/**
6 * A unit of communication.
7 * Has a payload. Also supports a feature to respond back to the sender.
8 */
9public interface Message {
10
11 /**
12 * Returns the payload of this message.
13 * @return message payload.
14 */
Madan Jampani53e44e62014-10-07 12:39:51 -070015 public byte[] payload();
Madan Jampaniab6d3112014-10-02 16:30:14 -070016
17 /**
Madan Jampani53e44e62014-10-07 12:39:51 -070018 * Sends a reply back to the sender of this message.
Madan Jampaniab6d3112014-10-02 16:30:14 -070019 * @param data payload of the response.
20 * @throws IOException if there is a communication error.
21 */
Madan Jampani53e44e62014-10-07 12:39:51 -070022 public void respond(byte[] data) throws IOException;
Madan Jampaniab6d3112014-10-02 16:30:14 -070023}