blob: 923e21e4323f464b2ed29451559051d61e5b0796 [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);
tom81583142014-09-30 01:40:29 -070032 this.nodeId = nodeId;
33 this.ipAddress = ipAddress;
34 this.tcpPort = tcpPort;
tom1d416c52014-09-29 20:55:24 -070035 }
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 }
tom81583142014-09-30 01:40:29 -070063
tom1d416c52014-09-29 20:55:24 -070064}