View Javadoc
1   package org.metricshub.ipmi.core.api.async;
2   
3   /*-
4    * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
5    * IPMI Java Client
6    * ჻჻჻჻჻჻
7    * Copyright 2023 Verax Systems, MetricsHub
8    * ჻჻჻჻჻჻
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   *
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
23   */
24  
25  import org.metricshub.ipmi.core.coding.commands.PrivilegeLevel;
26  import org.metricshub.ipmi.core.coding.security.CipherSuite;
27  import org.metricshub.ipmi.core.connection.Connection;
28  
29  import java.net.InetAddress;
30  
31  /**
32   * Handle to the {@link Connection}
33   */
34  public class ConnectionHandle {
35      private int handle;
36      private CipherSuite cipherSuite;
37      private PrivilegeLevel privilegeLevel;
38      private InetAddress remoteAddress;
39      private int remotePort;
40      private String user;
41      private String password;
42  
43      public ConnectionHandle(int handle, InetAddress remoteAddress, int remotePort) {
44          this.handle = handle;
45          this.remoteAddress = remoteAddress;
46          this.remotePort = remotePort;
47      }
48  
49      public CipherSuite getCipherSuite() {
50          return cipherSuite;
51      }
52  
53      public void setCipherSuite(CipherSuite cipherSuite) {
54          this.cipherSuite = cipherSuite;
55      }
56  
57      public PrivilegeLevel getPrivilegeLevel() {
58          return privilegeLevel;
59      }
60  
61      public void setPrivilegeLevel(PrivilegeLevel privilegeLevel) {
62          this.privilegeLevel = privilegeLevel;
63      }
64  
65      public int getHandle() {
66          return handle;
67      }
68  
69      public InetAddress getRemoteAddress() {
70          return remoteAddress;
71      }
72  
73      public int getRemotePort() {
74          return remotePort;
75      }
76  
77      public String getUser() {
78          return user;
79      }
80  
81      public void setUser(String user) {
82          this.user = user;
83      }
84  
85      public String getPassword() {
86          return password;
87      }
88  
89      public void setPassword(String password) {
90          this.password = password;
91      }
92  
93      @Override
94      public String toString() {
95          final StringBuilder sb = new StringBuilder("ConnectionHandle{");
96          sb.append("handle=").append(handle);
97          sb.append(", cipherSuite=").append(cipherSuite);
98          sb.append(", privilegeLevel=").append(privilegeLevel);
99          sb.append(", remoteAddress=").append(remoteAddress);
100         sb.append(", remotePort=").append(remotePort);
101         sb.append(", user='").append(user).append('\'');
102         sb.append('}');
103         return sb.toString();
104     }
105 }