blob: ddc79d35e75d828ec7ecaa9b54169a99737b243f [file] [log] [blame]
tom1d416c52014-09-29 20:55:24 -07001package org.onlab.onos.store.cluster.messaging;
2
3import org.onlab.onos.cluster.NodeId;
4import org.onlab.packet.IpPrefix;
5
6/**
7 * Hello message that nodes use to greet each other.
8 */
9public class HelloMessage extends ClusterMessage {
10
11 private NodeId nodeId;
12 private IpPrefix ipAddress;
13 private int tcpPort;
14
15 // For serialization
16 private HelloMessage() {
17 super(MessageSubject.HELLO);
18 nodeId = null;
19 ipAddress = null;
20 tcpPort = 0;
21 }
22
23 /**
24 * Creates a new hello message for the specified end-point data.
25 *
26 * @param nodeId sending node identification
27 * @param ipAddress sending node IP address
28 * @param tcpPort sending node TCP port
29 */
30 public HelloMessage(NodeId nodeId, IpPrefix ipAddress, int tcpPort) {
31 super(MessageSubject.HELLO);
32 nodeId = nodeId;
33 ipAddress = ipAddress;
34 tcpPort = tcpPort;
35 }
36
37 /**
38 * Returns the sending node identifer.
39 *
40 * @return node identifier
41 */
42 public NodeId nodeId() {
43 return nodeId;
44 }
45
46 /**
47 * Returns the sending node IP address.
48 *
49 * @return node IP address
50 */
51 public IpPrefix ipAddress() {
52 return ipAddress;
53 }
54
55 /**
56 * Returns the sending node TCP listen port.
57 *
58 * @return TCP listen port
59 */
60 public int tcpPort() {
61 return tcpPort;
62 }
63}