1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.netty.channel.epoll;
18
19 import java.net.SocketAddress;
20
21
22
23
24
25
26 public final class VSockAddress extends SocketAddress {
27 private static final long serialVersionUID = 8600894096347158429L;
28
29 public static final int VMADDR_CID_ANY = -1;
30 public static final int VMADDR_CID_HYPERVISOR = 0;
31 public static final int VMADDR_CID_LOCAL = 1;
32 public static final int VMADDR_CID_HOST = 2;
33
34 public static final int VMADDR_PORT_ANY = -1;
35
36 private final int cid;
37 private final int port;
38
39 public VSockAddress(int cid, int port) {
40 this.cid = cid;
41 this.port = port;
42 }
43
44 public int getCid() {
45 return cid;
46 }
47
48 public int getPort() {
49 return port;
50 }
51
52 @Override
53 public String toString() {
54 return "VSockAddress{" +
55 "cid=" + cid +
56 ", port=" + port +
57 '}';
58 }
59
60 @Override
61 public boolean equals(Object o) {
62 if (this == o) {
63 return true;
64 }
65 if (!(o instanceof VSockAddress)) {
66 return false;
67 }
68
69 VSockAddress that = (VSockAddress) o;
70
71 return cid == that.cid && port == that.port;
72 }
73
74 @Override
75 public int hashCode() {
76 int result = cid;
77 result = 31 * result + port;
78 return result;
79 }
80 }